From 2a1b42ad2e62b6cd5461345516e5d0ddcaa0abeb Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Tue, 14 May 2024 16:33:44 +0530 Subject: [PATCH] feat: added content length (#366) Co-authored-by: Vrishab Srivatsa <136090360+vsrivatsa-juspay@users.noreply.github.com> --- src/Utilities/PaymentHelpers.res | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Utilities/PaymentHelpers.res b/src/Utilities/PaymentHelpers.res index 5d7939698..5aa53d49e 100644 --- a/src/Utilities/PaymentHelpers.res +++ b/src/Utilities/PaymentHelpers.res @@ -982,6 +982,7 @@ let usePaymentIntent = (optLogger, paymentType) => { let uri = `${endpoint}/payments/${paymentIntentID}/confirm` let callIntent = body => { + let contentLength = body->String.length->Int.toString let maskedPayload = body->safeParseOpt->Option.getOr(JSON.Encode.null)->maskPayload->JSON.stringify let loggerPayload = @@ -1006,17 +1007,17 @@ let usePaymentIntent = (optLogger, paymentType) => { handleLogging( ~optLogger, ~internalMetadata=loggerPayload, - ~value="", + ~value=contentLength, ~eventName=PAYMENT_ATTEMPT, ~paymentMethod="CARD", (), ) | _ => - let _ = bodyArr->Array.map(((str, json)) => { + bodyArr->Array.forEach(((str, json)) => { if str === "payment_method_type" { handleLogging( ~optLogger, - ~value="", + ~value=contentLength, ~internalMetadata=loggerPayload, ~eventName=PAYMENT_ATTEMPT, ~paymentMethod=json->getStringFromJson(""),