diff --git a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php index dcc5ad0cb80b2..50b015baad04e 100644 --- a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php @@ -78,6 +78,10 @@ class CardSchemeValidator extends ConstraintValidator '/^5[1-5][0-9]{14}$/', '/^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})$/', ], + // Payment system MIR numbers start with 220, then 1 digit from 0 to 4, then 12 digits + 'MIR' => [ + '/^220[0-4][0-9]{12}$/', + ], // All UATP card numbers start with a 1 and have a length of 15 digits. 'UATP' => [ '/^1[0-9]{14}$/', diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php index 24c23109f4615..ddc9edb6c094d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php @@ -103,6 +103,7 @@ public function getValidNumbers() ['MASTERCARD', '2699999999999999'], ['MASTERCARD', '2709999999999999'], ['MASTERCARD', '2720995105105100'], + ['MIR', '2200381427330082'], ['UATP', '110165309696173'], ['VISA', '4111111111111111'], ['VISA', '4012888888881881'], @@ -135,6 +136,7 @@ public function getInvalidNumbers() ['MASTERCARD', '2721001234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet ['MASTERCARD', '2220991234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet ['UATP', '11016530969617', CardScheme::INVALID_FORMAT_ERROR], // invalid length + ['MIR', '22003814273300821', CardScheme::INVALID_FORMAT_ERROR], // invalid length ]; } }