Skip to content

Commit

Permalink
fix(elements): added check to resolve customer payment methods on com…
Browse files Browse the repository at this point in the history
…ponentType
  • Loading branch information
ArushKapoorJuspay committed Apr 26, 2024
1 parent a29b708 commit 9fff704
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/Utilities/Utils.res
Original file line number Diff line number Diff line change
Expand Up @@ -1224,13 +1224,9 @@ let getWalletPaymentMethod = (wallets, paymentType: CardThemeType.mode) => {
}
}

let componentsForPaymentElementCreate = [
"payment",
"googlePay",
"payPal",
"applePay",
"paymentRequestButtons",
]
let expressCheckoutComponents = ["googlePay", "payPal", "applePay", "paymentRequestButtons"]

let componentsForPaymentElementCreate = ["payment"]->Array.concat(expressCheckoutComponents)

let isComponentTypeForPaymentElementCreate = componentType => {
componentsForPaymentElementCreate->Array.includes(componentType)
Expand Down
4 changes: 3 additions & 1 deletion src/orca-loader/Elements.res
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ let make = (
)
preMountLoaderIframeDiv->Window.iframePostMessage(msg)
}

let fetchCustomerPaymentMethods = (mountedIframeRef, disableSaveCards, componentType) => {
if !disableSaveCards {
let handleCustomerPaymentMethodsLoaded = (event: Types.event) => {
Expand Down Expand Up @@ -880,7 +881,8 @@ let make = (
if (
newOptions
->getDictFromJson
->getBool("displaySavedPaymentMethods", true)
->getBool("displaySavedPaymentMethods", true) &&
!(Utils.expressCheckoutComponents->Array.includes(componentType))
) {
fetchCustomerPaymentMethods(mountedIframeRef, false, componentType)
}
Expand Down

0 comments on commit 9fff704

Please sign in to comment.