File tree Expand file tree Collapse file tree 4 files changed +111
-0
lines changed Expand file tree Collapse file tree 4 files changed +111
-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+ /**
8+ * Class Mir.
9+ * @link https://nspk.com/
10+ 11+ */
12+ class Mir extends Card implements CreditCard
13+ {
14+ /**
15+ * Regular expression for card number recognition.
16+ *
17+ * @var string
18+ */
19+ public static $ pattern = '/^220/ ' ;
20+
21+ /**
22+ * Credit card type.
23+ *
24+ * @var string
25+ */
26+ protected $ type = 'credit ' ;
27+
28+ /**
29+ * Credit card name.
30+ *
31+ * @var string
32+ */
33+ protected $ name = 'mir ' ;
34+
35+ /**
36+ * Brand name.
37+ *
38+ * @var string
39+ */
40+ protected $ brand = 'Mir ' ;
41+
42+ /**
43+ * Card number length's.
44+ *
45+ * @var array
46+ */
47+ protected $ number_length = [16 ];
48+
49+ /**
50+ * CVC code length's.
51+ *
52+ * @var array
53+ */
54+ protected $ cvc_length = [3 ];
55+
56+ /**
57+ * Test cvc code checksum against Luhn algorithm.
58+ *
59+ * @var bool
60+ */
61+ protected $ checksum_test = true ;
62+ }
Original file line number Diff line number Diff line change 33namespace LVR \CreditCard ;
44
55use LVR \CreditCard \Cards \Jcb ;
6+ use LVR \CreditCard \Cards \Mir ;
67use LVR \CreditCard \Cards \Visa ;
78use LVR \CreditCard \Cards \Dankort ;
89use LVR \CreditCard \Cards \Maestro ;
@@ -31,6 +32,7 @@ class Factory
3132 Mastercard::class,
3233 UnionPay::class,
3334 Visa::class,
35+ Mir::class,
3436 ];
3537
3638 /**
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ abstract class BaseCardTests extends TestCase
3131 MastercardTest::class,
3232 UnionPayTest::class,
3333 VisaTest::class,
34+ MirTest::class,
3435 ];
3536
3637 /** @test **/
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace LVR \CreditCard \Tests \Unit \Cards ;
4+
5+ use LVR \CreditCard \Cards \Mir ;
6+ use Illuminate \Support \Collection ;
7+
8+ class MirTest extends BaseCardTests
9+ {
10+ public $ instance = Mir::class;
11+
12+ /**
13+ * @return \Illuminate\Support\Collection
14+ */
15+ public function validNumbers (): Collection
16+ {
17+ return collect ([
18+ '2200654321000000 ' ,
19+ '2200420152000000 ' ,
20+ ]);
21+ }
22+
23+ /**
24+ * @return \Illuminate\Support\Collection
25+ */
26+ public function numbersWithInvalidLength (): Collection
27+ {
28+ return collect ([
29+ '2200 ' ,
30+ '220065 ' ,
31+ '220065432 ' ,
32+ '220065432100000 ' ,
33+ ]);
34+ }
35+
36+ /**
37+ * @return \Illuminate\Support\Collection
38+ */
39+ public function numbersWithInvalidCheckSum (): Collection
40+ {
41+ return collect ([
42+ '2200123456789010 ' ,
43+ '2200010400000000 ' ,
44+ ]);
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments