From d587598a1f13a234b68b5bc204780fda3c773e0e Mon Sep 17 00:00:00 2001 From: Riddhiagrawal001 <50551695+Riddhiagrawal001@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:29:25 +0530 Subject: [PATCH] fix: Use apifetcher function update (#283) Co-authored-by: Pritish Budhiraja <1805317@kiit.ac.in> --- src/components/HSwitchFeedBackModal.res | 2 +- src/entryPoints/hyperswitch/HyperSwitchEntry.res | 2 +- .../hyperswitch/WooCommerce/WooCommerceUIUtils.res | 2 +- src/screens/HyperSwitch/APIUtils/APIUtils.res | 2 +- src/screens/HyperSwitch/Analytics/Analytics.res | 6 +++--- .../HyperSwitch/Analytics/DownloadReportModal.res | 2 +- .../HomePageOverview/HomePageOverviewComponent.res | 1 + .../Analytics/RefundsAnalytics/RefundsAnalytics.res | 2 +- .../SystemMetrics/SystemMetricsAnalytics.res | 6 +++--- .../Connectors/ConnectorAccountDetails.res | 2 +- .../HyperSwitch/Connectors/ConnectorPaymentMethod.res | 2 +- .../HyperSwitch/Connectors/ConnectorPreview.res | 2 +- .../Connectors/Wallets/ApplePayWalletIntegration.res | 2 +- .../HyperSwitch/Developer/APIKeys/KeyManagement.res | 4 ++-- .../Developer/PaymentSettings/PaymentSettings.res | 2 +- .../HyperSwitch/FraudAndRisk/FRMIntegrationFields.res | 4 ++-- src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res | 2 +- src/screens/HyperSwitch/HSwitchRemoteFilter.res | 2 +- .../Home/CommonConnectorFlow/ConfigureConnector.res | 4 ++-- .../CommonConnectorFlow/QuickStartConnectorFlow.res | 2 +- .../Home/CommonConnectorFlow/SetupConnector.res | 2 +- .../HyperSwitch/Home/DelayedVerificationBanner.res | 2 +- .../HyperSwitch/Home/ProdIntent/ProdVerifyModal.res | 2 +- src/screens/HyperSwitch/Home/QuickStart/GoLive.res | 2 +- .../IntegrateYourApp/IntegrationDocsPage.res | 2 +- src/screens/HyperSwitch/Hooks/EnumVariantHook.res | 2 +- src/screens/HyperSwitch/Order/OrderRefundForm.res | 2 +- src/screens/HyperSwitch/Order/OrderUIUtils.res | 7 ++++--- src/screens/HyperSwitch/Order/ShowOrder.res | 2 +- src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res | 2 +- .../HyperSwitch/PostLoginScreen/PostLoginScreen.res | 1 + src/screens/HyperSwitch/Recon/Recon.res | 2 +- src/screens/HyperSwitch/Refunds/RefundUtils.res | 4 ++-- src/screens/HyperSwitch/Routing/ActiveRouting.res | 2 +- src/screens/HyperSwitch/Routing/DefaultRouting.res | 5 ++++- src/screens/HyperSwitch/Routing/PriorityRouting.res | 3 ++- .../HyperSwitch/Routing/VolumeSplitRouting.res | 6 +++--- .../HyperSwitch/RoutingRevamp/AdvancedRouting.res | 11 ++++++++--- src/screens/HyperSwitch/SDKPayment/TestPayment.res | 2 +- .../HSwitchProdOnboarding/HSwitchAgreementScreen.res | 2 +- .../HSwitchProdOnboarding/LiveEndpointsSetup.res | 4 ++-- .../HSwitchProdOnboarding/ProdOnboardingLanding.res | 2 +- .../SetupConnectorCredentials.res | 6 +++--- .../HSwitchSandboxOnboarding/IntegrationDocs.res | 2 +- .../HSwitchSandboxOnboarding/UserOnboarding.res | 4 ++-- .../UserOnboardingUIUtils.res | 4 ++-- src/screens/HyperSwitch/Settings/BusinessDetails.res | 1 + .../Settings/BusinessMapping/BusinessProfile.res | 2 +- .../HyperSwitch/Settings/HSwitchProfileSettings.res | 2 +- src/screens/HyperSwitch/Settings/HSwitchSettings.res | 2 +- .../HyperSwitch/SetupAccount/HSwitchSetupAccount.res | 11 ++++++----- .../StripePlusPaypal/StripePlusPaypalUIUtils.res | 2 +- src/screens/HyperSwitch/Surcharge/Surcharge.res | 7 ++++++- .../HyperSwitch/SwitchMerchant/SwitchMerchant.res | 4 ++-- .../HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res | 7 ++++++- .../HyperSwitch/UserManagement/InviteUsers.res | 2 +- .../HyperSwitch/UserManagement/ShowUserData.res | 2 +- .../login/HSwitchLoginFlow/HyperSwitchAuth.res | 10 +++++----- .../HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res | 2 +- 59 files changed, 108 insertions(+), 84 deletions(-) diff --git a/src/components/HSwitchFeedBackModal.res b/src/components/HSwitchFeedBackModal.res index a4d1eb621..a9be6ae78 100644 --- a/src/components/HSwitchFeedBackModal.res +++ b/src/components/HSwitchFeedBackModal.res @@ -18,7 +18,7 @@ let make = ( [ ("Feedback", values->HSwitchUtils.getBodyForFeedBack(~modalType, ())->Js.Json.object_), ]->LogicUtils.getJsonFromArrayOfJson - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) let successMessage = switch modalType { | FeedBackModal => "Thanks for feedback" | RequestConnectorModal => "Request submitted succesfully" diff --git a/src/entryPoints/hyperswitch/HyperSwitchEntry.res b/src/entryPoints/hyperswitch/HyperSwitchEntry.res index c3e749e1b..147c3e780 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchEntry.res +++ b/src/entryPoints/hyperswitch/HyperSwitchEntry.res @@ -64,7 +64,7 @@ module HyperSwitchEntryComponent = { let url = `${HSwitchGlobalVars.hyperSwitchFEPrefix}/config/merchant-access` let typedResponse = ( - await postDetails(url, Dict.make()->Js.Json.object_, Post) + await postDetails(url, Dict.make()->Js.Json.object_, Post, ()) )->FeatureFlagUtils.featureFlagType setFeatureFlag(._ => typedResponse) setScreenState(_ => PageLoaderWrapper.Success) diff --git a/src/entryPoints/hyperswitch/WooCommerce/WooCommerceUIUtils.res b/src/entryPoints/hyperswitch/WooCommerce/WooCommerceUIUtils.res index 38c1c31b9..b50223c77 100644 --- a/src/entryPoints/hyperswitch/WooCommerce/WooCommerceUIUtils.res +++ b/src/entryPoints/hyperswitch/WooCommerce/WooCommerceUIUtils.res @@ -112,7 +112,7 @@ module SelectPaymentMethods = { let body = ConnectorUtils.constructConnectorRequestBody(obj, initialValues) let connectorUrl = APIUtils.getURL(~entityName=CONNECTOR, ~methodType=Post, ~id=None, ()) - let response = await updateAPIHook(connectorUrl, body, Post) + let response = await updateAPIHook(connectorUrl, body, Post, ()) setInitialValues(_ => response) response->LogicUtils.getDictFromJsonObject->updateEnumForConnector->ignore setConnectorConfigureState(_ => Summary) diff --git a/src/screens/HyperSwitch/APIUtils/APIUtils.res b/src/screens/HyperSwitch/APIUtils/APIUtils.res index 5dab5b6c3..b466c8d4a 100644 --- a/src/screens/HyperSwitch/APIUtils/APIUtils.res +++ b/src/screens/HyperSwitch/APIUtils/APIUtils.res @@ -387,7 +387,7 @@ let useUpdateMethod = (~showErrorToast=true, ()) => { }, }) - async (url, body, method) => { + async (url, body, method, ()) => { try { let res = await fetchApi(url, ~method_=method, ~bodyStr=body->Js.Json.stringify, ()) await responseHandler( diff --git a/src/screens/HyperSwitch/Analytics/Analytics.res b/src/screens/HyperSwitch/Analytics/Analytics.res index ea06f4ef5..140ca923e 100644 --- a/src/screens/HyperSwitch/Analytics/Analytics.res +++ b/src/screens/HyperSwitch/Analytics/Analytics.res @@ -252,7 +252,7 @@ module TableWrapper = { (), ) - fetchDetails(tableEntity.uri, weeklyTableReqBody, Post) + fetchDetails(tableEntity.uri, weeklyTableReqBody, Post, ()) ->thenResolve(json => { setTableData(_ => getUpdatedData(data, json, cols)) setTableDataLoading(_ => false) @@ -285,7 +285,7 @@ module TableWrapper = { (), ) - fetchDetails(tableEntity.uri, tableReqBody, Post) + fetchDetails(tableEntity.uri, tableReqBody, Post, ()) ->thenResolve(json => { switch weeklyTableMetricsCols { | Some(cols) => getWeeklyData(json, cols)->ignore @@ -612,7 +612,7 @@ let make = ( setFilterDataJson(_ => None) if startTimeVal->isStringNonEmpty && endTimeVal->isStringNonEmpty { try { - updateDetails(filterUri, filterBody->Js.Json.object_, Post) + updateDetails(filterUri, filterBody->Js.Json.object_, Post, ()) ->thenResolve(json => setFilterDataJson(_ => json->Some)) ->catch(_ => resolve()) ->ignore diff --git a/src/screens/HyperSwitch/Analytics/DownloadReportModal.res b/src/screens/HyperSwitch/Analytics/DownloadReportModal.res index a585ff153..1f9bf33e5 100644 --- a/src/screens/HyperSwitch/Analytics/DownloadReportModal.res +++ b/src/screens/HyperSwitch/Analytics/DownloadReportModal.res @@ -23,7 +23,7 @@ let make = (~reportModal, ~setReportModal, ~entityName) => { let downloadReport = async body => { try { let url = getURL(~entityName, ~methodType=Post, ()) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setReportModal(_ => false) showToast(~message="Email Sent", ~toastType=ToastSuccess, ()) } catch { diff --git a/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res b/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res index 541bf598d..056a0dcfd 100644 --- a/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res +++ b/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res @@ -214,6 +214,7 @@ module OverviewInfo = { generateSampleDataUrl, [("record", 50.0->Js.Json.number)]->Dict.fromArray->Js.Json.object_, Post, + (), ) showToast(~message="Sample data generated successfully.", ~toastType=ToastSuccess, ()) Window.Location.reload() diff --git a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res index 8135dc83e..681497d31 100644 --- a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res @@ -33,7 +33,7 @@ let make = () => { let refundUrl = getURL(~entityName=REFUNDS, ~methodType=Post, ~id=Some("refund-post"), ()) let body = Dict.make() body->Dict.set("limit", 100->Belt.Int.toFloat->Js.Json.number) - let refundDetails = await updateDetails(refundUrl, body->Js.Json.object_, Post) + let refundDetails = await updateDetails(refundUrl, body->Js.Json.object_, Post, ()) let data = refundDetails->getDictFromJsonObject->getArrayFromDict("data", []) if data->Array.length < 1 { diff --git a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res index 384c02dca..17f47078e 100644 --- a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res @@ -134,7 +134,7 @@ module HSiwtchPaymentConfirmLatency = { } let getOverallLatency = async () => { - updateDetails(url, singleStatBodyEntity->singleStatBodyMake("Payment"), Fetch.Post) + updateDetails(url, singleStatBodyEntity->singleStatBodyMake("Payment"), Fetch.Post, ()) ->thenResolve(json => { setOverallrLatency(_ => json->parseJson) }) @@ -146,7 +146,7 @@ module HSiwtchPaymentConfirmLatency = { } let getConnectorLatency = () => { - updateDetails(url, singleStatBodyEntity->singleStatBodyMake("OutgoingEvent"), Fetch.Post) + updateDetails(url, singleStatBodyEntity->singleStatBodyMake("OutgoingEvent"), Fetch.Post, ()) ->thenResolve(json => { setConnectorLatency(_ => json->parseJson) setIsLoading(_ => false) @@ -275,7 +275,7 @@ module SystemMetricsAnalytics = { setFilterDataJson(_ => None) if startTimeVal->isStringNonEmpty && endTimeVal->isStringNonEmpty { try { - updateDetails(filterUri, filterBody->Js.Json.object_, Post) + updateDetails(filterUri, filterBody->Js.Json.object_, Post, ()) ->thenResolve(json => setFilterDataJson(_ => json->Some)) ->catch(_ => resolve()) ->ignore diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res index 50ddf3082..9d577d105 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res @@ -154,7 +154,7 @@ let make = (~setCurrentStep, ~setInitialValues, ~initialValues, ~isUpdateFlow, ~ ~connector=Some(connector), (), ) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setShowVerifyModal(_ => false) onSubmitMain(values)->ignore } catch { diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res b/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res index fc08d9674..df5e51956 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res @@ -55,7 +55,7 @@ let make = ( ConnectorUtils.connectorIgnoredField, ) let connectorUrl = getURL(~entityName=CONNECTOR, ~methodType=Post, ~id=connectorID, ()) - let response = await updateAPIHook(connectorUrl, body, Post) + let response = await updateAPIHook(connectorUrl, body, Post, ()) setInitialValues(_ => response) setScreenState(_ => Success) setCurrentStep(_ => ConnectorTypes.SummaryAndTest) diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res index 8228728ad..5ba240082 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res @@ -248,7 +248,7 @@ let make = ( isConnectorDisabled, ) let url = getURL(~entityName=CONNECTOR, ~methodType=Post, ~id=Some(connectorID), ()) - let _ = await updateDetails(url, disableConnectorPayload->Js.Json.object_, Post) + let _ = await updateDetails(url, disableConnectorPayload->Js.Json.object_, Post, ()) showToast(~message=`Successfully Saved the Changes`, ~toastType=ToastSuccess, ()) RescriptReactRouter.push("/connectors") } catch { diff --git a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res index a5e8b19d1..208e34d13 100644 --- a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res +++ b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res @@ -91,7 +91,7 @@ module Simplified = { try { let (body, domainName) = values->constructVerifyApplePayReq(connectorID) let verifyAppleUrl = getURL(~entityName=VERIFY_APPLE_PAY, ~methodType=Post, ()) - let _ = await updateAPIHook(`${verifyAppleUrl}/${merchantId}`, body, Post) + let _ = await updateAPIHook(`${verifyAppleUrl}/${merchantId}`, body, Post, ()) let updatedValue = values->constructApplePayMetadata(metadataInputs, #simplified) update(updatedValue) diff --git a/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res b/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res index 0300a362c..8b3638f91 100644 --- a/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res +++ b/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res @@ -71,7 +71,7 @@ module ApiEditModal = { | _ => APIUtils.getURL(~entityName=API_KEYS, ~methodType=Post, ()) } - let json = await updateDetails(url, body->Js.Json.object_, Post) + let json = await updateDetails(url, body->Js.Json.object_, Post, ()) let keyDict = json->LogicUtils.getDictFromJsonObject setApiKey(_ => keyDict->LogicUtils.getString("api_key", "")) @@ -222,7 +222,7 @@ module TableActionsCell = { ~id=Some(keyId), (), ) - (await deleteDetails(deleteUrl, body->Js.Json.object_, Delete))->ignore + (await deleteDetails(deleteUrl, body->Js.Json.object_, Delete, ()))->ignore getAPIKeyDetails()->ignore } catch { | Js.Exn.Error(e) => diff --git a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res index 91d965e2c..3db808bf2 100644 --- a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res +++ b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res @@ -50,7 +50,7 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { setScreenState(_ => PageLoaderWrapper.Loading) let url = getURL(~entityName=BUSINESS_PROFILE, ~methodType=Post, ~id=Some(id), ()) let body = values->getBusinessProfilePayload->Js.Json.object_ - let res = await updateDetails(url, body, Post) + let res = await updateDetails(url, body, Post, ()) let profileTypeInfo = res->businessProfileTypeMapper setProfileInfo(_ => profileTypeInfo) showToast(~message=`Details updated`, ~toastType=ToastState.ToastSuccess, ()) diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res index 825cdee7c..a3c4b48d6 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res @@ -247,7 +247,7 @@ let make = ( ->Js.Json.object_ let url = getURL(~entityName=MERCHANT_ACCOUNT, ~methodType=Post, ()) try { - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) } catch { | _ => () } @@ -255,7 +255,7 @@ let make = ( } let setFRMValues = async body => { - fetchApi(frmUrl, body, Fetch.Post) + fetchApi(frmUrl, body, Fetch.Post, ()) ->thenResolve(res => { setCurrentStep(prev => prev->getNextStep) let _ = updateMerchantDetails() diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res b/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res index 94f440c2a..f1854bba5 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res @@ -77,7 +77,7 @@ let make = (~initialValues, ~currentStep, ~setCurrentStep) => { let frmID = initialValues->getDictFromJsonObject->getString("merchant_connector_id", "") let disableFRMPayload = initialValues->FRMTypes.getDisableConnectorPayload(isFRMDisabled) let url = getURL(~entityName=FRAUD_RISK_MANAGEMENT, ~methodType=Post, ~id=Some(frmID), ()) - let _ = await updateDetails(url, disableFRMPayload->Js.Json.object_, Post) + let _ = await updateDetails(url, disableFRMPayload->Js.Json.object_, Post, ()) showToast(~message=`Successfully Saved the Changes`, ~toastType=ToastSuccess, ()) RescriptReactRouter.push("/fraud-risk-management") } catch { diff --git a/src/screens/HyperSwitch/HSwitchRemoteFilter.res b/src/screens/HyperSwitch/HSwitchRemoteFilter.res index fafea607a..ba66e704a 100644 --- a/src/screens/HyperSwitch/HSwitchRemoteFilter.res +++ b/src/screens/HyperSwitch/HSwitchRemoteFilter.res @@ -211,7 +211,7 @@ module RemoteTableFilters = { setFilterDataJson(_ => None) if startTimeVal->isStringNonEmpty && endTimeVal->isStringNonEmpty { try { - updateDetails(filterUrl, filterBody->Js.Json.object_, Post) + updateDetails(filterUrl, filterBody->Js.Json.object_, Post, ()) ->thenResolve(json => setFilterDataJson(_ => json->Some)) ->catch(_ => resolve()) ->ignore diff --git a/src/screens/HyperSwitch/Home/CommonConnectorFlow/ConfigureConnector.res b/src/screens/HyperSwitch/Home/CommonConnectorFlow/ConfigureConnector.res index 216e9f14b..f83651a1b 100644 --- a/src/screens/HyperSwitch/Home/CommonConnectorFlow/ConfigureConnector.res +++ b/src/screens/HyperSwitch/Home/CommonConnectorFlow/ConfigureConnector.res @@ -79,7 +79,7 @@ let make = (~connectProcessorValue: connectProcessor) => { firstProcessorRoutingPayload, secondProcessorRoutingPayload, ) - let routingResponse = await updateDetails(routingUrl, body, Post) + let routingResponse = await updateDetails(routingUrl, body, Post, ()) let activatingId = routingResponse->getDictFromJsonObject->getString("id", "") let activateRuleURL = getURL( ~entityName=ROUTING, @@ -87,7 +87,7 @@ let make = (~connectProcessorValue: connectProcessor) => { ~id=Some(activatingId), (), ) - let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post, ()) let _ = await updateEnumForRouting(activatingId) setButtonState(_ => Normal) } catch { diff --git a/src/screens/HyperSwitch/Home/CommonConnectorFlow/QuickStartConnectorFlow.res b/src/screens/HyperSwitch/Home/CommonConnectorFlow/QuickStartConnectorFlow.res index 327f451f4..9a56b0e19 100644 --- a/src/screens/HyperSwitch/Home/CommonConnectorFlow/QuickStartConnectorFlow.res +++ b/src/screens/HyperSwitch/Home/CommonConnectorFlow/QuickStartConnectorFlow.res @@ -85,7 +85,7 @@ let make = ( ~json=connectorName->Window.getConnectorConfig, ~profileId=activeBusinessProfile.profile_id, ) - let res = await updateDetails(url, testConnectorBody, Post) + let res = await updateDetails(url, testConnectorBody, Post, ()) connectorArray->Array.push(connectorName) setConnectorArray(_ => connectorArray) setInitialValues(_ => res) diff --git a/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res b/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res index 8478df27e..ad471f576 100644 --- a/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res +++ b/src/screens/HyperSwitch/Home/CommonConnectorFlow/SetupConnector.res @@ -208,7 +208,7 @@ module SelectPaymentMethods = { let body = ConnectorUtils.constructConnectorRequestBody(obj, initialValues) let connectorUrl = APIUtils.getURL(~entityName=CONNECTOR, ~methodType=Post, ~id=None, ()) - let response = await updateAPIHook(connectorUrl, body, Post) + let response = await updateAPIHook(connectorUrl, body, Post, ()) setInitialValues(_ => response) connectorArray->Array.push(connectorName) diff --git a/src/screens/HyperSwitch/Home/DelayedVerificationBanner.res b/src/screens/HyperSwitch/Home/DelayedVerificationBanner.res index 18286a98e..89dd32211 100644 --- a/src/screens/HyperSwitch/Home/DelayedVerificationBanner.res +++ b/src/screens/HyperSwitch/Home/DelayedVerificationBanner.res @@ -29,7 +29,7 @@ let make = React.memo((~merchantId="", ~verificationDays) => { let body = email->HyperSwitchAuthUtils.getEmailBody() try { let url = getURL(~entityName=USERS, ~userType=#VERIFY_EMAIL_REQUEST, ~methodType=Post, ()) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) showToast(~message=`Email Send Successfully!`, ~toastType=ToastSuccess, ()) } catch { | _ => diff --git a/src/screens/HyperSwitch/Home/ProdIntent/ProdVerifyModal.res b/src/screens/HyperSwitch/Home/ProdIntent/ProdVerifyModal.res index 8f387e6eb..b5363a352 100644 --- a/src/screens/HyperSwitch/Home/ProdIntent/ProdVerifyModal.res +++ b/src/screens/HyperSwitch/Home/ProdIntent/ProdVerifyModal.res @@ -15,7 +15,7 @@ let make = (~showModal, ~setShowModal, ~initialValues=Dict.make(), ~getProdVerif let url = getURL(~entityName=USERS, ~userType=#USER_DATA, ~methodType=Post, ()) let bodyValues = values->getBody->Js.Json.object_ let body = [("ProdIntent", bodyValues)]->LogicUtils.getJsonFromArrayOfJson - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) showToast( ~toastType=ToastSuccess, ~message="Successfully sent for verification!", diff --git a/src/screens/HyperSwitch/Home/QuickStart/GoLive.res b/src/screens/HyperSwitch/Home/QuickStart/GoLive.res index 0d6eb6f8c..f8b3215c9 100644 --- a/src/screens/HyperSwitch/Home/QuickStart/GoLive.res +++ b/src/screens/HyperSwitch/Home/QuickStart/GoLive.res @@ -70,7 +70,7 @@ let make = (~goLive) => { let url = getURL(~entityName=USERS, ~userType=#USER_DATA, ~methodType=Post, ()) let bodyValues = values->getBody->Js.Json.object_ let body = [("ProdIntent", bodyValues)]->LogicUtils.getJsonFromArrayOfJson - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) getProdVerifyDetails()->ignore } catch { diff --git a/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/IntegrationDocsPage.res b/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/IntegrationDocsPage.res index 722220ff6..bccef55a4 100644 --- a/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/IntegrationDocsPage.res +++ b/src/screens/HyperSwitch/Home/QuickStart/IntegrateYourApp/IntegrationDocsPage.res @@ -24,7 +24,7 @@ module RequestPage = { ->Js.Json.object_ let body = [("Feedback", requestedBody)]->LogicUtils.getJsonFromArrayOfJson - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) showToast( ~toastType=ToastSuccess, ~message="Request submitted successfully!", diff --git a/src/screens/HyperSwitch/Hooks/EnumVariantHook.res b/src/screens/HyperSwitch/Hooks/EnumVariantHook.res index df57815c1..32996ff43 100644 --- a/src/screens/HyperSwitch/Hooks/EnumVariantHook.res +++ b/src/screens/HyperSwitch/Hooks/EnumVariantHook.res @@ -71,7 +71,7 @@ let usePostEnumDetails = () => { try { let url = getURL(~entityName=USERS, ~userType=#MERCHANT_DATA, ~methodType=Post, ()) let bodyValForApi = enumVariant->QuickStartUtils.generateBodyBasedOnType(body) - let _ = await updateDetails(url, bodyValForApi, Post) + let _ = await updateDetails(url, bodyValForApi, Post, ()) let updatedRecoilValueDict = updateEnumInRecoil([(body, enumVariant)]) Js.Nullable.return(updatedRecoilValueDict) diff --git a/src/screens/HyperSwitch/Order/OrderRefundForm.res b/src/screens/HyperSwitch/Order/OrderRefundForm.res index 3de8b2d9f..fdb9c8858 100644 --- a/src/screens/HyperSwitch/Order/OrderRefundForm.res +++ b/src/screens/HyperSwitch/Order/OrderRefundForm.res @@ -26,7 +26,7 @@ let make = ( let updateRefundDetails = async body => { try { let refundsUrl = getURL(~entityName=REFUNDS, ~methodType=Post, ()) - let res = await updateDetails(refundsUrl, body, Post) + let res = await updateDetails(refundsUrl, body, Post, ()) let refundStatus = res->LogicUtils.getDictFromJsonObject->LogicUtils.getString("status", "") refetch() switch refundStatus->statusVariantMapper { diff --git a/src/screens/HyperSwitch/Order/OrderUIUtils.res b/src/screens/HyperSwitch/Order/OrderUIUtils.res index b936f8fc7..a0b9174f5 100644 --- a/src/screens/HyperSwitch/Order/OrderUIUtils.res +++ b/src/screens/HyperSwitch/Order/OrderUIUtils.res @@ -48,6 +48,7 @@ module GenerateSampleDataButton = { generateSampleDataUrl, [("record", 50.0->Js.Json.number)]->Dict.fromArray->Js.Json.object_, Post, + (), ) showToast(~message="Sample data generated successfully.", ~toastType=ToastSuccess, ()) getOrdersList()->ignore @@ -212,7 +213,7 @@ let setData = ( let getOrdersList = async ( filterValueJson, - ~updateDetails, + ~updateDetails: (string, Js.Json.t, Fetch.requestMethod, unit) => promise, ~setOrdersData, ~previewOnly, ~setScreenState, @@ -226,7 +227,7 @@ let getOrdersList = async ( try { let ordersUrl = getURL(~entityName=ORDERS, ~methodType=Post, ()) - let res = await updateDetails(ordersUrl, filterValueJson->Js.Json.object_, Fetch.Post) + let res = await updateDetails(ordersUrl, filterValueJson->Js.Json.object_, Fetch.Post, ()) let data = res->LogicUtils.getDictFromJsonObject->LogicUtils.getArrayFromDict("data", []) let total = res->getDictFromJsonObject->getInt("total_count", 0) @@ -242,7 +243,7 @@ let getOrdersList = async ( let newID = payment_id->String.replaceRegExp(%re("/_[0-9]$/g"), "") filterValueJson->Dict.set("payment_id", newID->Js.Json.string) - let res = await updateDetails(ordersUrl, filterValueJson->Js.Json.object_, Fetch.Post) + let res = await updateDetails(ordersUrl, filterValueJson->Js.Json.object_, Fetch.Post, ()) let data = res->LogicUtils.getDictFromJsonObject->LogicUtils.getArrayFromDict("data", []) let total = res->getDictFromJsonObject->getInt("total_count", 0) diff --git a/src/screens/HyperSwitch/Order/ShowOrder.res b/src/screens/HyperSwitch/Order/ShowOrder.res index 2ebc10866..461172d6c 100644 --- a/src/screens/HyperSwitch/Order/ShowOrder.res +++ b/src/screens/HyperSwitch/Order/ShowOrder.res @@ -508,7 +508,7 @@ module FraudRiskBannerDetails = { (), )}/${decision->String.toLowerCase}` - let _ = await updateDetails(ordersDecisionUrl, Dict.make()->Js.Json.object_, Post) + let _ = await updateDetails(ordersDecisionUrl, Dict.make()->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 8b32d8925..f7644cf63 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res @@ -287,7 +287,7 @@ let make = (~paymentId, ~createdAt) => { ->Dict.fromArray ->Js.Json.object_ let sdkLogsArray = - (await fetchPostDetils(url, body, Post)) + (await fetchPostDetils(url, body, Post, ())) ->getArrayFromJson([]) ->Array.map(event => { let eventDict = event->getDictFromJsonObject diff --git a/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res b/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res index d61d054a9..8a479aa8b 100644 --- a/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res +++ b/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res @@ -102,6 +102,7 @@ let make = () => { postLoginSurveyUrl, values->generateSurveyJson->Js.Json.object_, Post, + (), ) HSwitchUtils.setUserDetails("is_metadata_filled", "true"->Js.Json.string) setDashboardPageState(_ => #AUTO_CONNECTOR_INTEGRATION) diff --git a/src/screens/HyperSwitch/Recon/Recon.res b/src/screens/HyperSwitch/Recon/Recon.res index 027a77543..d53b3876d 100644 --- a/src/screens/HyperSwitch/Recon/Recon.res +++ b/src/screens/HyperSwitch/Recon/Recon.res @@ -14,7 +14,7 @@ let make = () => { let onClickForReconRequest = async () => { try { let url = getURL(~entityName=RECON, ~reconType=#REQUEST, ~methodType=Get, ()) - let _ = await updateDetails(url, Js.Json.null, Post) + let _ = await updateDetails(url, Js.Json.null, Post, ()) 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.`, diff --git a/src/screens/HyperSwitch/Refunds/RefundUtils.res b/src/screens/HyperSwitch/Refunds/RefundUtils.res index cfe903c54..c7b786427 100644 --- a/src/screens/HyperSwitch/Refunds/RefundUtils.res +++ b/src/screens/HyperSwitch/Refunds/RefundUtils.res @@ -1,6 +1,6 @@ let getRefundsList = async ( filterValueJson, - ~updateDetails, + ~updateDetails: (string, Js.Json.t, Fetch.requestMethod, unit) => promise, ~setRefundsData, ~setScreenState, ~offset, @@ -12,7 +12,7 @@ let getRefundsList = async ( setScreenState(_ => PageLoaderWrapper.Loading) try { let refundsUrl = getURL(~entityName=REFUNDS, ~methodType=Post, ~id=Some("refund-post"), ()) - let res = await updateDetails(refundsUrl, filterValueJson->Js.Json.object_, Fetch.Post) + let res = await updateDetails(refundsUrl, filterValueJson->Js.Json.object_, Fetch.Post, ()) let data = res->getDictFromJsonObject->getArrayFromDict("data", []) let total = res->getDictFromJsonObject->getInt("total_count", 0) diff --git a/src/screens/HyperSwitch/Routing/ActiveRouting.res b/src/screens/HyperSwitch/Routing/ActiveRouting.res index de756eeef..513f58ea5 100644 --- a/src/screens/HyperSwitch/Routing/ActiveRouting.res +++ b/src/screens/HyperSwitch/Routing/ActiveRouting.res @@ -50,7 +50,7 @@ module ActionButtons = { (), ) let body = [("Feedback", requestedBody)]->LogicUtils.getJsonFromArrayOfJson - let _ = await updateDetails(feedbackUrl, body, Post) + let _ = await updateDetails(feedbackUrl, body, Post, ()) showToast( ~toastType=ToastSuccess, ~message="Request submitted successfully!", diff --git a/src/screens/HyperSwitch/Routing/DefaultRouting.res b/src/screens/HyperSwitch/Routing/DefaultRouting.res index 4b67777b8..37ba18cb4 100644 --- a/src/screens/HyperSwitch/Routing/DefaultRouting.res +++ b/src/screens/HyperSwitch/Routing/DefaultRouting.res @@ -76,7 +76,10 @@ let make = () => { ~methodType=Post, (), )}/profile/${profile}` - (await updateDetails(defaultFallbackUpdateUrl, defaultPayload->Js.Json.array, Post))->ignore + + ( + await updateDetails(defaultFallbackUpdateUrl, defaultPayload->Js.Json.array, Post, ()) + )->ignore RescriptReactRouter.replace(`/routing/default`) setScreenState(_ => PageLoaderWrapper.Success) } catch { diff --git a/src/screens/HyperSwitch/Routing/PriorityRouting.res b/src/screens/HyperSwitch/Routing/PriorityRouting.res index 616597357..8e68de137 100644 --- a/src/screens/HyperSwitch/Routing/PriorityRouting.res +++ b/src/screens/HyperSwitch/Routing/PriorityRouting.res @@ -45,6 +45,7 @@ module SimpleRoutingView = { "", )->Js.Json.object_, Post, + (), ) showToast( @@ -64,7 +65,7 @@ module SimpleRoutingView = { try { setScreenState(_ => Loading) let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=routingId, ()) - let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post, ()) showToast( ~message="Successfully Activated Selected Configuration !", ~toastType=ToastState.ToastSuccess, diff --git a/src/screens/HyperSwitch/Routing/VolumeSplitRouting.res b/src/screens/HyperSwitch/Routing/VolumeSplitRouting.res index 0b097d492..83b062d15 100644 --- a/src/screens/HyperSwitch/Routing/VolumeSplitRouting.res +++ b/src/screens/HyperSwitch/Routing/VolumeSplitRouting.res @@ -37,7 +37,7 @@ module VolumeRoutingView = { try { setScreenState(_ => PageLoaderWrapper.Loading) let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=activatingId, ()) - let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post, ()) showToast(~message="Successfully Activated !", ~toastType=ToastState.ToastSuccess, ()) RescriptReactRouter.replace(`/routing?`) setScreenState(_ => Success) @@ -67,7 +67,7 @@ module VolumeRoutingView = { setScreenState(_ => Loading) let deactivateRoutingURL = `${getURL(~entityName=ROUTING, ~methodType=Post, ())}/deactivate` let body = [("profile_id", profile->Js.Json.string)]->Dict.fromArray->Js.Json.object_ - let _ = await updateDetails(deactivateRoutingURL, body, Post) + let _ = await updateDetails(deactivateRoutingURL, body, Post, ()) showToast(~message="Successfully Deactivated !", ~toastType=ToastState.ToastSuccess, ()) RescriptReactRouter.replace(`/routing?`) setScreenState(_ => Success) @@ -298,7 +298,7 @@ let make = (~routingRuleId, ~isActive) => { try { setScreenState(_ => PageLoaderWrapper.Loading) let updateUrl = getURL(~entityName=ROUTING, ~methodType=Post, ~id=None, ()) - let res = await updateDetails(updateUrl, values, Post) + let res = await updateDetails(updateUrl, values, Post, ()) showToast( ~message="Successfully Created a new Configuration !", ~toastType=ToastState.ToastSuccess, diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res index faad7cc64..0740e0ee8 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res @@ -539,7 +539,7 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => { try { setScreenState(_ => Loading) let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=activatingId, ()) - let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post, ()) showToast(~message="Successfully Activated !", ~toastType=ToastState.ToastSuccess, ()) RescriptReactRouter.replace(`/routing?`) setScreenState(_ => Success) @@ -568,7 +568,7 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => { setScreenState(_ => Loading) let deactivateRoutingURL = `${getURL(~entityName=ROUTING, ~methodType=Post, ())}/deactivate` let body = [("profile_id", profile->Js.Json.string)]->Dict.fromArray->Js.Json.object_ - let _ = await updateDetails(deactivateRoutingURL, body, Post) + let _ = await updateDetails(deactivateRoutingURL, body, Post, ()) showToast(~message="Successfully Deactivated !", ~toastType=ToastState.ToastSuccess, ()) RescriptReactRouter.replace(`/routing?`) setScreenState(_ => Success) @@ -628,7 +628,12 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => { } let getActivateUrl = getURL(~entityName=ROUTING, ~methodType=Post, ~id=None, ()) - let response = await updateDetails(getActivateUrl, payload->Identity.genericTypeToJson, Post) + let response = await updateDetails( + getActivateUrl, + payload->Identity.genericTypeToJson, + Post, + (), + ) showToast( ~message="Successfully Created a new Configuration !", diff --git a/src/screens/HyperSwitch/SDKPayment/TestPayment.res b/src/screens/HyperSwitch/SDKPayment/TestPayment.res index 45dd2f4d8..ad0bd96bd 100644 --- a/src/screens/HyperSwitch/SDKPayment/TestPayment.res +++ b/src/screens/HyperSwitch/SDKPayment/TestPayment.res @@ -53,7 +53,7 @@ let make = ( ->getTypedValueForPayment paymentData.currency = paymentData.currency->getCurrencyValue let body = paymentData->Identity.genericTypeToJson - let response = await updateDetails(url, body, Post) + let response = await updateDetails(url, body, Post, ()) let clientSecret = response->getDictFromJsonObject->getOptionString("client_secret") setPaymentId(_ => response->getDictFromJsonObject->getOptionString("payment_id")) setClientSecret(_ => clientSecret) diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res index c6c671dce..7f2bfbabf 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res @@ -19,7 +19,7 @@ let make = () => { try { let agreementUrl = getURL(~entityName=USERS, ~userType=#MERCHANT_DATA, ~methodType=Post, ()) let body = ProdOnboardingUtils.getProdApiBody(~parentVariant=#ProductionAgreement, ()) - let _ = await updateDetails(agreementUrl, body, Post) + let _ = await updateDetails(agreementUrl, body, Post, ()) setDashboardPageState(_ => #PROD_ONBOARDING) } catch { | _ => diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/LiveEndpointsSetup.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/LiveEndpointsSetup.res index c58b1e2f6..0cc17e2cc 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/LiveEndpointsSetup.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/LiveEndpointsSetup.res @@ -159,7 +159,7 @@ let make = (~pageView, ~setPageView, ~previewState: option pageView->ProdOnboardingUtils.getPageView) showToast(~message=`Details updated`, ~toastType=ToastState.ToastSuccess, ()) setButtonState(_ => Normal) @@ -175,7 +175,7 @@ let make = (~pageView, ~setPageView, ~previewState: optionJs.Json.string)]->Dict.fromArray->Js.Json.object_ let body = mercahantUpdateBody->MerchantAccountUtils.getSettingsPayload(merchantId) let url = getURL(~entityName=MERCHANT_ACCOUNT, ~methodType=Post, ()) - let merchantInfo = await updateDetails(url, body, Post) + let merchantInfo = await updateDetails(url, body, Post, ()) setMerchantDetailsValue(._ => merchantInfo->Js.Json.stringify) updateLiveEndpoint()->ignore } catch { diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res index d73dda8df..aba2ea6bb 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res @@ -268,7 +268,7 @@ let make = () => { setButtonState(_ => Loading) let url = getURL(~entityName=USERS, ~userType=#MERCHANT_DATA, ~methodType=Post, ()) let body = ProdOnboardingUtils.getProdApiBody(~parentVariant=#SetupComplete, ()) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setButtonState(_ => Normal) setDashboardPageState(_ => #HOME) } catch { diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res index 64bdfb09b..aa2365c1c 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res @@ -157,7 +157,7 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { ~connectorId, (), ) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setPageView(_ => pageView->ProdOnboardingUtils.getPageView) } catch { | _ => () @@ -205,7 +205,7 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { let body = requestPayload->ConnectorUtils.constructConnectorRequestBody(payload) - let res = await updateDetails(url, body, Post) + let res = await updateDetails(url, body, Post, ()) let connectorId = res->getDictFromJsonObject->getString("merchant_connector_id", "") setConnectorID(_ => connectorId) connectorId->updateSetupConnectorCredentials->ignore @@ -268,7 +268,7 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { )->ignoreFields(connectorID, verifyConnectorIgnoreField) let url = getURL(~entityName=CONNECTOR, ~methodType=Post, ~connector=Some(connectorName), ()) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setShowVerifyModal(_ => false) onSubmitMain(values)->ignore setIsLoading(_ => false) diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/IntegrationDocs.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/IntegrationDocs.res index 47aa640d6..a0ebf2bc7 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/IntegrationDocs.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/IntegrationDocs.res @@ -24,7 +24,7 @@ module RequestPage = { ->Js.Json.object_ let body = [("Feedback", requestedBody)]->LogicUtils.getJsonFromArrayOfJson - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) showToast( ~toastType=ToastSuccess, ~message="Request submitted successfully!", diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res index a651f349c..54ec967c1 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res @@ -116,7 +116,7 @@ let make = () => { ~metadata=metaDataDict, (), ) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) } catch { | _ => () @@ -142,7 +142,7 @@ let make = () => { ->Js.Json.object_, (), ) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) setDashboardPageState(_ => #HOME) } catch { diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res index a3b7f5516..ba56d2944 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res @@ -62,7 +62,7 @@ module DownloadAPIKeyButton = { ("description", "Default Value of the API key"->Js.Json.string), ("expiration", "never"->Js.Json.string), ]->Dict.fromArray - let res = await updateDetails(url, body->Js.Json.object_, Post) + let res = await updateDetails(url, body->Js.Json.object_, Post, ()) let apiKey = res->LogicUtils.getDictFromJsonObject->LogicUtils.getString("api_key", "") DownloadUtils.downloadOld(~fileName=`apiKey.txt`, ~content=apiKey) Clipboard.writeText(apiKey) @@ -422,7 +422,7 @@ module LandingPageTileForIntegrateDocs = { ~metadata=metaDataDict, (), ) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) } catch { | _ => () diff --git a/src/screens/HyperSwitch/Settings/BusinessDetails.res b/src/screens/HyperSwitch/Settings/BusinessDetails.res index 8e28649e1..60d82bb68 100644 --- a/src/screens/HyperSwitch/Settings/BusinessDetails.res +++ b/src/screens/HyperSwitch/Settings/BusinessDetails.res @@ -74,6 +74,7 @@ let make = () => { accountUrl, values->getSettingsPayload(uid->Option.getWithDefault("")), Post, + (), ) setFormState(_ => Preview) let merchantInfo = merchantDetails->getMerchantDetails->parseMerchantJson diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res index b1ef4381d..d3fb1db5b 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res @@ -139,7 +139,7 @@ let make = ( try { setScreenState(_ => PageLoaderWrapper.Loading) let url = getURL(~entityName=BUSINESS_PROFILE, ~methodType=Post, ()) - let response = await updateDetails(url, body, Post) + let response = await updateDetails(url, body, Post, ()) setUpdatedProfileId(_ => response->LogicUtils.getDictFromJsonObject->LogicUtils.getString("profile_id", "") ) diff --git a/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res b/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res index 62b0c7356..2a3456567 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res +++ b/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res @@ -73,7 +73,7 @@ module ResetPassword = { setIsLoading(_ => true) try { let url = getURL(~entityName=USERS, ~userType=#FORGOT_PASSWORD, ~methodType=Post, ()) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) showToast(~message="Please check your registered e-mail", ~toastType=ToastSuccess, ()) setIsLoading(_ => false) } catch { diff --git a/src/screens/HyperSwitch/Settings/HSwitchSettings.res b/src/screens/HyperSwitch/Settings/HSwitchSettings.res index f82409402..2304ff3c2 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchSettings.res +++ b/src/screens/HyperSwitch/Settings/HSwitchSettings.res @@ -28,7 +28,7 @@ module TileComponent = { let deleteSampleData = async () => { try { let generateSampleDataUrl = getURL(~entityName=GENERATE_SAMPLE_DATA, ~methodType=Delete, ()) - let _ = await updateDetails(generateSampleDataUrl, Dict.make()->Js.Json.object_, Delete) + let _ = await updateDetails(generateSampleDataUrl, Dict.make()->Js.Json.object_, Delete, ()) showToast(~message="Sample data deleted successfully", ~toastType=ToastSuccess, ()) } catch { | _ => () diff --git a/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res b/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res index 719d84cb5..caef4c3ec 100644 --- a/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res +++ b/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res @@ -39,7 +39,7 @@ let make = () => { ~profileId=activeBusinessProfile.profile_id, ) let stripeTestRes = - (await updateDetails(url, stripeTestBody, Post)) + (await updateDetails(url, stripeTestBody, Post, ())) ->getDictFromJsonObject ->ConnectorTableUtils.getProcessorPayloadType @@ -49,7 +49,7 @@ let make = () => { ~profileId=activeBusinessProfile.profile_id, ) let payPalTestRes = - (await updateDetails(url, paypalTestBody, Post)) + (await updateDetails(url, paypalTestBody, Post, ())) ->getDictFromJsonObject ->ConnectorTableUtils.getProcessorPayloadType let _ = await fetchConnectorListResponse() @@ -71,17 +71,18 @@ let make = () => { routingUrl, activeBusinessProfile.profile_id->routingPayload(stripTestRouting, payPalTestRouting), Post, + (), ) ) ->getDictFromJsonObject ->getOptionString("id") let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=activatingId, ()) - let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Dict.make()->Js.Json.object_, Post, ()) setStepCounter(_ => #ROUTING_ENABLED) // *GENERATE_SAMPLE_DATA let generateSampleDataUrl = getURL(~entityName=GENERATE_SAMPLE_DATA, ~methodType=Post, ()) - let _ = await updateDetails(generateSampleDataUrl, Dict.make()->Js.Json.object_, Post) + let _ = await updateDetails(generateSampleDataUrl, Dict.make()->Js.Json.object_, Post, ()) setStepCounter(_ => #GENERATE_SAMPLE_DATA) await delay(delayTime) setStepCounter(_ => #COMPLETED) @@ -95,7 +96,7 @@ let make = () => { (), ) let integrationUrl = getURL(~entityName=INTEGRATION_DETAILS, ~methodType=Post, ()) - let _ = await updateDetails(integrationUrl, body, Post) + let _ = await updateDetails(integrationUrl, body, Post, ()) setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) setDashboardPageState(_ => #INTEGRATION_DOC) } catch { diff --git a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res index d89fc5128..fb43561be 100644 --- a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res +++ b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res @@ -87,7 +87,7 @@ module SelectPaymentMethods = { #MultipleProcessorWithSmartRouting->QuickStartUtils.connectorChoiceVariantToString, ) } - let response = await updateAPIHook(connectorUrl, body, Post) + let response = await updateAPIHook(connectorUrl, body, Post, ()) setInitialValues(_ => response) response->LogicUtils.getDictFromJsonObject->updateEnumForConnector->ignore setConnectorConfigureState(_ => Summary) diff --git a/src/screens/HyperSwitch/Surcharge/Surcharge.res b/src/screens/HyperSwitch/Surcharge/Surcharge.res index 6e4157b8f..02c1600ec 100644 --- a/src/screens/HyperSwitch/Surcharge/Surcharge.res +++ b/src/screens/HyperSwitch/Surcharge/Surcharge.res @@ -168,7 +168,12 @@ let make = () => { try { let surchargePayload = values->buildSurchargePayloadBody let getActivateUrl = getURL(~entityName=SURCHARGE, ~methodType=Put, ()) - let _ = await updateDetails(getActivateUrl, surchargePayload->Identity.genericTypeToJson, Put) + let _ = await updateDetails( + getActivateUrl, + surchargePayload->Identity.genericTypeToJson, + Put, + (), + ) fetchDetails()->ignore setShowWarning(_ => true) RescriptReactRouter.replace(`/surcharge`) diff --git a/src/screens/HyperSwitch/SwitchMerchant/SwitchMerchant.res b/src/screens/HyperSwitch/SwitchMerchant/SwitchMerchant.res index f8c8f3ca0..712bb6193 100644 --- a/src/screens/HyperSwitch/SwitchMerchant/SwitchMerchant.res +++ b/src/screens/HyperSwitch/SwitchMerchant/SwitchMerchant.res @@ -33,7 +33,7 @@ module NewAccountCreationModal = { try { let url = getURL(~entityName=USERS, ~userType=#CREATE_MERCHANT, ~methodType=Fetch.Post, ()) let body = values - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) let _ = await fetchMerchantIDs() showToast( ~toastType=ToastSuccess, @@ -286,7 +286,7 @@ let make = (~userRole, ~isAddMerchantEnabled=false) => { let url = getURL(~entityName=USERS, ~userType=#SWITCH_MERCHANT, ~methodType=Post, ()) let body = Dict.make() body->Dict.set("merchant_id", value->Js.Json.string) - let res = await updateDetails(url, body->Js.Json.object_, Post) + let res = await updateDetails(url, body->Js.Json.object_, Post, ()) let responseDict = res->getDictFromJsonObject let token = responseDict->getString("token", "") let switchedMerchantId = responseDict->getString("merchant_id", "") diff --git a/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res b/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res index 0f4f6e459..09978325e 100644 --- a/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res +++ b/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res @@ -186,7 +186,12 @@ let make = () => { let threeDsPayload = values->buildThreeDsPayloadBody let getActivateUrl = getURL(~entityName=THREE_DS, ~methodType=Put, ()) - let _ = await updateDetails(getActivateUrl, threeDsPayload->Identity.genericTypeToJson, Put) + let _ = await updateDetails( + getActivateUrl, + threeDsPayload->Identity.genericTypeToJson, + Put, + (), + ) fetchDetails()->ignore setShowWarning(_ => true) RescriptReactRouter.replace(`/3ds`) diff --git a/src/screens/HyperSwitch/UserManagement/InviteUsers.res b/src/screens/HyperSwitch/UserManagement/InviteUsers.res index f9b6007d7..dd84a4d9b 100644 --- a/src/screens/HyperSwitch/UserManagement/InviteUsers.res +++ b/src/screens/HyperSwitch/UserManagement/InviteUsers.res @@ -90,7 +90,7 @@ let make = () => { let inviteUserReq = body => { let url = getURL(~entityName=USERS, ~userType=#INVITE, ~methodType=Post, ()) - let response = updateDetails(url, body, Post) + let response = updateDetails(url, body, Post, ()) response } diff --git a/src/screens/HyperSwitch/UserManagement/ShowUserData.res b/src/screens/HyperSwitch/UserManagement/ShowUserData.res index 25cb48519..2e5ff9c29 100644 --- a/src/screens/HyperSwitch/UserManagement/ShowUserData.res +++ b/src/screens/HyperSwitch/UserManagement/ShowUserData.res @@ -16,7 +16,7 @@ module UserHeading = { try { let url = getURL(~entityName=USERS, ~userType=#RESEND_INVITE, ~methodType=Post, ()) let body = [("user_id", userId->Js.Json.string)]->Dict.fromArray->Js.Json.object_ - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) showToast(~message=`Invite resend. Please check your email.`, ~toastType=ToastSuccess, ()) } catch { | _ => () diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res index 4734d8235..024230023 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res @@ -35,7 +35,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let getUserWithEmail = async body => { try { let url = getURL(~entityName=USERS, ~userType=#CONNECT_ACCOUNT, ~methodType=Post, ()) - let res = await updateDetails(url, body, Post) + let res = await updateDetails(url, body, Post, ()) let valuesDict = res->getDictFromJsonObject let magicLinkSent = valuesDict->LogicUtils.getBool("is_email_sent", false) @@ -53,7 +53,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let getUserWithEmailPassword = async (body, email, userType) => { try { let url = getURL(~entityName=USERS, ~userType, ~methodType=Post, ()) - let res = await updateDetails(url, body, Post) + let res = await updateDetails(url, body, Post, ()) let token = parseResponseJson(~json=res, ~email) // home @@ -78,7 +78,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let setResetPassword = async body => { try { let url = getURL(~entityName=USERS, ~userType=#RESET_PASSWORD, ~methodType=Post, ()) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) RescriptReactRouter.push("/") showToast(~message=`Password Changed Successfully`, ~toastType=ToastSuccess, ()) setAuthType(_ => LoginWithEmail) @@ -92,7 +92,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let setForgetPassword = async body => { try { let url = getURL(~entityName=USERS, ~userType=#FORGOT_PASSWORD, ~methodType=Post, ()) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setAuthType(_ => ForgetPasswordEmailSent) showToast(~message="Please check your registered e-mail", ~toastType=ToastSuccess, ()) } catch { @@ -104,7 +104,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let resendVerifyEmail = async body => { try { let url = getURL(~entityName=USERS, ~userType=#VERIFY_EMAIL_REQUEST, ~methodType=Post, ()) - let _ = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post, ()) setAuthType(_ => ResendVerifyEmailSent) showToast(~message="Please check your registered e-mail", ~toastType=ToastSuccess, ()) } catch { diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res index 32aede40c..daf4e25f5 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res @@ -21,7 +21,7 @@ let make = (~setAuthType, ~setAuthStatus, ~authType) => { let userType = authType == HyperSwitchAuthTypes.EmailVerify ? #VERIFY_EMAIL : #VERIFY_MAGIC_LINK let url = getURL(~entityName=USERS, ~methodType=Post, ~userType, ()) - let res = await updateDetails(url, body, Post) + let res = await updateDetails(url, body, Post, ()) let email = res->Js.Json.decodeObject->Option.getWithDefault(Dict.make())->getString("email", "") let token = HyperSwitchAuthUtils.parseResponseJson(~json=res, ~email)