From bd8a1a68d39219f37da57e0f143878ae5d42e4d2 Mon Sep 17 00:00:00 2001
From: Iryna Lagno <ilagno@ebay.com>
Date: Thu, 25 Jun 2015 17:18:49 +0300
Subject: [PATCH] MAGETWO-38647: credit card validation issue

---
 .../model/credit-card-validation/validator.js   | 17 ++++++++++++++---
 .../frontend/web/template/payment/cc-form.html  |  2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

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 dea84a03bdd..3b21f32dc80 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 87dfe38b878..e6d2a8dc4c2 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',
-- 
GitLab