Here in the below switch-case condition it is throwing error
Cannot read property 'entity' of undefined
because for every other case except "paytm"
the entity is present in the "payload"
but for paytm its "payload_data"
--> body.data.payload_data.entity.channel
How to solve this issue.
switch(body.data.payload.entity.channel){
case "paytm" :
await paytm(body);
break;
case "phonePe" :
await phonePe(body);
break;
case "googlePay":
default:
await googlePay(body);
}
I tried adding multiple things but it didnt worked for me.