comgate_ruby 0.8.2 → 0.8.3

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: d020da6b1614a32495b473b497b9931406275e575a5be5012b70c46313a60041
4
- data.tar.gz: ff070de8de6f549aaf6482c3a00f07cf7d496e683a6829cbdca7a40854ee8049
3
+ metadata.gz: f70dc5da596b91029a905c8cdb1987b96e805d9d222f54c3a8896947119ca0c8
4
+ data.tar.gz: 6ffc03ac6e2e119c35bce6aa561bab416c20f63dd8b8748c186969952e3f82ce
5
5
  SHA512:
6
- metadata.gz: cde1b8d7a8b37148cfa1af8afd799ca9858b565f52a34d265651233ac49a5dd90879ebc2c602097ed654aa1c79ae4cc764b08af0bda7a2047f9a7e3943a6d16d
7
- data.tar.gz: 56490bc816c7e2a5afa3b9ca30d36d4603ae388853d157d078b43ffe1e42376e627541e4b8e4b95eb9edccb0d00c96e2304486365f1d286dd7dbbbb01fbab973
6
+ metadata.gz: 994a8c9c9450d07e709da2dfe4e7787cffc72e3176b18ec0a1ac8b10718c6b6f9b848fb83e83a28017c5fc06d36ebf87d51b02b8a7720fe7600a2e40cc3fab9d
7
+ data.tar.gz: 5f512b4a460484552f42304cd539a45dbb233e8c2344f037b8ab5712537e5139f5607293f735e069fb064ca36084b273d199ed10abf9f5e0d1cf4fd9688756e4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [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
3
+
1
4
  ## [0.8.2] - 2023-06-20
2
5
  - If ENV["COMGATE_MIN_LOG_LEVEL"] is set, calls and responses to Comgate are logged at that level. Otherwise `:debug` is used.
3
6
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- comgate_ruby (0.8.1)
4
+ comgate_ruby (0.8.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -122,9 +122,10 @@ module Comgate
122
122
  def record_api_error
123
123
  return unless api_error?
124
124
 
125
- errors[:api] = ["[Error ##{result[:response_body]["error"]}] #{result[:response_body]["message"]}"]
125
+ msg = [result[:response_body]["message"], result[:response_body]["extraMessage"]].compact.join(" ")
126
+ errors[:api] = ["[Error ##{result[:response_body]["error"]}] #{msg}"]
126
127
  @result[:errors] = { api: { code: result[:response_body]["error"].to_i,
127
- message: result[:response_body]["message"] } }
128
+ message: msg } }
128
129
  end
129
130
 
130
131
  def api_error?
@@ -42,6 +42,7 @@ module Comgate
42
42
  transferId: %i[transfer_id],
43
43
  code: %i[code],
44
44
  message: %i[message],
45
+ extraMessage: %i[extra_message],
45
46
  payerId: %i[payer id],
46
47
  payerName: %i[payer account_name],
47
48
  payer_name: %i[payer account_name],
@@ -148,7 +149,7 @@ module Comgate
148
149
  def process_callback(comgate_params)
149
150
  Comgate::Response.new({ response_body: comgate_params }, DATA_CONVERSION_HASH)
150
151
  end
151
- alias process_payment_callback process_callback # backward compatibility
152
+ alias process_payment_callback process_callback # backward compatibility
152
153
 
153
154
  def allowed_payment_methods(payment_data)
154
155
  ph = gateway_params.merge(convert_data_to_comgate_params(%i[curr lang country], payment_data, required: false))
@@ -181,7 +182,7 @@ module Comgate
181
182
  if srv.success?
182
183
  Comgate::Response.new(srv.result, conversion_hash)
183
184
  else
184
- handle_failure_from(srv.errors)
185
+ handle_failure_from(srv)
185
186
  end
186
187
  end
187
188
 
@@ -189,8 +190,11 @@ module Comgate
189
190
  test_from_data.nil? ? test_calls_used? : (test_from_data == true)
190
191
  end
191
192
 
192
- def handle_failure_from(errors)
193
- raise errors.to_s
193
+ def handle_failure_from(srv)
194
+ raise srv.errors.to_s unless srv.result.dig(:response_body, "transId").present?
195
+
196
+ # pretends to be a successfull response, and keep payment check to decide what to do next
197
+ Comgate::Response.new(srv.result, conversion_hash)
194
198
  end
195
199
 
196
200
  def single_payment_payload(payment_data)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Comgate
4
- VERSION = "0.8.2"
4
+ VERSION = "0.8.3"
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.2
4
+ version: 0.8.3
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-20 00:00:00.000000000 Z
11
+ date: 2023-06-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Write a longer description or delete this line.
14
14
  email: