diff --git a/composer.json b/composer.json index b18838de..3f5e7257 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "paynl/magento2-plugin", "description": "PAY. Magento2 Payment methods", "type": "magento2-module", - "version": "1.6.7", + "version": "1.6.8", "require": { "magento/module-sales": "100 - 103", "magento/module-payment": "100 - 103", diff --git a/view/frontend/web/js/view/payment/method-renderer/billink.js b/view/frontend/web/js/view/payment/method-renderer/billink.js index 4427da01..848a05fb 100644 --- a/view/frontend/web/js/view/payment/method-renderer/billink.js +++ b/view/frontend/web/js/view/payment/method-renderer/billink.js @@ -36,13 +36,15 @@ define( return (this.getDOB() > 0 && this.getKVK() > 0); }, isVisible:function(){ - var currentShippingMethod = quote.shippingMethod().carrier_code+'_'+quote.shippingMethod().method_code; - var disallowedShippingMethods = []; - if(this.getDisallowedShipping()){ - disallowedShippingMethods = this.getDisallowedShipping().split(','); - } - if(disallowedShippingMethods.includes(currentShippingMethod)){ - return false; + 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; @@ -54,16 +56,16 @@ define( }, getDisallowedShipping: function () { return window.checkoutConfig.payment.disallowedshipping[this.item.method]; - }, - getCompany: function () { + }, + getCompany: function () { if (typeof quote.billingAddress._latestValue.company !== 'undefined') { return quote.billingAddress._latestValue.company; } - return ''; - }, + return ''; + }, getforCompany : function () { return window.checkoutConfig.payment.showforcompany[this.item.method]; - }, + }, /** * Get payment method data */ 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 4f2410f5..167e32df 100644 --- a/view/frontend/web/js/view/payment/method-renderer/default.js +++ b/view/frontend/web/js/view/payment/method-renderer/default.js @@ -17,13 +17,15 @@ define( template: 'Paynl_Payment/payment/default' }, isVisible:function(){ - var currentShippingMethod = quote.shippingMethod().carrier_code+'_'+quote.shippingMethod().method_code; - var disallowedShippingMethods = []; - if(this.getDisallowedShipping()){ - disallowedShippingMethods = this.getDisallowedShipping().split(','); - } - if(disallowedShippingMethods.includes(currentShippingMethod)){ - return false; + 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; @@ -35,27 +37,27 @@ define( }, getDisallowedShipping: function () { return window.checkoutConfig.payment.disallowedshipping[this.item.method]; - }, - getCompany: function () { + }, + getCompany: function () { if (typeof quote.billingAddress._latestValue.company !== 'undefined') { 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]; }, - + afterPlaceOrder: function () { window.location.replace(url.build('/paynl/checkout/redirect?nocache='+ (new Date().getTime()))); }, }); } -); \ No newline at end of file +); diff --git a/view/frontend/web/js/view/payment/method-renderer/ideal.js b/view/frontend/web/js/view/payment/method-renderer/ideal.js index 36987328..69dd4b8f 100644 --- a/view/frontend/web/js/view/payment/method-renderer/ideal.js +++ b/view/frontend/web/js/view/payment/method-renderer/ideal.js @@ -4,7 +4,7 @@ define( [ 'jquery', 'Paynl_Payment/js/view/payment/method-renderer/default', - 'mage/url', + 'mage/url', 'Magento_Checkout/js/model/quote' ], function ($, Component, url, quote) { @@ -22,13 +22,15 @@ define( return window.checkoutConfig.payment.banks[this.item.method].length > 0; }, isVisible:function(){ - var currentShippingMethod = quote.shippingMethod().carrier_code+'_'+quote.shippingMethod().method_code; - var disallowedShippingMethods = []; - if(this.getDisallowedShipping()){ - disallowedShippingMethods = this.getDisallowedShipping().split(','); - } - if(disallowedShippingMethods.includes(currentShippingMethod)){ - return false; + 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; @@ -40,16 +42,16 @@ define( }, getDisallowedShipping: function () { return window.checkoutConfig.payment.disallowedshipping[this.item.method]; - }, - getCompany: function () { + }, + getCompany: function () { if (typeof quote.billingAddress._latestValue.company !== 'undefined') { return quote.billingAddress._latestValue.company; } - return ''; - }, + return ''; + }, getforCompany : function () { return window.checkoutConfig.payment.showforcompany[this.item.method]; - }, + }, /** * Get payment method data */ @@ -64,4 +66,4 @@ define( } }); } -); \ No newline at end of file +);