Skip to content

Commit

Permalink
chore: reverting routing filtering connector list changes (#1781)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitanjli525 authored Nov 22, 2024
1 parent 75b1c9e commit c5126a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/screens/PayoutRouting/PayoutRoutingConfigure.res
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ let make = (~routingType) => {
baseUrlForRedirection
/>
| DEFAULTFALLBACK =>
<DefaultRouting urlEntityName=PAYOUT_DEFAULT_FALLBACK baseUrlForRedirection connectorList />
<DefaultRouting urlEntityName=PAYOUT_DEFAULT_FALLBACK baseUrlForRedirection />
| _ => React.null
}}
</History.BreadCrumbWrapper>
Expand Down
36 changes: 6 additions & 30 deletions src/screens/Routing/DefaultRouting.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ open APIUtils
open MerchantAccountUtils

@react.component
let make = (
~urlEntityName,
~baseUrlForRedirection,
~connectorList: array<ConnectorTypes.connectorPayload>,
) => {
let make = (~urlEntityName, ~baseUrlForRedirection) => {
open LogicUtils
let getURL = useGetURL()
let updateDetails = useUpdateMethod()
Expand All @@ -19,6 +15,7 @@ let make = (
let (gateways, setGateways) = React.useState(() => [])
let (defaultRoutingResponse, setDefaultRoutingResponse) = React.useState(_ => [])
let modalObj = RoutingUtils.getModalObj(DEFAULTFALLBACK, "default")
let typedConnectorValue = HyperswitchAtom.connectorListAtom->Recoil.useRecoilValueFromAtom
let {globalUIConfig: {backgroundColor}} = React.useContext(ThemeProvider.themeContext)

let settingUpConnectorsState = routingRespArray => {
Expand All @@ -27,23 +24,16 @@ let make = (
value->getDictFromJsonObject->getString("profile_id", "") === profile
)

let connectors = switch profileList->Array.get(0) {
let connectorList = switch profileList->Array.get(0) {
| Some(json) =>
json
->getDictFromJsonObject
->getArrayFromDict("connectors", [])
| _ => routingRespArray
}

let gatewayConnectors = connectors->Array.filter(connectorsItem => {
connectorList->Array.some(connectorListItem => {
connectorListItem.merchant_connector_id ===
connectorsItem->getDictFromJsonObject->getString("merchant_connector_id", "")
})
})

if gatewayConnectors->Array.length > 0 {
setGateways(_ => gatewayConnectors)
if connectorList->Array.length > 0 {
setGateways(_ => connectorList)
setScreenState(_ => PageLoaderWrapper.Success)
} else {
setScreenState(_ => PageLoaderWrapper.Custom)
Expand Down Expand Up @@ -147,21 +137,10 @@ let make = (
let merchantConnectorId =
gateway->getDictFromJsonObject->getString("merchant_connector_id", "")
let connectorLabel = ConnectorTableUtils.getConnectorObjectFromListViaId(
connectorList,
typedConnectorValue,
merchantConnectorId,
).connector_label

let connector =
connectorList
->Array.filter(item =>
item.merchant_connector_id ===
gateway->getDictFromJsonObject->getString("merchant_connector_id", "")
)
->Array.get(0)
->Option.getOr(Dict.make()->ConnectorListMapper.getProcessorPayloadType)

let isDisabled = connector.disabled

<div
className={`h-14 px-3 flex flex-row items-center justify-between text-jp-gray-900 dark:text-jp-gray-600 border-jp-gray-500 dark:border-jp-gray-960
${index !== 0 ? "border-t" : ""} ${style}`}>
Expand All @@ -174,9 +153,6 @@ let make = (
<div className="flex gap-1 items-center">
<p> {connectorName->React.string} </p>
<p className="text-sm opacity-50 "> {`(${connectorLabel})`->React.string} </p>
<RenderIf condition={isDisabled}>
<p className="text-sm opacity-50 "> {"(disabled)"->React.string} </p>
</RenderIf>
</div>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/screens/Routing/RoutingConfigure.res
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ let make = (~routingType) => {
urlEntityName=ROUTING
baseUrlForRedirection
/>
| DEFAULTFALLBACK =>
<DefaultRouting urlEntityName=DEFAULT_FALLBACK baseUrlForRedirection connectorList />
| DEFAULTFALLBACK => <DefaultRouting urlEntityName=DEFAULT_FALLBACK baseUrlForRedirection />
| _ => <> </>
}}
</History.BreadCrumbWrapper>
Expand Down

0 comments on commit c5126a0

Please sign in to comment.