diff --git a/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js b/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js index dea84a03bdd04e7b5fed66678f704e553ad5a371..3b21f32dc806cc346548c0337241e2301fd38054 100644 --- a/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js +++ b/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js @@ -29,7 +29,7 @@ function (number) { return creditCardNumberValidator(number).isValid; }, - 'Please enter a valid credit card number11.' + 'Please enter a valid credit card number.' ], 'validate-card-date': [ /** @@ -40,7 +40,7 @@ function (date) { return monthValidator(date).isValid; }, - 'Incorrect credit card expiration date11.' + 'Incorrect credit card expiration month.' ], 'validate-card-cvv': [ /** @@ -51,7 +51,18 @@ function (cvv) { return cvvValidator(cvv).isValid; }, - 'Please enter a valid credit card verification number11.' + 'Please enter a valid credit card verification number.' + ], + 'validate-card-year': [ + /** + * Validate credit card number based on mod 10 + * @param date - month + * @return {boolean} + */ + function (date) { + return monthValidator(date).isValid; + }, + 'Incorrect credit card expiration year.' ] }, function (i, rule) { diff --git a/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html b/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html index 87dfe38b878d893a69ee54940ba2540bb11bc3f3..e6d2a8dc4c2fa2adaf452260606fcc9853bebc88 100644 --- a/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html +++ b/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html @@ -66,7 +66,7 @@ <div class="control"> <select name="payment[cc_exp_year]" class="select select-year" - data-bind="attr: {id: getCode() + '_expiration_yr', 'data-container': getCode() + '-cc-year', 'data-validate': JSON.stringify({required:true})}, + data-bind="attr: {id: getCode() + '_expiration_yr', 'data-container': getCode() + '-cc-year', 'data-validate': JSON.stringify({required:true, 'validate-card-year':'#' + getCode() + '_expiration_yr'})}, enable: isActive($parents), options: getCcYearsValues(), optionsValue: 'value',