credit_card_validations 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f5f0a03dc86415f03764d9f870e29eda0d0d221
4
- data.tar.gz: 72bc861255c3463819e5a029b3eff1289f474956
3
+ metadata.gz: d7555060ec21b35f9dc425aa216b36cc1b126225
4
+ data.tar.gz: f76e3f36fd956a06fb0cc8b544395c02d50f9190
5
5
  SHA512:
6
- metadata.gz: 8945328360f2f8e58d2b326587d444577648bf4100fe1818335cdeceda2c11c141384ff580bace1c78fdb3030f5f298eb20123fe5ec53a2add8ccf2f83785fc0
7
- data.tar.gz: 17b858e627462948ece1103cc8584fba8f9da6665ac292bb9e9fbb1365407f19734d8595cdacb886a52fd3ada9cdf57ff8cf9c9f3ef8d25e08b055b0174682dc
6
+ metadata.gz: 18a97a9be61025a54de8ba408aa2c88ec6f3c1179499dbab2ff2cd9f79613ecd95eb127c2058f277238e48da4e43a1009c6f2958afb6237a31c6e42fa6ff6fd3
7
+ data.tar.gz: 1719ca2c69d515ef005ac9fd5ff458fe5e6c47fad3a8993e19d9313c128854d364f95aa95ab5ac1115001cc0283f571d36747e9ae129fbaa7e691c91ccb01fe4
@@ -1,26 +1,19 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.9
6
- - 2.2.5
7
- - 2.3.1
8
- - jruby-9.1.6.0
3
+ - 2.1.10
4
+ - 2.2.8
5
+ - 2.3.5
6
+ - jruby-9.1.15.0
9
7
  gemfile:
10
8
  - gemfiles/rails1-4.gemfile
11
9
  - gemfiles/rails5.gemfile
12
10
  matrix:
13
11
  exclude:
14
12
  - gemfile: gemfiles/rails5.gemfile
15
- rvm: 1.9.3
16
- - gemfile: gemfiles/rails5.gemfile
17
- rvm: 2.0.0
18
- - gemfile: gemfiles/rails5.gemfile
19
- rvm: 2.1.9
13
+ rvm: 2.1.10
20
14
  - gemfile: gemfiles/rails5.gemfile
21
15
  rvm: jruby-9.1.6.0
16
+
22
17
  before_install:
23
- - gem update --system
24
- - rvm @global do gem uninstall bundler -a -x
25
- - rvm @global do gem install bundler -v 1.13.7
26
- - gem --version
18
+ - gem update --system # use the very latest Rubygems
19
+ - gem install bundler # use the very latest Bundler
@@ -1,3 +1,9 @@
1
+ # 3.5.0
2
+ * Belkart support enhanced, PR #86
3
+ * Unionpay and Maestro range updates, PR #88
4
+ * Hipercard range updates , PR #79
5
+ * Visa and Discover length fix, PR #81
6
+
1
7
  # 3.4.0
2
8
  * Elo support enhanced, PR #75
3
9
 
data/README.md CHANGED
@@ -16,22 +16,28 @@ More info about card BIN numbers http://en.wikipedia.org/wiki/Bank_card_number
16
16
 
17
17
  Add this line to your application's Gemfile:
18
18
 
19
- gem 'credit_card_validations'
19
+ ```sh
20
+ $ gem 'credit_card_validations'
21
+ ```
20
22
 
21
23
  And then execute:
22
24
 
23
- $ bundle
25
+ ```sh
26
+ $ bundle
27
+ ```
24
28
 
25
29
  Or install it yourself as:
26
30
 
27
- $ gem install credit_card_validations
31
+ ```sh
32
+ $ gem install credit_card_validations
33
+ ```
28
34
 
29
35
  ## Usage
30
36
 
31
37
 
32
38
  The following issuing institutes are accepted:
33
39
 
34
- Name | Key |
40
+ | Name | Key |
35
41
  --------------------- | ------------|
36
42
  [American Express](http://en.wikipedia.org/wiki/American_Express) | :amex
37
43
  [China UnionPay](http://en.wikipedia.org/wiki/China_UnionPay) | :unionpay
@@ -53,7 +59,7 @@ The following issuing institutes are accepted:
53
59
 
54
60
  The following are supported with with plugins
55
61
 
56
- Name | Key |
62
+ | Name | Key |
57
63
  --------------------- | ------------|
58
64
  [Diners Club US](http://en.wikipedia.org/wiki/Diners_Club_International#MasterCard_alliance) | :diners_us
59
65
  [EnRoute](https://en.wikipedia.org/wiki/EnRoute_(credit_card)) | :en_route
@@ -64,12 +70,12 @@ The following are supported with with plugins
64
70
  ### Examples using string monkey patch
65
71
 
66
72
  ```ruby
67
- require 'credit_card_validations/string'
68
- '5274 5763 9425 9961'.credit_card_brand #=> :mastercard
69
- '5274 5763 9425 9961'.credit_card_brand_name #=> "MasterCard"
70
- '5274 5763 9425 9961'.valid_credit_card_brand?(:mastercard, :visa) #=> true
71
- '5274 5763 9425 9961'.valid_credit_card_brand?(:amex) #=> false
72
- '5274 5763 9425 9961'.valid_credit_card_brand?('MasterCard') #=> true
73
+ require 'credit_card_validations/string'
74
+ '5274 5763 9425 9961'.credit_card_brand #=> :mastercard
75
+ '5274 5763 9425 9961'.credit_card_brand_name #=> "MasterCard"
76
+ '5274 5763 9425 9961'.valid_credit_card_brand?(:mastercard, :visa) #=> true
77
+ '5274 5763 9425 9961'.valid_credit_card_brand?(:amex) #=> false
78
+ '5274 5763 9425 9961'.valid_credit_card_brand?('MasterCard') #=> true
73
79
  ```
74
80
 
75
81
  ### ActiveModel support
@@ -77,73 +83,72 @@ The following are supported with with plugins
77
83
  only for certain brands
78
84
 
79
85
  ```ruby
80
- class CreditCardModel
81
- attr_accessor :number
82
- include ActiveModel::Validations
83
- validates :number, credit_card_number: {brands: [:amex, :maestro]}
84
- end
86
+ class CreditCardModel
87
+ attr_accessor :number
88
+ include ActiveModel::Validations
89
+ validates :number, credit_card_number: {brands: [:amex, :maestro]}
90
+ end
85
91
  ```
86
92
 
87
93
  for all known brands
88
94
 
89
- ```ruby
90
- validates :number, presence: true, credit_card_number: true
95
+ ```ruby
96
+ validates :number, presence: true, credit_card_number: true
91
97
  ```
92
98
 
93
99
  ### Examples using CreditCardValidations::Detector class
94
100
 
95
- ```ruby
96
- number = "4111111111111111"
97
- detector = CreditCardValidations::Detector.new(number)
98
- detector.brand #:visa
99
- detector.visa? #true
100
- detector.valid?(:mastercard,:maestro) #false
101
- detector.valid?(:visa, :mastercard) #true
102
- detector.issuer_category #"Banking and financial"
101
+ ```ruby
102
+ number = "4111111111111111"
103
+ detector = CreditCardValidations::Detector.new(number)
104
+ detector.brand #:visa
105
+ detector.visa? #true
106
+ detector.valid?(:mastercard,:maestro) #false
107
+ detector.valid?(:visa, :mastercard) #true
108
+ detector.issuer_category #"Banking and financial"
103
109
  ```
104
110
 
105
111
  ### Also You can add your own brand rules to detect other credit card brands/types
106
112
  passing name,length(integer/array of integers) and prefix(string/array of strings)
107
113
  Example
108
114
 
109
- ```ruby
110
- CreditCardValidations.add_brand(:voyager, {length: 15, prefixes: '86'})
111
- voyager_test_card_number = '869926275400212'
112
- CreditCardValidations::Detector.new(voyager_test_card_number).brand #:voyager
113
- CreditCardValidations::Detector.new(voyager_test_card_number).voyager? #true
115
+ ```ruby
116
+ CreditCardValidations.add_brand(:voyager, {length: 15, prefixes: '86'})
117
+ voyager_test_card_number = '869926275400212'
118
+ CreditCardValidations::Detector.new(voyager_test_card_number).brand #:voyager
119
+ CreditCardValidations::Detector.new(voyager_test_card_number).voyager? #true
114
120
  ```
115
121
 
116
122
  ### Remove brands also supported
117
123
 
118
124
  ```ruby
119
- CreditCardValidations::Detector.delete_brand(:maestro)
125
+ CreditCardValidations::Detector.delete_brand(:maestro)
120
126
  ```
121
127
 
122
128
  ### Check luhn
123
129
 
124
- ```ruby
125
- CreditCardValidations::Detector.new(@credit_card_number).valid_luhn?
126
- #or
127
- CreditCardValidations::Luhn.valid?(@credit_card_number)
130
+ ```ruby
131
+ CreditCardValidations::Detector.new(@credit_card_number).valid_luhn?
132
+ #or
133
+ CreditCardValidations::Luhn.valid?(@credit_card_number)
128
134
  ```
129
135
 
130
136
  ### Generate credit card numbers that pass validation
131
137
 
132
138
  ```ruby
133
- CreditCardValidations::Factory.random(:amex)
134
- # => "348051773827666"
135
- CreditCardValidations::Factory.random(:maestro)
136
- # => "6010430241237266856"
139
+ CreditCardValidations::Factory.random(:amex)
140
+ # => "348051773827666"
141
+ CreditCardValidations::Factory.random(:maestro)
142
+ # => "6010430241237266856"
137
143
  ```
138
144
 
139
145
  ### Plugins
140
146
 
141
- ```ruby
142
- require 'credit_card_validations/plugins/en_route'
143
- require 'credit_card_validations/plugins/laser'
144
- require 'credit_card_validations/plugins/diners_us'
145
-
146
- ```
147
+ ```ruby
148
+ require 'credit_card_validations/plugins/en_route'
149
+ require 'credit_card_validations/plugins/laser'
150
+ require 'credit_card_validations/plugins/diners_us'
151
+ ```
147
152
 
148
153
  ## Contributing
149
154
 
@@ -1,3 +1,3 @@
1
1
  module CreditCardValidations
2
- VERSION = '3.4.0'
2
+ VERSION = '3.5.0'
3
3
  end
@@ -4,6 +4,7 @@
4
4
  - :length:
5
5
  - 13
6
6
  - 16
7
+ - 19
7
8
  :prefixes:
8
9
  - '4'
9
10
  :options:
@@ -161,11 +162,42 @@
161
162
  - '604'
162
163
  - '605'
163
164
  - '6060'
164
- - '621'
165
- - '627'
166
- - '629'
167
- - '6304'
168
- - '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'
169
201
  - '670'
170
202
  - '671'
171
203
  - '672'
@@ -192,11 +224,58 @@
192
224
  - 18
193
225
  - 19
194
226
  :prefixes:
195
- - '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'
196
264
  - '624'
197
265
  - '625'
198
266
  - '626'
199
- - '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'
200
279
  :options:
201
280
  :skip_luhn: true
202
281
  :brand_name: China UnionPay
@@ -230,6 +309,12 @@
230
309
  - 19
231
310
  :prefixes:
232
311
  - '384'
312
+ - '606282'
313
+ - '637095'
314
+ - '637568'
315
+ - '637599'
316
+ - '637609'
317
+ - '637612'
233
318
  :elo:
234
319
  :rules:
235
320
  - :length:
@@ -390,6 +475,7 @@
390
475
  :rules:
391
476
  - :length:
392
477
  - 16
478
+ - 19
393
479
  :prefixes:
394
480
  - '6011'
395
481
  - '644'
@@ -399,3 +485,5 @@
399
485
  - '648'
400
486
  - '649'
401
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:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credit_card_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-08 00:00:00.000000000 Z
11
+ date: 2018-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel