-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathSurchargeProcessorEntity.res
More file actions
82 lines (77 loc) · 2.43 KB
/
Copy pathSurchargeProcessorEntity.res
File metadata and controls
82 lines (77 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
open ConnectorTypes
type colType =
| Name
| TestMode
| Status
| Disabled
| MerchantConnectorId
| ConnectorLabel
let defaultColumns = [Name, MerchantConnectorId, ConnectorLabel, Status, Disabled]
let getHeading = colType => {
switch colType {
| Name => Table.makeHeaderInfo(~key="connector_name", ~title="Processor")
| TestMode => Table.makeHeaderInfo(~key="test_mode", ~title="Test Mode")
| Status => Table.makeHeaderInfo(~key="status", ~title="Integration status")
| Disabled => Table.makeHeaderInfo(~key="disabled", ~title="Status")
| ConnectorLabel => Table.makeHeaderInfo(~key="connector_label", ~title="Connector Label")
| MerchantConnectorId =>
Table.makeHeaderInfo(~key="merchant_connector_id", ~title="Merchant Connector ID")
}
}
let connectorStatusColor = connectorStatus =>
connectorStatus->String.toLowerCase == "active" ? TagBinding.Success : TagBinding.Neutral
let getCell = (connector: connectorPayloadCommonType, colType): Table.cell => {
switch colType {
| Name =>
CustomCell(
<SurchargeProcessorHelper.CustomConnectorCellWithDefaultIcon
connectorName=connector.connector_name connectorType={SurchargeProcessor} connector
/>,
"",
)
| TestMode => Text(connector.test_mode->Option.getOr(false) ? "True" : "False")
| Disabled =>
Label({
title: connector.disabled ? "DISABLED" : "ENABLED",
color: connector.disabled ? LabelGray : LabelGreen,
})
| Status =>
Table.CustomCell(
<TagBinding
text={connector.status->String.toUpperCase}
color={connector.status->connectorStatusColor}
variant=Subtle
shape=Squarical
size=Xs
/>,
"",
)
| ConnectorLabel => Text(connector.connector_label)
| MerchantConnectorId =>
CustomCell(
<HelperComponents.CopyTextCustomComp
customTextCss="w-36 truncate whitespace-nowrap" displayValue=Some(connector.id)
/>,
"",
)
}
}
let surchargeProcessorEntity = (path: string, ~authorization: CommonAuthTypes.authorization) => {
EntityType.makeEntity(
~uri=``,
~getObjects=_ => [],
~defaultColumns,
~getHeading,
~getCell,
~dataKey="",
~getShowLink={
connectorObj =>
GroupAccessUtils.linkForGetShowLinkViaAccess(
~url=GlobalVars.appendDashboardPath(
~url=`/${path}/${connectorObj.id}?name=${connectorObj.connector_name}`,
),
~authorization,
)
},
)
}