diff --git a/src/Payments/ACHBankTransfer.res b/src/Payments/ACHBankTransfer.res index c4665add..98a91da3 100644 --- a/src/Payments/ACHBankTransfer.res +++ b/src/Payments/ACHBankTransfer.res @@ -10,7 +10,8 @@ let make = (~paymentType: CardThemeType.mode) => { let intent = PaymentHelpers.usePaymentIntent(Some(loggerState), BankTransfer) let (email, _) = Recoil.useLoggedRecoilState(userEmailAddress, "email", loggerState) let setComplete = Recoil.useSetRecoilState(fieldsComplete) - let paymentMethodListValue = Recoil.useRecoilValueFromAtom(PaymentUtils.paymentMethodListValue) + + let (requiredFieldsBody, setRequiredFieldsBody) = React.useState(_ => Dict.make()) let complete = email.value != "" && email.isValid->Option.getOr(false) let empty = email.value == "" @@ -27,9 +28,14 @@ let make = (~paymentType: CardThemeType.mode) => { let confirm = json->getDictFromJson->ConfirmType.itemToObjMapper if confirm.doSubmit { if complete { - let (connectors, _) = paymentMethodListValue->PaymentUtils.getConnectors(BankTransfer(ACH)) + let bodyArr = + PaymentBody.dynamicPaymentBody("bank_transfer", "ach") + ->getJsonFromArrayOfJson + ->flattenObject(true) + ->mergeTwoFlattenedJsonDicts(requiredFieldsBody) + ->getArrayOfTupleFromDict intent( - ~bodyArr=PaymentBody.achBankTransferBody(~email=email.value, ~connectors), + ~bodyArr, ~confirmParam=confirm.confirmParams, ~handleUserError=false, ~iframeId, @@ -43,7 +49,9 @@ let make = (~paymentType: CardThemeType.mode) => { useSubmitPaymentData(submitCallback)
- +
diff --git a/src/Payments/PaymentMethodsRecord.res b/src/Payments/PaymentMethodsRecord.res index 68dea2a5..939697ea 100644 --- a/src/Payments/PaymentMethodsRecord.res +++ b/src/Payments/PaymentMethodsRecord.res @@ -681,6 +681,7 @@ let dynamicFieldsEnabledPaymentMethods = [ "upi_collect", "sepa", "affirm", + "ach", ] let getIsBillingField = requiredFieldType => { diff --git a/src/Utilities/PaymentBody.res b/src/Utilities/PaymentBody.res index c7c8d235..eaa5c76b 100644 --- a/src/Utilities/PaymentBody.res +++ b/src/Utilities/PaymentBody.res @@ -654,21 +654,6 @@ let epsBody = (~name, ~bankName) => [ ), ] -let achBankTransferBody = (~email, ~connectors) => [ - ("payment_method", "bank_transfer"->JSON.Encode.string), - ("connector", connectors->Utils.getArrofJsonString->JSON.Encode.array), - ("payment_method_type", "ach"->JSON.Encode.string), - ( - "payment_method_data", - [ - ("billing", [("email", email->JSON.Encode.string)]->Utils.getJsonFromArrayOfJson), - ( - "bank_transfer", - [("ach_bank_transfer", Dict.make()->JSON.Encode.object)]->Utils.getJsonFromArrayOfJson, - ), - ]->Utils.getJsonFromArrayOfJson, - ), -] let bacsBankTransferBody = (~email, ~name, ~connectors) => { let (firstName, lastName) = name->Utils.getFirstAndLastNameFromFullName @@ -945,7 +930,7 @@ let appendRedirectPaymentMethods = [ ] let appendBankeDebitMethods = ["sepa"] -let appendBankTransferMethods = ["sepa"] +let appendBankTransferMethods = ["sepa", "ach"] let getPaymentMethodSuffix = (~paymentMethodType, ~paymentMethod, ~isQrPaymentMethod) => { if isQrPaymentMethod {