diff --git a/src/screens/HyperSwitch/Connectors/ConnectPayPalFlow/PayPalFlowUtils.res b/src/screens/HyperSwitch/Connectors/ConnectPayPalFlow/PayPalFlowUtils.res index b64c82087..4af6d2f77 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectPayPalFlow/PayPalFlowUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectPayPalFlow/PayPalFlowUtils.res @@ -85,25 +85,25 @@ let handleConnectorIntegrated = ( handleStateToNextPage()->ignore } -let handleObjectResponse = ( - ~dict, - ~setSetupAccountStatus, - ~setInitialValues, - ~connector, - ~handleStateToNextPage, -) => { - let dictkey = dict->Dict.keysToArray->LogicUtils.getValueFromArray(0, "") - - switch dictkey->stringToVariantMapper { - | Ppcp_custom_denied => setSetupAccountStatus(._ => dictkey->stringToVariantMapper) - | Connector_integrated => - handleConnectorIntegrated( - ~dictValue=dict, - ~setInitialValues, +let handleObjectResponse = (~dict, ~setInitialValues, ~connector, ~handleStateToNextPage) => { + open LogicUtils + let dictkey = dict->Dict.keysToArray->getValueFromArray(0, "") + if dictkey->stringToVariantMapper === Connector_integrated { + let values = dict->getJsonObjectFromDict("connector_integrated") + let bodyTypeValue = + values + ->getDictFromJsonObject + ->getDictfromDict("connector_account_details") + ->getString("auth_type", "") + let body = ConnectorUtils.generateInitialValuesDict( + ~values, ~connector, - ~handleStateToNextPage, + ~bodyType=bodyTypeValue, + ~isPayoutFlow=false, + (), ) - | _ => setSetupAccountStatus(._ => dictkey->stringToVariantMapper) + setInitialValues(_ => body) + handleStateToNextPage() } } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorHome.res b/src/screens/HyperSwitch/Connectors/ConnectorHome.res index dad1a93d1..f112af168 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorHome.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorHome.res @@ -152,12 +152,8 @@ let make = (~isPayoutFlow=false, ~showStepIndicator=true, ~showBreadCrumb=true) setCurrentStep(_ => AutomaticFlow) } | JSONObject(dict) => - handleObjectResponse( - ~dict, - ~setSetupAccountStatus, - ~setInitialValues, - ~connector, - ~handleStateToNextPage={_ => setCurrentStep(_ => PaymentMethods)}, + handleObjectResponse(~dict, ~setInitialValues, ~connector, ~handleStateToNextPage=_ => + setCurrentStep(_ => PaymentMethods) ) | _ => () } @@ -165,7 +161,7 @@ let make = (~isPayoutFlow=false, ~showStepIndicator=true, ~showBreadCrumb=true) } catch { | _ => setScreenState(_ => PageLoaderWrapper.Custom) } - }, (connector, setInitialValues, setSetupAccountStatus)) + }, (connector, initialValues, setSetupAccountStatus)) let customUiForPaypal =