From a1631f3b1f3e6021053cae934146ca09368ab333 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <77892330+PritishBudhiraja@users.noreply.github.com> Date: Fri, 15 Dec 2023 18:20:37 +0530 Subject: [PATCH 1/5] feat: Show Orders Enhancements & sidebar value changes (#103) --- src/entryPoints/hyperswitch/SidebarValues.res | 22 +- src/screens/HyperSwitch/Order/OrderEntity.res | 22 +- src/screens/HyperSwitch/Order/OrderTypes.res | 4 +- src/screens/HyperSwitch/Order/ShowOrder.res | 192 ++++++++++++------ .../SDKPayment/TestCredentials.res | 4 +- 5 files changed, 156 insertions(+), 88 deletions(-) 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/Order/OrderEntity.res b/src/screens/HyperSwitch/Order/OrderEntity.res index 348fe61a9..e169b398f 100644 --- a/src/screens/HyperSwitch/Order/OrderEntity.res +++ b/src/screens/HyperSwitch/Order/OrderEntity.res @@ -521,7 +521,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 +619,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 +641,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 +702,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) 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/ShowOrder.res b/src/screens/HyperSwitch/Order/ShowOrder.res index a159f346f..6a438365a 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)}
- /* - 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/OrderUIUtils.res b/src/screens/HyperSwitch/Order/OrderUIUtils.res index 49fa5ba7e..51fd74096 100644 --- a/src/screens/HyperSwitch/Order/OrderUIUtils.res +++ b/src/screens/HyperSwitch/Order/OrderUIUtils.res @@ -42,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 bb8945edf..2760f41e1 100644 --- a/src/screens/HyperSwitch/Order/ShowOrder.res +++ b/src/screens/HyperSwitch/Order/ShowOrder.res @@ -507,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 { diff --git a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res index c8914b75b..89b94d128 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res @@ -350,7 +350,7 @@ let make = (~paymentId, ~createdAt) => { } let getDetails = async () => { try { - let _wasmResult = await Window.connectorWasmInit() + let _ = await Window.connectorWasmInit() if !(paymentId->HSwitchOrderUtils.isTestPayment) { fetchPaymentLogsData()->ignore fetchSdkLogsData()->ignore diff --git a/src/screens/HyperSwitch/PaymentLogs/PaymentUtils.res b/src/screens/HyperSwitch/PaymentLogs/PaymentUtils.res index 0d445df67..c0b1be064 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentUtils.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentUtils.res @@ -1,5 +1,5 @@ // will be removed once the backend does the URl mapping -let nameToURLMapper = (urlName, ~payment_id="", ~merchant_id="", ()) => { +let nameToURLMapper = (urlName, ~payment_id, ~merchant_id="", ()) => { switch urlName { | "PaymentsCreate" => "/payments" | "PaymentsStart" => `/payments/redirect/${payment_id}/${merchant_id}` diff --git a/src/screens/HyperSwitch/PaymentMethodDetails.res b/src/screens/HyperSwitch/PaymentMethodDetails.res deleted file mode 100644 index 43e206387..000000000 --- a/src/screens/HyperSwitch/PaymentMethodDetails.res +++ /dev/null @@ -1,95 +0,0 @@ -type paymentDetails = { - type_: string, - icon: option, - displayName: string, -} -let defaultPaymentDetails = { - type_: "", - icon: None, - displayName: "", -} -let icon = (~size=22, ~width as _=size, name) => { - -} -let details = [ - { - type_: "card", - icon: Some(icon("default-card", ~size=19)), - displayName: "Card", - }, - { - type_: "crypto_currency", - icon: Some(icon("crypto", ~size=19)), - displayName: "Crypto", - }, - { - type_: "klarna", - icon: Some(icon("klarna", ~size=19)), - displayName: "Klarna", - }, - { - type_: "afterpay_clearpay", - icon: Some(icon("afterpay", ~size=19)), - displayName: "After Pay", - }, - { - type_: "affirm", - icon: Some(icon("affirm", ~size=19)), - displayName: "Affirm", - }, - { - type_: "sofort", - icon: Some(icon("sofort", ~size=19)), - displayName: "Sofort", - }, - { - type_: "bank_transfer", - icon: Some(icon("default-card", ~size=19)), - displayName: "ACH Bank Transfer", - }, - { - type_: "sepa_debit", - icon: None, - displayName: "SEPA Debit", - }, - { - type_: "giropay", - icon: Some(icon("giropay", ~size=19, ~width=25)), - displayName: "GiroPay", - }, - { - type_: "eps", - icon: Some(icon("eps", ~size=19, ~width=25)), - displayName: "EPS", - }, - { - type_: "ideal", - icon: Some(icon("ideal", ~size=19, ~width=25)), - displayName: "iDEAL", - }, - { - type_: "ban_connect", - icon: None, - displayName: "Ban Connect", - }, - { - type_: "ach_bank_debit", - icon: Some(icon("ach-bank-debit", ~size=19, ~width=25)), - displayName: "ACH Direct Debit", - }, - { - type_: "google_pay", - icon: Some(icon("google_pay", ~size=25)), - displayName: "Google Pay", - }, - // { - // type_: "apple_pay", - // icon: Some(icon("default-card", ~size=19)), - // displayName: "Apple Pay", - // }, - { - type_: "paypal", - icon: Some(icon("paypal", ~size=19)), - displayName: "PayPal", - }, -] diff --git a/src/screens/HyperSwitch/PaymentMethodListType.res b/src/screens/HyperSwitch/PaymentMethodListType.res index 8b70b9b75..06c7df7a6 100644 --- a/src/screens/HyperSwitch/PaymentMethodListType.res +++ b/src/screens/HyperSwitch/PaymentMethodListType.res @@ -28,19 +28,6 @@ type methods = { payment_method_types: array, } -type list = { - redirect_url: string, - payment_methods: array, -} - -let defaultList = { - redirect_url: "", - payment_methods: [], -} -let defaultBankNames = { - bank_name: [], - eligible_connectors: [], -} let getMethod = str => { switch str { | "card" => Cards @@ -54,19 +41,6 @@ let getMethod = str => { } } -let getPaymentMethodType = str => { - switch str { - | "afterpay_clearpay" => AfterPay - | "klarna" => Klarna - | "affirm" => Affirm - | "apple_pay" => ApplePay - | "google_pay" => Gpay - | "credit" => Card(Credit) - | "debit" => Card(Debit) - | "crypto_currency" => CryptoCurrency - | _ => NONE - } -} let getPaymentExperienceType = str => { switch str { | "redirect_to_url" => RedirectToURL @@ -146,47 +120,3 @@ let getMethodsArr = (dict, str) => { } }) } - -let itemToObjMapper = dict => { - { - redirect_url: getString(dict, "redirect_url", ""), - payment_methods: getMethodsArr(dict, "payment_methods"), - } -} - -let paymentListLookup = (arr: array, ~order) => { - let (otherPaymentList, walletsList) = arr->Array.reduce(([], []), ( - (otherPaymentList, walletsList), - method, - ) => { - switch method.payment_method { - | Cards => otherPaymentList->Array.push("card") - | Wallets => - method.payment_method_types - ->Js.Array2.map(item => walletsList->Array.push(item.payment_method_type)) - ->ignore - | PayLater => - method.payment_method_types - ->Js.Array2.map(item => otherPaymentList->Array.push(item.payment_method_type)) - ->ignore - | BankDebit - | BankTransfer - | BankRedirect => - method.payment_method_types - ->Js.Array2.map(item => otherPaymentList->Array.push(item.payment_method_type)) - ->ignore - | Crypto => - method.payment_method_types - ->Js.Array2.map(item => otherPaymentList->Array.push(item.payment_method_type)) - ->ignore - | NONE => () - } - (otherPaymentList, walletsList) - }) - - ( - walletsList->LogicUtils.removeDuplicate->LogicUtils.sortBasedOnPriority(order), - otherPaymentList->LogicUtils.removeDuplicate->LogicUtils.sortBasedOnPriority(order), - // ["card", "bank_transfer"], - ) -} diff --git a/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res b/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res index 333ddc14b..774f22dd0 100644 --- a/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res +++ b/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res @@ -111,7 +111,7 @@ let make = () => { (), ) - let _responseJson = await updateDetails( + let _ = await updateDetails( postLoginSurveyUrl, values->generateSurveyJson->Js.Json.object_, Post, diff --git a/src/screens/HyperSwitch/PostLoginScreen/PostLoginUtils.res b/src/screens/HyperSwitch/PostLoginScreen/PostLoginUtils.res index 311351d32..59c0ae490 100644 --- a/src/screens/HyperSwitch/PostLoginScreen/PostLoginUtils.res +++ b/src/screens/HyperSwitch/PostLoginScreen/PostLoginUtils.res @@ -8,7 +8,6 @@ let defaultValueForQuestions: questionsType = { options: [], key: "", } -let userName = HSLocalStorage.getFromUserDetails("name") let userRoleQuestions: questionsType = { question: `What role fits you well?`, options: [ diff --git a/src/screens/HyperSwitch/Recon/Recon.res b/src/screens/HyperSwitch/Recon/Recon.res index af84b8b66..58e070606 100644 --- a/src/screens/HyperSwitch/Recon/Recon.res +++ b/src/screens/HyperSwitch/Recon/Recon.res @@ -17,7 +17,7 @@ let make = () => { try { let url = getURL(~entityName=RECON, ~reconType=#REQUEST, ~methodType=Get, ()) let _ = await updateDetails(url, Js.Json.null, Post) - let _merchantDetails = await fetchMerchantAccountDetails() + let _ = await fetchMerchantAccountDetails() showToast( ~message=`Thank you for your interest in our reconciliation module. We are currently reviewing your request for access. We will follow up with you soon regarding next steps.`, ~toastType=ToastSuccess, diff --git a/src/screens/HyperSwitch/Refunds/RefundEntity.res b/src/screens/HyperSwitch/Refunds/RefundEntity.res index 45b6d9991..a54da52c2 100644 --- a/src/screens/HyperSwitch/Refunds/RefundEntity.res +++ b/src/screens/HyperSwitch/Refunds/RefundEntity.res @@ -2,11 +2,6 @@ open LogicUtils open HelperComponents open HSwitchOrderUtils -type refundMetaData = { - udf1: string, - new_customer: string, - login_date: string, -} type refunds = { refund_id: string, payment_id: string, @@ -36,21 +31,6 @@ type refundsColType = | MetaData | ConnectorName -let refunditemToObjMapper = dict => { - amount: getFloat(dict, "amount", 0.0), - created_at: getString(dict, "created_at", ""), - currency: getString(dict, "currency", ""), - error_message: getString(dict, "error_message", ""), - metadata: getString(dict, "metadata", ""), - payment_id: getString(dict, "payment_id", ""), - reason: getString(dict, "reason", ""), - refund_id: getString(dict, "refund_id", ""), - status: getString(dict, "status", ""), - updated_at: getString(dict, "updated_at", ""), - error_code: getString(dict, "error_code", ""), - connector: getString(dict, "connector", ""), -} - let defaultColumns = [RefundId, Amount, RefundStatus, PaymentId, Created] let refundsMapDefaultCols = Recoil.atom(. "refundsMapDefaultCols", defaultColumns) @@ -167,8 +147,6 @@ let getCell = (refundData, colType): Table.cell => { } } -let refundDefaultCols = Recoil.atom(. "hyperSwitchRefundDefaultCols", defaultColumns) - let itemToObjMapper = dict => { { amount: getFloat(dict, "amount", 0.0), diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res index 5cb5682fa..92629c41c 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res @@ -2,7 +2,6 @@ let unselectedNormalText = "text-base font-normal text-grey-700 opacity-50" let selectedNormalText = "text-base font-medium text-grey-700 " let dividerColor = "bg-grey-700 bg-opacity-20 h-px w-full" let unselectedSubHeading = "text-lg font-normal text-grey-700 " -let selectedSubHeading = "text-lg font-normal text-blue-700 " module CheckListSection = { open ProdOnboardingUtils diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingUtils.res index fb5620301..0753b4031 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingUtils.res @@ -27,7 +27,6 @@ let getPageView = index => { | SETUP_WEBHOOK_PROCESSOR => REPLACE_API_KEYS | REPLACE_API_KEYS => SETUP_WEBHOOK_USER | SETUP_WEBHOOK_USER => SETUP_COMPLETED - // | TEST_LIVE_PAYMENT => SETUP_COMPLETED | _ => SETUP_COMPLETED } } @@ -39,8 +38,6 @@ let getBackPageView = index => { | SETUP_WEBHOOK_PROCESSOR => SETUP_CREDS | REPLACE_API_KEYS => SETUP_WEBHOOK_PROCESSOR | SETUP_WEBHOOK_USER => REPLACE_API_KEYS - // | TEST_LIVE_PAYMENT => SETUP_WEBHOOK_USER - // | SETUP_COMPLETED => TEST_LIVE_PAYMENT | _ => SETUP_COMPLETED } } @@ -138,16 +135,6 @@ let getWarningBlockForConnector = connectorName => { } } -let getFirstSubVariant = (parentVariant: ProdOnboardingTypes.sectionHeadingVariant) => { - open ProdOnboardingTypes - switch parentVariant { - | #SetupProcessor => SELECT_PROCESSOR - | #ConfigureEndpoint => REPLACE_API_KEYS - | #SetupComplete => SETUP_COMPLETED - | #ProductionAgreement => SELECT_PROCESSOR - } -} - let getProdApiBody = ( ~parentVariant: ProdOnboardingTypes.sectionHeadingVariant, ~connectorId="", @@ -176,15 +163,6 @@ let getProdApiBody = ( ] ->Js.Dict.fromArray ->Js.Json.object_ - // | #SetupComplete => - // [ - // ( - // (parentVariant :> string), - // [("paymentId", paymentId->Js.Json.string)]->Js.Dict.fromArray->Js.Json.object_, - // ), - // ] - // ->Js.Dict.fromArray - // ->Js.Json.object_ | _ => (parentVariant :> string)->Js.Json.string } } diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res index e1f3206ad..4031cdcde 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res @@ -1,7 +1,6 @@ let headerTextStyle = "text-xl font-semibold text-grey-700" let subTextStyle = "text-base font-normal text-grey-700 opacity-50" let dividerColor = "bg-grey-700 bg-opacity-20 h-px w-full" -let highlightedText = "text-base font-normal text-blue-700 underline" module ConnectorDetailsForm = { open ConnectorUtils @@ -95,10 +94,16 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { let (initialValues, setInitialValues) = React.useState(_ => Js.Json.null) let getDetails = async () => { - let _wasmResult = await Window.connectorWasmInit() - let val = connectorName->Window.getConnectorConfig - setConnectorDetails(_ => val) - setScreenState(_ => Success) + try { + let _ = await Window.connectorWasmInit() + let val = connectorName->Window.getConnectorConfig + setConnectorDetails(_ => val) + setScreenState(_ => Success) + } catch { + | Js.Exn.Error(e) => + let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong!") + setScreenState(_ => PageLoaderWrapper.Error(err)) + } } let url = RescriptReactRouter.useUrl() let updateDetails = useUpdateMethod(~showErrorToast=false, ()) diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res index d07bd6a18..4b0f88bf5 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res @@ -1034,7 +1034,7 @@ let getTabsForIntegration = ( } } let skipOnboarding = async path => { - let _skipOnboarding = await skipAndContinue() + let _ = await skipAndContinue() Window._open(path) }
diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUtils.res index 261db46a0..7f65456f3 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUtils.res @@ -16,8 +16,6 @@ let integrateFromScratchBackEndlang: array = [ let platforms: array = [#Web, #IOS, #Android, #BigCommerce, #ReactNative] let requestOnlyPlatforms: array = [#BigCommerce, #IOS, #Android, #ReactNative] -let frontendLangForGithub: array = [#ReactJs, #HTML, #Next] -let backendLangForGithub: array = [#Node, #Ruby, #Java, #Python, #Net, #Php] let getContentBasedOnIndex = (~currentRoute, ~tabIndex) => switch currentRoute { diff --git a/src/screens/HyperSwitch/Settings/HSwitchSettings.res b/src/screens/HyperSwitch/Settings/HSwitchSettings.res index 325a76cb0..e1e752991 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchSettings.res +++ b/src/screens/HyperSwitch/Settings/HSwitchSettings.res @@ -30,11 +30,7 @@ module TileComponent = { let deleteSampleData = async () => { try { let generateSampleDataUrl = getURL(~entityName=GENERATE_SAMPLE_DATA, ~methodType=Delete, ()) - let _generateSampleData = await updateDetails( - generateSampleDataUrl, - Js.Dict.empty()->Js.Json.object_, - Delete, - ) + let _ = await updateDetails(generateSampleDataUrl, Js.Dict.empty()->Js.Json.object_, Delete) showToast(~message="Sample data deleted successfully", ~toastType=ToastSuccess, ()) } catch { | _ => () diff --git a/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res b/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res index e942288ba..e8f7e80b8 100644 --- a/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res +++ b/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res @@ -498,15 +498,6 @@ let businessProfileNameDropDownOption = arrBusinessProfile => obj }) -let businessProfileIdDropDownOption = arrBusinessProfile => - arrBusinessProfile->Js.Array2.map(ele => { - let obj: SelectBox.dropdownOption = { - label: ele.profile_id, - value: ele.profile_id, - } - obj - }) - let useFetchBusinessProfiles = () => { open APIUtils let fetchDetails = useGetMethod() diff --git a/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res b/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res index 3e2b9b72a..60a9a6b4e 100644 --- a/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res +++ b/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res @@ -82,11 +82,7 @@ let make = () => { // *GENERATE_SAMPLE_DATA let generateSampleDataUrl = getURL(~entityName=GENERATE_SAMPLE_DATA, ~methodType=Post, ()) - let _generateSampleData = await updateDetails( - generateSampleDataUrl, - Js.Dict.empty()->Js.Json.object_, - Post, - ) + let _ = await updateDetails(generateSampleDataUrl, Js.Dict.empty()->Js.Json.object_, Post) setStepCounter(_ => #GENERATE_SAMPLE_DATA) await delay(delayTime) setStepCounter(_ => #COMPLETED) diff --git a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res index 568902e8f..5e0dbd867 100644 --- a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res +++ b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res @@ -1,29 +1,25 @@ -let matchInSearchOption = (searchOptions, searchText, name, link, ~sectionName="", ()) => { +let matchInSearchOption = (searchOptions, searchText, name, link, ~sectionName, ()) => { open LogicUtils - - let valueReturned = - searchOptions - ->Belt.Option.getWithDefault([]) - ->Js.Array2.filter(item => { - let (searchKey, _redirection) = item - checkStringStartsWithSubstring(~itemToCheck=searchKey, ~searchText) - }) - ->Js.Array2.map(item => { - let (searchKey, redirection) = item - [ - ( - "elements", - [ - sectionName->Js.Json.string, - name->Js.Json.string, - searchKey->Js.Json.string, - ]->Js.Json.array, - ), - ("redirect_link", `${link}${redirection}`->Js.Json.string), - ]->Js.Dict.fromArray - }) - - valueReturned + searchOptions + ->Belt.Option.getWithDefault([]) + ->Js.Array2.filter(item => { + let (searchKey, _redirection) = item + checkStringStartsWithSubstring(~itemToCheck=searchKey, ~searchText) + }) + ->Js.Array2.map(item => { + let (searchKey, redirection) = item + [ + ( + "elements", + [ + sectionName->Js.Json.string, + name->Js.Json.string, + searchKey->Js.Json.string, + ]->Js.Json.array, + ), + ("redirect_link", `${link}${redirection}`->Js.Json.string), + ]->Js.Dict.fromArray + }) } module RenderedComponent = { diff --git a/src/screens/HyperSwitch/Utils/MilestoneAchievedCard.res b/src/screens/HyperSwitch/Utils/MilestoneAchievedCard.res deleted file mode 100644 index c36b52bac..000000000 --- a/src/screens/HyperSwitch/Utils/MilestoneAchievedCard.res +++ /dev/null @@ -1,59 +0,0 @@ -open LottieFiles -let confettiJson = "successConfetti.json" -@react.component -let make = ( - ~headingModule="", - ~subText="", - ~buttonText: option=?, - ~customBackButtonRoute, -) => { - let confettiGif = useLottieJson(confettiJson) - let url = RescriptReactRouter.useUrl() - let hyperswitchMixPanel = HSMixPanel.useSendEvent() - let currentPageName = url.path->LogicUtils.getListHead - -
-
- -
-

- {`Congrats on your ${headingModule}`->React.string} -

-

{subText->React.string}

-
- - {switch buttonText { - | Some(buttonText) => -
-
-
-
- - - -
-
-}