Skip to content

Commit

Permalink
chore: plaid minor enhancements (#1175)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitanjli525 authored Aug 23, 2024
1 parent 939d109 commit 08b5942
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module PMAuthProcessorInput = {
}
<SelectBox.BaseDropdown
allowMultiSelect=false
buttonText="Select Value"
buttonText="Select PM Authentication Processor"
input
options
hideMultiSelectButtons=false
Expand All @@ -68,7 +68,6 @@ module PMAuthProcessorInput = {

@react.component
let make = (
~onCloseClickCustomFun,
~setShowWalletConfigurationModal,
~update,
~paymentMethod,
Expand Down Expand Up @@ -121,7 +120,7 @@ let make = (
}

let closeModal = () => {
onCloseClickCustomFun()
update()
onCancelClick()
setShowWalletConfigurationModal(_ => false)
}
Expand All @@ -145,6 +144,7 @@ let make = (
~label=`${inputArg.label}`,
~comboCustomInput=renderValueInp(inputArg.options),
~inputFields=[makeInputFieldInfo(~name=`${inputArg.name1}`), makeInputFieldInfo(~name=``)],
~isRequired=true,
(),
)
}
Expand All @@ -167,6 +167,7 @@ let make = (
}}
text="Proceed"
buttonType={Primary}
buttonState={validateSelectedPMAuth(formState.values, paymentMethodType)}
/>
</div>
<FormValuesSpy />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module AdditionalDetailsSidebarComp = {
<BankDebit
setShowWalletConfigurationModal
update=updatePaymentMethods
onCloseClickCustomFun
paymentMethod
paymentMethodType=method.payment_method_type
setInitialValues
Expand Down

0 comments on commit 08b5942

Please sign in to comment.