Skip to content

Commit

Permalink
fix: added display_voucher_information again
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushKapoorJuspay committed May 14, 2024
1 parent 45f1080 commit f5d4a5e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/Utilities/PaymentHelpers.res
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,40 @@ let rec intentCall = (
("metadata", metaData->JSON.Encode.object),
])
}
} else if intent.nextAction.type_ === "display_voucher_information" {
let voucherData = intent.nextAction.voucher_details->Belt.Option.getWithDefault({
download_url: "",
reference: "",
})
let headerObj = Js.Dict.empty()
headers->Js.Array2.forEach(
entries => {
let (x, val) = entries
Js.Dict.set(headerObj, x, val->Js.Json.string)
},
)
let metaData =
[
("voucherUrl", voucherData.download_url->Js.Json.string),
("reference", voucherData.reference->Js.Json.string),
("returnUrl", url.href->Js.Json.string),
("paymentMethod", paymentMethod->Js.Json.string),
("payment_intent_data", data),
]->Js.Dict.fromArray
handleLogging(
~optLogger,
~value="",
~internalMetadata=metaData->Js.Json.object_->Js.Json.stringify,
~eventName=DISPLAY_VOUCHER,
~paymentMethod,
(),
)
handlePostMessage([
("fullscreen", true->Js.Json.boolean),
("param", `voucherData`->Js.Json.string),
("iframeId", iframeId->Js.Json.string),
("metadata", metaData->Js.Json.object_),
])
} else if intent.nextAction.type_ == "third_party_sdk_session_token" {
let session_token = switch intent.nextAction.session_token {
| Some(token) => token->getDictFromJson
Expand Down

0 comments on commit f5d4a5e

Please sign in to comment.