diff --git a/.env b/.env index 321b79a39..dd73c712c 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -apiBaseUrl=https://sandbox.hyperswitch.io +apiBaseUrl=https://integ-api.hyperswitch.io sdkBaseUrl=https://beta.hyperswitch.io/v1/HyperLoader.js \ No newline at end of file diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res index d8da8b3aa..f89605955 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res @@ -58,8 +58,8 @@ let make = ( try { if connector->Js.String2.length > 0 { let dict = isPayoutFlow - ? Window.getPayoutConnectorConfig(connector) - : Window.getConnectorConfig(connector) + ? Window.getPayoutConnectorConfig(connector->Js.String2.toLowerCase) + : Window.getConnectorConfig(connector->Js.String2.toLowerCase) setScreenState(_ => Success) dict } else { diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res b/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res index 768f8ca69..ef51c50a2 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res @@ -48,7 +48,7 @@ let make = ( try { setScreenState(_ => Loading) let obj: ConnectorTypes.wasmRequest = { - connector, + connector: connector->Js.String2.toLowerCase, payment_methods_enabled: paymentMethodsEnabled, metadata: metaData, } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res index b4cc51951..e9473d7e3 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res @@ -137,8 +137,8 @@ module ConnectorSummaryGrid = { try { if connector->Js.String2.length > 0 { let dict = isPayoutFlow - ? Window.getPayoutConnectorConfig(connector) - : Window.getConnectorConfig(connector) + ? Window.getPayoutConnectorConfig(connector->Js.String2.toLowerCase) + : Window.getConnectorConfig(connector->Js.String2.toLowerCase) setScreenState(_ => Success) dict } else { diff --git a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res index a186c7f6f..5e0002d78 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res @@ -133,7 +133,10 @@ let getProcessorPayloadType = dict => { open LogicUtils { connector_type: dict->getString("connector_type", ""), - connector_name: dict->getString("connector_name", ""), + connector_name: dict + ->getString("connector_name", "") + ->ConnectorUtils.getConnectorNameTypeFromString + ->ConnectorUtils.getConnectorNameString, connector_label: dict->getString("connector_label", ""), connector_account_details: dict ->getObj("connector_account_details", Js.Dict.empty()) diff --git a/src/screens/HyperSwitch/Connectors/ConnectorUIUtils/PaymentMethod.res b/src/screens/HyperSwitch/Connectors/ConnectorUIUtils/PaymentMethod.res index 3648e3c70..49054ea3f 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorUIUtils/PaymentMethod.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorUIUtils/PaymentMethod.res @@ -195,8 +195,8 @@ module PaymentMethodsRender = { let pmts = React.useMemo1(() => { ( isPayoutFlow - ? Window.getPayoutConnectorConfig(connector) - : Window.getConnectorConfig(connector) + ? Window.getPayoutConnectorConfig(connector->Js.String2.toLowerCase) + : Window.getConnectorConfig(connector->Js.String2.toLowerCase) )->getDictFromJsonObject }, [connector]) let keys = diff --git a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res index a4a75733e..36623e45e 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res @@ -433,7 +433,7 @@ let stripeTestInfo = { } let paypalTestInfo = { - description: "A paypal test processor to simulate payment flows and experience hyperswitch checkout.", + description: "A payPal test processor to simulate payment flows and experience hyperswitch checkout.", } let wiseInfo = { @@ -489,7 +489,7 @@ let getConnectorNameString = connector => { | MOLLIE => "mollie" | TRUSTPAY => "trustpay" | ZEN => "zen" - | PAYPAL => "paypal" + | PAYPAL => "payPal" | COINBASE => "coinbase" | OPENNODE => "opennode" | NMI => "nmi" @@ -508,7 +508,7 @@ let getConnectorNameString = connector => { | TSYS => "tsys" | NOON => "noon" | STRIPE_TEST => "stripe_test" - | PAYPAL_TEST => "paypal_test" + | PAYPAL_TEST => "payPal_test" | WISE => "wise" | STAX => "stax" | GOCARDLESS => "gocardless" @@ -546,7 +546,7 @@ let getConnectorNameTypeFromString = connector => { | "mollie" => MOLLIE | "trustpay" => TRUSTPAY | "zen" => ZEN - | "paypal" => PAYPAL + | "payPal" | "paypal" => PAYPAL | "coinbase" => COINBASE | "opennode" => OPENNODE | "nmi" => NMI @@ -558,7 +558,7 @@ let getConnectorNameTypeFromString = connector => { | "fauxpay" => FAUXPAY | "pretendpay" => PRETENDPAY | "stripe_test" => STRIPE_TEST - | "paypal_test" => PAYPAL_TEST + | "payPal_test" => PAYPAL_TEST | "cashtocode" => CASHTOCODE | "payme" => PAYME | "globepay" => GLOBEPAY @@ -803,7 +803,7 @@ let generateInitialValuesDict = ( dict->Js.Dict.set("connector_account_details", connectorAccountDetails->Js.Json.object_) - dict->Js.Dict.set("connector_name", connector->Js.Json.string) + dict->Js.Dict.set("connector_name", connector->Js.String2.toLowerCase->Js.Json.string) dict->Js.Dict.set( "connector_type", getConnectorType(connector->getConnectorNameTypeFromString, ~isPayoutFlow, ())->Js.Json.string, @@ -1168,6 +1168,7 @@ let constructConnectorRequestBody = (wasmRequest: wasmRequest, payload: Js.Json. let dict = Js.Dict.fromArray([ ("connector_account_details", connectorAccountDetails), ("connector_label", dict->getString("connector_label", "")->Js.Json.string), + ("status", dict->getString("status", "active")->Js.Json.string), ]) values ->getDictFromJsonObject @@ -1210,8 +1211,8 @@ let defaultSelectAllCards = ( let config = ( isPayoutFlow - ? Window.getPayoutConnectorConfig(connector) - : Window.getConnectorConfig(connector) + ? Window.getPayoutConnectorConfig(connector->Js.String.toLowerCase) + : Window.getConnectorConfig(connector->Js.String.toLowerCase) )->getDictFromJsonObject pmts->Js.Array2.forEach(val => { switch val.payment_method->getPaymentMethodFromString { diff --git a/src/screens/HyperSwitch/Connectors/SimpleConnectorFlow/ConnectPayPal.res b/src/screens/HyperSwitch/Connectors/SimpleConnectorFlow/ConnectPayPal.res index 9e84f80ab..72422730d 100644 --- a/src/screens/HyperSwitch/Connectors/SimpleConnectorFlow/ConnectPayPal.res +++ b/src/screens/HyperSwitch/Connectors/SimpleConnectorFlow/ConnectPayPal.res @@ -279,7 +279,7 @@ let make = ( ->Belt.Option.getWithDefault("") ->LogicUtils.getBoolFromString(false) - let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) + let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success) let (configuartionType, setConfigurationType) = React.useState(_ => ConnectorTypes.NotSelected) let (retryTime, setRetryTime) = React.useState(_ => 0) @@ -297,6 +297,7 @@ let make = ( open ConnectorUtils open SimpleConnectorFlowUtils try { + setScreenState(_ => Loading) let profileIdValue = values->LogicUtils.getDictFromJsonObject->LogicUtils.getString("profile_id", "") let body = generateConnectorPayloadPayPal( @@ -319,14 +320,14 @@ let make = ( ) let res = await updateDetails(url, body, Post) - setScreenState(_ => Success) setInitialValues(_ => res) let connectorId = res->LogicUtils.getDictFromJsonObject->LogicUtils.getString("merchant_connector_id", "") if !isUpdateFlow { - RescriptReactRouter.push(`/connectors/new?name=paypal&connectorId=${connectorId}`) + RescriptReactRouter.push(`/connectors/new?name=payPal&connectorId=${connectorId}`) } setConnectorId(_ => connectorId) + setScreenState(_ => Success) } catch { | Js.Exn.Error(e) => { setShowVerifyModal(_ => false) @@ -415,80 +416,91 @@ let make = ( switch setupAccountStatus { | Account_not_found => switch configuartionType { - | Manual => setSetupAccountStatus(._ => Manual_setup_flow) + | Manual + | NotSelected => + setSetupAccountStatus(._ => Manual_setup_flow) + | Automatic => handleConnector(values)->ignore } - | Manual_setup_flow => handleConnectorConnected(values) + | Manual_setup_flow => { + let dictOfInitialValues = values->LogicUtils.getDictFromJsonObject + dictOfInitialValues->Js.Dict.set("disabled", false->Js.Json.boolean) + dictOfInitialValues->Js.Dict.set("status", "active"->Js.Json.string) + setInitialValues(_ => dictOfInitialValues->Js.Json.object_) + handleConnectorConnected(dictOfInitialValues->Js.Json.object_) + } | _ => () } Js.Nullable.null->Js.Promise.resolve }