From f0f2cd3411a78c9e0c779b30807be51d5ecf6206 Mon Sep 17 00:00:00 2001 From: AllenTJ7 <163137620+AllenTJ7@users.noreply.github.com> Date: Wed, 28 May 2025 00:14:17 +0530 Subject: [PATCH] Update webhook.ts --- functions/src/payments/phonepe/webhook.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/src/payments/phonepe/webhook.ts b/functions/src/payments/phonepe/webhook.ts index 2ba5136..8f797d7 100644 --- a/functions/src/payments/phonepe/webhook.ts +++ b/functions/src/payments/phonepe/webhook.ts @@ -172,6 +172,7 @@ export const phonePeWebhook = onRequest({ let paymentType = orderData.metaInfo?.paymentType || 'Gym Membership'; let trainerId = orderData.metaInfo?.trainerId; let trainerData = null; + let emailCustomer = membershipData?.fields?.['email'] || membershipData?.fields?.['Email Address']; const discountPercentage = orderData.metaInfo?.discount || 0; const hasDiscount = discountPercentage > 0; @@ -308,7 +309,7 @@ export const phonePeWebhook = onRequest({ const formattedDate = format(new Date(), 'dd/MM/yyyy'); - if (membershipData?.fields?.['email']) { + if (emailCustomer) { logger.info(`Preparing to send invoice email to customer: ${membershipData?.fields?.['email']}`); try { const emailSubject = isFreeplan