From 4ad2b9b6dda9aea701ba5e619aab79a60f3ee165 Mon Sep 17 00:00:00 2001 From: rising-dragon401 Date: Fri, 31 May 2024 18:27:43 +0530 Subject: [PATCH] feat: ali pay hk added, fix for disableSavedPaymentMethods prop (#410) Co-authored-by: Pritish Budhiraja --- public/icons/orca.svg | 14 ++++++++++++++ src/Payments/PaymentMethodsRecord.res | 7 +++++++ src/Utilities/PaymentBody.res | 4 +++- src/Utilities/PaymentUtils.res | 1 + src/orca-loader/Elements.res | 18 ++++++++++-------- 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/public/icons/orca.svg b/public/icons/orca.svg index 1d3e33e..36d80f1 100644 --- a/public/icons/orca.svg +++ b/public/icons/orca.svg @@ -1025,6 +1025,20 @@ License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL /> + + + + + + + + + @@ -1069,7 +1070,8 @@ let getPaymentBody = ( | "ideal" => iDealBody(~name=fullName, ~bankName=bank) | "eps" => epsBody(~name=fullName, ~bankName=bank) | "blik" => blikBody(~blikCode) - | "ali_pay" => + | "ali_pay" + | "ali_pay_hk" => switch paymentExperience { | QrFlow => dynamicPaymentBody(paymentMethod, paymentMethodType, ~isQrPaymentMethod=true) | RedirectToURL diff --git a/src/Utilities/PaymentUtils.res b/src/Utilities/PaymentUtils.res index fbf4a69..39d9756 100644 --- a/src/Utilities/PaymentUtils.res +++ b/src/Utilities/PaymentUtils.res @@ -10,6 +10,7 @@ let paymentListLookupNew = ( let walletToBeDisplayedInTabs = [ "mb_way", "ali_pay", + "ali_pay_hk", "mobile_pay", "we_chat_pay", "vipps", diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index 217db77..e9edbca 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) } @@ -992,14 +996,12 @@ let make = ( preMountLoaderMountedPromise ->then(_ => { fetchPaymentsList(mountedIframeRef, componentType) - if ( + let disableSavedPaymentMethods = newOptions ->getDictFromJson ->getBool("displaySavedPaymentMethods", true) && - !(expressCheckoutComponents->Array.includes(componentType)) - ) { - fetchCustomerPaymentMethods(mountedIframeRef, false, componentType) - } + !(expressCheckoutComponents->Array.includes(componentType))->not + fetchCustomerPaymentMethods(mountedIframeRef, disableSavedPaymentMethods, componentType) fetchSessionTokens(mountedIframeRef) resolve() })