comgate_ruby 0.8.0 → 0.8.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: c7feda6e77063468d2577e6f865f899a9652d0e1728a8ccec608ecc311b7a433
4
- data.tar.gz: 6610c12a6b20f234f2813b5b9448b25c1915f13dc784b4916750d7fef4301378
3
+ metadata.gz: c7882560b8946462a01c78940b5c3f9c1e771418b90123e5de3b4f4e3c8dea2e
4
+ data.tar.gz: 47271d5e947abd8f189c42f79e248fd0992d56e3a92eb24b624e3f8559ec09fb
5
5
  SHA512:
6
- metadata.gz: 574aafb0ad4b606d9beacdf9ce13eb531efcf961f3b9b51f2157ea4d2e647be911581437d3d7ab9ce6db03a741ad8b06bee7ca18f769594b77d91b23f217c142
7
- data.tar.gz: 8eb352360617ba623bc0487c9eaf8c24ebfd34fab06af02f1deea6ba2cfe169e81497a53a200794e1235a5e8f4480ad286cc52470bb938a42432d7fc3daf9412
6
+ metadata.gz: 72e412a79248be368f95a76c7a8e3214e7156edb8a2336af3150ac1b652e7d95c2e8614ad1c1e4d1f2a3b7d201a7aa915101a6f05fa6fb7f58497f32dd17fd36
7
+ data.tar.gz: 8ce0f483ea79eebd5c25cfac010cc0761b5de48cfd1bb5b36155aabf2621bfc9a834e42428f75dcf4bff89554adec82a6289f34a4af8966ce8e86e2afa841239
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [0.8.1] - 2023-06-13
2
+ - Allowed `proxy_uri` param for Comgate::Gateway
3
+
1
4
  ## [0.8] - 2023-06-06
2
5
  - Update to conform universal payment interface params (see Readme)
3
6
  - BREAKING: change in repeating params `{transaction_id: "xxx", ....}` is now at `{payment: {reccurrence: { init_transaction_id: "xxx" } } }`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- comgate_ruby (0.8.0)
4
+ comgate_ruby (0.8.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -21,6 +21,11 @@ If bundler is not being used to manage dependencies, install the gem by executin
21
21
  gateway = Comgate::Gateway.new(merchant_gateway_id: ":comgate_id",
22
22
  test_calls: false,
23
23
  client_secret: ":comgate_secret")
24
+ # or with proxy
25
+ gateway = Comgate::Gateway.new(merchant_gateway_id: ":comgate_id",
26
+ test_calls: false,
27
+ client_secret: ":comgate_secret",
28
+ proxy_uri: "http://pxuser:pxpassword@proxy.me:123") # or just "http://proxy.me:123"
24
29
  ```
25
30
 
26
31
  ### 2) prepare endpoint
@@ -20,11 +20,12 @@ module Comgate
20
20
 
21
21
  attr_reader :payload, :url
22
22
 
23
- def initialize(url:, payload:, test_call: false)
23
+ def initialize(url:, payload:, test_call: false, proxy_uri: nil)
24
24
  super()
25
25
  @url = url
26
26
  @payload = payload
27
27
  @payload.merge!(test: "true") if test_call
28
+ @proxy_uri = proxy_uri
28
29
  end
29
30
 
30
31
  def build_result
@@ -57,7 +58,20 @@ module Comgate
57
58
  end
58
59
 
59
60
  def https_conn
60
- @https_conn ||= Net::HTTP.start(service_uri.host, service_uri.port, connection_options)
61
+ @https_conn ||= if @proxy_uri
62
+ proxy = URI.parse(@proxy_uri)
63
+ Net::HTTP.start(service_uri.host,
64
+ service_uri.port,
65
+ proxy.host,
66
+ proxy.port,
67
+ proxy.user,
68
+ proxy.password,
69
+ connection_options)
70
+ else
71
+ Net::HTTP.start(service_uri.host,
72
+ service_uri.port,
73
+ connection_options)
74
+ end
61
75
  end
62
76
 
63
77
  def request
@@ -74,6 +74,10 @@ module Comgate
74
74
  options[:test_calls] == true
75
75
  end
76
76
 
77
+ def proxy_uri
78
+ options[:proxy_uri]
79
+ end
80
+
77
81
  def start_transaction(payment_data)
78
82
  make_call(url: "#{BASE_URL}/create",
79
83
  payload: single_payment_payload(payment_data),
@@ -173,7 +177,7 @@ module Comgate
173
177
  def make_call(url:, payload:, test_call:, conversion_hash: DATA_CONVERSION_HASH)
174
178
  raise "There are errors in pre-api-call phase: #{payload[:errors]}" unless payload[:errors].nil?
175
179
 
176
- srv = Comgate::ApiCaller.call(url: url, payload: payload, test_call: test_call)
180
+ srv = Comgate::ApiCaller.call(url: url, payload: payload, test_call: test_call, proxy_uri: proxy_uri)
177
181
  if srv.success?
178
182
  Comgate::Response.new(srv.result, conversion_hash)
179
183
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Comgate
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.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.0
4
+ version: 0.8.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-06 00:00:00.000000000 Z
11
+ date: 2023-06-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Write a longer description or delete this line.
14
14
  email: