bckbn 2.1.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -17
- data/lib/bckbn/connection.rb +9 -5
- data/lib/bckbn/resources/transaction/api.rb +40 -46
- data/lib/bckbn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37a10557782376798c380251fe6ad06d2edd810f6b82a71367ab8467a79514e6
|
4
|
+
data.tar.gz: 7acf9a2c8d491d29e613db118ca1ab437c3111f314cac75cd0d021ee7ff48129
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dd0e439fccb97dd31ad7d4132ad571e600b8102b3c6527c2fed250472ddafab7acebe8bcc61dbd22a194336579ecc0dd38a21f7040c5bdabc7417b5e310bec0
|
7
|
+
data.tar.gz: 1654134a8a063c8178ccad2b33872972d6d9d3290b1aecf81d6b0ed4762c51ea326309a2df5a37b16f4329fb0b11e142741151d032d5f4acc862dc1b3c0fb257
|
data/Gemfile.lock
CHANGED
@@ -1,41 +1,40 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bckbn (2.1
|
4
|
+
bckbn (2.2.1)
|
5
5
|
addressable (~> 2.8.5)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.8.
|
10
|
+
addressable (2.8.6)
|
11
11
|
public_suffix (>= 2.0.2, < 6.0)
|
12
12
|
ast (2.4.2)
|
13
|
-
base64 (0.1.1)
|
14
13
|
coderay (1.1.3)
|
15
14
|
concurrent-ruby (1.2.2)
|
16
15
|
crack (0.4.5)
|
17
16
|
rexml
|
18
17
|
diff-lcs (1.5.0)
|
19
|
-
faker (3.2.
|
18
|
+
faker (3.2.2)
|
20
19
|
i18n (>= 1.8.11, < 2)
|
21
|
-
hashdiff (1.0
|
20
|
+
hashdiff (1.1.0)
|
22
21
|
i18n (1.14.1)
|
23
22
|
concurrent-ruby (~> 1.0)
|
24
|
-
json (2.
|
23
|
+
json (2.7.1)
|
25
24
|
language_server-protocol (3.17.0.3)
|
26
25
|
method_source (1.0.0)
|
27
|
-
parallel (1.
|
28
|
-
parser (3.
|
26
|
+
parallel (1.24.0)
|
27
|
+
parser (3.3.0.2)
|
29
28
|
ast (~> 2.4.1)
|
30
29
|
racc
|
31
30
|
pry (0.14.2)
|
32
31
|
coderay (~> 1.1)
|
33
32
|
method_source (~> 1.0)
|
34
|
-
public_suffix (5.0.
|
35
|
-
racc (1.7.
|
33
|
+
public_suffix (5.0.4)
|
34
|
+
racc (1.7.3)
|
36
35
|
rainbow (3.1.1)
|
37
|
-
rake (13.0
|
38
|
-
regexp_parser (2.
|
36
|
+
rake (13.1.0)
|
37
|
+
regexp_parser (2.9.0)
|
39
38
|
rexml (3.2.6)
|
40
39
|
rspec (3.12.0)
|
41
40
|
rspec-core (~> 3.12.0)
|
@@ -50,19 +49,18 @@ GEM
|
|
50
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
50
|
rspec-support (~> 3.12.0)
|
52
51
|
rspec-support (3.12.1)
|
53
|
-
rubocop (1.
|
54
|
-
base64 (~> 0.1.1)
|
52
|
+
rubocop (1.59.0)
|
55
53
|
json (~> 2.3)
|
56
54
|
language_server-protocol (>= 3.17.0)
|
57
55
|
parallel (~> 1.10)
|
58
|
-
parser (>= 3.2.2.
|
56
|
+
parser (>= 3.2.2.4)
|
59
57
|
rainbow (>= 2.2.2, < 4.0)
|
60
58
|
regexp_parser (>= 1.8, < 3.0)
|
61
59
|
rexml (>= 3.2.5, < 4.0)
|
62
|
-
rubocop-ast (>= 1.
|
60
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
63
61
|
ruby-progressbar (~> 1.7)
|
64
62
|
unicode-display_width (>= 2.4.0, < 3.0)
|
65
|
-
rubocop-ast (1.
|
63
|
+
rubocop-ast (1.30.0)
|
66
64
|
parser (>= 3.2.1.0)
|
67
65
|
ruby-progressbar (1.13.0)
|
68
66
|
unicode-display_width (2.5.0)
|
data/lib/bckbn/connection.rb
CHANGED
@@ -16,11 +16,13 @@ module Bckbn
|
|
16
16
|
HttpBadRequest = Class.new(BaseHttpError)
|
17
17
|
HttpInternalServerError = Class.new(BaseHttpError)
|
18
18
|
HttpServiceUnavailable = Class.new(BaseHttpError)
|
19
|
+
HttpGatewayTimeout = Class.new(BaseHttpError)
|
19
20
|
|
20
21
|
ERRORS = {
|
21
|
-
Net::HTTPBadRequest => HttpBadRequest,
|
22
|
-
Net::HTTPInternalServerError => HttpInternalServerError,
|
23
|
-
Net::HTTPServiceUnavailable => HttpServiceUnavailable
|
22
|
+
Net::HTTPBadRequest => HttpBadRequest, # 400
|
23
|
+
Net::HTTPInternalServerError => HttpInternalServerError, # 500
|
24
|
+
Net::HTTPServiceUnavailable => HttpServiceUnavailable, # 503
|
25
|
+
Net::HTTPGatewayTimeout => HttpGatewayTimeout # 504
|
24
26
|
}.freeze
|
25
27
|
|
26
28
|
def initialize(per_req_config)
|
@@ -48,7 +50,7 @@ module Bckbn
|
|
48
50
|
log(:debug, "\nResponse: #{data.to_json}")
|
49
51
|
klass.new(**data, logs: @logs)
|
50
52
|
else
|
51
|
-
err_klass = ERRORS
|
53
|
+
err_klass = ERRORS.fetch(response.class)
|
52
54
|
message = "Error: #{rbody ? rbody["errors"] : "Unknown"}"
|
53
55
|
log(:error, message)
|
54
56
|
err = err_klass.new(message, @logs)
|
@@ -73,7 +75,7 @@ module Bckbn
|
|
73
75
|
log(:debug, "\nResponse: #{data.to_json}")
|
74
76
|
klass.new(**data, logs: @logs)
|
75
77
|
else
|
76
|
-
err_klass = ERRORS
|
78
|
+
err_klass = ERRORS.fetch(response.class)
|
77
79
|
message = "Error: #{rbody ? rbody["errors"] : "Unknown"}"
|
78
80
|
log(:error, message)
|
79
81
|
|
@@ -105,6 +107,8 @@ module Bckbn
|
|
105
107
|
ro.fraud_result = ::Bckbn::Transaction::FraudResult.new(**resp_obj.fraud_result)
|
106
108
|
end
|
107
109
|
end
|
110
|
+
rescue StandardError => e
|
111
|
+
raise e
|
108
112
|
end
|
109
113
|
|
110
114
|
def headers(config)
|
@@ -14,52 +14,46 @@ module Bckbn
|
|
14
14
|
}.freeze
|
15
15
|
private_constant :ENDPOINTS
|
16
16
|
|
17
|
-
|
18
|
-
body =
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
body =
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
body =
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.echeck_void(body, config = {})
|
60
|
-
body = EcheckVoidRequest.new(body)
|
61
|
-
@conn = Bckbn::Connection.new(config)
|
62
|
-
@conn.post_to_api(ENDPOINTS.fetch(__method__), body.to_h, EcheckVoidResponse)
|
17
|
+
class << self
|
18
|
+
def authorization(body, config = {})
|
19
|
+
process_transaction(__method__, body, config, AuthorizationRequest, AuthorizationResponse)
|
20
|
+
end
|
21
|
+
|
22
|
+
def capture(body, config = {})
|
23
|
+
process_transaction(__method__, body, config, CaptureRequest, CaptureResponse)
|
24
|
+
end
|
25
|
+
|
26
|
+
def credit(body, config = {})
|
27
|
+
process_transaction(__method__, body, config, CreditRequest, CreditResponse)
|
28
|
+
end
|
29
|
+
|
30
|
+
def sale(body, config = {})
|
31
|
+
process_transaction(__method__, body, config, SaleRequest, SaleResponse)
|
32
|
+
end
|
33
|
+
|
34
|
+
def void(body, config = {})
|
35
|
+
process_transaction(__method__, body, config, VoidRequest, VoidResponse)
|
36
|
+
end
|
37
|
+
|
38
|
+
def echeck_credit(body, config = {})
|
39
|
+
process_transaction(__method__, body, config, EcheckCreditRequest, EcheckCreditResponse)
|
40
|
+
end
|
41
|
+
|
42
|
+
def echeck_sale(body, config = {})
|
43
|
+
process_transaction(__method__, body, config, EcheckSaleRequest, EcheckSaleResponse)
|
44
|
+
end
|
45
|
+
|
46
|
+
def echeck_void(body, config = {})
|
47
|
+
process_transaction(__method__, body, config, EcheckVoidRequest, EcheckVoidResponse)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def process_transaction(method, body, config, request_klass, response_klass)
|
53
|
+
request = request_klass.new(body)
|
54
|
+
conn = Bckbn::Connection.new(config)
|
55
|
+
conn.post_to_api(ENDPOINTS.fetch(method), request.to_h, response_klass)
|
56
|
+
end
|
63
57
|
end
|
64
58
|
end
|
65
59
|
end
|
data/lib/bckbn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bckbn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nikkypx
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|