Skip to content

Commit 0431f3b

Browse files
Merge pull request #2809 from Adyen/ECP-9493
[ECP-9493]ApplePay and GooglePay -Terms & Conditions checkbox validation
2 parents 18e2968 + 9a62bb7 commit 0431f3b

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

Model/Ui/AdyenGenericConfigProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ protected function showLogos(): bool
105105
}
106106
return false;
107107
}
108-
}
108+
}

view/frontend/web/js/view/payment/method-renderer/adyen-applepay-method.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,21 @@ define(
2323
},
2424
buildComponentConfiguration: function (paymentMethod, paymentMethodsExtraInfo) {
2525
let baseComponentConfiguration = this._super();
26+
let self = this;
2627
let applePayConfiguration = Object.assign(baseComponentConfiguration,
2728
{
2829
showPayButton: true,
2930
totalPriceLabel: baseComponentConfiguration.configuration.merchantName,
3031
amount: paymentMethodsExtraInfo[paymentMethod.type].configuration.amount
3132
}
3233
);
34+
applePayConfiguration.onClick = function(resolve, reject) {
35+
if (self.validate()) {
36+
resolve();
37+
} else {
38+
reject();
39+
}
40+
}
3341

3442
return applePayConfiguration;
3543
},

view/frontend/web/js/view/payment/method-renderer/adyen-googlepay-method.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ define(
1212
'Magento_Checkout/js/model/quote',
1313
'Adyen_Payment/js/view/payment/method-renderer/adyen-pm-method',
1414
],
15-
function(
15+
function (
1616
quote,
17-
adyenPaymentMethod,
17+
adyenPaymentMethod
1818
) {
1919
return adyenPaymentMethod.extend({
2020
placeOrderButtonVisible: false,
@@ -23,12 +23,23 @@ define(
2323
},
2424
buildComponentConfiguration: function (paymentMethod, paymentMethodsExtraInfo) {
2525
let baseComponentConfiguration = this._super();
26+
let self = this;
27+
let googlePayConfiguration = Object.assign(
28+
baseComponentConfiguration,
29+
paymentMethodsExtraInfo[paymentMethod.type].configuration
30+
);
2631

27-
let googlePayConfiguration = Object.assign(baseComponentConfiguration, paymentMethodsExtraInfo[paymentMethod.type].configuration);
2832
googlePayConfiguration.showPayButton = true;
2933

30-
return googlePayConfiguration
34+
googlePayConfiguration.onClick = function(resolve,reject) {
35+
if (self.validate()) {
36+
resolve();
37+
} else {
38+
reject();
39+
}
40+
}
41+
return googlePayConfiguration;
3142
}
32-
})
43+
});
3344
}
3445
);

view/frontend/web/js/view/payment/method-renderer/adyen-pm-method.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ define(
149149
},
150150

151151
handleOnFailure: function(error, component) {
152-
this.isPlaceOrderAllowed(true);
152+
153+
paymentComponentStates().setIsPlaceOrderAllowed(this.getMethodCode(), true);
154+
153155
fullScreenLoader.stopLoader();
154156
errorProcessor.process(error, this.currentMessageContainer);
155157
},

0 commit comments

Comments
 (0)