comgate_ruby 0.8.3 → 0.8.3.1
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/CHANGELOG.md +4 -1
- data/Gemfile.lock +1 -1
- data/lib/comgate/api_caller.rb +16 -2
- data/lib/comgate/gateway.rb +4 -3
- data/lib/comgate/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: 4a86d9ae209a84c1dd4d9942b70d6bc33724567029891397a1a2fe6aa685b540
|
4
|
+
data.tar.gz: b296ea50f4e2c1ebd450c02e38508b52c15d7e730aedfc2a9200a7ae3093a7a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e88150f9ae6eb61eb202209794ff100df4cf74c7f0201000cce7562476462d6f33c7b077cb76ea01611e818de016db35238936b6481cd79ef9f5ae8420a37a81
|
7
|
+
data.tar.gz: 0a511d5d5b38e465cd48ce14dba204b23f2500e38222f7374ccc69d3bc342ecb5b91f5edba057be1d978aaa5ed2da54c1fee25549fc70d2f342a8eefadcfeef1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
## [0.8.3.1] - 2023-06-28
|
2
|
+
- fixed internal passing errors
|
3
|
+
|
1
4
|
## [0.8.3] - 2023-06-27
|
2
|
-
- If response from Comgate API is error, but
|
5
|
+
- If response from Comgate API is error, but contain "transId", we do not raise exception but pass info up to stack
|
3
6
|
|
4
7
|
## [0.8.2] - 2023-06-20
|
5
8
|
- If ENV["COMGATE_MIN_LOG_LEVEL"] is set, calls and responses to Comgate are logged at that level. Otherwise `:debug` is used.
|
data/Gemfile.lock
CHANGED
data/lib/comgate/api_caller.rb
CHANGED
@@ -37,8 +37,20 @@ module Comgate
|
|
37
37
|
|
38
38
|
attr_accessor :response
|
39
39
|
|
40
|
+
HttpResponseStubStruct = Struct.new(:code, :body, :uri, :headers, keyword_init: true) do
|
41
|
+
def [](key)
|
42
|
+
headers[key]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
40
46
|
def call_api
|
41
47
|
self.response = https_conn.request(request)
|
48
|
+
# body =""
|
49
|
+
# binding.pry
|
50
|
+
# self.response = HttpResponseStubStruct.new(code: "200",
|
51
|
+
# body: body,
|
52
|
+
# uri: URI.parse("example.com"),
|
53
|
+
# headers: { "content-type" => "application/x-www-form-urlencoded; charset=UTF-8" })
|
42
54
|
rescue *KNOWN_CONNECTION_ERRORS => e
|
43
55
|
handle_connection_error(e)
|
44
56
|
end
|
@@ -124,8 +136,10 @@ module Comgate
|
|
124
136
|
|
125
137
|
msg = [result[:response_body]["message"], result[:response_body]["extraMessage"]].compact.join(" ")
|
126
138
|
errors[:api] = ["[Error ##{result[:response_body]["error"]}] #{msg}"]
|
127
|
-
@result[:errors] = { api:
|
128
|
-
|
139
|
+
@result[:errors] = { api: [
|
140
|
+
{ code: result[:response_body]["error"].to_i,
|
141
|
+
message: msg }
|
142
|
+
] }
|
129
143
|
end
|
130
144
|
|
131
145
|
def api_error?
|
data/lib/comgate/gateway.rb
CHANGED
@@ -179,10 +179,11 @@ module Comgate
|
|
179
179
|
raise "There are errors in pre-api-call phase: #{payload[:errors]}" unless payload[:errors].nil?
|
180
180
|
|
181
181
|
srv = Comgate::ApiCaller.call(url: url, payload: payload, test_call: test_call, proxy_uri: proxy_uri)
|
182
|
+
|
182
183
|
if srv.success?
|
183
184
|
Comgate::Response.new(srv.result, conversion_hash)
|
184
185
|
else
|
185
|
-
handle_failure_from(srv)
|
186
|
+
handle_failure_from(srv, conversion_hash)
|
186
187
|
end
|
187
188
|
end
|
188
189
|
|
@@ -190,8 +191,8 @@ module Comgate
|
|
190
191
|
test_from_data.nil? ? test_calls_used? : (test_from_data == true)
|
191
192
|
end
|
192
193
|
|
193
|
-
def handle_failure_from(srv)
|
194
|
-
raise srv.errors.to_s
|
194
|
+
def handle_failure_from(srv, conversion_hash)
|
195
|
+
raise srv.errors.to_s if srv.result.dig(:response_body, "transId").nil?
|
195
196
|
|
196
197
|
# pretends to be a successfull response, and keep payment check to decide what to do next
|
197
198
|
Comgate::Response.new(srv.result, conversion_hash)
|
data/lib/comgate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comgate_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.3
|
4
|
+
version: 0.8.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petr Mlčoch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Write a longer description or delete this line.
|
14
14
|
email:
|