From 91cbedb26d09e5f3eee08d37f37fa83898b0bae6 Mon Sep 17 00:00:00 2001 From: vsrivatsa-juspay Date: Thu, 30 May 2024 15:56:16 +0530 Subject: [PATCH 1/2] fix: allow customer to pay with different payment method on cancel of klarna sdk --- src/Payments/KlarnaSDK.res | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Payments/KlarnaSDK.res b/src/Payments/KlarnaSDK.res index 86c4c0384..22b401a8f 100644 --- a/src/Payments/KlarnaSDK.res +++ b/src/Payments/KlarnaSDK.res @@ -32,10 +32,6 @@ let make = (~sessionObj: SessionsType.token) => { let handleCloseLoader = () => { Utils.handlePostMessage([("fullscreen", false->JSON.Encode.bool)]) - Utils.postFailedSubmitResponse( - ~errortype="confirm_payment_failed", - ~message="An unknown error has occurred", - ) } let submitCallback = (ev: Window.event) => { From 545943d6d87e98028ca0429c86914bc752833430 Mon Sep 17 00:00:00 2001 From: Arush Date: Thu, 30 May 2024 18:23:35 +0530 Subject: [PATCH 2/2] fix: fixed klarnaInit undefined in submitCallback --- src/Payments/KlarnaSDK.res | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Payments/KlarnaSDK.res b/src/Payments/KlarnaSDK.res index 22b401a8f..2acaf11dd 100644 --- a/src/Payments/KlarnaSDK.res +++ b/src/Payments/KlarnaSDK.res @@ -34,7 +34,7 @@ let make = (~sessionObj: SessionsType.token) => { Utils.handlePostMessage([("fullscreen", false->JSON.Encode.bool)]) } - let submitCallback = (ev: Window.event) => { + let submitCallback = React.useCallback((ev: Window.event) => { let json = ev.data->JSON.parseExn let confirm = json->Utils.getDictFromJson->ConfirmType.itemToObjMapper @@ -61,7 +61,7 @@ let make = (~sessionObj: SessionsType.token) => { }, ) } - } + }, [status]) useSubmitPaymentData(submitCallback) React.useEffect(() => {