diff --git a/CHANGELOG.md b/CHANGELOG.md index 913787d01..d9e322091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,33 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 1.10.0 (2023-12-15) + +### Features + +- Show Details Paymentb Enhancement ([#104](https://github.com/juspay/hyperswitch-control-center/pull/104)) ([`134d470`](https://github.com/juspay/hyperswitch-control-center/commit/134d470ceadef14e02c5ca6b31d1475b25212d0d)) + +**Full Changelog:** [`v1.9.0...v1.10.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.9.0...v1.10.0) + +- - - + + +## 1.9.0 (2023-12-15) + +### Features + +- Show Orders Enhancements & sidebar value changes ([#103](https://github.com/juspay/hyperswitch-control-center/pull/103)) ([`a1631f3`](https://github.com/juspay/hyperswitch-control-center/commit/a1631f3b1f3e6021053cae934146ca09368ab333)) + +### Refactors + +- Refactoring key errors ([#98](https://github.com/juspay/hyperswitch-control-center/pull/98)) ([`50b86b9`](https://github.com/juspay/hyperswitch-control-center/commit/50b86b9670ecec63ddc6ed8221e55b9ae593e20a)) +- Refactoring key errors ([#100](https://github.com/juspay/hyperswitch-control-center/pull/100)) ([`1ddbe68`](https://github.com/juspay/hyperswitch-control-center/commit/1ddbe6874c93dccee2cfc1d73281ba6ce9008323)) + +**Full Changelog:** [`v1.8.0...v1.9.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.8.0...v1.9.0) + +- - - + + ## 1.8.0 (2023-12-14) ### Features diff --git a/src/components/BreadCrumb.res b/src/components/BreadCrumb.res deleted file mode 100644 index ae374f060..000000000 --- a/src/components/BreadCrumb.res +++ /dev/null @@ -1,91 +0,0 @@ -type status = Active | Disabled | Completed - -type breadCrumb_options = { - status: status, - position: int, -} - -type breadCrumb = { - key: string, - status: status, - position: int, -} -@react.component -let make = ( - ~breadCrumb: Js.Dict.t, - ~containerStyle="", - ~breadCrumbStyle="", - ~container: React.element=<> , -) => { - let (breadCrumbArray, setBreadcrumbArray) = React.useState(_ => []) - let (arrayLength, setArrayLength) = React.useState(_ => 0) - let sortByPosition = (a, b) => { - if a.position < b.position { - -1 - } else if a.position > b.position { - 1 - } else { - 0 - } - } - - React.useEffect1(() => { - let arr = - breadCrumb - ->Js.Dict.entries - ->Belt.Array.keepMap(val => { - let (key, obj) = val - let breadObj: breadCrumb = { - key, - status: obj.status, - position: obj.position, - } - Some(breadObj) - }) - ->Js.Array2.sortInPlaceWith(sortByPosition) - setArrayLength(_ => Js.Array2.length(arr)) - setBreadcrumbArray(_ => arr) - None - }, [breadCrumb]) - -
-
- {breadCrumbArray - ->Js.Array2.mapi((val, index) => { - let t = switch val.status { - | Active => "blue-800" - | Disabled => "gray-400" - | Completed => "green-800" - } -
-
- {if val.status == Completed { -
- -
- } else { -
- {val.position->Belt.Int.toString->React.string} -
- }} -
- {val.key->React.string} -
- {if val.position != arrayLength { -
- // {React.string(">")} - -
- } else { - React.null - }} -
-
- }) - ->React.array} - {container} -
-
-} diff --git a/src/components/CardList.res b/src/components/CardList.res deleted file mode 100644 index d71b4fc7e..000000000 --- a/src/components/CardList.res +++ /dev/null @@ -1,95 +0,0 @@ -type cardListInfo = { - id: string, - label: string, - imageUrl: option, - secondaryLabel: option, - primaryTag: option, - tagsList: array, - description: option, - tertiaryText: option, - isLive: option, -} - -@react.component -let make = (~listInfo: array, ~onClickHandler) => { -
- {listInfo - ->Js.Array2.mapi((item, index) => { -
Belt.Int.toString} - onClick={_ => onClickHandler(item.id, item.label)} - className="border border-solid border-[#E1E1E1] dark:!border-[#48484d] dark:hover:border-sky-300 hover:bg-[#E9F1FF] dark:bg-[#252626] cursor-pointer bg-[#F6F6F6] dark:hover:bg-[#111010] rounded-lg min-w-[300px] w-[calc(32%-20px)] overflow-hidden items-center mt-8 mr-4"> - {item.imageUrl->Belt.Option.mapWithDefault(React.null, imageUrl => - - )} -
-
- {switch item.primaryTag { - | None | Some("") => React.null - | Some(tag) => -
- - {React.string(tag)} -
- }} -
- {React.string(item.label)} - {item.isLive->Belt.Option.mapWithDefault(React.null, integrationStatus => { - if integrationStatus->Js.String2.toLowerCase === "live" { -
- - {React.string("LIVE")} -
- } else if integrationStatus->Js.String2.toLowerCase === "integrating" { -
- - {React.string("Integrating")} -
- } else { - React.null - } - })} -
-
- {React.string( - item.description->Belt.Option.getWithDefault("No description available"), - )} - {switch item.tertiaryText { - | Some("") | None => React.null - | Some(text) => -
- - {React.string(text)} -
- }} -
-
-
- {item.tagsList - ->Js.Array2.mapi((tag, index) => { -
Belt.Int.toString} className=" mt-2 w-fit flex mr-2 "> - -
- }) - ->React.array} -
-
-
- }) - ->React.array} -
-} diff --git a/src/components/Dropdown.res b/src/components/Dropdown.res deleted file mode 100644 index b724858f4..000000000 --- a/src/components/Dropdown.res +++ /dev/null @@ -1,114 +0,0 @@ -type dropdownOptions = { - label: string, - value: Js.Json.t, -} - -type action<'string> = ItemClick(dropdownOptions) - -module Chevron = { - @react.component - let make = (~color="#354052") => { - - - - - - - - - } -} - -@react.component -let make = ( - ~title="Gateway", - ~list=["Gateway1", "Gateway2"], - ~titleclass="text-jp-gray-900 text-xs text-white", - ~mapper=Js.Dict.empty(), - ~labelVal="All Merchants", - ~customContainerStyle="py-3", -) => { - let (clickedItem, setClickedItem) = React.useState(_ => None) - let (showTitle, setshowTitle) = React.useState(_ => title) - let (showList, setShowList) = React.useState(_ => false) - let listOptions = list->Belt.Array.keepMap(val => { - let statusObj = { - label: val, - value: Js.Dict.get(mapper, val)->Belt.Option.getWithDefault(val)->Js.Json.string, - } - Some(statusObj) - }) - - let listOptions = listOptions->Js.Array.concat([{label: labelVal, value: Js.Json.null}]) - let dropDownClassName = listOptions->Js.Array2.length < 3 ? "hidden" : "" - - let (_, dispatch) = React.useReducer((_, action) => - switch action { - | ItemClick(item: dropdownOptions) => { - let value = item.value->Js.Json.decodeString->Belt.Option.getWithDefault("") - if value === "" { - setClickedItem(_ => None) - setshowTitle(_ => labelVal) - } else { - setClickedItem(_ => Some(value)) - setshowTitle(_ => item.label) - } - setShowList(_ => false) - } - } - , ()) - - let ref = React.useRef(Js.Nullable.null) - OutsideClick.useOutsideClick( - ~refs=ArrayOfRef([ref]), - ~isActive=showList, - ~callback=() => { - setShowList(_ => false) - }, - (), - ) -
ReactDOM.Ref.domRef} className={`relative inline-block ${dropDownClassName}`}> -
setShowList(prev => !prev)}> -
{React.string(showTitle)}
-
- -
-
- {showList - ? -
    - {listOptions - ->Js.Array2.mapi((item, i) => { - let value = item.value->Js.Json.decodeString->Belt.Option.getWithDefault("") - <> -
    dispatch(ItemClick(item))}> - {React.string(item.label)} -
    - -
    -
    - - }) - ->React.array} -
-
- : React.null} -
-} diff --git a/src/components/priority-logics/AddDefaultPLGateway.res b/src/components/priority-logics/AddDefaultPLGateway.res deleted file mode 100644 index ff84b46e7..000000000 --- a/src/components/priority-logics/AddDefaultPLGateway.res +++ /dev/null @@ -1,78 +0,0 @@ -open LogicUtils - -@react.component -let make = ( - ~gatewayOptions, - ~dropDownbuttonText="Default Gateways", - ~dropDownSidetext="Default Gateways", -) => { - let input = ReactFinalForm.useField(`json.default_gateways`).input - let isMobileView = MatchMedia.useMobileChecker() - - let selected = input.value->getStrArryFromJson - - let length = selected->Js.Array2.length - - let buttonText = - length === 0 - ? dropDownbuttonText - : `${length->string_of_int} ${isMobileView ? "" : dropDownbuttonText} Selected` - -
-
-
- ()} - /> -
- {React.string(dropDownSidetext)} - {React.string(" *")} -
-
- -
- -
-
-
-
- {selected - ->Array.mapWithIndex((op, i) => { -
Belt.Int.toString}> -
- {React.string(string_of_int(i + 1))} -
-
{React.string(op)}
- {if i !== length - 1 { - ()} - /> - } else { - React.null - }} -
- }) - ->React.array} -
-
-} diff --git a/src/components/priority-logics/PriorityLogicUtils.res b/src/components/priority-logics/PriorityLogicUtils.res index 83f1337b9..e516b8d6c 100644 --- a/src/components/priority-logics/PriorityLogicUtils.res +++ b/src/components/priority-logics/PriorityLogicUtils.res @@ -1,66 +1,7 @@ -type val = - StringArray(array) | String(string) | IntArray(array) | Int(int) | Bool(bool) - type gateway = { gateway_name: string, distribution: int, disableFallback: bool, } -type volumeBasedDistribution = { - gateways: array, - isEnforceGatewayPriority: bool, -} - -type formState = CreateConfig | EditConfig | EditReplica | ViewConfig - -let getGateways = dict => { - dict - ->LogicUtils.getArrayFromDict("gateways", []) - ->Belt.Array.keepMap(Js.Json.decodeObject) - ->Js.Array2.map(ob => { - { - gateway_name: LogicUtils.getString(ob, "gateway_name", ""), - distribution: LogicUtils.getInt(ob, "distribution", 0), - disableFallback: LogicUtils.getBool(ob, "disableFallback", false), - } - }) -} -let volumeBasedDistributionMapper = dict => { - switch Js.Dict.get(dict, "volumeBasedDistribution")->Belt.Option.flatMap(Js.Json.decodeObject) { - | Some(dict) => { - gateways: dict->getGateways, - isEnforceGatewayPriority: dict->LogicUtils.getBool("isEnforceGatewayPriority", false), - } - | None => { - gateways: [], - isEnforceGatewayPriority: false, - } - } -} - -type status = ACTIVE | APPROVED | PENDING | REJECTED -type configType = RuleBased | CodeBased - -let logicStatusToStr = status => - switch status { - | ACTIVE => "ACTIVE" - | APPROVED => "APPROVED" - | PENDING => "PENDING" - | REJECTED => "REJECTED" - } - -let getColorOnStatus = status => - switch status { - | ACTIVE => Table.LabelGreen - | APPROVED => Table.LabelGreen - | PENDING => Table.LabelOrange - | REJECTED => Table.LabelRed - } - -let getAvailableName = (presentNames, name) => { - let index = Belt.Array.range(0, presentNames->Js.Array2.length)->Js.Array2.findIndex(index => { - !Js.Array2.includes(presentNames, `${name}-copy-${index->string_of_int}`) - }) - `${name}-copy-${index->string_of_int}` -} +type formState = CreateConfig | EditConfig | ViewConfig diff --git a/src/entryPoints/hyperswitch/SidebarValues.res b/src/entryPoints/hyperswitch/SidebarValues.res index 2e7b100cd..5ee5949a6 100644 --- a/src/entryPoints/hyperswitch/SidebarValues.res +++ b/src/entryPoints/hyperswitch/SidebarValues.res @@ -260,12 +260,9 @@ let proFeatures = isProFeaturesEnabled => let fraudAndRisk = isfraudAndRiskEnabled => isfraudAndRiskEnabled - ? LinkWithTag({ + ? Link({ name: "Fraud & Risk", icon: "shield-alt", - iconTag: "sidebar-lock", - iconStyles: "w-15 h-15", - iconSize: 15, link: `/fraud-risk-management`, access: isfraudAndRiskEnabled ? ReadWrite : NoAccess, searchOptions: [], @@ -274,13 +271,10 @@ let fraudAndRisk = isfraudAndRiskEnabled => let payoutConnectors = isPayoutConnectorsEnabled => isPayoutConnectorsEnabled - ? LinkWithTag({ + ? Link({ name: "Payout Processors", link: `/payoutconnectors`, icon: "connectors", - iconTag: "sidebar-lock", - iconStyles: "w-15 h-15", - iconSize: 15, access: ReadWrite, searchOptions: HSwitchUtils.getSearchOptionsForProcessors( ~processorList=ConnectorUtils.payoutConnectorList, @@ -291,12 +285,9 @@ let payoutConnectors = isPayoutConnectorsEnabled => let reconTag = (recon, isReconEnabled) => recon - ? LinkWithTag({ + ? Link({ name: "Reconcilation", icon: isReconEnabled ? "recon" : "recon-lock", - iconTag: "sidebar-lock", - iconStyles: "w-15 h-15", - iconSize: 15, link: `/recon`, access: ReadWrite, }) @@ -326,16 +317,15 @@ let getHyperSwitchAppSidebars = ( default->analytics, default->connectors, default->workflow, + frm->fraudAndRisk, + payOut->payoutConnectors, + recon->reconTag(isReconEnabled), default->developers(userRole, systemMetrics), settings( ~isUserManagementEnabled=userManagement, ~isBusinessProfileEnabled=businessProfile, ~isSampleDataEnabled=sampleData, ), - [frm, payOut, recon]->Js.Array2.includes(true)->proFeatures, - frm->fraudAndRisk, - payOut->payoutConnectors, - recon->reconTag(isReconEnabled), ] sidebar } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res index 60c21e1e1..95730cc8e 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res @@ -39,7 +39,7 @@ let inputField = ( ~getPlaceholder, ~checkRequiredFields, ~disabled, - ~description="", + ~description, ~toolTipPosition: ToolTip.toolTipPosition=ToolTip.Right, (), ) => diff --git a/src/screens/HyperSwitch/Connectors/ConnectorHome.res b/src/screens/HyperSwitch/Connectors/ConnectorHome.res index 4d027a959..3d71d1e40 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorHome.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorHome.res @@ -100,7 +100,7 @@ let make = (~isPayoutFlow=false, ~showStepIndicator=true, ~showBreadCrumb=true) let getDetails = async () => { try { setScreenState(_ => Loading) - let _wasmResult = await Window.connectorWasmInit() + let _ = await Window.connectorWasmInit() if isUpdateFlow { await getConnectorDetails() } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res index e9473d7e3..e25277fe0 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res @@ -273,8 +273,7 @@ let make = ( showToast(~message=`Successfully Saved the Changes`, ~toastType=ToastSuccess, ()) RescriptReactRouter.push("/connectors") } catch { - | Js.Exn.Error(e) => - let _err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Disable connector!") + | Js.Exn.Error(_) => showToast(~message=`Failed to Disable connector!`, ~toastType=ToastError, ()) } } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res index 5e0002d78..561e75600 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res @@ -14,34 +14,6 @@ let defaultColumns = [ PaymentMethods, ] -module ConnectorActions = { - @react.component - let make = () => { - let onClick = e => { - e->ReactEvent.Mouse.stopPropagation - } - -
-
-
- } - toolTipPosition=Left - tooltipPositioning=#absolute - /> -
-
-
- } -} - let parsePaymentMethodType = paymentMethodType => { open LogicUtils diff --git a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res index 36623e45e..3a2b0f762 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res @@ -20,121 +20,6 @@ let getStepName = step => { let toLCase = str => str->Js.String2.toLowerCase let len = arr => arr->Js.Array2.length -let subLabelOptions: array = [ - { - label: "AIBMS", - value: "aibms", - }, - { - label: "American Express Brighton", - value: "amex_brighton", - }, - { - label: "American Express Direct", - value: "amex_direct", - }, - { - label: "Asia-Mideast Processing", - value: "asia_mideast", - }, - { - label: "Barclays", - value: "barclays", - }, - { - label: "CCS (CAFIS)", - value: "ccs", - }, - { - label: "Chase Paymentech Solutions", - value: "chase", - }, - { - label: "Citibank", - value: "citi", - }, - { - label: "Comercio Latino", - value: "comercio_latino", - }, - { - label: "CyberSource ACH Service", - value: "cybs_ach", - }, - { - label: "Visa Platform Connect", - value: "visa", - }, - { - label: "FDC Compass", - value: "fdc_compass", - }, - { - label: "FDC Nashville Global", - value: "fdc_nashville", - }, - { - label: "FDMS Nashville", - value: "fdms_nashville", - }, - { - label: "FDMS South", - value: "fdms_south", - }, - { - label: "Ingenico ePayments", - value: "ingenico", - }, - { - label: "GPN", - value: "gpn", - }, - { - label: "HSBC", - value: "hsbc", - }, - { - label: "Litle", - value: "litle", - }, - { - label: "LloydsTSB Cardnet", - value: "lloyds", - }, - { - label: "Moneris", - value: "moneris", - }, - { - label: "Omnipay Direct", - value: "omnipay", - }, - { - label: "OmniPay-Ireland", - value: "omnipay_ireland", - }, - { - label: "RBS WorldPay Atlanta", - value: "rbs_worldpay", - }, - { - label: "Streamline", - value: "streamline", - }, - { - label: "SIX", - value: "six", - }, - { - label: "TeleCheck", - value: "telecheck", - }, - { - label: "TSYS Acquiring Solutions", - value: "tsys", - }, -] - let payoutConnectorList: array = [ADYEN, WISE] let connectorList: array = [ @@ -649,13 +534,6 @@ let getPaymentMethodEnabled: Js.Json.t => array = json => getArrayDataFromJson(json, itemToObjMapper) } -let getMetaData = json => { - open LogicUtils - let val = json->Js.Json.decodeObject->Belt.Option.getWithDefault(Js.Dict.empty()) - let _apple_pay = val->getJsonObjectFromDict("apple_pay") - let _goole_pay = val->getJsonObjectFromDict("apple_pay") -} - let connectorIgnoredField = [ "business_country", "business_label", @@ -699,14 +577,6 @@ let ignoreFields = (json, id, fields) => { } } -let getPayoutConnectorAuthType = connector => { - switch connector { - | ADYEN => (#SignatureKey: authType :> string) - | WISE => (#BodyKey: authType :> string) - | _ => (#Nokey: authType :> string) - } -} - let mapAuthType = (authType: string) => { switch authType->toLCase { | "bodykey" => #BodyKey @@ -718,7 +588,7 @@ let mapAuthType = (authType: string) => { } } -let getConnectorType = (connector, ~isPayoutFlow=false, ()) => { +let getConnectorType = (connector, ~isPayoutFlow, ()) => { isPayoutFlow ? "payout_processor" : switch connector { @@ -956,26 +826,6 @@ let validateConnectorRequiredFields = ( newDict->Js.Json.object_ } -let getFirstLabelViaCountryKey = (dict, country) => { - dict - ->Js.Dict.get(country) - ->Belt.Option.getWithDefault([]) - ->Belt.Array.get(0) - ->Belt.Option.getWithDefault("") -} - -let getDefaultCountryAndLabel = dict => { - let defaultCountry = dict->Js.Dict.keys->Belt.Array.get(0)->Belt.Option.getWithDefault("") - - let defaultLabel = - dict - ->Js.Dict.get(defaultCountry) - ->Belt.Option.getWithDefault([]) - ->Belt.Array.get(0) - ->Belt.Option.getWithDefault("") - (defaultCountry, defaultLabel) -} - let getPlaceHolder = (connector: connectorName, fieldName, label) => { switch (connector, fieldName) { | (KLARNA, "api_key") => "Enter as:-Basic{API Key}" diff --git a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res index f6e9911ad..8e7d4669e 100644 --- a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res +++ b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res @@ -165,53 +165,6 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { }} /> - /* - Belt.Option.getWithDefault("") - ->Js.String2.length > 0 && !webhookOnly}> - - {
-

- {"Configured Webhook Events"->React.string} -

-
- {webhookEventsDict - ->Js.Dict.entries - ->Js.Array2.map(webhookSection => { - let (heading, events) = webhookSection -
-
- {React.string((heading ++ " Events")->LogicUtils.snakeToTitle)} -
-
-
- {events - ->LogicUtils.getArrayFromJson([]) - ->Js.Array2.map(event => { -
- - - {event - ->LogicUtils.getStringFromJson("") - ->LogicUtils.snakeToTitle - ->React.string} - -
- }) - ->React.array} -
-
- }) - ->React.array} -
-
} - - - */
diff --git a/src/screens/HyperSwitch/Home/HomeUtils.res b/src/screens/HyperSwitch/Home/HomeUtils.res index 6a8e17293..cabfb3900 100644 --- a/src/screens/HyperSwitch/Home/HomeUtils.res +++ b/src/screens/HyperSwitch/Home/HomeUtils.res @@ -16,7 +16,7 @@ let subtextStyle = `${getTextClass( )} text-grey-700 opacity-50` let cardHeaderText = `${getTextClass(~textVariant=H3, ~h3TextVariant=Leading_2, ())} ` let hoverStyle = "cursor-pointer group-hover:shadow hover:shadow-homePageBoxShadow group" -let boxCssHover = (~ishoverStyleRequired=true, ()) => +let boxCssHover = (~ishoverStyleRequired, ()) => `flex flex-col bg-white border rounded-md pt-10 pl-10 gap-2 h-12.5-rem ${ishoverStyleRequired ? hoverStyle : ""}` @@ -161,43 +161,6 @@ module MerchantAuthInfo = { } } -module InputText = { - @react.component - let make = (~setAmount) => { - let (value, setValue) = React.useState(_ => "100") - let showPopUp = PopUpState.useShowPopUp() - let input: ReactFinalForm.fieldRenderPropsInput = { - name: "-", - onBlur: _ev => (), - onChange: ev => { - let value = {ev->ReactEvent.Form.target}["value"] - if value->Js.String2.includes("") { - showPopUp({ - popUpType: (Warning, WithIcon), - heading: `Script Tags are not allowed`, - description: React.string(`Input cannot contain tags`), - handleConfirm: {text: "OK"}, - }) - } - let value = value->Js.String2.replace("", "") - if Js.Re.test_(%re("/^[0-9]*$/"), value) && value->Js.String2.length <= 8 { - setValue(_ => value) - setAmount(_ => value->Belt.Int.fromString->Belt.Option.getWithDefault(100) * 100) - } - }, - onFocus: _ev => (), - value: Js.Json.string(value), - checked: false, - } - - - } -} - module CheckoutCard = { @react.component let make = () => { @@ -477,7 +440,7 @@ let responseDataMapper = (res: Js.Json.t) => { let arrayFromJson = res->getArrayFromJson([]) let resDict = Js.Dict.empty() - let _a = arrayFromJson->Js.Array2.map(value => { + arrayFromJson->Js.Array2.forEach(value => { let value1 = value->getDictFromJsonObject let key = value1->Js.Dict.keys->Belt.Array.get(0)->Belt.Option.getWithDefault("") resDict->Js.Dict.set(key, value1->getValueMapped(key)) diff --git a/src/screens/HyperSwitch/Home/HomeV2.res b/src/screens/HyperSwitch/Home/HomeV2.res index e715aede1..df5532bdb 100644 --- a/src/screens/HyperSwitch/Home/HomeV2.res +++ b/src/screens/HyperSwitch/Home/HomeV2.res @@ -16,19 +16,6 @@ module HomePageHorizontalStepper = { 2 } - // let step = if !(typedValueOfEnum.firstProcessorConnected.processorID->Js.String2.length > 0) { - // 0 - // } else if ( - // typedValueOfEnum.isMultipleConfiguration && - // !(typedValueOfEnum.configuredRouting.routing_id->Js.String2.length > 0) - // ) { - // 0 - // } else if !typedValueOfEnum.integrationCompleted { - // 1 - // } else { - // 2 - // } - let getStepperStyle = index => { index <= step ? "bg-blue-700 text-white border-transparent" : "border-blue-700 text-blue-700 " } @@ -115,12 +102,12 @@ module QuickStart = { processorName: secondConnectorValue.connector_name, } - let _isMultipleConnectorSetup = await ConnectorChoice({ + let _ = await ConnectorChoice({ isMultipleConfiguration: true, })->usePostEnumDetails(#IsMultipleConfiguration) - let _firstEnumSetupValues = + let _ = await ProcesorType(bodyOfFirstConnector)->usePostEnumDetails(#FirstProcessorConnected) - let _secondEnumSetupValues = + let _ = await ProcesorType(bodyOfSecondConnector)->usePostEnumDetails( #SecondProcessorConnected, ) @@ -141,10 +128,10 @@ module QuickStart = { processorName: firstConnectorValue.connector_name, } - let _isMultipleConnectorSetup = await ConnectorChoice({ + let _ = await ConnectorChoice({ isMultipleConfiguration: true, })->usePostEnumDetails(#IsMultipleConfiguration) - let _firstEnumSetupValues = + let _ = await ProcesorType(bodyOfFirstConnector)->usePostEnumDetails(#FirstProcessorConnected) let _ = updateEnumInRecoil([ (ConnectorChoice({isMultipleConfiguration: true}), #IsMultipleConfiguration), diff --git a/src/screens/HyperSwitch/Home/ProdIntent/ProdVerifyModalUtils.res b/src/screens/HyperSwitch/Home/ProdIntent/ProdVerifyModalUtils.res index 5ff289839..d1b1d1b83 100644 --- a/src/screens/HyperSwitch/Home/ProdIntent/ProdVerifyModalUtils.res +++ b/src/screens/HyperSwitch/Home/ProdIntent/ProdVerifyModalUtils.res @@ -1,5 +1,4 @@ let errorClass = "text-sm leading-4 font-medium text-start ml-1 mt-2" -let selectedClass = "bg-green-900 text-white font-semibold" type prodFormColumnType = | POCemail @@ -22,28 +21,6 @@ let getStringFromVariant = key => { } } -let getVarientFromString = stringVal => { - switch stringVal { - | "poc_email" => POCemail - | "legal_business_name" => BusinessName - | "business_location" => Country - | "business_website" => Website - | "poc_name" => POCName - | "comments" => BusinessTAN - | _ => IsCompleted - } -} - -type prodFieldsObjType = { - poc_email: string, - comments: string, - legal_business_name: string, - business_location: string, - is_complated: bool, - business_website: string, - poc_name: string, -} - let businessName = FormRenderer.makeFieldInfo( ~label="Legal Business Name", ~name=BusinessName->getStringFromVariant, diff --git a/src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res b/src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res index 7de1e90e6..17204cb71 100644 --- a/src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res +++ b/src/screens/HyperSwitch/Home/QuickStart/QuickStartUtils.res @@ -1,7 +1,5 @@ open QuickStartTypes -let testConnectors = [ConnectorTypes.STRIPE, ConnectorTypes.PAYPAL] - let getTestConnectorName = (connector, quickStartPageState) => { open ConnectorUtils open QuickStartTypes @@ -31,13 +29,7 @@ let quickStartEnumIntialArray: array = [ #PaypalConnected, #SPTestPayment, ] -let getInitalEnumArray: bool => array = isMultipleConfiguration => { - if isMultipleConfiguration { - quickStartEnumIntialArray - } else { - [#FirstProcessorConnected, #TestPayment, #IntegrationMethod, #IntegrationCompleted] - } -} + let defaultChoiceStateValue: landingChoiceType = { displayText: "Not Selected", description: "Not Selected", @@ -511,27 +503,6 @@ let textToVariantMapperForBuildHS = str => { } } -let getBackButtonState = quickStartPageState => { - switch quickStartPageState { - | ConnectProcessor(connect_processor) => - switch connect_processor { - | CONFIGURE_PRIMARY => ConnectProcessor(LANDING) - | CONFIGURE_SECONDARY => ConnectProcessor(CONFIGURE_PRIMARY) - | CONFIGURE_SMART_ROUTING => ConnectProcessor(CONFIGURE_SECONDARY) - | CHECKOUT => ConnectProcessor(CONFIGURE_SMART_ROUTING) - | _ => ConnectProcessor(LANDING) - } - | IntegrateApp(integrate_app) => - switch integrate_app { - | CHOOSE_INTEGRATION => ConnectProcessor(CHECKOUT) - | CUSTOM_INTEGRATION => IntegrateApp(CHOOSE_INTEGRATION) - | _ => IntegrateApp(LANDING) - } - | GoLive(_) => IntegrateApp(CUSTOM_INTEGRATION) - | FinalLandingPage => GoLive(GO_LIVE) - } -} - let stringToVariantMapperForUserData = str => switch str { | "ProductionAgreement" => #ProductionAgreement diff --git a/src/screens/HyperSwitch/Order/OrderEntity.res b/src/screens/HyperSwitch/Order/OrderEntity.res index 348fe61a9..65583afef 100644 --- a/src/screens/HyperSwitch/Order/OrderEntity.res +++ b/src/screens/HyperSwitch/Order/OrderEntity.res @@ -1,35 +1,6 @@ open OrderTypes open LogicUtils -let getDateCreatedObject = () => { - let currentDate = Js.Date.now() - let filterCreatedDict = Js.Dict.empty() - let currentTimestamp = currentDate->Js.Date.fromFloat->Js.Date.toISOString - Js.Dict.set( - filterCreatedDict, - "lte", - Js.Json.string(currentTimestamp->TimeZoneHook.formattedISOString("YYYY-MM-DDTHH:mm:[00][Z]")), - ) - - let prevMins = { - let presentDayInString = Js.Date.fromFloat(currentDate) - let prevDateInFloat = Js.Date.getMinutes(presentDayInString) -. 30.0 - Js.Date.setMinutes(presentDayInString, prevDateInFloat) - } - - Js.Dict.set( - filterCreatedDict, - "gte", - Js.Json.string( - prevMins - ->Js.Date.fromFloat - ->Js.Date.toISOString - ->TimeZoneHook.formattedISOString("YYYY-MM-DDTHH:mm:[00][Z]"), - ), - ) - - Js.Json.object_(filterCreatedDict) -} module CurrencyCell = { @react.component let make = (~amount, ~currency) => { @@ -521,7 +492,14 @@ let getHeadingForSummary = summaryColType => { Table.makeHeaderInfo(~key="last_updated", ~title="Last Updated", ~showSort=true, ()) | PaymentId => Table.makeHeaderInfo(~key="payment_id", ~title="Payment ID", ~showSort=true, ()) | Currency => Table.makeHeaderInfo(~key="currency", ~title="Currency", ~showSort=true, ()) - | ErrorCode => Table.makeHeaderInfo(~key="error_code", ~title="Error Code", ~showSort=true, ()) + | AmountReceived => + Table.makeHeaderInfo( + ~key="amount_received", + ~title="Amount Received", + ~description="Amount captured by the payment processor for this payment.", + ~showSort=true, + (), + ) | ClientSecret => Table.makeHeaderInfo(~key="client_secret", ~title="Client Secret", ~showSort=true, ()) | ConnectorTransactionID => @@ -612,8 +590,7 @@ let getHeadingForOtherDetails = otherDetailsColType => { | Billing => Table.makeHeaderInfo(~key="billing", ~title="Billing Address", ~showSort=true, ()) | AmountCapturable => Table.makeHeaderInfo(~key="amount_capturable", ~title="AmountCapturable", ~showSort=true, ()) - | AmountReceived => - Table.makeHeaderInfo(~key="amount_received", ~title="Amount Received", ~showSort=true, ()) + | ErrorCode => Table.makeHeaderInfo(~key="error_code", ~title="Error Code", ~showSort=true, ()) | MandateData => Table.makeHeaderInfo(~key="mandate_data", ~title="Mandate Data", ~showSort=true, ()) | FRMName => Table.makeHeaderInfo(~key="frm_name", ~title="FRM Tag", ~showSort=true, ()) @@ -635,7 +612,13 @@ let getCellForSummary = (order, summaryColType): Table.cell => { | LastUpdated => Date(order.last_updated) | PaymentId => CustomCell(, "") | Currency => Text(order.currency) - | ErrorCode => Text(order.error_code) + | AmountReceived => + CustomCell( + Belt.Float.toString} currency={order.currency} + />, + "", + ) | ClientSecret => Text(order.client_secret) | OrderQuantity => Text(order.order_quantity) | ProductName => Text(order.product_name) @@ -690,7 +673,7 @@ let getCellForOtherDetails = (order, aboutPaymentColType): Table.cell => { | Shipping => Text(order.shipping) | Billing => Text(order.billing) | AmountCapturable => Currency(order.amount_capturable /. 100.0, order.currency) - | AmountReceived => Currency(order.amount_received /. 100.0, order.currency) + | ErrorCode => Text(order.error_code) | MandateData => Text(order.mandate_data) | FRMName => Text(order.frm_message.frm_name) | FRMTransactionType => Text(order.frm_message.frm_transaction_type) @@ -773,38 +756,7 @@ let getCell = (order, colType: colType): Table.cell => { } } -let ordersDefaultCols = Recoil.atom(. "hyperSwitchOrderDefaultCols", defaultColumns) - -let getOptionsArr = optionObjArr => { - optionObjArr->Js.Array2.map(item => { - let temp: EntityType.optionType<'t> = { - urlKey: item.urlKey, - field: FormRenderer.makeFieldInfo( - ~label=item.label, - ~name=item.urlKey, - ~customInput=InputFields.textInput(), - (), - ), - parser: val => { - val - }, - localFilter: None, - } - temp - }) -} - -// let options: array> = getOptionsArr(optionObj) - -let getDefaultFilters = dateCreatedObject => { - let dict = Js.Dict.empty() - let filtersDict = Js.Dict.empty() - Js.Dict.set(filtersDict, "dateCreated", dateCreatedObject) - Js.Dict.set(dict, "offset", Js.Json.number(0.0)) - Js.Dict.set(dict, "filters", Js.Json.object_(filtersDict)) - - Js.Json.object_(dict) -} +let _ = Recoil.atom(. "hyperSwitchOrderDefaultCols", defaultColumns) let itemToObjMapperForFRMDetails = dict => { { @@ -876,58 +828,6 @@ let itemToObjMapper = dict => { } } -let datePickerField = (~limit) => { - FormRenderer.makeMultiInputFieldInfo( - ~label="Date Range", - ~comboCustomInput=InputFields.dateRangeField( - ~startKey="filters.dateCreated.gte", - ~endKey="filters.dateCreated.lte", - ~format="YYYY-MM-DDTHH:mm:ss[Z]", - ~showTime=true, - ~disablePastDates={false}, - ~disableFutureDates={true}, - ~predefinedDays=[ - Hour(0.5), - Hour(1.0), - Hour(6.0), - Today, - Yesterday, - Day(2.0), - Day(7.0), - Day(30.0), - ThisMonth, - LastMonth, - ], - ~numMonths=2, - ~disableApply=false, - ~dateRangeLimit=limit, - ~optFieldKey="filters.dateCreated.opt", - (), - ), - ~inputFields=[], - ~isRequired=true, - (), - ) -} - -/* let initialFilterFields: array> = [ - { - field: makeFieldInfo( - ~label="Customer Id", - ~name="customer_id", - ~customInput=orderFilterInput(), - ~parse=Parsers.arrayParser, - ~format=Formatter.numericArrayStringFormat, - (), - ), - localFilter: None, - }, - { - localFilter: None, - field: datePickerField(~limit=7), - }, -] */ - let getOrders: Js.Json.t => array = json => { getArrayDataFromJson(json, itemToObjMapper) } diff --git a/src/screens/HyperSwitch/Order/OrderTypes.res b/src/screens/HyperSwitch/Order/OrderTypes.res index 1bc4abf94..7981027d3 100644 --- a/src/screens/HyperSwitch/Order/OrderTypes.res +++ b/src/screens/HyperSwitch/Order/OrderTypes.res @@ -184,7 +184,7 @@ type summaryColType = | LastUpdated | PaymentId | Currency - | ErrorCode + | AmountReceived | ClientSecret | OrderQuantity | ProductName @@ -206,7 +206,7 @@ type aboutPaymentColType = type otherDetailsColType = | MandateData | AmountCapturable - | AmountReceived + | ErrorCode | Shipping | Billing | Email diff --git a/src/screens/HyperSwitch/Order/OrderUIUtils.res b/src/screens/HyperSwitch/Order/OrderUIUtils.res index 2514bd116..51fd74096 100644 --- a/src/screens/HyperSwitch/Order/OrderUIUtils.res +++ b/src/screens/HyperSwitch/Order/OrderUIUtils.res @@ -19,16 +19,12 @@ module PaymentLogs = { let make = (~id, ~createdAt) => { let {auditTrail} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let isSmallDevice = MatchMedia.useMatchMedia("(max-width: 700px)") - let showPaymentLogsComp = auditTrail
- - {HSwitchOrderUtils.eventLogHeader} - - +
@@ -46,7 +42,7 @@ module GenerateSampleDataButton = { let generateSampleData = async () => { try { let generateSampleDataUrl = getURL(~entityName=GENERATE_SAMPLE_DATA, ~methodType=Post, ()) - let _generateSampleData = await updateDetails( + let _ = await updateDetails( generateSampleDataUrl, [("record", 50.0->Js.Json.number)]->Js.Dict.fromArray->Js.Json.object_, Post, diff --git a/src/screens/HyperSwitch/Order/ShowOrder.res b/src/screens/HyperSwitch/Order/ShowOrder.res index a159f346f..2760f41e1 100644 --- a/src/screens/HyperSwitch/Order/ShowOrder.res +++ b/src/screens/HyperSwitch/Order/ShowOrder.res @@ -23,15 +23,23 @@ module OrderInfo = { ~paymentStatus, ~openRefundModal, ~paymentId, + ~border="border border-jp-gray-940 border-opacity-75 dark:border-jp-gray-960", ) => { let hyperswitchMixPanel = HSMixPanel.useSendEvent() let typedPaymentStatus = paymentStatus->statusVariantMapper -
+
-
- {`${(data.amount /. 100.00)->Belt.Float.toString} ${data.currency} `->React.string} +
+
+ {`${(data.amount /. 100.00)->Belt.Float.toString} ${data.currency} `->React.string} +
+ } + toolTipPosition=Top + tooltipWidthClass="w-fit" + />
{getStatus(data)}
- LogicUtils.isEmptyDict)}> -
-
- Js.Json.stringifyAny->Belt.Option.getWithDefault("")} - headerText="Payment Metadata" - overrideBackgroundColor="bg-white" - /> -
-
-
-
{"More Payment Details"->React.string}
@@ -257,7 +254,7 @@ module DisputesSection = { module Refunds = { open OrderEntity @react.component - let make = (~refundDict, ~isNonRefundConnector) => { + let make = (~refundData) => { let expand = -1 let (expandedRowIndexArray, setExpandedRowIndexArray) = React.useState(_ => [-1]) let heading = refundColumns->Js.Array2.map(getRefundHeading) @@ -291,8 +288,6 @@ module Refunds = { } } - let refundData = - refundDict->getArrayFromDict("refunds", [])->Js.Json.array->OrderEntity.getRefunds let rows = refundData->Js.Array2.map(item => { refundColumns->Js.Array2.map(colType => getRefundCell(item, colType)) }) @@ -304,26 +299,15 @@ module Refunds = { } } -
-

{"Refunds"->React.string}

- - {!isNonRefundConnector && rows->Js.Array2.length === 0 - ? - : React.null} - {isNonRefundConnector - ? - : React.null} -
+ } } @@ -438,7 +422,6 @@ module Disputes = { } } - let disputesData = disputesData->getArrayFromDict("disputes", [])->Js.Json.array->getDisputes let rows = disputesData->Js.Array2.map(item => { columnsInPaymentPage->Js.Array2.map(colType => getCell(item, colType)) }) @@ -450,21 +433,15 @@ module Disputes = { } } -
-

{"Disputes"->React.string}

- - Js.Array2.length === 0}> - - -
+ } } @@ -530,11 +507,7 @@ module FraudRiskBannerDetails = { (), )}/${decision->Js.String2.toLowerCase}` - let _decisonResponse = await updateDetails( - ordersDecisionUrl, - Js.Dict.empty()->Js.Json.object_, - Post, - ) + let _ = await updateDetails(ordersDecisionUrl, Js.Dict.empty()->Js.Json.object_, Post) showToast(~message="Details Updated", ~toastType=ToastSuccess, ()) refetch() } catch { @@ -561,7 +534,7 @@ module FraudRiskBannerDetails = { }
+ className="w-full bg-white dark:bg-jp-gray-lightgray_background rounded-md px-4 pb-5 h-full">
{frmColumns @@ -633,6 +606,20 @@ module FraudRiskBanner = { } } +module RenderAccordian = { + @react.component + let make = (~initialExpandedArray=[], ~accordion) => { + + } +} + @react.component let make = (~id) => { open APIUtils @@ -650,6 +637,24 @@ let make = (~id) => { let orderData = OrderHooks.getOrdersData(id, refetchCounter, setScreenState) let order = OrderEntity.itemToObjMapper(orderData->getDictFromJsonObject) + let refundData = + orderData + ->getDictFromJsonObject + ->getArrayFromDict("refunds", []) + ->Js.Json.array + ->OrderEntity.getRefunds + + let isRefundDataAvailable = refundData->Js.Array2.length !== 0 + + let disputesData = + orderData + ->getDictFromJsonObject + ->getArrayFromDict("disputes", []) + ->Js.Json.array + ->DisputesEntity.getDisputes + + let isDisputeDataVisible = disputesData->Js.Array2.length !== 0 + let createdAt = React.useMemo1(() => { orderData->getDictFromJsonObject->getString("created", "") }, [orderData]) @@ -730,7 +735,7 @@ let make = (~id) => { customUI={}> -
+
getDictFromJsonObject} @@ -740,28 +745,102 @@ let make = (~id) => {
getDictFromJsonObject} />
+ +
+ { + + }, + renderContentOnTop: None, + }, + ]} + /> +
+
+ +
+ { + + }, + renderContentOnTop: None, + }, + ]} + /> +
+
- getDictFromJsonObject} - isNonRefundConnector={isNonRefundConnector(orderData)} + { +
ReactDOM.Ref.domRef}> + +
+ }, + renderContentOnTop: None, + }, + ]} />
-
- getDictFromJsonObject} /> -
-
ReactDOM.Ref.domRef}> -
{"FRM Details"->React.string}
- -
- + { + + }, + renderContentOnTop: None, + }, + ]} + /> - getDictFromJsonObject} - openRefundModal - isNonRefundConnector={isNonRefundConnector(orderData)} - isMetadata=true + LogicUtils.isEmptyDict)}> + { +
+ Js.Json.stringifyAny + ->Belt.Option.getWithDefault("")} + overrideBackgroundColor="bg-white" + /> +
+ }, + renderContentOnTop: None, + }, + ]} + /> +
+ { + getDictFromJsonObject} + openRefundModal + isNonRefundConnector={isNonRefundConnector(orderData)} + isMetadata=true + /> + }, + renderContentOnTop: None, + }, + ]} />
diff --git a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res index c7de1280b..89b94d128 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res @@ -6,7 +6,7 @@ module PrettyPrintJson = { @react.component let make = ( ~jsonToDisplay, - ~headerText, + ~headerText=None, ~maxHeightClass="max-h-25-rem", ~overrideBackgroundColor="bg-hyperswitch_background", ) => { @@ -34,30 +34,37 @@ module PrettyPrintJson = { showToast(~message="Copied to Clipboard!", ~toastType=ToastSuccess, ()) hyperswitchMixPanel( ~pageName=`${url.path->getListHead}`, - ~contextName=`${headerText->toCamelCase}`, + ~contextName=`${headerText->Belt.Option.getWithDefault("")->toCamelCase}`, ~actionName="copied", (), ) } + let copyParsedJson = +
handleOnClickCopy(~parsedValue=parsedJson)} className="cursor-pointer"> + +
+
Js.String2.length > 0}> {<> -
-

- {headerText->React.string} -

-
handleOnClickCopy(~parsedValue=parsedJson)} className="cursor-pointer"> - + Belt.Option.isSome}> +
+

+ {headerText->Belt.Option.getWithDefault("")->React.string} +

+ {copyParsedJson}
+
+
+
+              {parsedJson->React.string}
+            
+ {copyParsedJson}
-
-            {parsedJson->React.string}
-          
-
-
-
- - - -
-
-}