File tree Expand file tree Collapse file tree 4 files changed +103
-0
lines changed Expand file tree Collapse file tree 4 files changed +103
-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 Hipercard extends Card implements CreditCard
8+ {
9+ /**
10+ * Regular expression for card number recognition.
11+ *
12+ * @var string
13+ */
14+ public static $ pattern = '/^(606282\d{10}(\d{3})?)|(3841\d{15})/ ' ;
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 = 'hipercard ' ;
29+
30+ /**
31+ * Brand name.
32+ *
33+ * @var string
34+ */
35+ protected $ brand = 'Hipercard ' ;
36+
37+ /**
38+ * Card number length's.
39+ *
40+ * @var array
41+ */
42+ protected $ number_length = [13 , 16 , 19 ];
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 99use LVR \CreditCard \Cards \Maestro ;
1010use LVR \CreditCard \Cards \UnionPay ;
1111use LVR \CreditCard \Cards \Discovery ;
12+ use LVR \CreditCard \Cards \Hipercard ;
1213use LVR \CreditCard \Cards \DinersClub ;
1314use LVR \CreditCard \Cards \Mastercard ;
1415use LVR \CreditCard \Cards \VisaElectron ;
@@ -29,6 +30,7 @@ class Factory
2930 DinersClub::class,
3031 Discovery::class,
3132 Jcb::class,
33+ Hipercard::class,
3234 Mastercard::class,
3335 UnionPay::class,
3436 Visa::class,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ abstract class BaseCardTests extends TestCase
2828 DinersClubTest::class,
2929 DiscoveryTest::class,
3030 JcbTest::class,
31+ HipercardTest::class,
3132 MastercardTest::class,
3233 UnionPayTest::class,
3334 VisaTest::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 \Hipercard ;
7+
8+ class HipercardTest extends BaseCardTests
9+ {
10+ public $ instance = Hipercard::class;
11+
12+ /**
13+ * @return \Illuminate\Support\Collection
14+ */
15+ public function validNumbers (): Collection
16+ {
17+ return collect ([
18+ '6062826043427285 ' ,
19+ '6062820114738720 ' ,
20+ '6062820090765804 ' ,
21+ ]);
22+ }
23+
24+ /**
25+ * @return \Illuminate\Support\Collection
26+ */
27+ public function numbersWithInvalidLength (): Collection
28+ {
29+ return collect ([
30+ '60628260434272857 ' ,
31+ ]);
32+ }
33+
34+ /**
35+ * @return \Illuminate\Support\Collection
36+ */
37+ public function numbersWithInvalidCheckSum (): Collection
38+ {
39+ return collect ([
40+ '5121647321685222 ' ,
41+ ]);
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments