adyen-ruby-api-library 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61215b9de7ba034430b475ae7e70caaf9e28403e9932d7dee5c2092cab206843
4
- data.tar.gz: e0363ffc4090d847ecc2e1a7c976a91adf58d3f70d75d88609a51aee5f4dc518
3
+ metadata.gz: 4b2156b9db20964cb7f43be56c19a462ccc091e42fdcecd887c9da04dc880116
4
+ data.tar.gz: 47cb2a027baa58061a6eb46e5c703ff7bc18b05002e5a7c0c5b9d9e9d68616fd
5
5
  SHA512:
6
- metadata.gz: 2dc2019edf4bb02922b573b45e151a472cb3cb178b55677ffbb52d3867fb3514b1aabf76458338a8d832d1116a215fa0286c963a086c8ed2fd156ee94b4e5422
7
- data.tar.gz: 45dee79d7372364092e9b3a9fd789d2b7553ac4052ebf0d6701bed7f2c62ad0772b7eb25702233feffe9ed13d158af7c958fa0a71f07a5740e869dda88402351
6
+ metadata.gz: a1e4c4a2fd0b91b3e375a66a59910548a9e272beb8940e2ecf6432593e2c14494006d7d6387020245fea48af0f24b50b7803d135db654294e9079c842f818390
7
+ data.tar.gz: de54e9a6c6da6a49b922d26cb6197651f59f145fef43412bfdf50863097f287d8139dd1647e6efd585d1c08d8dbffaca845f16e0e46ec49334e323f73ade74d1
data/.github/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @crrood @Aleffio @wboereboom @cyattilakiss
1
+ * @crrood @wboereboom @AlexandrosMor @michaelpaul
data/README.md CHANGED
@@ -108,7 +108,7 @@ If you have a feature request, or spotted a bug or a technical problem, [create
108
108
  For other questions, [contact our Support Team](https://www.adyen.help/hc/en-us/requests/new?ticket_form_id=360000705420).
109
109
 
110
110
  ## Licence
111
- This repository is available under the [MIT license](https://github.com/Adyen/adyen-ruby-api-library/blob/master/LICENSE).
111
+ This repository is available under the [MIT license](https://github.com/Adyen/adyen-ruby-api-library/blob/main/LICENSE).
112
112
 
113
113
  ## See also
114
114
  * [Example integration](https://github.com/adyen-examples/adyen-rails-online-payments)
data/docs/checkout.html CHANGED
@@ -23,8 +23,8 @@
23
23
 
24
24
  <p class="view"><a href="https://github.com/Adyen/adyen-ruby-api-library">View the Project on GitHub <small>Adyen/adyen-ruby-api-library</small></a></p>
25
25
  <ul>
26
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
27
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
26
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/main">Download <strong>ZIP File</strong></a></li>
27
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/main">Download <strong>TAR Ball</strong></a></li>
28
28
  <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
29
29
  </ul>
30
30
  </header>
data/docs/index.html CHANGED
@@ -21,8 +21,8 @@
21
21
  <p class="view"><a href="https://github.com/Adyen/adyen-ruby-api-library">View the Project on GitHub <small>Adyen/adyen-ruby-api-library</small></a></p>
22
22
 
23
23
  <ul>
24
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
25
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
24
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/main">Download <strong>ZIP File</strong></a></li>
25
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/main">Download <strong>TAR Ball</strong></a></li>
26
26
  <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
27
27
  </ul>
28
28
  </header>
@@ -25,8 +25,8 @@
25
25
 
26
26
 
27
27
  <ul>
28
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
29
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
28
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/main">Download <strong>ZIP File</strong></a></li>
29
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/main">Download <strong>TAR Ball</strong></a></li>
30
30
  <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
31
31
  </ul>
32
32
  </header>
data/docs/marketpay.html CHANGED
@@ -23,8 +23,8 @@
23
23
 
24
24
  <p class="view"><a href="https://github.com/Adyen/adyen-ruby-api-library">View the Project on GitHub <small>Adyen/adyen-ruby-api-library</small></a></p>
25
25
  <ul>
26
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
27
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
26
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/main">Download <strong>ZIP File</strong></a></li>
27
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/main">Download <strong>TAR Ball</strong></a></li>
28
28
  <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
29
29
  </ul>
30
30
  </header>
data/docs/payment.html CHANGED
@@ -24,8 +24,8 @@
24
24
 
25
25
  <p class="view"><a href="https://github.com/Adyen/adyen-ruby-api-library">View the Project on GitHub <small>Adyen/adyen-ruby-api-library</small></a></p>
26
26
  <ul>
27
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
28
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
27
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/main">Download <strong>ZIP File</strong></a></li>
28
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/main">Download <strong>TAR Ball</strong></a></li>
29
29
  <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
30
30
  </ul>
31
31
  </header>
data/docs/payout.html CHANGED
@@ -23,8 +23,8 @@
23
23
 
24
24
  <p class="view"><a href="https://github.com/Adyen/adyen-ruby-api-library">View the Project on GitHub <small>Adyen/adyen-ruby-api-library</small></a></p>
25
25
  <ul>
26
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
27
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
26
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/main">Download <strong>ZIP File</strong></a></li>
27
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/main">Download <strong>TAR Ball</strong></a></li>
28
28
  <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
29
29
  </ul>
30
30
  </header>
data/docs/recurring.html CHANGED
@@ -23,8 +23,8 @@
23
23
 
24
24
  <p class="view"><a href="https://github.com/Adyen/adyen-ruby-api-library">View the Project on GitHub <small>Adyen/adyen-ruby-api-library</small></a></p>
25
25
  <ul>
26
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
27
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
26
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/main">Download <strong>ZIP File</strong></a></li>
27
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/main">Download <strong>TAR Ball</strong></a></li>
28
28
  <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
29
29
  </ul>
30
30
  </header>
@@ -25,8 +25,8 @@
25
25
 
26
26
 
27
27
  <ul>
28
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/master">Download <strong>ZIP File</strong></a></li>
29
- <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/master">Download <strong>TAR Ball</strong></a></li>
28
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/zipball/main">Download <strong>ZIP File</strong></a></li>
29
+ <li><a href="https://github.com/Adyen/adyen-ruby-api-library/tarball/main">Download <strong>TAR Ball</strong></a></li>
30
30
  <li><a href="https://github.com/Adyen/adyen-ruby-api-library">View On <strong>GitHub</strong></a></li>
31
31
  </ul>
32
32
  </header>
data/lib/adyen/client.rb CHANGED
@@ -104,7 +104,13 @@ module Adyen
104
104
  # set auth type based on service
105
105
  case auth_type
106
106
  when "basic"
107
- faraday.basic_auth(@ws_user, @ws_password)
107
+ if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
108
+ # for faraday 2.0 and higher
109
+ faraday.request :authorization, :basic, @ws_user, @ws_password
110
+ else
111
+ # for faraday 1.x
112
+ faraday.basic_auth(@ws_user, @ws_password)
113
+ end
108
114
  when "api-key"
109
115
  faraday.headers["x-api-key"] = @api_key
110
116
  end
@@ -132,7 +138,7 @@ module Adyen
132
138
  if action.is_a?(::Hash)
133
139
  if action.fetch(:method) == "get"
134
140
  begin
135
- response = conn.get
141
+ response = conn.get
136
142
  rescue Faraday::ConnectionFailed => connection_error
137
143
  raise connection_error, "Connection to #{url} failed"
138
144
  end
data/lib/adyen/errors.rb CHANGED
@@ -3,7 +3,10 @@ module Adyen
3
3
  attr_reader :code, :response, :request, :msg
4
4
 
5
5
  def initialize(request = nil, response = nil, msg = nil, code = nil)
6
- mask_fields(request)
6
+ unless request.nil?
7
+ request = request.is_a?(Hash) ? request : JSON.parse(request, symbolize_names: true)
8
+ mask_fields(request)
9
+ end
7
10
 
8
11
  # components of formatted error message
9
12
  attributes = {
@@ -37,7 +40,7 @@ module Adyen
37
40
  ]
38
41
 
39
42
  # convert to hash if necessary
40
- request = request.is_a?(Hash) ? request : JSON.parse(request)
43
+ request = request.is_a?(Hash) ? request : JSON.parse(request, symbolize_names: true)
41
44
 
42
45
  # iterate through request to find fields to mask
43
46
  request.each do |k, v|
@@ -67,6 +67,10 @@ module Adyen
67
67
  @client.call_adyen_api(@service, action, args[0], args[1], @version)
68
68
  end
69
69
  end
70
+
71
+ def apple_pay
72
+ @apple_pay ||= Adyen::CheckoutApplePay.new(@client, @version)
73
+ end
70
74
  end
71
75
 
72
76
  class CheckoutDetail < Service
@@ -130,4 +134,17 @@ module Adyen
130
134
  @client.call_adyen_api(@service, action, request, headers, @version)
131
135
  end
132
136
  end
137
+
138
+ class CheckoutApplePay < Service
139
+ def initialize(client, version = DEFAULT_VERSION)
140
+ @service = "Checkout"
141
+ @client = client
142
+ @version = version
143
+ end
144
+
145
+ def sessions(request, headers = {})
146
+ action = "applePay/sessions"
147
+ @client.call_adyen_api(@service, action, request, headers, @version)
148
+ end
149
+ end
133
150
  end
data/lib/adyen/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Adyen
2
2
  NAME = "adyen-ruby-api-library"
3
- VERSION = "6.0.0".freeze
3
+ VERSION = "6.1.0".freeze
4
4
  end
@@ -345,6 +345,38 @@ RSpec.describe Adyen::Checkout, service: "checkout" do
345
345
  to eq("cancelled")
346
346
  end
347
347
 
348
+ it "makes an applePay/sessions call" do
349
+ request_body = JSON.parse(json_from_file("mocks/requests/Checkout/apple_pay_sessions.json"))
350
+
351
+ response_body = json_from_file("mocks/responses/Checkout/apple_pay_sessions.json")
352
+
353
+ url = @shared_values[:client].service_url(@shared_values[:service], "applePay/sessions", @shared_values[:client].checkout.version)
354
+ WebMock.stub_request(:post, url).
355
+ with(
356
+ body: request_body,
357
+ headers: {
358
+ "x-api-key" => @shared_values[:client].api_key
359
+ }
360
+ ).
361
+ to_return(
362
+ body: response_body
363
+ )
364
+
365
+ result = @shared_values[:client].checkout.apple_pay.sessions(request_body)
366
+ response_hash = result.response
367
+
368
+ expect(result.status).
369
+ to eq(200)
370
+ expect(response_hash).
371
+ to eq(JSON.parse(response_body))
372
+ expect(response_hash).
373
+ to be_a Adyen::HashWithAccessors
374
+ expect(response_hash).
375
+ to be_a_kind_of Hash
376
+ expect(response_hash["data"]).
377
+ to eq("LARGE_BLOB_HERE")
378
+ end
379
+
348
380
  it "makes a sessions call" do
349
381
  request_body = JSON.parse(json_from_file("mocks/requests/Checkout/sessions.json"))
350
382
 
data/spec/errors_spec.rb CHANGED
@@ -43,5 +43,14 @@ RSpec.describe Adyen::AdyenError do
43
43
  it 'masks CVC when logging request in errors' do
44
44
  expect(Adyen::AdyenError.new(@shared_values[:request], 'response', 'message', 'code').request[:paymentMethod][:cvc]).to eq('***')
45
45
  end
46
+
47
+ context 'when request is string' do
48
+ it 'masks card number when logging request in errors' do
49
+ expect(Adyen::AdyenError.new(JSON.generate(@shared_values[:request]), 'response', 'message', 'code').request[:paymentMethod][:number]).to eq('411111******1111')
50
+ end
51
+ it 'masks CVC when logging request in errors' do
52
+ expect(Adyen::AdyenError.new(JSON.generate(@shared_values[:request]), 'response', 'message', 'code').request[:paymentMethod][:cvc]).to eq('***')
53
+ end
54
+ end
46
55
  end
47
56
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ "displayName": "YOUR_MERCHANT_NAME",
3
+ "domainName": "window.location.hostname",
4
+ "merchantIdentifier": "YOUR_MERCHANT_ID"
5
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "data" : "LARGE_BLOB_HERE"
3
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adyen-ruby-api-library
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-21 00:00:00.000000000 Z
11
+ date: 2022-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -153,6 +153,7 @@ files:
153
153
  - spec/mocks/requests/Account/upload_document.json
154
154
  - spec/mocks/requests/BinLookup/get_3ds_availability.json
155
155
  - spec/mocks/requests/BinLookup/get_cost_estimate.json
156
+ - spec/mocks/requests/Checkout/apple_pay_sessions.json
156
157
  - spec/mocks/requests/Checkout/orders.json
157
158
  - spec/mocks/requests/Checkout/orders_cancel.json
158
159
  - spec/mocks/requests/Checkout/origin_keys.json
@@ -229,6 +230,7 @@ files:
229
230
  - spec/mocks/responses/Account/upload_document.json
230
231
  - spec/mocks/responses/BinLookup/get_3ds_availability.json
231
232
  - spec/mocks/responses/BinLookup/get_cost_estimate.json
233
+ - spec/mocks/responses/Checkout/apple_pay_sessions.json
232
234
  - spec/mocks/responses/Checkout/get-payment-link.json
233
235
  - spec/mocks/responses/Checkout/orders.json
234
236
  - spec/mocks/responses/Checkout/orders_cancel.json
@@ -318,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
320
  - !ruby/object:Gem::Version
319
321
  version: '0'
320
322
  requirements: []
321
- rubygems_version: 3.2.3
323
+ rubygems_version: 3.1.2
322
324
  signing_key:
323
325
  specification_version: 4
324
326
  summary: Official Adyen Ruby API Library