mangopay 3.24.1 → 3.25.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: c227169098718116d4d2473a9e9f5373c5556a89a1bc851b304093fd6e8ff511
4
- data.tar.gz: b925a267ad094eb69801beafb04904c95852820837d158298d2c8b49506be8fb
3
+ metadata.gz: 4de0eaa7025d0d6788238c4f8a23d21b1c2d1eff469da6d24fe671f3e10e15cf
4
+ data.tar.gz: fd221c8c6c05355a6c4d0f58bb04ffa0df81d5a17fd30865e25beab644e47eac
5
5
  SHA512:
6
- metadata.gz: 88c78792b4aff5d84ebc7c0687cf11b12f974507e09bec368a28101ca169520e3269353536af528669f37305fc0030c414e61754ea1c8f0fb4c7130b09639efd
7
- data.tar.gz: c122b794f79e18718d833359d58d0ca6dd4fce57a21195eaae2130a275a0279d138d21939fe02ca754073bfc249f22676212cb7e435553c0cb6a21bfe9edef3a
6
+ metadata.gz: 4349f6ed08748ddc4a88b893ac22b7e4c0d32b6cf2ae2dcfcf4616cf8a14508d450793218c1769e4ba5b53638a62b88d985fce3f9cec80a3dd34beccb8e20c2e
7
+ data.tar.gz: c5b2cc5ceda45a3b87002e2c279799763e8815621834537aa3aa346dac765578e43366aed356ab45ec0f18d4404bc6c6bdc398fb5181dc3822290d9ec1e1c178
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [3.25.1] - 2024-04-30
2
+ ### Fixed
3
+
4
+ - Updated tests for [Look up metadata for a payment method](https://mangopay.com/docs/endpoints/payment-method-metadata#lookup-payment-method-metadata).
5
+
6
+ ## [3.25.0] - 2024-04-16
7
+ ### Added
8
+
9
+ - Add trace header logging : Introduced the `log_trace_headers` boolean configuration key. Set it to true to enable logging of `x_mangopay_trace-id` and `IdempotencyKey` in the log of the http requests.
10
+
1
11
  ## [3.24.1] - 2024-04-10
2
12
  ### Fixed
3
13
 
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.24.1'
2
+ VERSION = '3.25.1'
3
3
  end
data/lib/mangopay.rb CHANGED
@@ -5,6 +5,7 @@ require 'multi_json'
5
5
  require 'benchmark'
6
6
  require 'logger'
7
7
  require 'time'
8
+ require 'securerandom'
8
9
 
9
10
  # helpers
10
11
  require 'mangopay/version'
@@ -55,7 +56,7 @@ module MangoPay
55
56
  class Configuration
56
57
  attr_accessor :preproduction, :root_url,
57
58
  :client_id, :client_apiKey,
58
- :temp_dir, :log_file, :http_timeout,
59
+ :temp_dir, :log_file, :log_trace_headers, :http_timeout,
59
60
  :http_max_retries, :http_open_timeout,
60
61
  :logger, :use_ssl, :uk_header_flag
61
62
 
@@ -65,6 +66,7 @@ module MangoPay
65
66
  config.client_id = @client_id
66
67
  config.client_apiKey = @client_apiKey
67
68
  config.log_file = @log_file
69
+ config.log_trace_headers = @log_trace_headers
68
70
  config.http_timeout = @http_timeout
69
71
  config.http_max_retries = @http_max_retries
70
72
  config.http_open_timeout = @http_open_timeout
@@ -101,6 +103,10 @@ module MangoPay
101
103
 
102
104
  true
103
105
  end
106
+
107
+ def log_trace_headers
108
+ @log_trace_headers || false
109
+ end
104
110
 
105
111
  def uk_header_flag
106
112
  @uk_header_flag || false
@@ -274,6 +280,9 @@ module MangoPay
274
280
  'Authorization' => "#{auth_token['token_type']} #{auth_token['access_token']}",
275
281
  'Content-Type' => 'application/json'
276
282
  }
283
+ if configuration.log_trace_headers
284
+ headers.update('x_mangopay_trace-id' => SecureRandom.uuid)
285
+ end
277
286
  begin
278
287
  headers.update('x_mangopay_client_user_agent' => JSON.dump(user_agent))
279
288
  rescue => e
@@ -292,7 +301,12 @@ module MangoPay
292
301
  def do_request_with_log(http, req, uri)
293
302
  res, time = nil, nil
294
303
  params = FilterParameters.request(req.body)
295
- line = "[#{Time.now.iso8601}] #{req.method.upcase} \"#{uri.to_s}\" #{params}"
304
+ if configuration.log_trace_headers
305
+ trace_headers = JSON.dump({ 'Idempotency-Key' => req['Idempotency-Key'] , 'x_mangopay_trace-id' => req['x_mangopay_trace-id'] })
306
+ line = "[#{Time.now.iso8601}] #{req.method.upcase} \"#{uri.to_s}\" #{params} #{trace_headers}"
307
+ else
308
+ line = "[#{Time.now.iso8601}] #{req.method.upcase} \"#{uri.to_s}\" #{params}"
309
+ end
296
310
  begin
297
311
  time = Benchmark.realtime {
298
312
  begin
@@ -9,7 +9,7 @@ describe MangoPay::PaymentMethodMetadata, type: :feature do
9
9
  expect(metadata['IssuerCountryCode']).not_to be_nil
10
10
  expect(metadata['IssuingBank']).not_to be_nil
11
11
  expect(metadata['BinData']).not_to be_nil
12
- expect(metadata['CardType']).not_to be_nil
12
+ expect(metadata['BinData'][0]['CardType']).not_to be_nil
13
13
  end
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mangopay
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.24.1
4
+ version: 3.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoffroy Lorieux
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-04-10 00:00:00.000000000 Z
12
+ date: 2024-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json