Skip to content

Commit

Permalink
fix: updated headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritish Budhiraja committed May 17, 2024
1 parent a2329c5 commit 470b78b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Utilities/PaymentHelpers.res
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/Utils.res
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 470b78b

Please sign in to comment.