comgate_ruby 0.8.3 → 0.8.3.1

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
2
  SHA256:
3
- metadata.gz: f70dc5da596b91029a905c8cdb1987b96e805d9d222f54c3a8896947119ca0c8
4
- data.tar.gz: 6ffc03ac6e2e119c35bce6aa561bab416c20f63dd8b8748c186969952e3f82ce
3
+ metadata.gz: 4a86d9ae209a84c1dd4d9942b70d6bc33724567029891397a1a2fe6aa685b540
4
+ data.tar.gz: b296ea50f4e2c1ebd450c02e38508b52c15d7e730aedfc2a9200a7ae3093a7a0
5
5
  SHA512:
6
- metadata.gz: 994a8c9c9450d07e709da2dfe4e7787cffc72e3176b18ec0a1ac8b10718c6b6f9b848fb83e83a28017c5fc06d36ebf87d51b02b8a7720fe7600a2e40cc3fab9d
7
- data.tar.gz: 5f512b4a460484552f42304cd539a45dbb233e8c2344f037b8ab5712537e5139f5607293f735e069fb064ca36084b273d199ed10abf9f5e0d1cf4fd9688756e4
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 containt "transId" we do not raise exception but pass info up to stack
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- comgate_ruby (0.8.3)
4
+ comgate_ruby (0.8.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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: { code: result[:response_body]["error"].to_i,
128
- message: msg } }
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?
@@ -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 unless srv.result.dig(:response_body, "transId").present?
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Comgate
4
- VERSION = "0.8.3"
4
+ VERSION = "0.8.3.1"
5
5
  end
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-27 00:00:00.000000000 Z
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: