From 08b5942d8ff9e5bab3cd6b42052eaa6128fc79ce Mon Sep 17 00:00:00 2001 From: Gitanjli <96485413+gitanjli525@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:46:10 +0530 Subject: [PATCH] chore: plaid minor enhancements (#1175) --- .../ConnectorMetaData/BankDebit/BankDebit.res | 7 ++++--- .../BankDebit/BankDebitUtils.res | 15 +++++++++++++++ .../AdditionalDetailsSidebar.res | 1 - 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/screens/Connectors/ConnectorMetaData/BankDebit/BankDebit.res b/src/screens/Connectors/ConnectorMetaData/BankDebit/BankDebit.res index 9a6de8f4f..c9cb3f4b0 100644 --- a/src/screens/Connectors/ConnectorMetaData/BankDebit/BankDebit.res +++ b/src/screens/Connectors/ConnectorMetaData/BankDebit/BankDebit.res @@ -54,7 +54,7 @@ module PMAuthProcessorInput = { } { - onCloseClickCustomFun() + update() onCancelClick() setShowWalletConfigurationModal(_ => false) } @@ -145,6 +144,7 @@ let make = ( ~label=`${inputArg.label}`, ~comboCustomInput=renderValueInp(inputArg.options), ~inputFields=[makeInputFieldInfo(~name=`${inputArg.name1}`), makeInputFieldInfo(~name=``)], + ~isRequired=true, (), ) } @@ -167,6 +167,7 @@ let make = ( }} text="Proceed" buttonType={Primary} + buttonState={validateSelectedPMAuth(formState.values, paymentMethodType)} /> diff --git a/src/screens/Connectors/ConnectorMetaData/BankDebit/BankDebitUtils.res b/src/screens/Connectors/ConnectorMetaData/BankDebit/BankDebitUtils.res index e09a8b8ac..1067cf9db 100644 --- a/src/screens/Connectors/ConnectorMetaData/BankDebit/BankDebitUtils.res +++ b/src/screens/Connectors/ConnectorMetaData/BankDebit/BankDebitUtils.res @@ -16,3 +16,18 @@ let itemToObjMapper = dict => { mca_id: dict->getString("mca_id", ""), } } + +let validateSelectedPMAuth = (values, paymentMethodType) => { + let existingPaymentMethodValues = + values + ->getDictFromJsonObject + ->getDictfromDict("pm_auth_config") + ->getArrayFromDict("enabled_payment_methods", []) + ->JSON.Encode.array + ->getArrayDataFromJson(itemToObjMapper) + + let newPaymentMethodValues = + existingPaymentMethodValues->Array.filter(item => item.payment_method_type == paymentMethodType) + + newPaymentMethodValues->Array.length > 0 ? Button.Normal : Button.Disabled +} diff --git a/src/screens/Connectors/PaymentMethodAdditionalDetails/AdditionalDetailsSidebar.res b/src/screens/Connectors/PaymentMethodAdditionalDetails/AdditionalDetailsSidebar.res index 3a9d83ebd..c2ec07ab1 100644 --- a/src/screens/Connectors/PaymentMethodAdditionalDetails/AdditionalDetailsSidebar.res +++ b/src/screens/Connectors/PaymentMethodAdditionalDetails/AdditionalDetailsSidebar.res @@ -31,7 +31,6 @@ module AdditionalDetailsSidebarComp = {