adyen-ruby-api-library 5.1.0 → 6.0.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 +4 -4
- data/.github/workflows/ruby.yml +20 -0
- data/.gitignore +2 -0
- data/README.md +2 -2
- data/lib/adyen/services/checkout.rb +2 -1
- data/lib/adyen/services/payments.rb +1 -1
- data/lib/adyen/version.rb +1 -1
- data/spec/checkout_spec.rb +30 -2
- data/spec/mocks/requests/Checkout/sessions.json +10 -0
- data/spec/mocks/responses/Checkout/sessions-success.json +11 -0
- metadata +6 -5
- data/.travis.yml +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61215b9de7ba034430b475ae7e70caaf9e28403e9932d7dee5c2092cab206843
|
4
|
+
data.tar.gz: e0363ffc4090d847ecc2e1a7c976a91adf58d3f70d75d88609a51aee5f4dc518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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/
|
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 =
|
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 =
|
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 = [
|
data/lib/adyen/version.rb
CHANGED
data/spec/checkout_spec.rb
CHANGED
@@ -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
|
|
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:
|
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-
|
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
|
-
|
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
|