From 26cde8f7c530f823cb704c86b2c90f5fd046c1b0 Mon Sep 17 00:00:00 2001 From: Govind <97059996+SGFGOV@users.noreply.github.com> Date: Mon, 13 Nov 2023 13:05:41 +0530 Subject: [PATCH] Update index.tsx Sometimes if payment session provider types aren't supported by the server, the component crashes. A minor fix to check that --- .../components/payment-container/index.tsx | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/modules/checkout/components/payment-container/index.tsx b/src/modules/checkout/components/payment-container/index.tsx index 25ff46de5..a428b1d6b 100644 --- a/src/modules/checkout/components/payment-container/index.tsx +++ b/src/modules/checkout/components/payment-container/index.tsx @@ -52,19 +52,28 @@ const PaymentContainer: React.FC = ({ disabled={disabled} > -
-

- {PaymentInfoMap[paymentSession.provider_id].title} -

- - {PaymentInfoMap[paymentSession.provider_id].description} - - {selected && ( -
- -
- )} -
+ {PaymentInfoMap[paymentSession.provider_id] ? ( +
+

+ {PaymentInfoMap[paymentSession.provider_id].title} +

+ + { + PaymentInfoMap[paymentSession.provider_id] + .description + } + + {selected && ( +
+ +
+ )} +
+ ) : ( + <> + )} )