comgate_ruby 0.6.0 → 0.7

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: c88ee185af7a8e67a0e652866834bcff26e3f2a3e22299d8fe1acb069fec3c56
4
- data.tar.gz: de1435c492d44847a991e73d8bbd19d64a5d94958df9d36cf1e6e4935f54f865
3
+ metadata.gz: 72f2698e92aee79da30f44ca5e7bff94f91fd2e5040e592376ed5da708917357
4
+ data.tar.gz: 3da9f58a4a35c420d2b1297352caacbcef7def37e00765fa3029362ef597a631
5
5
  SHA512:
6
- metadata.gz: 81682fda76ce705ed1b3b1cba13baa704b6bcfc457ffed8bd44ebb7638259debf629881a2e8e1ba6b7aec3ccfe3284d58d015af4378ee6cb9e4b117c501a1f1d
7
- data.tar.gz: b93203aef6c290982f2c29bf3eb73f74e6da0e14c0401f80b1908dbf677ea546974444ed712e33e2ba08ba2d543112be7b8a4a11bc2b9b5dbab3ff0ee5459b16
6
+ metadata.gz: bebb119abe984f6f30f03d4ed37481fbff9ca749f74978cc54456c2e16c132de0ddddc1d3587555659b392a7952ca554bb61e5a401c7025610764771fcb2c933
7
+ data.tar.gz: e65fc6812ceaa251f0d3a730cf71ad243485118941462dfcc30f11122be90f16dd081f0df3a22a65115bcccd165a2e294d58b60638d12d95980fa45999da5efa
data/CHANGELOG.md CHANGED
@@ -3,3 +3,8 @@
3
3
  - Initial release
4
4
 
5
5
 
6
+ ## [0.7.0] - 2023-04-27
7
+
8
+ - better handling errors not in "error" param from Comgate
9
+ - renamed `check_state` to `check_transaction` (and keep backward compatibility)
10
+ - renamed `process_payment_callback` to `process_callback` (and keep backward compatibility)
data/README.md CHANGED
@@ -83,7 +83,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
83
83
 
84
84
  ### Check payment state (ad-hoc)
85
85
  0) The endpoint must be always implemented, this is just additional way to check payment state
86
- 1) Call `gateway.check_state(transaction_id: ":transID")`. It will return `{state: :paid, transaction_id: ":transID"}` and some more infos.
86
+ 1) Call `gateway.check_transaction(transaction_id: ":transID")`. It will return `{state: :paid, transaction_id: ":transID"}` and some more infos.
87
87
  2) Handle status change like bullet 5) in single payment
88
88
 
89
89
  ### Get payment methods allowed to merchant
@@ -115,8 +115,14 @@ module Comgate
115
115
 
116
116
  def api_error?
117
117
  return false unless decoded_response_body.is_a?(Hash)
118
+ return true if decoded_response_body["error"].to_i.positive?
118
119
 
119
- decoded_response_body["error"].to_i.positive?
120
+ if decoded_response_body["code"].to_i.positive?
121
+ decoded_response_body["error"] = decoded_response_body["code"]
122
+ return true
123
+ end
124
+
125
+ false
120
126
  end
121
127
 
122
128
  def handle_connection_error(error)
@@ -134,7 +134,7 @@ module Comgate
134
134
  test_call: false)
135
135
  end
136
136
 
137
- def check_state(transaction_id:)
137
+ def check_transaction(transaction_id:)
138
138
  make_call(url: "#{BASE_URL}/status",
139
139
  payload: gateway_params.merge(transId: transaction_id),
140
140
  test_call: false)
@@ -31,7 +31,7 @@ module Comgate
31
31
  1500 => "unexpected error"
32
32
  }.freeze
33
33
 
34
- attr_accessor :http_code, :redirect_to, :hash, :array, :errors
34
+ attr_accessor :http_code, :transaction_id, :redirect_to, :hash, :array, :errors
35
35
  attr_reader :params_conversion_hash
36
36
 
37
37
  def initialize(caller_result, params_conversion_hash = {})
@@ -46,6 +46,7 @@ module Comgate
46
46
  case converted_body
47
47
  when Hash
48
48
  @hash = converted_body
49
+ @transaction_id = converted_body[:transaction_id]
49
50
  @array = nil
50
51
  when Array
51
52
  @array = converted_body
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Comgate
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7"
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.6.0
4
+ version: '0.7'
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-04-26 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Write a longer description or delete this line.
14
14
  email: