From b7b53be8e2ced057b8f9bab36df0ecb589ee000a Mon Sep 17 00:00:00 2001 From: Arush Date: Tue, 25 Jun 2024 17:05:45 +0530 Subject: [PATCH] fix: google Pay Fix --- src/orca-loader/PaymentSessionMethods.res | 26 ++++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/orca-loader/PaymentSessionMethods.res b/src/orca-loader/PaymentSessionMethods.res index 828484ba6..b999f967a 100644 --- a/src/orca-loader/PaymentSessionMethods.res +++ b/src/orca-loader/PaymentSessionMethods.res @@ -12,12 +12,6 @@ let getCustomerSavedPaymentMethods = ( open GooglePayType let applePaySessionRef = ref(Nullable.null) - let gPayClient = google( - { - "environment": publishableKey->String.startsWith("pk_prd_") ? "PRODUCTION" : "TEST", - }->Identity.anyTypeToJson, - ) - PaymentHelpers.fetchCustomerPaymentMethodList( ~clientSecret, ~publishableKey, @@ -27,6 +21,12 @@ let getCustomerSavedPaymentMethods = ( ~isPaymentSession=true, ) ->then(customerDetails => { + let gPayClient = google( + { + "environment": publishableKey->String.startsWith("pk_prd_") ? "PRODUCTION" : "TEST", + }->Identity.anyTypeToJson, + ) + let customerDetailsDict = customerDetails->JSON.Decode.object->Option.getOr(Dict.make()) let (customerPaymentMethods, isGuestCustomer) = customerDetailsDict->PaymentType.itemToCustomerObjMapper @@ -168,7 +168,12 @@ let getCustomerSavedPaymentMethods = ( PaymentUtils.getStateJson() ->then(stateJson => { - logger.setLogInfo(~value="States Loaded", ~eventName=APPLE_PAY_FLOW, ~paymentMethod="APPLE_PAY", ()) + logger.setLogInfo( + ~value="States Loaded", + ~eventName=APPLE_PAY_FLOW, + ~paymentMethod="APPLE_PAY", + (), + ) stateJson->completeApplePayPayment }) ->catch(err => { @@ -226,7 +231,12 @@ let getCustomerSavedPaymentMethods = ( PaymentUtils.getStateJson() ->then( stateJson => { - logger.setLogInfo(~value="States Loaded", ~eventName=GOOGLE_PAY_FLOW, ~paymentMethod="GOOGLE_PAY", ()) + logger.setLogInfo( + ~value="States Loaded", + ~eventName=GOOGLE_PAY_FLOW, + ~paymentMethod="GOOGLE_PAY", + (), + ) stateJson->completeGooglePayPayment }, )