Skip to content

Commit

Permalink
fix: disablesavedpaymentmethods prop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vsrivatsa-juspay committed May 31, 2024
1 parent 6412a43 commit fa8b2b2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/orca-loader/Elements.res
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -192,7 +196,7 @@ let make = (
}
let msg =
[
("sendCustomerPaymentMethodsResponse", !disableSaveCards->JSON.Encode.bool),
("sendCustomerPaymentMethodsResponse", !disableSavedPaymentMethods->JSON.Encode.bool),
]->Dict.fromArray
preMountLoaderIframeDiv->Window.iframePostMessage(msg)
}
Expand Down Expand Up @@ -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()
})
Expand Down

0 comments on commit fa8b2b2

Please sign in to comment.