Skip to content

Commit

Permalink
chore: update paypal metadata (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Jun 3, 2024
1 parent 639ca09 commit 98b0b00
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion src/screens/Connectors/ConnectorAccountDetailsHelper.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let metaDataInputKeysToIgnore = ["google_pay", "apple_pay", "zen_apple_pay", "paypal_sdk"]
let metaDataInputKeysToIgnore = ["google_pay", "apple_pay", "zen_apple_pay"]

let connectorsWithIntegrationSteps: array<ConnectorTypes.connectorTypes> = [
Processors(ADYEN),
Expand All @@ -7,6 +7,45 @@ let connectorsWithIntegrationSteps: array<ConnectorTypes.connectorTypes> = [
Processors(PAYPAL),
]

module MultiConfigInp = {
@react.component
let make = (~label, ~fieldsArray: array<ReactFinalForm.fieldRenderProps>) => {
let enabledList = (fieldsArray[0]->Option.getOr(ReactFinalForm.fakeFieldRenderProps)).input
let valueField = (fieldsArray[1]->Option.getOr(ReactFinalForm.fakeFieldRenderProps)).input

let input: ReactFinalForm.fieldRenderPropsInput = {
name: "string",
onBlur: _ev => (),
onChange: ev => {
let value = ev->Identity.formReactEventToArrayOfString
valueField.onChange(value->Identity.anyTypeToReactEvent)
enabledList.onChange(value->Identity.anyTypeToReactEvent)
},
onFocus: _ev => (),
value: enabledList.value,
checked: true,
}
<TextInput input placeholder={`Enter ${label->LogicUtils.snakeToTitle}`} />
}
}

let renderValueInp = (~label, fieldsArray: array<ReactFinalForm.fieldRenderProps>) => {
<MultiConfigInp fieldsArray label />
}

let multiValueInput = (~label, ~fieldName1, ~fieldName2) => {
open FormRenderer
makeMultiInputFieldInfoOld(
~label,
~comboCustomInput=renderValueInp(~label),
~inputFields=[
makeInputFieldInfo(~name=`${fieldName1}`, ()),
makeInputFieldInfo(~name=`${fieldName2}`, ()),
],
(),
)
}

let getCurrencyOption: CurrencyUtils.currencyCode => SelectBox.dropdownOption = currencyType => {
open CurrencyUtils
{
Expand Down Expand Up @@ -156,6 +195,7 @@ module RenderConnectorInputFields = {
let label = switch field {
| "pull_mechanism_for_external_3ds_enabled" => "Pull Mechanism Enabled"
| "klarna_region" => "Region of your Klarna Merchant Account"

| _ => details->getString(field, "")
}

Expand All @@ -179,6 +219,12 @@ module RenderConnectorInputFields = {
~options=details->getStrArrayFromDict(field, []),
(),
)
| (Processors(PAYPAL), "key1") =>
multiValueInput(
~label,
~fieldName1="connector_account_details.key1",
~fieldName2="metadata.paypal_sdk.client_id",
)
| _ =>
inputField(
~name=formName,
Expand Down

0 comments on commit 98b0b00

Please sign in to comment.