Skip to content

Commit aecb33a

Browse files
antonch1989nicolas-grekas
authored andcommitted
[Validator] add MIR card scheme
1 parent d2e9a70 commit aecb33a

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy