From fa8b2b20cc1320ddaa321b73d64a5f6a0a4b5c4d Mon Sep 17 00:00:00 2001 From: vsrivatsa-juspay Date: Fri, 31 May 2024 17:47:46 +0530 Subject: [PATCH] fix: disablesavedpaymentmethods prop fix --- src/orca-loader/Elements.res | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index 6cd9c6118..0f826e287 100644 --- a/src/orca-loader/Elements.res +++ b/src/orca-loader/Elements.res @@ -171,8 +171,12 @@ let make = ( preMountLoaderIframeDiv->Window.iframePostMessage(msg) } - let fetchCustomerPaymentMethods = (mountedIframeRef, disableSaveCards, componentType) => { - if !disableSaveCards { + let fetchCustomerPaymentMethods = ( + mountedIframeRef, + disableSavedPaymentMethods, + componentType, + ) => { + if !disableSavedPaymentMethods { let handleCustomerPaymentMethodsLoaded = (event: Types.event) => { let json = event.data->Identity.anyTypeToJson let dict = json->getDictFromJson @@ -192,7 +196,7 @@ let make = ( } let msg = [ - ("sendCustomerPaymentMethodsResponse", !disableSaveCards->JSON.Encode.bool), + ("sendCustomerPaymentMethodsResponse", !disableSavedPaymentMethods->JSON.Encode.bool), ]->Dict.fromArray preMountLoaderIframeDiv->Window.iframePostMessage(msg) } @@ -989,16 +993,12 @@ let make = ( preMountLoaderMountedPromise ->then(_ => { fetchPaymentsList(mountedIframeRef, componentType) - let requireCustomerPaymentMethods = + let disableSavedPaymentMethods = newOptions ->getDictFromJson ->getBool("displaySavedPaymentMethods", true) && - !(expressCheckoutComponents->Array.includes(componentType)) - fetchCustomerPaymentMethods( - mountedIframeRef, - requireCustomerPaymentMethods, - componentType, - ) + !(expressCheckoutComponents->Array.includes(componentType))->not + fetchCustomerPaymentMethods(mountedIframeRef, disableSavedPaymentMethods, componentType) fetchSessionTokens(mountedIframeRef) resolve() })