From 470b78b9793ce6ab542140b772e7876be5b97b63 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Fri, 17 May 2024 16:26:05 +0530 Subject: [PATCH] fix: updated headers --- src/Utilities/PaymentHelpers.res | 9 ++++++++- src/Utilities/Utils.res | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Utilities/PaymentHelpers.res b/src/Utilities/PaymentHelpers.res index b9f0b2259..f3fdb235c 100644 --- a/src/Utilities/PaymentHelpers.res +++ b/src/Utilities/PaymentHelpers.res @@ -945,6 +945,9 @@ let rec maskPayload = payloadJson => { let usePaymentIntent = (optLogger, paymentType) => { open RecoilAtoms + let url = RescriptReactRouter.useUrl() + let paymentTypeFromUrl = + CardUtils.getQueryParamsDictforKey(url.search, "componentName")->CardThemeType.getPaymentMode let blockConfirm = Recoil.useRecoilValueFromAtom(isConfirmBlocked) let switchToCustomPod = Recoil.useRecoilValueFromAtom(switchToCustomPod) let paymentMethodList = Recoil.useRecoilValueFromAtom(paymentMethodList) @@ -962,7 +965,11 @@ let usePaymentIntent = (optLogger, paymentType) => { switch keys.clientSecret { | Some(clientSecret) => let paymentIntentID = String.split(clientSecret, "_secret_")->Array.get(0)->Option.getOr("") - let headers = [("Content-Type", "application/json"), ("api-key", confirmParam.publishableKey)] + let headers = [ + ("Content-Type", "application/json"), + ("api-key", confirmParam.publishableKey), + ("X-Client-Source", paymentTypeFromUrl->CardThemeType.getPaymentModeToStrMapper), + ] let returnUrlArr = [("return_url", confirmParam.return_url->JSON.Encode.string)] let manual_retry = isManualRetryEnabled ? [("retry_action", "manual_retry"->JSON.Encode.string)] diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res index efcb2667e..64a4748fb 100644 --- a/src/Utilities/Utils.res +++ b/src/Utilities/Utils.res @@ -798,7 +798,7 @@ let delay = timeOut => { } let getHeaders = (~uri=?, ~token=?, ~headers=Dict.make(), ()) => { let headerObj = - [("Content-Type", "application/json"), ("sdk-version", Window.version)]->Dict.fromArray + [("Content-Type", "application/json"), ("X-Client-Version", Window.version)]->Dict.fromArray switch (token, uri) { | (Some(tok), Some(_uriVal)) => headerObj->Dict.set("Authorization", tok)