Skip to content

Commit 2f07acc

Browse files
committed
MC-31504: [2.4.0] Update PayPal plugin to use the PayPal JavaScript SDK
- Added loading spinner to persist until redirect happens
1 parent 5e28859 commit 2f07acc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/code/Magento/Paypal/view/frontend/web/js/in-context/express-checkout-wrapper.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ define([
3737
/**
3838
* Execute logic on Paypal button click
3939
*/
40-
onClick: function () {},
40+
onClick: function () {
41+
//display loading widget
42+
$("body").trigger('processStart');
43+
},
4144

4245
/**
4346
* Before payment execute
@@ -103,9 +106,9 @@ define([
103106
* @return {*}
104107
*/
105108
afterOnAuthorize: function (res, resolve, reject, actions) {
109+
$("body").trigger('processStop');
106110
if (res.success) {
107111
resolve();
108-
109112
return actions.redirect(res.redirectUrl);
110113
}
111114

@@ -120,6 +123,7 @@ define([
120123
* @param {Function} reject
121124
*/
122125
catchOnAuthorize: function (err, resolve, reject) {
126+
$("body").trigger('processStop');
123127
this.addAlert(this.paymentActionError);
124128
reject(err);
125129
},
@@ -131,6 +135,7 @@ define([
131135
* @param {Object} actions
132136
*/
133137
onCancel: function (data, actions) {
138+
$("body").trigger('processStop');
134139
actions.redirect(this.clientConfig.onCancelUrl);
135140
},
136141

0 commit comments

Comments
 (0)