Skip to content

Commit 27b3d61

Browse files
committed
Update Hipercard, Elo, Visa and JCB validation pattern'
1 parent 5a3a004 commit 27b3d61

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ composer.lock
66

77
/build
88
/vendor
9+
.idea/

src/CreditCard.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@ class CreditCard
4646
// Credit cards
4747
'hipercard' => array(
4848
'type' => 'hipercard',
49-
'pattern' => '/^(606282\d{10}(\d{3})?)|(3841\d{15})$/',
49+
'pattern' => '/^((606282|637095|637568)[0-9]{10}|38[0-9]{14,17})$/',
5050
'length' => array(13, 16, 19),
5151
'cvcLength' => array(3),
5252
'luhn' => true,
5353
),
5454
'elo' => array(
5555
'type' => 'elo',
56-
'pattern' => '/^(4011(7[89])?)|43(1274|8935)|45(1416|7393|76(31|32)?)|50(4175|6699|67[0-7][0-8]|9\d{3})|627780|636(297|368|369)|6500(3([1-3]|[5-9])|4\d{1}|5[01])|650(4(0[5-9]|[1-3]\d{1}|8[5-9]|9\d{1})|5([0-2]\d{1}|3[0-8]|4[1-9]|5\d{1}|[6-8]\d{1}|9[0-8])|7(0\d{1}|1[0-8]|2[0-7])|9(0[1-9]|1\d{1}|20))|6516(5[2-9]|6\d{1}|7[0-9])|6550([01]\d{1}|2[1-9]|[34]\d{1}|5[0-8])/',
56+
'pattern' => '/^((50670[7-8])|(506715)|(50671[7-9])|(50672[0-1])|(50672[4-9])|(50673[0-3])|(506739)|(50674[0-8])|(50675[0-3])|(50677[4-8])|(50900[0-9])|(50901[3-9])|(50902[0-9])|(50903[1-9])|(50904[0-9])|(50905[0-9])|(50906[0-4])|(50906[6-9])|(50907[0-2])|(50907[4-5])|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|(457393)|(431274)|(50907[6-9])|(50908[0-9])|(627780))/',
5757
'length' => array(16),
5858
'cvcLength' => array(3),
5959
'luhn' => true,
6060
),
6161
'visa' => array(
6262
'type' => 'visa',
63-
'pattern' => '/^4/',
63+
'pattern' => '/^4[0-9]{15}$/',
6464
'length' => array(13, 16),
6565
'cvcLength' => array(3),
6666
'luhn' => true,
@@ -103,7 +103,7 @@ class CreditCard
103103
),
104104
'jcb' => array(
105105
'type' => 'jcb',
106-
'pattern' => '/^35/',
106+
'pattern' => '/(3[0-9]{15}|(2131|1800)[0-9]{11})/',
107107
'length' => array(16),
108108
'cvcLength' => array(3),
109109
'luhn' => true,

0 commit comments

Comments
 (0)