diff --git a/src/Payments/PaypalSDK.res b/src/Payments/PaypalSDK.res
index 1f352ccee..42601cb4c 100644
--- a/src/Payments/PaypalSDK.res
+++ b/src/Payments/PaypalSDK.res
@@ -95,14 +95,12 @@ let make = (~sessionObj: SessionsType.token, ~list: PaymentMethodsRecord.list) =
~token=payload.nonce,
~connectors,
)
- let modifiedPaymentBody = PaymentUtils.isAppendingCustomerAcceptance(
- isGuestCustomer,
- list.payment_type,
+ let modifiedPaymentBody = PaymentUtils.appendedCustomerAcceptance(
+ ~isGuestCustomer,
+ ~paymentType=list.payment_type,
+ ~body,
)
- ? body->Array.concat([
- ("customer_acceptance", PaymentBody.customerAcceptanceBody),
- ])
- : body
+
intent(
~bodyArr=modifiedPaymentBody,
~confirmParam={
diff --git a/src/Utilities/PaymentUtils.res b/src/Utilities/PaymentUtils.res
index 7880470f6..983a550a5 100644
--- a/src/Utilities/PaymentUtils.res
+++ b/src/Utilities/PaymentUtils.res
@@ -228,6 +228,12 @@ let getPaymentMethodName = (~paymentMethodType, ~paymentMethodName) => {
}
}
-let isAppendingCustomerAcceptance = (isGuestCustomer, paymentType) => {
+let isAppendingCustomerAcceptance = (~isGuestCustomer, ~paymentType) => {
!isGuestCustomer && (paymentType === "new_mandate" || paymentType === "setup_mandate")
}
+
+let appendedCustomerAcceptance = (~isGuestCustomer, ~paymentType, ~body) => {
+ isAppendingCustomerAcceptance(~isGuestCustomer, ~paymentType)
+ ? body->Array.concat([("customer_acceptance", PaymentBody.customerAcceptanceBody)])
+ : body
+}
diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res
index 556938256..fe3be5abf 100644
--- a/src/Utilities/Utils.res
+++ b/src/Utilities/Utils.res
@@ -853,3 +853,7 @@ let isOtherElements = componentType => {
}
let nbsp = `\u00A0`
+
+let callbackFuncForExtractingValFromDict = key => {
+ x => x->Js.Dict.get(key)
+}
diff --git a/src/orca-loader/LoaderPaymentElement.res b/src/orca-loader/LoaderPaymentElement.res
index 21f43fe5e..e34242950 100644
--- a/src/orca-loader/LoaderPaymentElement.res
+++ b/src/orca-loader/LoaderPaymentElement.res
@@ -19,25 +19,21 @@ let make = (componentType, options, setIframeRef, iframeRef, mountPostMessage) =
setIframeRef(ref)
}
- let callbackFuncForExtractValFromDict = key => {
- x => x->Js.Dict.get(key)
- }
-
let sdkHandleConfirmPayment =
options->getDecodedBoolFromJson(
- callbackFuncForExtractValFromDict("sdkHandleConfirmPayment"),
+ callbackFuncForExtractingValFromDict("sdkHandleConfirmPayment"),
false,
)
let sdkHandleOneClickConfirmPayment =
options->getDecodedBoolFromJson(
- callbackFuncForExtractValFromDict("sdkHandleOneClickConfirmPayment"),
+ callbackFuncForExtractingValFromDict("sdkHandleOneClickConfirmPayment"),
true,
)
let displaySavedPaymentMethods =
options->getDecodedBoolFromJson(
- callbackFuncForExtractValFromDict("displaySavedPaymentMethods"),
+ callbackFuncForExtractingValFromDict("displaySavedPaymentMethods"),
true,
)