We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 1b9940cd authored by rikterbeek's avatar rikterbeek

Fixes #35 add aditionalValidators to payment method adyen_hpp and adyen_sepa...

Fixes #35 add aditionalValidators to payment method adyen_hpp and adyen_sepa (other payment mehthods already have this) so terms of condition is validated if it is set to manually
parent feb2463b
......@@ -29,9 +29,10 @@ define(
'Adyen_Payment/js/action/set-payment-method',
'Magento_Checkout/js/action/select-payment-method',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/checkout-data'
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/model/payment/additional-validators'
],
function (ko, $, Component, setPaymentMethodAction, selectPaymentMethodAction,quote, checkoutData) {
function (ko, $, Component, setPaymentMethodAction, selectPaymentMethodAction,quote, checkoutData, additionalValidators) {
'use strict';
var brandCode = ko.observable(null);
var paymentMethod = ko.observable(null);
......@@ -64,6 +65,9 @@ define(
'issuerId': ko.observable(null),
getCode: function() {
return self.item.method;
},
validate: function () {
return self.validate();
}
}
} else {
......@@ -73,6 +77,9 @@ define(
'method': self.item.method,
getCode: function() {
return self.item.method;
},
validate: function () {
return self.validate();
}
}
}
......@@ -82,15 +89,19 @@ define(
},
/** Redirect to adyen */
continueToAdyen: function () {
if (this.validate() && additionalValidators.validate()) {
//update payment method information if additional data was changed
this.selectPaymentMethod();
setPaymentMethodAction();
return false;
}
},
continueToAdyenBrandCode: function() {
// set payment method to adyen_hpp
var self = this;
if (this.validate() && additionalValidators.validate()) {
// for ideal add brand_code in request
if(brandCode() == "ideal") {
var data = {
......@@ -113,6 +124,8 @@ define(
selectPaymentMethodAction(data);
setPaymentMethodAction();
}
return false;
},
selectPaymentMethodBrandCode: function() {
......@@ -151,6 +164,9 @@ define(
}),
isPaymentMethodSelectionOnAdyen: function() {
return window.checkoutConfig.payment.adyenHpp.isPaymentMethodSelectionOnAdyen;
},
validate: function () {
return true;
}
});
}
......
......@@ -25,9 +25,10 @@ define(
[
'ko',
'Magento_Checkout/js/view/payment/default',
'Adyen_Payment/js/action/set-payment-method'
'Adyen_Payment/js/action/set-payment-method',
'Magento_Checkout/js/model/payment/additional-validators'
],
function (ko, Component, setPaymentMethodAction) {
function (ko, Component, setPaymentMethodAction, additionalValidators) {
'use strict';
var brandCode = ko.observable(null);
var paymentMethod = ko.observable(null);
......@@ -46,13 +47,18 @@ define(
},
/** Redirect to adyen */
continueToAdyen: function () {
if (this.validate() && additionalValidators.validate()) {
//update payment method information if additional data was changed
this.selectPaymentMethod();
setPaymentMethodAction();
return false;
}
},
showLogo: function() {
return window.checkoutConfig.payment.adyen.showLogo;
},
validate: function () {
return true;
}
});
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment