diff --git a/composer.json b/composer.json index 01e6427..a2994b9 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "payex/magento2-checkin", "type": "magento2-module", - "version": "1.0.0", + "version": "1.0.1", "description": "PayEx Checkin module for Magento 2", "license": "Apache-2.0", "authors": [ diff --git a/etc/module.xml b/etc/module.xml index 7114c4e..25097de 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - + diff --git a/view/frontend/web/js/view/checkin.js b/view/frontend/web/js/view/checkin.js index 31f276f..02e75aa 100644 --- a/view/frontend/web/js/view/checkin.js +++ b/view/frontend/web/js/view/checkin.js @@ -21,6 +21,7 @@ define([ var PayEx = window.payex, onConsumerIdentifiedDelay = ko.observable(false), + isEnabled = ko.observable(false), isVisible = ko.observable(false), isShippingSectionVisible = ko.observable(false), isRequired = ko.observable(false), @@ -34,6 +35,7 @@ define([ billingDetails: ko.observable({}) } }, + isEnabled: isEnabled, isVisible: isVisible, isShippingSectionVisible: isShippingSectionVisible, isRequired: isRequired, @@ -50,12 +52,15 @@ define([ Object.assign(self.config.data, window.checkoutConfig.PayEx_Checkin); self.config.isCheckout = config.isCheckout; + self.isEnabled((this.config.data.isEnabled == true)); self.isRequired((this.config.data.isRequired == true)); - stepNavigator.steps.subscribe(function(section){ - stepNavigator.hideSection('shipping'); - isShippingSectionVisible(false); - }); + if(self.isEnabled) { + stepNavigator.steps.subscribe(function (section) { + stepNavigator.hideSection('shipping'); + isShippingSectionVisible(false); + }); + } } else { Object.assign(self.config, config); @@ -65,8 +70,10 @@ define([ self.proceedAsGuest(); }; - // Make request to get consumer info if user logged in through checkin in current session - self.checkIsCheckedIn(); + if(self.isEnabled) { + // Make request to get consumer info if user logged in through checkin in current session + self.checkIsCheckedIn(); + } }, checkIsCheckedIn: function(){ var self = this; @@ -278,4 +285,4 @@ define([ } } }); -}); \ No newline at end of file +});