File tree Expand file tree Collapse file tree 3 files changed +106
-0
lines changed Expand file tree Collapse file tree 3 files changed +106
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace LVR \CreditCard \Cards ;
4+
5+ use LVR \CreditCard \Contracts \CreditCard ;
6+
7+ class Elo extends Card implements CreditCard
8+ {
9+ /**
10+ * Regular expression for card number recognition.
11+ *
12+ * @var string
13+ */
14+ public static $ pattern = '/^(40117[8-9]|431274|438935|451416|457393|45763[1-2]|506(699|7[0-6][0-9]|77[0-8])|509\d{3}|504175|627780|636297|636368|65003[1-3]|6500(3[5-9]|4[0-9]|5[0-1])|6504(0[5-9]|[1-3][0-9])|650(4[8-9][0-9]|5[0-2][0-9]|53[0-8])|6505(4[1-9]|[5-8][0-9]|9[0-8])|6507(0[0-9]|1[0-8])|65072[0-7]|6509(0[1-9]|1[0-9]|20)|6516(5[2-9]|[6-7][0-9])|6550([0-1][0-9]|2[1-9]|[3-4][0-9]|5[0-8]))/ ' ;
15+
16+ /**
17+ * Credit card type.
18+ *
19+ * @var string
20+ */
21+ protected $ type = 'credit ' ;
22+
23+ /**
24+ * Credit card name.
25+ *
26+ * @var string
27+ */
28+ protected $ name = 'elo ' ;
29+
30+ /**
31+ * Brand name.
32+ *
33+ * @var string
34+ */
35+ protected $ brand = 'Elo ' ;
36+
37+ /**
38+ * Card number length's.
39+ *
40+ * @var array
41+ */
42+ protected $ number_length = [16 ];
43+
44+ /**
45+ * CVC code length's.
46+ *
47+ * @var array
48+ */
49+ protected $ cvc_length = [3 ];
50+
51+ /**
52+ * Test cvc code checksum against Luhn algorithm.
53+ *
54+ * @var bool
55+ */
56+ protected $ checksum_test = true ;
57+ }
Original file line number Diff line number Diff line change 66use LVR \CreditCard \Cards \Dankort ;
77use LVR \CreditCard \Cards \DinersClub ;
88use LVR \CreditCard \Cards \Discovery ;
9+ use LVR \CreditCard \Cards \Elo ;
910use LVR \CreditCard \Cards \Forbrugsforeningen ;
1011use LVR \CreditCard \Cards \Hipercard ;
1112use LVR \CreditCard \Cards \Jcb ;
@@ -26,6 +27,7 @@ class Factory
2627 Forbrugsforeningen::class,
2728 Maestro::class,
2829 VisaElectron::class,
30+ Elo::class,
2931 // Debit cards
3032 AmericanExpress::class,
3133 DinersClub::class,
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace LVR \CreditCard \Tests \Unit \Cards ;
4+
5+ use Illuminate \Support \Collection ;
6+ use LVR \CreditCard \Cards \Elo ;
7+
8+ class EloTest extends BaseCardTests
9+ {
10+ public $ instance = Elo::class;
11+
12+ /**
13+ * @return \Illuminate\Support\Collection
14+ */
15+ public function validNumbers (): Collection
16+ {
17+ return collect ([
18+ '6363685305150464 ' ,
19+ '6363682833437620 ' ,
20+ '4514165077816223 ' ,
21+ '4389354567568609 '
22+ ]);
23+ }
24+
25+ /**
26+ * @return \Illuminate\Support\Collection
27+ */
28+ public function numbersWithInvalidLength (): Collection
29+ {
30+ return collect ([
31+ '6011111 ' ,
32+ '601111111111111 ' ,
33+ '60110009901394241 '
34+ ]);
35+ }
36+
37+ /**
38+ * @return \Illuminate\Support\Collection
39+ */
40+ public function numbersWithInvalidCheckSum (): Collection
41+ {
42+ return collect ([
43+ '6011111111111118 ' ,
44+ '6011000990139423 '
45+ ]);
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments