From 5388dc04dca059fa0f9e3d8bd652d1f63d2d6305 Mon Sep 17 00:00:00 2001 From: devansh bawari Date: Mon, 22 Feb 2021 18:12:41 +0530 Subject: [PATCH] Message Fixed --- .../checkout/onepage/paypal-smart-button.blade.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/Webkul/Paypal/src/Resources/views/checkout/onepage/paypal-smart-button.blade.php b/packages/Webkul/Paypal/src/Resources/views/checkout/onepage/paypal-smart-button.blade.php index 0fdf64d4d..b4988d20b 100644 --- a/packages/Webkul/Paypal/src/Resources/views/checkout/onepage/paypal-smart-button.blade.php +++ b/packages/Webkul/Paypal/src/Resources/views/checkout/onepage/paypal-smart-button.blade.php @@ -21,7 +21,7 @@ }; window.onload = (function() { - eventBus.$on('after-payment-method-selected', function(payment) { + eventBus.$on('after-payment-method-selected', function (payment) { if (payment.method != 'paypal_smart_button') { $('.paypal-buttons').remove(); @@ -40,6 +40,8 @@ shape: 'rect', }, + authorizationFailed: false, + enableStandardCardFields: false, alertBox: function (message) { @@ -58,10 +60,11 @@ }) .catch(function (error) { if (error.response.data.error === 'invalid_client') { + options.authorizationFailed = true; options.alertBox(messages.authorizationError); } - options.alertBox(messages.universalError); + return error; }); }, @@ -86,6 +89,12 @@ .catch(function (error) { window.location.href = "{{ route('shop.checkout.cart.index') }}"; }) + }, + + onError: function (error) { + if (! options.authorizationFailed) { + options.alertBox(error); + } } };