Skip to content

Commit 911b3c5

Browse files
committed
#3924 Square payment plugin. Further changes to prevent infinite loop on nonce request
1 parent 3490b1a commit 911b3c5

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/Plugins/Nop.Plugin.Payments.Square/Views/PaymentInfo.cshtml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
toggleStoredCard();
4040
4141
var submitForm = false;
42-
var stepBack = false;
4342
var onePageCheckout = @orderSettings.OnePageCheckoutEnabled.ToString().ToLower();
4443
$('.payment-info-next-step-button').attr('onclick', null);
4544
$('.payment-info-next-step-button').prop('disabled', true);
@@ -91,13 +90,7 @@
9190
9291
paymentFormLoaded: function () {
9392
if (paymentForm) {
94-
if (stepBack) {
95-
paymentForm.destroy();
96-
paymentForm = null;
97-
}
98-
else {
99-
paymentForm.setPostalCode('@Model.PostalCode');
100-
}
93+
paymentForm.setPostalCode('@Model.PostalCode');
10194
}
10295
$('.payment-info-next-step-button').prop('disabled', false);
10396
$('.payment-info-next-step-button').css("opacity", 1);
@@ -113,18 +106,25 @@
113106
if (!submitForm && (!selectedStoredCardId || selectedStoredCardId == '@(Guid.Empty.ToString())')) {
114107
if (paymentForm) {
115108
paymentForm.requestCardNonce();
109+
return false;
116110
}
117-
return false;
118111
}
119112
else if (onePageCheckout) {
120-
submitForm = true;
113+
submitForm = false;
121114
PaymentInfo.save();
122115
}
123116
});
124117
125118
$(document).on('accordion_section_opened', function (data) {
126-
if (data && (data.currentSectionId == 'opc-billing' || data.currentSectionId == 'opc-shipping' || data.currentSectionId == 'opc-shipping_method' || data.currentSectionId == 'opc-payment_method')) {
127-
stepBack = true;
119+
if (data.currentSectionId != 'opc-confirm_order' && data.currentSectionId != 'opc-payment_info') {
120+
if (paymentForm) {
121+
paymentForm.destroy();
122+
paymentForm = null;
123+
}
124+
$('.payment-info-next-step-button').attr('onclick', 'PaymentInfo.save()');
125+
}
126+
if (data.currentSectionId == 'opc-payment_info' && data.previousSectionId == 'opc-confirm_order') {
127+
$('.payment-info-next-step-button').attr('onclick', null);
128128
}
129129
});
130130
});

src/Plugins/Nop.Plugin.Payments.Square/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"Group": "Payment methods",
33
"FriendlyName": "Credit Card",
44
"SystemName": "Payments.Square",
5-
"Version": "1.32",
5+
"Version": "1.33",
66
"SupportedVersions": [ "4.20" ],
77
"Author": "nopCommerce team",
88
"DisplayOrder": 1,

0 commit comments

Comments
 (0)