From d8ef9028636192a28bc5a8e0e626bccf646d6c51 Mon Sep 17 00:00:00 2001 From: Arush Date: Sun, 30 Jun 2024 22:26:12 +0530 Subject: [PATCH] fix: googlePay and applePay billing details not being passed in confirm call for saved methods --- src/Utilities/ApplePayHelpers.res | 4 +++- src/Utilities/GooglePayHelpers.res | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Utilities/ApplePayHelpers.res b/src/Utilities/ApplePayHelpers.res index e3a0dc0b7..3de8335a3 100644 --- a/src/Utilities/ApplePayHelpers.res +++ b/src/Utilities/ApplePayHelpers.res @@ -36,12 +36,13 @@ let getApplePayFromResponse = ( ~stateJson, ~connectors, ~isPaymentSession=false, + ~isSavedMethodsFlow=false, ) => { let billingContact = billingContactDict->ApplePayTypes.billingContactItemToObjMapper let shippingContact = shippingContactDict->ApplePayTypes.shippingContactItemToObjMapper - let requiredFieldsBody = if isPaymentSession { + let requiredFieldsBody = if isPaymentSession || isSavedMethodsFlow { DynamicFieldsUtils.getApplePayRequiredFields( ~billingContact, ~shippingContact, @@ -179,6 +180,7 @@ let useHandleApplePayResponse = ( ~requiredFields=paymentMethodTypes.required_fields, ~stateJson, ~connectors, + ~isSavedMethodsFlow, ) processPayment( diff --git a/src/Utilities/GooglePayHelpers.res b/src/Utilities/GooglePayHelpers.res index b2519d690..aaf32f480 100644 --- a/src/Utilities/GooglePayHelpers.res +++ b/src/Utilities/GooglePayHelpers.res @@ -8,6 +8,7 @@ let getGooglePayBodyFromResponse = ( ~requiredFields=[], ~stateJson, ~isPaymentSession=false, + ~isSavedMethodsFlow=false, ) => { let obj = gPayResponse->getDictFromJson->GooglePayType.itemToObjMapper let gPayBody = PaymentUtils.appendedCustomerAcceptance( @@ -35,7 +36,7 @@ let getGooglePayBodyFromResponse = ( ->getDictFromJson ->getString("email", "") - let requiredFieldsBody = if isPaymentSession { + let requiredFieldsBody = if isPaymentSession || isSavedMethodsFlow { DynamicFieldsUtils.getGooglePayRequiredFields( ~billingContact, ~shippingContact, @@ -112,6 +113,7 @@ let useHandleGooglePayResponse = (~connectors, ~intent, ~isSavedMethodsFlow=fals ~connectors, ~requiredFields=paymentMethodTypes.required_fields, ~stateJson, + ~isSavedMethodsFlow, ) processPayment( ~body,