From bb98ae66e17baad2638c6b261b293df982de66eb Mon Sep 17 00:00:00 2001 From: sakksham7 <130480324+sakksham7@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:05:46 +0530 Subject: [PATCH] chore: added dynamic fields for ach (#777) --- src/Payments/ACHBankTransfer.res | 16 ++++++++++++---- src/Payments/PaymentMethodsRecord.res | 1 + src/Utilities/PaymentBody.res | 17 +---------------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/Payments/ACHBankTransfer.res b/src/Payments/ACHBankTransfer.res index c4665addb..98a91da37 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)