adyen-ruby-api-library 5.1.0 → 6.0.0

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: 606de1d31b6cefd59729a9f8f3e865ab3d6f2b8542c45187193552b6081ca73c
4
- data.tar.gz: 696ae30282dda22e188e7fc4dbe6bc1fe9c3d9eba1a205bc8e4aa8f5252c860a
3
+ metadata.gz: 61215b9de7ba034430b475ae7e70caaf9e28403e9932d7dee5c2092cab206843
4
+ data.tar.gz: e0363ffc4090d847ecc2e1a7c976a91adf58d3f70d75d88609a51aee5f4dc518
5
5
  SHA512:
6
- metadata.gz: 8d8ca15489a40507aec9d8b1e6484efdc68f1189dca253e12e8d46f030fbc59e324021046a218d133e0fa337873e9978585bdc5e8c7010e3150993e683374818
7
- data.tar.gz: 73ed56f5737ebfc1834622d97daeae79c7910fafa8fe9f4f4424ed7bd26c4bad29bcc22ab0d2f65be3edca4cc8191c88c86c9b7274dcaec1ff98b1a688b7bd69
6
+ metadata.gz: 2dc2019edf4bb02922b573b45e151a472cb3cb178b55677ffbb52d3867fb3514b1aabf76458338a8d832d1116a215fa0286c963a086c8ed2fd156ee94b4e5422
7
+ data.tar.gz: 45dee79d7372364092e9b3a9fd789d2b7553ac4052ebf0d6701bed7f2c62ad0772b7eb25702233feffe9ed13d158af7c958fa0a71f07a5740e869dda88402351
@@ -0,0 +1,20 @@
1
+ name: ruby
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ os: [ubuntu-latest]
11
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
12
+ ruby: [2.5, 2.6, 2.7, '3.0', head]
13
+ runs-on: ${{ matrix.os }}
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
20
+ - run: bundle exec rspec
data/.gitignore CHANGED
@@ -13,3 +13,5 @@ design.txt
13
13
  .ruby-version
14
14
 
15
15
  .DS_Store
16
+
17
+ .idea
data/README.md CHANGED
@@ -6,7 +6,7 @@ This is the officially supported Ruby library for using Adyen's APIs.
6
6
  ## Integration
7
7
  The library supports all APIs under the following services:
8
8
 
9
- * [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v67/overview): Our latest integration for accepting online payments. Current supported version: **v67**
9
+ * [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v68/overview): Our latest integration for accepting online payments. Current supported version: **v68**
10
10
  * [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v64/overview): Our classic integration for online payments. Current supported version: **v64**
11
11
  * [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v49/overview): Endpoints for managing saved payment details. Current supported version: **v49**
12
12
  * [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v64/overview): Endpoints for sending funds to your customers. Current supported version: **v64**
@@ -84,7 +84,7 @@ response = adyen.checkout.payments({
84
84
 
85
85
  - Change API Version
86
86
  ~~~~ruby
87
- adyen.checkout.version = 67
87
+ adyen.checkout.version = 68
88
88
  ~~~~
89
89
 
90
90
  ### Example integration
@@ -2,13 +2,14 @@ require_relative "service"
2
2
 
3
3
  module Adyen
4
4
  class Checkout < Service
5
- DEFAULT_VERSION = 67
5
+ DEFAULT_VERSION = 68
6
6
 
7
7
  def initialize(client, version = DEFAULT_VERSION)
8
8
  service = "Checkout"
9
9
  method_names = [
10
10
  :payment_session,
11
11
  :origin_keys,
12
+ :sessions
12
13
  ]
13
14
 
14
15
  with_application_info = [
@@ -25,7 +25,7 @@ module Adyen
25
25
  with_application_info = [
26
26
  :authorise,
27
27
  :authorise3d,
28
- :authorise3ds2,
28
+ :authorise3ds2
29
29
  ]
30
30
 
31
31
  super(client, version, service, method_names, with_application_info)
data/lib/adyen/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Adyen
2
2
  NAME = "adyen-ruby-api-library"
3
- VERSION = "5.1.0".freeze
3
+ VERSION = "6.0.0".freeze
4
4
  end
@@ -172,7 +172,7 @@ RSpec.describe Adyen::Checkout, service: "checkout" do
172
172
  expect(response_hash.resultCode).
173
173
  to eq("Authorised")
174
174
  end
175
-
175
+
176
176
  # must be created manually due to paymentsLinks format
177
177
  it "makes a paymentLinks call" do
178
178
  request_body = JSON.parse(json_from_file("mocks/requests/Checkout/payment_links.json"))
@@ -210,7 +210,7 @@ RSpec.describe Adyen::Checkout, service: "checkout" do
210
210
  expect(response_hash).
211
211
  to be_a_kind_of Hash
212
212
  end
213
-
213
+
214
214
  # must be created manually due to paymentsLinks/{linkId} format
215
215
  it "makes a get paymentLinks/{linkId} call" do
216
216
  response_body = json_from_file("mocks/responses/Checkout/get-payment-link.json")
@@ -345,6 +345,34 @@ RSpec.describe Adyen::Checkout, service: "checkout" do
345
345
  to eq("cancelled")
346
346
  end
347
347
 
348
+ it "makes a sessions call" do
349
+ request_body = JSON.parse(json_from_file("mocks/requests/Checkout/sessions.json"))
350
+
351
+ response_body = json_from_file("mocks/responses/Checkout/sessions-success.json")
352
+
353
+ url = @shared_values[:client].service_url(@shared_values[:service], "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(body: response_body, status: 201)
362
+
363
+ result = @shared_values[:client].checkout.sessions(request_body)
364
+ response_hash = result.response
365
+
366
+ expect(result.status).
367
+ to eq(201)
368
+ expect(response_hash).
369
+ to eq(JSON.parse(response_body))
370
+ expect(response_hash).
371
+ to be_a Adyen::HashWithAccessors
372
+ expect(response_hash).
373
+ to be_a_kind_of Hash
374
+ end
375
+
348
376
  # create client for automated tests
349
377
  client = create_client(:api_key)
350
378
 
@@ -0,0 +1,10 @@
1
+ {
2
+ "merchantAccount": "YourMerchantAccount",
3
+ "amount": {
4
+ "value": 100,
5
+ "currency": "EUR"
6
+ },
7
+ "returnUrl": "https://your-company.com/checkout?shopperOrder=12xy..",
8
+ "reference": "YOUR_PAYMENT_REFERENCE",
9
+ "countryCode": "NL"
10
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "id": "session-test-id",
3
+ "amount": {
4
+ "currency": "EUR",
5
+ "value": 1000
6
+ },
7
+ "reference": "TestReference",
8
+ "returnUrl": "http://test-url.com",
9
+ "expiresAt": "2021-09-30T06:45:06Z",
10
+ "merchantAccount": "YourMerchantAccount"
11
+ }
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: 5.1.0
4
+ version: 6.0.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-06-11 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -81,8 +81,8 @@ files:
81
81
  - ".github/ISSUE_TEMPLATE/feature_request.md"
82
82
  - ".github/PULL_REQUEST_TEMPLATE.md"
83
83
  - ".github/dependabot.yml"
84
+ - ".github/workflows/ruby.yml"
84
85
  - ".gitignore"
85
- - ".travis.yml"
86
86
  - CODE_OF_CONDUCT.md
87
87
  - CONTRIBUTING.md
88
88
  - Gemfile
@@ -163,6 +163,7 @@ files:
163
163
  - spec/mocks/requests/Checkout/payment_methods_balance.json
164
164
  - spec/mocks/requests/Checkout/payment_session.json
165
165
  - spec/mocks/requests/Checkout/payments.json
166
+ - spec/mocks/requests/Checkout/sessions.json
166
167
  - spec/mocks/requests/Checkout/verify.json
167
168
  - spec/mocks/requests/DataProtectionService/request_subject_erasure.json
168
169
  - spec/mocks/requests/DisputeService/defend_dispute.json
@@ -239,6 +240,7 @@ files:
239
240
  - spec/mocks/responses/Checkout/payment_methods_balance.json
240
241
  - spec/mocks/responses/Checkout/payment_session.json
241
242
  - spec/mocks/responses/Checkout/payments.json
243
+ - spec/mocks/responses/Checkout/sessions-success.json
242
244
  - spec/mocks/responses/Checkout/update-payment-link.json
243
245
  - spec/mocks/responses/Checkout/verify.json
244
246
  - spec/mocks/responses/DataProtectionService/request_subject_erasure.json
@@ -316,8 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
318
  - !ruby/object:Gem::Version
317
319
  version: '0'
318
320
  requirements: []
319
- rubyforge_project:
320
- rubygems_version: 2.7.8
321
+ rubygems_version: 3.2.3
321
322
  signing_key:
322
323
  specification_version: 4
323
324
  summary: Official Adyen Ruby API Library
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- sudo: false
2
- language: ruby
3
-
4
- rvm:
5
- - 2.5
6
- - 2.4
7
- - 2.3
8
- - 2.2
9
- - 2.1
10
-
11
- notifications:
12
- email: false
13
-
14
- script: bundle exec rspec