credit_card_detector 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b275b2204494c66c28dfb5eb23925b6ab6afc37b
4
- data.tar.gz: 8baec80bedec36a582aab73f65b6f552255459d2
2
+ SHA256:
3
+ metadata.gz: 48385279de1a7a74afcb8e801e4fe112eab34dcb9aed7c1d5c9b625d3a3bf18d
4
+ data.tar.gz: a09eae296c27ab046971dc7ea22a6ba9c0f6c0967a08b926e383bc9d64ba0188
5
5
  SHA512:
6
- metadata.gz: 8d7bc3057b56ff82481011092797d445d651f63bb3e04a81e551da38fa54157cc3740b5f5624bd233e721e5869d1a5bb46a92d28363f9fdf6155ff4fef501d91
7
- data.tar.gz: 762b2d41da9ff1779d406f9c6672e1c73addfd302ca240303c7b78c173566ee0f1c531a3d1e98eeae7cf9560afa9a9015072d4694fb04be4dd8a7e5b05b4d31d
6
+ metadata.gz: 4c781b164301c641778db4f7ba114f3f562d37c20608cc9542e36122026ed5c83589486c1973583cb36ae81449491d163cd6ac29e44d1b004a29f70ebcd8bac4
7
+ data.tar.gz: 03afb74cc4d02f2e5796f17dc5c2571cc238a45b78fd5d4ba4e1e9f178b813e454a1238d91725e9fe5036eafc10ed026b7f2b96e8abc117636dc1f0aa16b4db2
data/README.md CHANGED
@@ -37,6 +37,7 @@ The following issuing institutes are accepted:
37
37
  [JCB](http://en.wikipedia.org/wiki/Japan_Credit_Bureau) | :jcb
38
38
  [Maestro](http://en.wikipedia.org/wiki/Maestro_%28debit_card%29) | :maestro
39
39
  [MasterCard](http://en.wikipedia.org/wiki/MasterCard) | :mastercard
40
+ [MIR](http://www.nspk.ru/en/cards-mir/) | :mir
40
41
  [Rupay](http://en.wikipedia.org/wiki/RuPay) | :rupay
41
42
  [Solo](http://en.wikipedia.org/wiki/Solo_(debit_card)) | :solo
42
43
  [Switch](http://en.wikipedia.org/wiki/Switch_(debit_card)) | :switch
@@ -2,21 +2,24 @@ require "credit_card_detector/rule"
2
2
 
3
3
  module CreditCardDetector
4
4
  class Brand
5
- attr_reader :id, :name, :options
5
+ attr_reader :id, :options
6
6
 
7
7
  def initialize(id, data)
8
8
  @id = id
9
- @name = data.fetch(:name)
10
9
  @raw_rules = data.fetch(:rules)
11
10
  @options = data.fetch(:options, {})
12
11
  end
13
12
 
13
+ def name
14
+ options.fetch(:brand_name)
15
+ end
16
+
14
17
  def matches?(number)
15
18
  rules.any? { |rule| rule.matches? number }
16
19
  end
17
20
 
18
21
  def luhn?
19
- !@options.fetch(:skip_luhn, false)
22
+ !options.fetch(:skip_luhn, false)
20
23
  end
21
24
 
22
25
  def rules
@@ -1,4 +1,4 @@
1
1
  module CreditCardDetector
2
- VERSION = "0.3"
2
+ VERSION = "0.4"
3
3
  end
4
4
 
data/lib/data/brands.yaml CHANGED
@@ -1,14 +1,15 @@
1
1
  ---
2
2
  :visa:
3
- :name: Visa
4
3
  :rules:
5
4
  - :length:
6
5
  - 13
7
6
  - 16
7
+ - 19
8
8
  :prefixes:
9
9
  - '4'
10
+ :options:
11
+ :brand_name: Visa
10
12
  :mastercard:
11
- :name: MasterCard
12
13
  :rules:
13
14
  - :length:
14
15
  - 16
@@ -40,16 +41,18 @@
40
41
  - '53'
41
42
  - '54'
42
43
  - '55'
44
+ :options:
45
+ :brand_name: MasterCard
43
46
  :amex:
44
- :name: American Express
45
47
  :rules:
46
48
  - :length:
47
49
  - 15
48
50
  :prefixes:
49
51
  - '34'
50
52
  - '37'
53
+ :options:
54
+ :brand_name: American Express
51
55
  :diners:
52
- :name: Diners Club
53
56
  :rules:
54
57
  - :length:
55
58
  - 14
@@ -62,23 +65,10 @@
62
65
  - '305'
63
66
  - '36'
64
67
  - '38'
65
- :discover:
66
- :name: Discover
67
- :rules:
68
- - :length:
69
- - 16
70
- :prefixes:
71
- - '6011'
72
- - '644'
73
- - '645'
74
- - '646'
75
- - '647'
76
- - '648'
77
- - '649'
78
- - '65'
68
+ :options:
69
+ :brand_name: Diners Club
79
70
  :jcb:
80
- :name: JCB
81
- :rules:
71
+ :rules:
82
72
  - :length:
83
73
  - 15
84
74
  - 16
@@ -100,8 +90,9 @@
100
90
  - 19
101
91
  :prefixes:
102
92
  - '357266'
93
+ :options:
94
+ :brand_name: JCB
103
95
  :solo:
104
- :name: Solo
105
96
  :rules:
106
97
  - :length:
107
98
  - 16
@@ -111,7 +102,6 @@
111
102
  - '6334'
112
103
  - '6767'
113
104
  :switch:
114
- :name: Switch
115
105
  :rules:
116
106
  - :length:
117
107
  - 16
@@ -125,7 +115,6 @@
125
115
  - '633301'
126
116
  - '633300'
127
117
  :maestro:
128
- :name: Maestro
129
118
  :rules:
130
119
  - :length:
131
120
  - 12
@@ -173,11 +162,42 @@
173
162
  - '604'
174
163
  - '605'
175
164
  - '6060'
176
- - '621'
177
- - '627'
178
- - '629'
179
- - '6304'
180
- - '6390'
165
+ - '616788'
166
+ - '62183'
167
+ - '62186'
168
+ - '62188'
169
+ - '62198'
170
+ - '62199'
171
+ - '6220'
172
+ - '622110'
173
+ - '627089'
174
+ - '62709601'
175
+ - '6271'
176
+ - '6272'
177
+ - '6273'
178
+ - '6274'
179
+ - '6275'
180
+ - '6276'
181
+ - '6277'
182
+ - '6278'
183
+ - '6279'
184
+ - '6280'
185
+ - '6281'
186
+ - '6294'
187
+ - '6301'
188
+ - '630490'
189
+ - '633857'
190
+ - '63609'
191
+ - '6361'
192
+ - '636392'
193
+ - '636708'
194
+ - '637043'
195
+ - '637102'
196
+ - '637118'
197
+ - '637187'
198
+ - '637529'
199
+ - '639'
200
+ - '64'
181
201
  - '670'
182
202
  - '671'
183
203
  - '672'
@@ -197,7 +217,6 @@
197
217
  - '6771'
198
218
  - '679'
199
219
  :unionpay:
200
- :name: China UnionPay
201
220
  :rules:
202
221
  - :length:
203
222
  - 16
@@ -205,22 +224,68 @@
205
224
  - 18
206
225
  - 19
207
226
  :prefixes:
208
- - '622'
227
+ - '620'
228
+ - '6210'
229
+ - '6212'
230
+ - '6213'
231
+ - '6214'
232
+ - '6215'
233
+ - '6216'
234
+ - '6217'
235
+ - '621977'
236
+ - '622126'
237
+ - '622127'
238
+ - '622128'
239
+ - '622129'
240
+ - '62213'
241
+ - '62214'
242
+ - '62215'
243
+ - '62216'
244
+ - '62217'
245
+ - '62218'
246
+ - '62220'
247
+ - '62221'
248
+ - '62222'
249
+ - '62223'
250
+ - '62224'
251
+ - '62225'
252
+ - '62226'
253
+ - '62227'
254
+ - '62228'
255
+ - '62229'
256
+ - '6223'
257
+ - '6224'
258
+ - '6225'
259
+ - '6226'
260
+ - '6227'
261
+ - '6228'
262
+ - '6229'
263
+ - '623'
209
264
  - '624'
210
265
  - '625'
211
266
  - '626'
212
- - '628'
267
+ - '62702'
268
+ - '62704'
269
+ - '62706'
270
+ - '62707'
271
+ - '6282'
272
+ - '6283'
273
+ - '6284'
274
+ - '6291'
275
+ - '6292'
276
+ - '632062'
277
+ - '685800'
278
+ - '69075'
213
279
  :options:
214
280
  :skip_luhn: true
281
+ :brand_name: China UnionPay
215
282
  :dankort:
216
- :name: Dankort
217
283
  :rules:
218
284
  - :length:
219
285
  - 16
220
286
  :prefixes:
221
287
  - '5019'
222
288
  :rupay:
223
- :name: Rupay
224
289
  :rules:
225
290
  - :length:
226
291
  - 16
@@ -239,43 +304,186 @@
239
304
  :options:
240
305
  :skip_luhn: true
241
306
  :hipercard:
242
- :name: Hipercard
243
307
  :rules:
244
308
  - :length:
245
309
  - 19
246
310
  :prefixes:
247
311
  - '384'
312
+ - '606282'
313
+ - '637095'
314
+ - '637568'
315
+ - '637599'
316
+ - '637609'
317
+ - '637612'
248
318
  :elo:
249
- :name: Elo
250
319
  :rules:
251
320
  - :length:
252
321
  - 16
253
322
  :prefixes:
254
- - '4011'
323
+ - '401178'
324
+ - '401179'
325
+ - '431274'
255
326
  - '438935'
256
327
  - '451416'
257
- - '4576'
328
+ - '457393'
329
+ - '457631'
330
+ - '457632'
258
331
  - '504175'
259
332
  - '506699'
260
- - '5067'
261
- - '509040'
262
- - '509042'
263
- - '509043'
264
- - '509045'
265
- - '509046'
266
- - '509047'
267
- - '509048'
268
- - '509049'
333
+ - '50670'
334
+ - '50671'
335
+ - '506717'
336
+ - '506718'
337
+ - '50672'
338
+ - '506720'
339
+ - '506721'
340
+ - '506724'
341
+ - '506725'
342
+ - '506726'
343
+ - '506727'
344
+ - '506728'
345
+ - '506729'
346
+ - '50673'
347
+ - '50674'
348
+ - '50675'
349
+ - '50676'
350
+ - '506770'
351
+ - '506771'
352
+ - '506772'
353
+ - '506773'
354
+ - '506774'
355
+ - '506775'
356
+ - '506776'
357
+ - '506777'
358
+ - '506778'
359
+ - '50900'
360
+ - '509013'
361
+ - '50902'
362
+ - '509031'
363
+ - '509033'
364
+ - '509035'
365
+ - '509036'
366
+ - '509037'
367
+ - '509038'
368
+ - '509039'
369
+ - '50904'
269
370
  - '509050'
270
371
  - '509051'
271
372
  - '509052'
373
+ - '509053'
272
374
  - '509064'
273
375
  - '509066'
274
376
  - '509067'
275
377
  - '509068'
276
378
  - '509069'
379
+ - '509072'
277
380
  - '509074'
381
+ - '509076'
382
+ - '509077'
383
+ - '509078'
384
+ - '509079'
385
+ - '509080'
386
+ - '509081'
387
+ - '509082'
388
+ - '509083'
389
+ - '509085'
278
390
  - '636297'
279
- - '63636'
391
+ - '636368'
392
+ - '650031'
393
+ - '650032'
394
+ - '650033'
395
+ - '650035'
396
+ - '650036'
397
+ - '650037'
398
+ - '650038'
399
+ - '650039'
400
+ - '65004'
401
+ - '650050'
402
+ - '650051'
403
+ - '650405'
404
+ - '650406'
405
+ - '650407'
406
+ - '650408'
407
+ - '650409'
408
+ - '65041'
409
+ - '65042'
410
+ - '65043'
411
+ - '650485'
412
+ - '650486'
413
+ - '650487'
414
+ - '650488'
415
+ - '650489'
416
+ - '65049'
417
+ - '65050'
418
+ - '65051'
419
+ - '65052'
420
+ - '650530'
421
+ - '650531'
422
+ - '650532'
423
+ - '650533'
424
+ - '650534'
425
+ - '650535'
426
+ - '650536'
427
+ - '650537'
428
+ - '650538'
429
+ - '650541'
430
+ - '650700'
431
+ - '650720'
432
+ - '650901'
433
+ - '650921'
434
+ - '650922'
435
+ - '650923'
436
+ - '650924'
437
+ - '650925'
438
+ - '650926'
439
+ - '650927'
440
+ - '650928'
441
+ - '650929'
442
+ - '65093'
443
+ - '65094'
444
+ - '65095'
445
+ - '65096'
446
+ - '650970'
447
+ - '650971'
448
+ - '650972'
449
+ - '650973'
450
+ - '650974'
451
+ - '650975'
452
+ - '650976'
453
+ - '650977'
454
+ - '650978'
455
+ - '651652'
456
+ - '65500'
457
+ - '65501'
458
+ - '655021'
459
+ - '65503'
460
+ - '65504'
280
461
  :options:
281
462
  :skip_luhn: true
463
+ :brand_name: Elo
464
+ :mir:
465
+ :rules:
466
+ - :length:
467
+ - 16
468
+ :prefixes:
469
+ - '2200'
470
+ - '2201'
471
+ - '2202'
472
+ - '2203'
473
+ - '2204'
474
+ :discover:
475
+ :rules:
476
+ - :length:
477
+ - 16
478
+ - 19
479
+ :prefixes:
480
+ - '6011'
481
+ - '644'
482
+ - '645'
483
+ - '646'
484
+ - '647'
485
+ - '648'
486
+ - '649'
487
+ - '65'
488
+ :options:
489
+ :brand_name: Discover
@@ -56,9 +56,44 @@
56
56
  - 5641 8200 0000 0005
57
57
  - 5033 9619 8909 17
58
58
  - 5868 2416 0825 5333 38
59
+ - 6167 8856 4660 5238
60
+ - 6218 3782 7162 0705
61
+ - 6218 6064 1843 1366
62
+ - 6218 8455 3580 6171
63
+ - 6219 8470 1538 3118
64
+ - 6219 9203 6534 5837
65
+ - 6220 1885 7707 6726
66
+ - 6221 1083 1803 2381
67
+ - 6270 8984 1174 5752
68
+ - 6270 9601 6484 7142
69
+ - 6271 0126 3275 2014
70
+ - 6272 5470 0241 5113
71
+ - 6273 5523 8170 6073
72
+ - 6274 4145 1171 2555
73
+ - 6275 3486 8618 0058
74
+ - 6276 0982 4454 3458
75
+ - 6277 6702 4773 1576
76
+ - 6278 1636 1660 6511
77
+ - 6279 7366 4387 5768
78
+ - 6280 4737 1307 4604
79
+ - 6281 5524 1682 8637
80
+ - 6294 4318 2601 2816
81
+ - 6301 1412 8720 7778
82
+ - 6304 9003 0332 3654
83
+ - 6304 9086 6523 0248 21
84
+ - 6338 5705 2835 6175
85
+ - 6360 9440 0747 0123
86
+ - 6361 4178 1150 8502
87
+ - 6363 9214 5556 2632
88
+ - 6367 0803 6033 4748
89
+ - 6370 4379 0022 2632
90
+ - 6371 0283 5125 2860
91
+ - 6371 1802 0780 5415
92
+ - 6371 8718 1864 7655
93
+ - 6375 2978 8623 4844
94
+ - 6400 0578 8840 6561
59
95
  - 6799 9901 0000 0000 019
60
96
  - 6390 0200 0000 000003
61
- - 6304 9506 0000 0000 00
62
97
  - 6304 9000 1774 0292 441
63
98
  :jcb:
64
99
  - 3575 7591 5225 4876
@@ -74,9 +109,61 @@
74
109
  - 6334 7306 0000 0000 00
75
110
  - 6767 6767 6767 6767 671
76
111
  :unionpay:
112
+ - 6205 4687 6758 6422
113
+ - 6210 0345 5222 3424
114
+ - 6212 2545 6614 8478
115
+ - 6213 0005 0723 4136
116
+ - 6214 0114 0514 5414
117
+ - 6215 4794 3842 9213
118
+ - 6216 2080 3647 3680
119
+ - 6217 3228 8155 9136
120
+ - 6219 7704 6772 7014
121
+ - 6221 2610 6056 0875
122
+ - 6221 2703 3387 7511
123
+ - 6221 2860 4501 8723
124
+ - 6221 2940 0187 5508
125
+ - 6221 3008 0432 3735
126
+ - 6221 4035 2650 5041
127
+ - 6221 5050 3211 0387
128
+ - 6221 6206 2057 6335
129
+ - 6221 7084 6822 1773
130
+ - 6221 8075 5266 5356
131
+ - 6222 0036 3722 7888
132
+ - 6222 1058 8000 7162
133
+ - 6222 2061 3672 5803
134
+ - 6222 3068 2276 5616
135
+ - 6222 4053 4600 2835
136
+ - 6222 5203 3381 7225
137
+ - 6222 6080 1686 1014
138
+ - 6222 7088 5121 8153
139
+ - 6222 8035 1083 2211
140
+ - 6222 9175 6828 0444
141
+ - 6223 7906 8294 4834
142
+ - 6224 0617 0122 1813
143
+ - 6225 2033 2312 4467
144
+ - 6226 0315 6271 3412
145
+ - 6227 5171 6866 2101
146
+ - 6228 3658 3631 6034
147
+ - 6229 9701 3846 6087
148
+ - 6230 0388 8477 1162
149
+ - 6234 6051 1836 1717
150
+ - 6244 1608 1703 3165
151
+ - 6251 7173 7983 2118
152
+ - 6262 1704 1722 3287
77
153
  - 6264 1852 1292 2132 067
78
- - 6288 9977 1545 2584
79
154
  - 6269 9920 5813 4322
155
+ - 6270 2754 6260 5740
156
+ - 6270 4000 5254 5060
157
+ - 6270 6014 6481 7266
158
+ - 6270 7647 4746 0500
159
+ - 6282 7754 7900 5608
160
+ - 6283 5632 6428 3062
161
+ - 6284 6110 6682 6452
162
+ - 6291 8025 7481 1158
163
+ - 6292 6014 3461 6826
164
+ - 6320 6205 2613 4288
165
+ - 6858 0012 5116 6441
166
+ - 6907 5577 4227 8443
80
167
  :dankort:
81
168
  - 5019 7170 1010 3742
82
169
  :switch:
@@ -87,10 +174,10 @@
87
174
  :hipercard:
88
175
  - 3841 0058 9908 8180 330
89
176
  :elo:
90
- - '4011 4141 3850 9070'
177
+ - '4011 7841 3850 9070'
91
178
  - '4389 3555 4728 7502'
92
- - '4514 1620 5642 0699'
93
- - '4576 5598 7564 9522'
179
+ - '4573 9320 5642 0699'
180
+ - '4576 3198 7564 9522'
94
181
  - '5041 7572 2687 1008'
95
182
  - '5066 9917 1703 9876'
96
183
  - '5067 5391 6526 0388'
@@ -113,3 +200,7 @@
113
200
  - '5090 7463 8779 6948'
114
201
  - '6362 9745 2190 7765'
115
202
  - '6363 6850 2897 2643'
203
+ - '6504 9799 9991 0279'
204
+ - '6516 5299 9991 0328'
205
+ :mir:
206
+ - 2202 1234 1234 1234
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credit_card_detector
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Volozhanin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-20 00:00:00.000000000 Z
12
+ date: 2018-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.5.1
108
+ rubygems_version: 2.7.3
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Gem provides basic credit card number validation and type detection without