Disallowed Shipping Methods
Magento\Shipping\Model\Config\Source\Allmethods
diff --git a/i18n/nl_NL.csv b/i18n/nl_NL.csv
index ddd81abb..223a70ef 100644
--- a/i18n/nl_NL.csv
+++ b/i18n/nl_NL.csv
@@ -6,6 +6,7 @@
"Invalid return, no transactionId specified","Ongeldige return, geen transactieId meegegeven"
"There was an error checking the transaction status","Fout bij het controleren van de transactie status"
"Payment canceled","Betaling geannuleerd"
+"Payment denied","Betaling afgewezen"
"Something went wrong, please try again later","Er is iet mis gegaan, probeer het later nogmaals"
"Enter your API-token and ServiceId first","Voer eerst je API-token en Service Id in"
"No","Nee"
diff --git a/view/frontend/web/js/view/payment/method-renderer.js b/view/frontend/web/js/view/payment/method-renderer.js
index 0c0763f0..fcb6a74c 100644
--- a/view/frontend/web/js/view/payment/method-renderer.js
+++ b/view/frontend/web/js/view/payment/method-renderer.js
@@ -9,15 +9,13 @@ define(
rendererList) {
'use strict';
- var defaultComponent = 'Paynl_Payment/js/view/payment/method-renderer/default';
- var idealComponent = 'Paynl_Payment/js/view/payment/method-renderer/ideal';
- var billinkComponent = 'Paynl_Payment/js/view/payment/method-renderer/billink';
+ var defaultComponent = 'Paynl_Payment/js/view/payment/method-renderer/default';
var methods = [
{type: 'paynl_payment_afterpay', component: defaultComponent},
{type: 'paynl_payment_alipay', component: defaultComponent},
{type: 'paynl_payment_amex', component: defaultComponent},
- {type: 'paynl_payment_billink', component: billinkComponent},
+ {type: 'paynl_payment_billink', component: defaultComponent},
{type: 'paynl_payment_capayable', component: defaultComponent},
{type: 'paynl_payment_capayable_gespreid', component: defaultComponent},
{type: 'paynl_payment_cartasi', component: defaultComponent},
@@ -35,10 +33,10 @@ define(
{type: 'paynl_payment_giropay', component: defaultComponent},
{type: 'paynl_payment_givacard', component: defaultComponent},
{type: 'paynl_payment_huisentuincadeau', component: defaultComponent},
- {type: 'paynl_payment_ideal', component: idealComponent},
- {type: 'paynl_payment_instore', component: idealComponent},
- {type: 'paynl_payment_klarna', component: idealComponent},
- {type: 'paynl_payment_klarnakp', component: idealComponent},
+ {type: 'paynl_payment_ideal', component: defaultComponent},
+ {type: 'paynl_payment_instore', component: defaultComponent},
+ {type: 'paynl_payment_klarna', component: defaultComponent},
+ {type: 'paynl_payment_klarnakp', component: defaultComponent},
{type: 'paynl_payment_maestro', component: defaultComponent},
{type: 'paynl_payment_mistercash', component: defaultComponent},
{type: 'paynl_payment_multibanco', component: defaultComponent},
diff --git a/view/frontend/web/js/view/payment/method-renderer/billink.js b/view/frontend/web/js/view/payment/method-renderer/billink.js
deleted file mode 100644
index 848a05fb..00000000
--- a/view/frontend/web/js/view/payment/method-renderer/billink.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/*browser:true*/
-/*global define*/
-define(
- [
- 'jquery',
- 'Magento_Checkout/js/view/payment/default',
- 'mage/url',
- 'Magento_Checkout/js/action/place-order',
- 'Magento_Checkout/js/model/quote'
- ],
- function ($, Component, url, placeOrderAction, quote) {
- 'use strict';
- return Component.extend({
- defaults: {
- template: 'Paynl_Payment/payment/billink'
- },
- kvknummer: null,
- dateofbirth: null,
- billink_agree: null,
- showKVK: function () {
- return this.getKVK() > 0;
- },
- getKVK: function () {
- return window.checkoutConfig.payment.showkvk[this.item.method];
- },
- showDOB: function () {
- return this.getDOB() > 0;
- },
- getDOB: function () {
- return window.checkoutConfig.payment.showdob[this.item.method];
- },
- showKVKDOB: function () {
- return this.getDOB() > 0;
- },
- getKVKDOB: function () {
- return (this.getDOB() > 0 && this.getKVK() > 0);
- },
- isVisible:function(){
- var disallowedShippingMethods = this.getDisallowedShipping();
- if (disallowedShippingMethods) {
- var carrier_code = typeof quote.shippingMethod().carrier_code !== 'undefined' ? quote.shippingMethod().carrier_code + '_' : '';
- var method_code = typeof quote.shippingMethod().method_code !== 'undefined' ? quote.shippingMethod().method_code : '';
- var currentShippingMethod = carrier_code + method_code;
- var disallowedShippingMethodsSplitted = disallowedShippingMethods.split(',');
- if (disallowedShippingMethodsSplitted.includes(currentShippingMethod) && currentShippingMethod.length > 0) {
- return false;
- }
- }
- if(this.getforCompany() == 1 && this.getCompany().length != 0){
- return false;
- }
- if(this.getforCompany() == 2 && this.getCompany().length == 0){
- return false;
- }
- return true;
- },
- getDisallowedShipping: function () {
- return window.checkoutConfig.payment.disallowedshipping[this.item.method];
- },
- getCompany: function () {
- if (typeof quote.billingAddress._latestValue.company !== 'undefined') {
- return quote.billingAddress._latestValue.company;
- }
- return '';
- },
- getforCompany : function () {
- return window.checkoutConfig.payment.showforcompany[this.item.method];
- },
- /**
- * Get payment method data
- */
- getData: function () {
-
- var dob = new Date(this.dateofbirth);
-
- var dd = dob.getDate();
- var mm = dob.getMonth() + 1;
-
- var yyyy = dob.getFullYear();
- if (dd < 10) {
- dd = '0' + dd;
- }
- if (mm < 10) {
- mm = '0' + mm;
- }
- var dob_format = dd + '-' + mm + '-' + yyyy;
-
- return {
- 'method': this.item.method,
- 'po_number': null,
- 'additional_data': {
- "kvknummer": this.kvknummer,
- "dob": dob_format,
- "billink_agree": this.billink_agree
- }
- };
- },
- getInstructions: function () {
- return window.checkoutConfig.payment.instructions[this.item.method];
- },
- getPaymentIcon: function () {
- return window.checkoutConfig.payment.icon[this.item.method];
- },
- placeOrder: function (data, event) {
- var placeOrder;
- var showingKVK = this.getKVK() == 2;
- var showingDOB = this.getDOB() == 2;
- if (showingKVK) {
- if (this.billink_agree != true) {
- alert('U dient eerst akkoord te gaan met de betalingsvoorwaarden van Billink.');
- return false;
- }
- if (this.kvknummer == null || this.kvknummer.length < 8) {
- alert('Voer een geldig KVK nummer in.');
- return false;
- }
- }
- if (showingDOB) {
- if (this.dateofbirth == null || this.dateofbirth.length < 1) {
- alert('Voer een geldig geboortedatum in.');
- return false;
- }
- }
-
- if (event) {
- event.preventDefault();
- }
-
- $('#billink-button').html('Processing').attr('disabled','disabled');
-
- this.isPlaceOrderActionAllowed(false);
- placeOrder = placeOrderAction(this.getData(), this.redirectAfterPlaceOrder);
-
- $.when(placeOrder).fail(function () {
- this.isPlaceOrderActionAllowed(true);
- }.bind(this)).done(this.afterPlaceOrder.bind(this));
-
- return true;
- },
- afterPlaceOrder: function () {
- window.location.replace(url.build('/paynl/checkout/redirect?nocache=' + (new Date().getTime())));
- },
- });
- }
-);
diff --git a/view/frontend/web/js/view/payment/method-renderer/default.js b/view/frontend/web/js/view/payment/method-renderer/default.js
index 167e32df..b6c59db0 100644
--- a/view/frontend/web/js/view/payment/method-renderer/default.js
+++ b/view/frontend/web/js/view/payment/method-renderer/default.js
@@ -6,16 +6,20 @@ define(
'Magento_Checkout/js/view/payment/default',
'mage/url',
'Magento_Checkout/js/action/place-order',
- 'Magento_Checkout/js/model/quote'
+ 'Magento_Checkout/js/model/quote',
+ 'Magento_Ui/js/modal/alert'
],
- function ($, Component, url, placeOrderAction, quote) {
+ function ($, Component, url, placeOrderAction, quote, alert) {
'use strict';
return Component.extend({
redirectAfterPlaceOrder: false,
-
defaults: {
template: 'Paynl_Payment/payment/default'
},
+ selectedBank: null,
+ kvknummer: null,
+ dateofbirth: null,
+ billink_agree: null,
isVisible:function(){
var disallowedShippingMethods = this.getDisallowedShipping();
if (disallowedShippingMethods) {
@@ -37,27 +41,125 @@ define(
},
getDisallowedShipping: function () {
return window.checkoutConfig.payment.disallowedshipping[this.item.method];
- },
- getCompany: function () {
- if (typeof quote.billingAddress._latestValue.company !== 'undefined') {
+ },
+ getCompany: function () {
+ if (typeof quote.billingAddress._latestValue.company !== 'undefined' && quote.billingAddress._latestValue.company !== null) {
return quote.billingAddress._latestValue.company;
}
- return '';
- },
+ return '';
+ },
getforCompany : function () {
return window.checkoutConfig.payment.showforcompany[this.item.method];
- },
+ },
getInstructions: function () {
return window.checkoutConfig.payment.instructions[this.item.method];
},
getPaymentIcon: function () {
return window.checkoutConfig.payment.icon[this.item.method];
},
-
+ showKVK: function () {
+ return this.getKVK() > 0;
+ },
+ getKVK: function () {
+ return window.checkoutConfig.payment.showkvk[this.item.method];
+ },
+ showDOB: function () {
+ return this.getDOB() > 0;
+ },
+ getDOB: function () {
+ return window.checkoutConfig.payment.showdob[this.item.method];
+ },
+ showKVKDOB: function () {
+ return this.getKVKDOB() > 0;
+ },
+ getKVKDOB: function () {
+ return (this.getDOB() > 0 && this.getKVK() > 0);
+ },
+ showBanks: function(){
+ return window.checkoutConfig.payment.banks[this.item.method].length > 0;
+ },
+ getBanks: function(){
+ return window.checkoutConfig.payment.banks[this.item.method];
+ },
afterPlaceOrder: function () {
window.location.replace(url.build('/paynl/checkout/redirect?nocache='+ (new Date().getTime())));
},
-
+ getData: function () {
+ var dob = new Date(this.dateofbirth);
+ var dd = dob.getDate();
+ var mm = dob.getMonth() + 1;
+ var yyyy = dob.getFullYear();
+ if (dd < 10) {
+ dd = '0' + dd;
+ }
+ if (mm < 10) {
+ mm = '0' + mm;
+ }
+ var dob_format = dd + '-' + mm + '-' + yyyy;
+ return {
+ 'method': this.item.method,
+ 'po_number': null,
+ 'additional_data': {
+ "kvknummer": this.kvknummer,
+ "dob": dob_format,
+ "billink_agree": this.billink_agree,
+ "bank_id": this.selectedBank
+ }
+ };
+ },
+ placeOrder: function (data, event) {
+ var placeOrder;
+ var showingKVK = this.getKVK() == 2;
+ var showingDOB = this.getDOB() == 2;
+ if (showingKVK) {
+ if (this.billink_agree != true) {
+ alert({
+ title: $.mage.__('Betalingsvoorwaarden'),
+ content: $.mage.__('U dient eerst akkoord te gaan met de betalingsvoorwaarden.'),
+ actions: {
+ always: function(){}
+ }
+ });
+ return false;
+ }
+ if (this.kvknummer == null || this.kvknummer.length < 8) {
+ alert({
+ title: $.mage.__('Ongeldig KVK nummer'),
+ content: $.mage.__('Voer een geldig KVK nummer in.'),
+ actions: {
+ always: function(){}
+ }
+ });
+ return false;
+ }
+ }
+ if (showingDOB) {
+ if (this.dateofbirth == null || this.dateofbirth.length < 1) {
+ alert({
+ title: $.mage.__('Ongeldig geboortedatum'),
+ content: $.mage.__('Voer een geldig geboortedatum in.'),
+ actions: {
+ always: function(){}
+ }
+ });
+ return false;
+ }
+ }
+ if (event) {
+ event.preventDefault();
+ }
+ $('#payment-button').html('Processing').attr('disabled','disabled');
+ this.isPlaceOrderActionAllowed(false);
+ placeOrder = placeOrderAction(this.getData(), this.redirectAfterPlaceOrder);
+ $.when(placeOrder).fail(function () {
+ this.isPlaceOrderActionAllowed(true);
+ }.bind(this)).done(this.afterPlaceOrder.bind(this));
+ return true;
+ },
});
}
);
+
+
+
+
diff --git a/view/frontend/web/js/view/payment/method-renderer/ideal.js b/view/frontend/web/js/view/payment/method-renderer/ideal.js
deleted file mode 100644
index 69dd4b8f..00000000
--- a/view/frontend/web/js/view/payment/method-renderer/ideal.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*browser:true*/
-/*global define*/
-define(
- [
- 'jquery',
- 'Paynl_Payment/js/view/payment/method-renderer/default',
- 'mage/url',
- 'Magento_Checkout/js/model/quote'
- ],
- function ($, Component, url, quote) {
- 'use strict';
- return Component.extend({
- defaults: {
- template: 'Paynl_Payment/payment/ideal'
- },
-
- selectedBank: null,
- getBanks: function(){
- return window.checkoutConfig.payment.banks[this.item.method];
- },
- showBanks: function(){
- return window.checkoutConfig.payment.banks[this.item.method].length > 0;
- },
- isVisible:function(){
- var disallowedShippingMethods = this.getDisallowedShipping();
- if (disallowedShippingMethods) {
- var carrier_code = typeof quote.shippingMethod().carrier_code !== 'undefined' ? quote.shippingMethod().carrier_code + '_' : '';
- var method_code = typeof quote.shippingMethod().method_code !== 'undefined' ? quote.shippingMethod().method_code : '';
- var currentShippingMethod = carrier_code + method_code;
- var disallowedShippingMethodsSplitted = disallowedShippingMethods.split(',');
- if (disallowedShippingMethodsSplitted.includes(currentShippingMethod) && currentShippingMethod.length > 0) {
- return false;
- }
- }
- if(this.getforCompany() == 1 && this.getCompany().length != 0){
- return false;
- }
- if(this.getforCompany() == 2 && this.getCompany().length == 0){
- return false;
- }
- return true;
- },
- getDisallowedShipping: function () {
- return window.checkoutConfig.payment.disallowedshipping[this.item.method];
- },
- getCompany: function () {
- if (typeof quote.billingAddress._latestValue.company !== 'undefined') {
- return quote.billingAddress._latestValue.company;
- }
- return '';
- },
- getforCompany : function () {
- return window.checkoutConfig.payment.showforcompany[this.item.method];
- },
- /**
- * Get payment method data
- */
- getData: function () {
- return {
- 'method': this.item.method,
- 'po_number': null,
- 'additional_data': {
- "bank_id": this.selectedBank
- }
- };
- }
- });
- }
-);
diff --git a/view/frontend/web/template/payment/billink.html b/view/frontend/web/template/payment/billink.html
deleted file mode 100644
index c1c7fb4c..00000000
--- a/view/frontend/web/template/payment/billink.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Geboortedatum
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/view/frontend/web/template/payment/default.html b/view/frontend/web/template/payment/default.html
index 228bc953..4d7f6704 100644
--- a/view/frontend/web/template/payment/default.html
+++ b/view/frontend/web/template/payment/default.html
@@ -20,11 +20,28 @@
-
+
+
+
+
+ Geboortedatum
+
+
+
+
+
+