From 1cc6ae868c9fea029db02f5e86f03ab119a8ff24 Mon Sep 17 00:00:00 2001 From: Nicole Norman <114614923+nicolenorman@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:02:55 -0500 Subject: [PATCH] Add onErrorPaymentOrder callback (#105) --- view/frontend/web/js/model/spi.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/view/frontend/web/js/model/spi.js b/view/frontend/web/js/model/spi.js index 7b7d93d..d505ff1 100644 --- a/view/frontend/web/js/model/spi.js +++ b/view/frontend/web/js/model/spi.js @@ -8,6 +8,7 @@ define([ 'Bold_CheckoutPaymentBooster/js/model/spi/callbacks/on-require-order-data-callback', 'Bold_CheckoutPaymentBooster/js/model/spi/callbacks/on-approve-payment-order-callback', 'Bold_CheckoutPaymentBooster/js/model/spi/callbacks/on-sca-payment-order-callback', + 'Magento_Ui/js/model/messageList' ], function ( quote, fullScreenLoader, @@ -17,7 +18,8 @@ define([ onUpdatePaymentOrderCallback, onRequireOrderDataCallback, onApprovePaymentOrderCallback, - onScaPaymentOrderCallback + onScaPaymentOrderCallback, + messageList ) { 'use strict'; @@ -113,6 +115,10 @@ define([ throw e; } }, + 'onErrorPaymentOrder': function (errors) { + console.error('An unexpected PayPal error occurred', errors); + messageList.addErrorMessage({message: 'Warning: An unexpected error occurred. Please try again.'}); + }, } }; const paymentsInstance = new window.bold.Payments(initialData);