diff --git a/view/frontend/web/js/core/checkout/PaymentMethodController.js b/view/frontend/web/js/core/checkout/PaymentMethodController.js index 5a498267..6c2c9e98 100644 --- a/view/frontend/web/js/core/checkout/PaymentMethodController.js +++ b/view/frontend/web/js/core/checkout/PaymentMethodController.js @@ -376,10 +376,10 @@ PaymentMethodController.prototype.addCreditCardHolderNameListener = function(for } PaymentMethodController.prototype.addValidatorListener = function(formObject) { - var paymentMethodController = this; + const paymentMethodController = this; jQuery(formObject.containerSelector).on('change', function (event) { - var element = jQuery(event.target); + const element = jQuery(event.target); if ( element.attr('name').startsWith('payment[cc_type]') && element.val() !== 'default' @@ -728,15 +728,15 @@ PaymentMethodController.prototype.validateCcNumberField = function (element, for }; PaymentMethodController.prototype.validateCcExpDateField = function (formObject) { - var cardExpirationMonth = formObject.creditCardExpMonth; - var cardExpirationYear = formObject.creditCardExpYear; + const cardExpirationMonth = formObject.creditCardExpMonth; + const cardExpirationYear = formObject.creditCardExpYear; - var cardDate = new Date (cardExpirationYear.val(), cardExpirationMonth.val() -1); - var dateNow = new Date(); + const cardDate = new Date (cardExpirationYear.val(), cardExpirationMonth.val() -1); + const dateNow = new Date(); - var monthParentsElements = cardExpirationMonth.parent().parent(); - var yearParentsElements = cardExpirationYear.parent().parent(); - var parentsElements = yearParentsElements.parents('.field'); + const monthParentsElements = cardExpirationMonth.parent().parent(); + const yearParentsElements = cardExpirationYear.parent().parent(); + const parentsElements = yearParentsElements.parents('.field'); if (cardDate < dateNow) { monthParentsElements.addClass('_error'); @@ -752,9 +752,9 @@ PaymentMethodController.prototype.validateCcExpDateField = function (formObject) }; PaymentMethodController.prototype.validateDefaultField = function (element) { - var requiredElement = element.parent().parent(); + const requiredElement = element.parent().parent(); - if (element.val() == '') { + if (element.val() === '') { requiredElement.addClass('_error'); requiredElement.children('.field-error').show(); return true; @@ -766,8 +766,8 @@ PaymentMethodController.prototype.validateDefaultField = function (element) { }; PaymentMethodController.prototype.validateBrandField = function (formObject) { - var element = formObject.creditCardBrand; - var requiredElement = element.parent().parent(); + const element = formObject.creditCardBrand; + const requiredElement = element.parent().parent(); var brands = []; PlatformConfig.PlatformConfig.avaliableBrands[formObject.savedCardSelectUsed].forEach(function (item) { diff --git a/view/frontend/web/js/core/checkout/PlatformFormHandler.js b/view/frontend/web/js/core/checkout/PlatformFormHandler.js index 4d27a98a..620216ed 100644 --- a/view/frontend/web/js/core/checkout/PlatformFormHandler.js +++ b/view/frontend/web/js/core/checkout/PlatformFormHandler.js @@ -7,13 +7,13 @@ FormHandler.prototype.init = function (formObject) { }; FormHandler.prototype.switchBrand = function (brand) { - var brandsSelector = this.formObject.containerSelector + ' .brands'; - var brandElement = this.formObject.creditCardBrand; + const brandsSelector = this.formObject.containerSelector + ' .brands'; + const brandElement = this.formObject.creditCardBrand; jQuery(brandsSelector).css('filter', 'grayscale(100%) opacity(60%)'); if(typeof brand != 'undefined' && brand.length > 0){ - var brandSelector = + const brandSelector = this.formObject.containerSelector + ' .' + brand.toLowerCase();