cashbox 0.0.28 → 0.0.29
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cashbox/model/credit_card.rb +13 -0
- data/lib/cashbox/model/payment_method.rb +6 -6
- data/lib/cashbox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 494c2c2038e3a5a9cd16a08e9150edb1bdb21bb3
|
4
|
+
data.tar.gz: b5855dcc9b3cb371522c85d7a14f50d9a6862832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80e0b9ad17debe098926bec454b55f1c21725a4394f2d6cb60f3f02a9b1fbdafb6373cb6b8cfca58b4049fef8650c6df6c29f40b51df5293e129ef9c7a88342b
|
7
|
+
data.tar.gz: bbc2a88cbb06761a6a2028984c9a0abfccd2aacd010668b0c396fa70fe2d78bf3b62d4952b3fb9948d7ae639695eb627b8d85c430b4abaaa81d426310a1b2fbc
|
data/Gemfile.lock
CHANGED
@@ -2,11 +2,24 @@ module Cashbox
|
|
2
2
|
class CreditCard < Model
|
3
3
|
include Concern::Objectable
|
4
4
|
|
5
|
+
MASTER_CARD = 'MasterCard'
|
6
|
+
VISA = 'Visa'
|
7
|
+
|
8
|
+
BIN_PREFIXES = {
|
9
|
+
'2' => MASTER_CARD,
|
10
|
+
'5' => MASTER_CARD,
|
11
|
+
'4' => VISA
|
12
|
+
}
|
13
|
+
|
5
14
|
property :vid
|
6
15
|
property :account
|
7
16
|
property :account_length
|
8
17
|
property :bin
|
9
18
|
property :expiration_date
|
10
19
|
property :last_digits
|
20
|
+
|
21
|
+
def network
|
22
|
+
BIN_PREFIXES[bin.to_s[0]]
|
23
|
+
end
|
11
24
|
end
|
12
25
|
end
|
@@ -4,6 +4,9 @@ module Cashbox
|
|
4
4
|
include Rest::ReadWrite
|
5
5
|
include Rest::Archive
|
6
6
|
|
7
|
+
CREDIT_CARD = 'CreditCard'
|
8
|
+
DIRECT_DEBIT = 'DirectDebit'
|
9
|
+
|
7
10
|
property :id
|
8
11
|
property :vid
|
9
12
|
property :created, coerce: Cashbox::Type.DateTime
|
@@ -18,11 +21,11 @@ module Cashbox
|
|
18
21
|
property :validation_status
|
19
22
|
|
20
23
|
def credit_card?
|
21
|
-
type ==
|
24
|
+
type == CREDIT_CARD
|
22
25
|
end
|
23
26
|
|
24
27
|
def direct_debit?
|
25
|
-
type ==
|
28
|
+
type == DIRECT_DEBIT
|
26
29
|
end
|
27
30
|
|
28
31
|
def last_digits
|
@@ -30,10 +33,7 @@ module Cashbox
|
|
30
33
|
end
|
31
34
|
|
32
35
|
def card_network
|
33
|
-
|
34
|
-
bin_number = credit_card.bin.to_s
|
35
|
-
return "Visa" if bin_number.start_with?("4")
|
36
|
-
return "Master Card" if bin_number.start_with?("2", "5")
|
36
|
+
credit_card.network unless direct_debit?
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/cashbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cashbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathon Storer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|