Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81faf42

Browse files
feature #30377 [Validator] add MIR card scheme (antonch1989)
This PR was squashed before being merged into the 4.3-dev branch (closes #30377). Discussion ---------- [Validator] add MIR card scheme | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30376 | License | MIT Commits ------- aecb33a [Validator] add MIR card scheme
2 parents 5b38e17 + aecb33a commit 81faf42

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ class CardSchemeValidator extends ConstraintValidator
7878
'/^5[1-5][0-9]{14}$/',
7979
'/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/',
8080
],
81+
// Payment system MIR numbers start with 220, then 1 digit from 0 to 4, then 12 digits
82+
'MIR' => [
83+
'/^220[0-4][0-9]{12}$/',
84+
],
8185
// All UATP card numbers start with a 1 and have a length of 15 digits.
8286
'UATP' => [
8387
'/^1[0-9]{14}$/',

src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function getValidNumbers()
103103
['MASTERCARD', '2699999999999999'],
104104
['MASTERCARD', '2709999999999999'],
105105
['MASTERCARD', '2720995105105100'],
106+
['MIR', '2200381427330082'],
106107
['UATP', '110165309696173'],
107108
['VISA', '4111111111111111'],
108109
['VISA', '4012888888881881'],
@@ -135,6 +136,7 @@ public function getInvalidNumbers()
135136
['MASTERCARD', '2721001234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet
136137
['MASTERCARD', '2220991234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet
137138
['UATP', '11016530969617', CardScheme::INVALID_FORMAT_ERROR], // invalid length
139+
['MIR', '22003814273300821', CardScheme::INVALID_FORMAT_ERROR], // invalid length
138140
];
139141
}
140142
}

0 commit comments

Comments
 (0)