From 547d0b7bd46a36241370f4ae0aaf7ba7ce1a6478 Mon Sep 17 00:00:00 2001 From: Arush Date: Tue, 14 May 2024 14:21:20 +0530 Subject: [PATCH 1/2] fix: added display_voucher_information again --- src/Utilities/PaymentHelpers.res | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/Utilities/PaymentHelpers.res b/src/Utilities/PaymentHelpers.res index d64586455..006023c66 100644 --- a/src/Utilities/PaymentHelpers.res +++ b/src/Utilities/PaymentHelpers.res @@ -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 = Dict.make() + headers->Array.forEach( + entries => { + let (x, val) = entries + Dict.set(headerObj, x, val->JSON.Encode.string) + }, + ) + let metaData = + [ + ("voucherUrl", voucherData.download_url->JSON.Encode.string), + ("reference", voucherData.reference->JSON.Encode.string), + ("returnUrl", url.href->JSON.Encode.string), + ("paymentMethod", paymentMethod->JSON.Encode.string), + ("payment_intent_data", data), + ]->Dict.fromArray + handleLogging( + ~optLogger, + ~value="", + ~internalMetadata=metaData->JSON.Encode.object->JSON.stringify, + ~eventName=DISPLAY_VOUCHER, + ~paymentMethod, + (), + ) + handlePostMessage([ + ("fullscreen", true->JSON.Encode.bool), + ("param", `voucherData`->JSON.Encode.string), + ("iframeId", iframeId->JSON.Encode.string), + ("metadata", metaData->JSON.Encode.object), + ]) } else if intent.nextAction.type_ == "third_party_sdk_session_token" { let session_token = switch intent.nextAction.session_token { | Some(token) => token->getDictFromJson From 1ab16e3bce28fcc623d1417fbf2406016c81ed3a Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Tue, 14 May 2024 14:22:48 +0530 Subject: [PATCH 2/2] Belt changes Option.getOr --- src/Utilities/PaymentHelpers.res | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utilities/PaymentHelpers.res b/src/Utilities/PaymentHelpers.res index 006023c66..5d7939698 100644 --- a/src/Utilities/PaymentHelpers.res +++ b/src/Utilities/PaymentHelpers.res @@ -653,7 +653,7 @@ let rec intentCall = ( ]) } } else if intent.nextAction.type_ === "display_voucher_information" { - let voucherData = intent.nextAction.voucher_details->Belt.Option.getWithDefault({ + let voucherData = intent.nextAction.voucher_details->Option.getOr({ download_url: "", reference: "", })