adyen-ruby-api-library 7.3.0 → 8.0.0.pre.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gh_release.yml +13 -9
- data/.github/workflows/release.yml +32 -0
- data/.github/workflows/rubygems_release.yml +3 -1
- data/.github/workflows/services.yml +1 -1
- data/Makefile +5 -4
- data/README.md +16 -15
- data/VERSION +2 -0
- data/lib/adyen/client.rb +10 -4
- data/lib/adyen/services/balancePlatform/account_holders_api.rb +9 -0
- data/lib/adyen/services/checkout.rb +1 -1
- data/lib/adyen/services/disputes.rb +66 -0
- data/lib/adyen/services/management/android_files_company_level_api.rb +9 -0
- data/lib/adyen/services/management/my_api_credential_api.rb +9 -0
- data/lib/adyen/services/management/terminals_terminal_level_api.rb +9 -0
- data/lib/adyen/services/management.rb +1 -1
- data/lib/adyen/services/transfers/transfers_api.rb +9 -0
- data/lib/adyen/services/transfers.rb +1 -1
- data/lib/adyen/version.rb +1 -1
- data/lib/adyen-ruby-api-library.rb +1 -1
- data/spec/checkout-oauth_spec.rb +2 -2
- data/spec/checkout_spec.rb +2 -2
- data/spec/client_spec.rb +5 -5
- data/spec/disputes_spec.rb +45 -0
- data/spec/mocks/requests/DisputesService/retrieve_applicable_defense_reasons.json +4 -0
- data/spec/mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json +71 -0
- metadata +10 -15
- data/.github/workflows/release_request.yml +0 -15
- data/lib/adyen/services/dispute.rb +0 -21
- data/spec/dispute_spec.rb +0 -17
- data/spec/mocks/requests/DisputeService/defend_dispute.json +0 -5
- data/spec/mocks/requests/DisputeService/delete_dispute_defense_document.json +0 -5
- data/spec/mocks/requests/DisputeService/retrieve_applicable_defense_reasons.json +0 -4
- data/spec/mocks/requests/DisputeService/supply_defense_document.json +0 -11
- data/spec/mocks/responses/DisputeService/defend_dispute.json +0 -5
- data/spec/mocks/responses/DisputeService/delete_dispute_defense_document.json +0 -5
- data/spec/mocks/responses/DisputeService/retrieve_applicable_defense_reasons.json +0 -28
- data/spec/mocks/responses/DisputeService/supply_defense_document.json +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6208e49aea0041d02d48442edd2244e97543db02242392723f07f138dc50e25
|
4
|
+
data.tar.gz: 4c04497ce4353e66e9fc3d612be8bb72af156304309dddfbd36b14636c71058e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b696a2853d0df2ead2b55619a731d5f718aaba7ec73dc6289538242ce49f1ed33cae25f6adf130039193de340d17d9e0e539c4e1f83d78f518f72e5ccb1a34cf
|
7
|
+
data.tar.gz: 702e2c4639badd85765bafd0be78855f90c4a922b3d96cbe96bbb7420595ebf273c5f47431204ff5f53ef4b74d33cf2f958f3e02e2644dd8648660443f50a041
|
@@ -1,16 +1,20 @@
|
|
1
|
-
name: Github
|
1
|
+
name: Automatic Github release
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
workflow_dispatch:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
paths:
|
9
|
+
- VERSION
|
8
10
|
|
9
11
|
jobs:
|
10
|
-
|
12
|
+
github:
|
11
13
|
permissions:
|
12
14
|
contents: write
|
13
|
-
uses: Adyen/
|
15
|
+
uses: Adyen/release-automation-action/.github/workflows/reusable-github-release.yml@v1.1.0
|
14
16
|
with:
|
15
|
-
|
16
|
-
|
17
|
+
release-title: Adyen Ruby API Library
|
18
|
+
develop-branch: main
|
19
|
+
secrets:
|
20
|
+
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Prepare release
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
pre-release:
|
7
|
+
required: false
|
8
|
+
type: boolean
|
9
|
+
default: false
|
10
|
+
description: "This release will be labeled as non-production ready"
|
11
|
+
pull_request:
|
12
|
+
types:
|
13
|
+
- closed
|
14
|
+
branches:
|
15
|
+
- main
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
candidate:
|
19
|
+
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged && !startsWith(github.head_ref, 'promote/'))
|
20
|
+
permissions:
|
21
|
+
contents: write
|
22
|
+
pull-requests: write
|
23
|
+
runs-on: ubuntu-latest
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v3
|
26
|
+
- name: Prepare the next main release
|
27
|
+
uses: Adyen/release-automation-action@v1.1.0
|
28
|
+
with:
|
29
|
+
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
|
30
|
+
develop-branch: main
|
31
|
+
version-files: lib/adyen/version.rb
|
32
|
+
pre-release: ${{ inputs.pre-release || false }}
|
@@ -10,7 +10,9 @@ jobs:
|
|
10
10
|
|
11
11
|
steps:
|
12
12
|
- uses: actions/checkout@v4
|
13
|
-
|
13
|
+
- run: |
|
14
|
+
git config user.name github-actions
|
15
|
+
git config user.email github-actions@github.com
|
14
16
|
- name: Release Gem on RubyGems
|
15
17
|
if: contains(github.ref, 'refs/tags/v')
|
16
18
|
uses: cadwallion/publish-rubygems-action@master
|
@@ -21,7 +21,7 @@ jobs:
|
|
21
21
|
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
|
22
22
|
committer: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
|
23
23
|
author: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
|
24
|
-
base:
|
24
|
+
base: main
|
25
25
|
branch: automation/services
|
26
26
|
title: ${{ steps.vars.outputs.pr_title }}
|
27
27
|
body: ${{ steps.vars.outputs.pr_body }}
|
data/Makefile
CHANGED
@@ -6,21 +6,22 @@ openapi-generator-cli:=java -jar build/openapi-generator-cli.jar
|
|
6
6
|
output:=build/out
|
7
7
|
|
8
8
|
services:=balancePlatform checkout legalEntityManagement management payout transfers
|
9
|
-
singleFileServices:=balanceControlService binLookup dataProtection recurring storedValue payment posTerminalManagement
|
9
|
+
singleFileServices:=balanceControlService binLookup dataProtection recurring storedValue payment posTerminalManagement disputes
|
10
10
|
|
11
11
|
binLookup: spec=BinLookupService-v54
|
12
|
-
checkout: spec=CheckoutService-
|
12
|
+
checkout: spec=CheckoutService-v71
|
13
13
|
dataProtection: spec=DataProtectionService-v1
|
14
14
|
storedValue: spec=StoredValueService-v46
|
15
15
|
posTerminalManagement: spec=TfmAPIService-v1
|
16
16
|
payment: spec=PaymentService-v68
|
17
17
|
recurring: spec=RecurringService-v68
|
18
18
|
payout: spec=PayoutService-v68
|
19
|
-
management: spec=ManagementService-
|
19
|
+
management: spec=ManagementService-v3
|
20
20
|
legalEntityManagement: spec=LegalEntityService-v3
|
21
21
|
balancePlatform: spec=BalancePlatformService-v2
|
22
22
|
balanceControlService: spec=BalanceControlService-v1
|
23
|
-
transfers: spec=TransferService-
|
23
|
+
transfers: spec=TransferService-v4
|
24
|
+
disputes: spec=DisputeService-v30
|
24
25
|
|
25
26
|
allServices: $(services) $(singleFileServices)
|
26
27
|
|
data/README.md
CHANGED
@@ -7,21 +7,22 @@ This is the officially supported Ruby library for using Adyen's APIs.
|
|
7
7
|
|
8
8
|
This library supports the following:
|
9
9
|
|
10
|
-
| API name
|
11
|
-
|
12
|
-
| [BIN lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview)
|
13
|
-
| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/
|
14
|
-
| [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview)
|
15
|
-
| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api)
|
16
|
-
| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview)
|
17
|
-
| [Management API](https://docs.adyen.com/api-explorer/Management/
|
18
|
-
| [Payments API](https://docs.adyen.com/api-explorer/Payment/68/overview)
|
19
|
-
| [Payouts API](https://docs.adyen.com/api-explorer/Payout/68/overview)
|
20
|
-
| [POS Terminal Management API](https://docs.adyen.com/api-explorer/postfmapi/1/overview)
|
21
|
-
| [Recurring API](https://docs.adyen.com/api-explorer/Recurring/68/overview)
|
22
|
-
| [Stored Value API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api)
|
23
|
-
| [Transfers API](https://docs.adyen.com/api-explorer/transfers/
|
24
|
-
| [Cloud-based Terminal API](https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api/terminal-api-reference/) |
|
10
|
+
| API name | API version | Description | API object |
|
11
|
+
|-------------------------------------------------------------------------------------------------------------------------------|:-----------:|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
|
12
|
+
| [BIN lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | v54 | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | [BinLookup](lib/adyen/services/binLookup.rb) |
|
13
|
+
| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/71/overview) | v71 | Our latest integration for accepting online payments. | [CheckoutAPI](lib/adyen/services/checkout.rb) |
|
14
|
+
| [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | v2 | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | [BalancePlatform](lib/adyen/services/balancePlatform.rb) |
|
15
|
+
| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | v1 | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | [DataProtection](lib/adyen/services/dataProtection.rb) |
|
16
|
+
| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | v3 | Manage legal entities that contain information required for verification. | [LegalEntityManagement](lib/adyen/services/legalEntityManagement.rb) |
|
17
|
+
| [Management API](https://docs.adyen.com/api-explorer/Management/3/overview) | v3 | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | [Management](lib/adyen/services/management.rb) |
|
18
|
+
| [Payments API](https://docs.adyen.com/api-explorer/Payment/68/overview) | v68 | Our classic integration for online payments. | [Classic Integration API](lib/adyen/services/payment.rb) |
|
19
|
+
| [Payouts API](https://docs.adyen.com/api-explorer/Payout/68/overview) | v68 | Endpoints for sending funds to your customers. | [Payout](lib/adyen/services/payout.rb) |
|
20
|
+
| [POS Terminal Management API](https://docs.adyen.com/api-explorer/postfmapi/1/overview) | v1 | Endpoints for managing your point-of-sale payment terminals. | [TerminalManagement](lib/adyen/services/posTerminalManagement.rb) |
|
21
|
+
| [Recurring API](https://docs.adyen.com/api-explorer/Recurring/68/overview) | v68 | Endpoints for managing saved payment details. | [Recurring](lib/adyen/services/recurring.rb) |
|
22
|
+
| [Stored Value API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api) | v46 | Manage both online and point-of-sale gift cards and other stored-value cards. | [StoredValue](lib/adyen/services/storedValue.rb) |
|
23
|
+
| [Transfers API](https://docs.adyen.com/api-explorer/transfers/4/overview) | v4 | The Transfers API provides endpoints that can be used to get information about all your transactions, move funds within your balance platform or send funds from your balance platform to a transfer instrument. | [Transfers](lib/adyen/services/transfers.rb) |
|
24
|
+
| [Cloud-based Terminal API](https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api/terminal-api-reference/) | - | Our point-of-sale integration. | [TerminalCloudAPI](lib/adyen/services/terminalCloudAPI.rb) |
|
25
|
+
| [Disputes API](https://docs.adyen.com/api-explorer/Disputes/30/overview) | v30 | You can use the [Disputes API](https://docs.adyen.com/risk-management/disputes-api) to automate the dispute handling process so that you can respond to disputes and chargebacks as soon as they are initiated. The Disputes API lets you retrieve defense reasons, supply and delete defense documents, and accept or defend disputes. | [Disputes](lib/adyen/services/disputes.rb) |
|
25
26
|
|
26
27
|
For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/).
|
27
28
|
|
data/VERSION
ADDED
data/lib/adyen/client.rb
CHANGED
@@ -23,7 +23,13 @@ module Adyen
|
|
23
23
|
@oauth_token = oauth_token
|
24
24
|
@env = env
|
25
25
|
@adapter = adapter || Faraday.default_adapter
|
26
|
-
|
26
|
+
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.1')
|
27
|
+
# for faraday 2.1 and higher
|
28
|
+
@adapter_options = adapter_options || Faraday.default_adapter_options
|
29
|
+
else
|
30
|
+
# for faraday 1.x and 2.0
|
31
|
+
@adapter_options = adapter_options || {}
|
32
|
+
end
|
27
33
|
@mock_service_url_base = mock_service_url_base || "http://localhost:#{mock_port}"
|
28
34
|
@live_url_prefix = live_url_prefix
|
29
35
|
@connection_options = connection_options || Faraday::ConnectionOptions.new
|
@@ -62,7 +68,7 @@ module Adyen
|
|
62
68
|
when 'PosTerminalManagement'
|
63
69
|
url = "https://postfmapi-#{@env}.adyen.com/postfmapi/terminal"
|
64
70
|
supports_live_url_prefix = false
|
65
|
-
when 'DataProtectionService', '
|
71
|
+
when 'DataProtectionService', 'DisputesService'
|
66
72
|
url = "https://ca-#{@env}.adyen.com/ca/services/#{service}"
|
67
73
|
supports_live_url_prefix = false
|
68
74
|
when 'LegalEntityManagement'
|
@@ -237,8 +243,8 @@ module Adyen
|
|
237
243
|
@data_protection ||= Adyen::DataProtection.new(self)
|
238
244
|
end
|
239
245
|
|
240
|
-
def
|
241
|
-
@
|
246
|
+
def disputes
|
247
|
+
@disputes ||= Adyen::Disputes.new(self)
|
242
248
|
end
|
243
249
|
|
244
250
|
def bin_lookup
|
@@ -25,6 +25,15 @@ module Adyen
|
|
25
25
|
@client.call_adyen_api(@service, action, {}, headers, @version)
|
26
26
|
end
|
27
27
|
|
28
|
+
def get_tax_form(id, headers: {}, query_params: {})
|
29
|
+
endpoint = '/accountHolders/{id}/taxForms'.gsub(/{.+?}/, '%s')
|
30
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
31
|
+
endpoint = format(endpoint, id)
|
32
|
+
endpoint += create_query_string(query_params)
|
33
|
+
action = { method: 'get', url: endpoint }
|
34
|
+
@client.call_adyen_api(@service, action, {}, headers, @version)
|
35
|
+
end
|
36
|
+
|
28
37
|
def update_account_holder(request, id, headers: {})
|
29
38
|
endpoint = '/accountHolders/{id}'.gsub(/{.+?}/, '%s')
|
30
39
|
endpoint = endpoint.gsub(%r{^/}, '')
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require_relative './service'
|
2
|
+
module Adyen
|
3
|
+
class Disputes < Service
|
4
|
+
attr_accessor :service, :version
|
5
|
+
|
6
|
+
DEFAULT_VERSION = 30
|
7
|
+
def initialize(client, version = DEFAULT_VERSION)
|
8
|
+
super(client, version, 'Disputes')
|
9
|
+
end
|
10
|
+
|
11
|
+
def accept_dispute(request, headers: {})
|
12
|
+
endpoint = '/acceptDispute'.gsub(/{.+?}/, '%s')
|
13
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
14
|
+
endpoint = format(endpoint)
|
15
|
+
|
16
|
+
action = { method: 'post', url: endpoint }
|
17
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
18
|
+
end
|
19
|
+
|
20
|
+
def defend_dispute(request, headers: {})
|
21
|
+
endpoint = '/defendDispute'.gsub(/{.+?}/, '%s')
|
22
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
23
|
+
endpoint = format(endpoint)
|
24
|
+
|
25
|
+
action = { method: 'post', url: endpoint }
|
26
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
27
|
+
end
|
28
|
+
|
29
|
+
def delete_dispute_defense_document(request, headers: {})
|
30
|
+
endpoint = '/deleteDisputeDefenseDocument'.gsub(/{.+?}/, '%s')
|
31
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
32
|
+
endpoint = format(endpoint)
|
33
|
+
|
34
|
+
action = { method: 'post', url: endpoint }
|
35
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
36
|
+
end
|
37
|
+
|
38
|
+
def download_dispute_defense_document(request, headers: {})
|
39
|
+
endpoint = '/downloadDisputeDefenseDocument'.gsub(/{.+?}/, '%s')
|
40
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
41
|
+
endpoint = format(endpoint)
|
42
|
+
|
43
|
+
action = { method: 'post', url: endpoint }
|
44
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
45
|
+
end
|
46
|
+
|
47
|
+
def retrieve_applicable_defense_reasons(request, headers: {})
|
48
|
+
endpoint = '/retrieveApplicableDefenseReasons'.gsub(/{.+?}/, '%s')
|
49
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
50
|
+
endpoint = format(endpoint)
|
51
|
+
|
52
|
+
action = { method: 'post', url: endpoint }
|
53
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
54
|
+
end
|
55
|
+
|
56
|
+
def supply_defense_document(request, headers: {})
|
57
|
+
endpoint = '/supplyDefenseDocument'.gsub(/{.+?}/, '%s')
|
58
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
59
|
+
endpoint = format(endpoint)
|
60
|
+
|
61
|
+
action = { method: 'post', url: endpoint }
|
62
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
@@ -34,5 +34,14 @@ module Adyen
|
|
34
34
|
@client.call_adyen_api(@service, action, {}, headers, @version)
|
35
35
|
end
|
36
36
|
|
37
|
+
def upload_android_app(company_id, headers: {})
|
38
|
+
endpoint = '/companies/{companyId}/androidApps'.gsub(/{.+?}/, '%s')
|
39
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
40
|
+
endpoint = format(endpoint, company_id)
|
41
|
+
|
42
|
+
action = { method: 'post', url: endpoint }
|
43
|
+
@client.call_adyen_api(@service, action, {}, headers, @version)
|
44
|
+
end
|
45
|
+
|
37
46
|
end
|
38
47
|
end
|
@@ -52,5 +52,14 @@ module Adyen
|
|
52
52
|
@client.call_adyen_api(@service, action, request, headers, @version)
|
53
53
|
end
|
54
54
|
|
55
|
+
def generate_new_client_key_for_self(headers: {})
|
56
|
+
endpoint = '/me/generateClientKey'.gsub(/{.+?}/, '%s')
|
57
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
58
|
+
endpoint = format(endpoint)
|
59
|
+
|
60
|
+
action = { method: 'post', url: endpoint }
|
61
|
+
@client.call_adyen_api(@service, action, {}, headers, @version)
|
62
|
+
end
|
63
|
+
|
55
64
|
end
|
56
65
|
end
|
@@ -16,5 +16,14 @@ module Adyen
|
|
16
16
|
@client.call_adyen_api(@service, action, {}, headers, @version)
|
17
17
|
end
|
18
18
|
|
19
|
+
def reassign_terminal(request, terminal_id, headers: {})
|
20
|
+
endpoint = '/terminals/{terminalId}/reassign'.gsub(/{.+?}/, '%s')
|
21
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
22
|
+
endpoint = format(endpoint, terminal_id)
|
23
|
+
|
24
|
+
action = { method: 'post', url: endpoint }
|
25
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
26
|
+
end
|
27
|
+
|
19
28
|
end
|
20
29
|
end
|
@@ -16,5 +16,14 @@ module Adyen
|
|
16
16
|
@client.call_adyen_api(@service, action, request, headers, @version)
|
17
17
|
end
|
18
18
|
|
19
|
+
def return_transfer(request, id, headers: {})
|
20
|
+
endpoint = '/transfers/{id}/returns'.gsub(/{.+?}/, '%s')
|
21
|
+
endpoint = endpoint.gsub(%r{^/}, '')
|
22
|
+
endpoint = format(endpoint, id)
|
23
|
+
|
24
|
+
action = { method: 'post', url: endpoint }
|
25
|
+
@client.call_adyen_api(@service, action, request, headers, @version)
|
26
|
+
end
|
27
|
+
|
19
28
|
end
|
20
29
|
end
|
data/lib/adyen/version.rb
CHANGED
@@ -9,7 +9,7 @@ require_relative 'adyen/services/marketpay'
|
|
9
9
|
require_relative 'adyen/services/posTerminalManagement'
|
10
10
|
require_relative 'adyen/services/service'
|
11
11
|
require_relative 'adyen/services/dataProtection'
|
12
|
-
require_relative 'adyen/services/
|
12
|
+
require_relative 'adyen/services/disputes'
|
13
13
|
require_relative 'adyen/services/binLookup'
|
14
14
|
require_relative 'adyen/hash_with_accessors'
|
15
15
|
require_relative 'adyen/utils/hmac_validator'
|
data/spec/checkout-oauth_spec.rb
CHANGED
@@ -587,7 +587,7 @@ RSpec.describe "Adyen::Checkout OAuth authentication", service: "checkout" do
|
|
587
587
|
|
588
588
|
result = @shared_values[:client].checkout.recurring_api.get_tokens_for_stored_payment_details(query_params:{"merchantAccount" => "TestMerchantAccount", "shopperReference" => "test-1234"})
|
589
589
|
expect(
|
590
|
-
a_request(:get, "http://localhost:3001/
|
590
|
+
a_request(:get, "http://localhost:3001/v71/storedPaymentMethods?merchantAccount=TestMerchantAccount&shopperReference=test-1234")
|
591
591
|
.with(headers: {
|
592
592
|
'Accept' => '*/*',
|
593
593
|
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
@@ -613,7 +613,7 @@ RSpec.describe "Adyen::Checkout OAuth authentication", service: "checkout" do
|
|
613
613
|
url = adyen.service_url("Checkout", "paymentMethods", @shared_values[:client].checkout.version)
|
614
614
|
|
615
615
|
expect(url).
|
616
|
-
to eq("https://prefix-checkout-live.adyenpayments.com/checkout/
|
616
|
+
to eq("https://prefix-checkout-live.adyenpayments.com/checkout/v71/paymentMethods")
|
617
617
|
|
618
618
|
end
|
619
619
|
end
|
data/spec/checkout_spec.rb
CHANGED
@@ -670,7 +670,7 @@ RSpec.describe Adyen::Checkout, service: 'checkout' do
|
|
670
670
|
'shopperReference' => 'test-1234'
|
671
671
|
})
|
672
672
|
expect(
|
673
|
-
a_request(:get, 'http://localhost:3001/
|
673
|
+
a_request(:get, 'http://localhost:3001/v71/storedPaymentMethods?merchantAccount=TestMerchantAccount&shopperReference=test-1234')
|
674
674
|
.with(headers: {
|
675
675
|
'Accept' => '*/*',
|
676
676
|
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
@@ -696,7 +696,7 @@ RSpec.describe Adyen::Checkout, service: 'checkout' do
|
|
696
696
|
url = adyen.service_url('Checkout', 'paymentMethods', @shared_values[:client].checkout.version)
|
697
697
|
|
698
698
|
expect(url)
|
699
|
-
.to eq('https://prefix-checkout-live.adyenpayments.com/checkout/
|
699
|
+
.to eq('https://prefix-checkout-live.adyenpayments.com/checkout/v71/paymentMethods')
|
700
700
|
end
|
701
701
|
end
|
702
702
|
|
data/spec/client_spec.rb
CHANGED
@@ -124,7 +124,7 @@ RSpec.describe Adyen do
|
|
124
124
|
mock_response = Faraday::Response.new(status: 200)
|
125
125
|
|
126
126
|
expect(Adyen::AdyenResult).to receive(:new)
|
127
|
-
expect(Faraday).to receive(:new).with('http://localhost:3001/
|
127
|
+
expect(Faraday).to receive(:new).with('http://localhost:3001/v71/payments/details',
|
128
128
|
connection_options).and_return(mock_faraday_connection)
|
129
129
|
expect(mock_faraday_connection).to receive(:post).and_return(mock_response)
|
130
130
|
client.checkout.payments_api.payments_details(request_body)
|
@@ -132,14 +132,14 @@ RSpec.describe Adyen do
|
|
132
132
|
|
133
133
|
it "checks the creation of checkout url" do
|
134
134
|
client = Adyen::Client.new(api_key: "api_key", env: :test)
|
135
|
-
expect(client.service_url("Checkout", "paymentMethods", "
|
136
|
-
to eq("https://checkout-test.adyen.com/
|
135
|
+
expect(client.service_url("Checkout", "paymentMethods", "71")).
|
136
|
+
to eq("https://checkout-test.adyen.com/v71/paymentMethods")
|
137
137
|
end
|
138
138
|
|
139
139
|
it "checks the creation of checkout url" do
|
140
140
|
client = Adyen::Client.new(api_key: "api_key", env: :live, live_url_prefix: "YourLiveUrlPrefix")
|
141
|
-
expect(client.service_url("Checkout", "paymentMethods", "
|
142
|
-
to eq("https://YourLiveUrlPrefix-checkout-live.adyenpayments.com/checkout/
|
141
|
+
expect(client.service_url("Checkout", "paymentMethods", "71")).
|
142
|
+
to eq("https://YourLiveUrlPrefix-checkout-live.adyenpayments.com/checkout/v71/paymentMethods")
|
143
143
|
end
|
144
144
|
it "checks the creation of lem url" do
|
145
145
|
client = Adyen::Client.new(api_key: "api_key", env: :live)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Adyen::Disputes, service: 'disputes service' do
|
4
|
+
before(:all) do
|
5
|
+
@shared_values = {
|
6
|
+
client: create_client(:api_key),
|
7
|
+
service: 'Disputes'
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
# methods / values to test for
|
12
|
+
# format is defined in spec_helper
|
13
|
+
it 'makes a retrieve_applicable_defense_reasons call' do
|
14
|
+
request_body = JSON.parse(json_from_file('mocks/requests/DisputesService/retrieve_applicable_defense_reasons.json'))
|
15
|
+
|
16
|
+
response_body = json_from_file('mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json')
|
17
|
+
|
18
|
+
url = @shared_values[:client].service_url(@shared_values[:service], 'retrieveApplicableDefenseReasons',
|
19
|
+
@shared_values[:client].disputes.version)
|
20
|
+
WebMock.stub_request(:post, url)
|
21
|
+
.with(
|
22
|
+
body: request_body,
|
23
|
+
headers: {
|
24
|
+
'x-api-key' => @shared_values[:client].api_key
|
25
|
+
}
|
26
|
+
)
|
27
|
+
.to_return(
|
28
|
+
body: response_body
|
29
|
+
)
|
30
|
+
|
31
|
+
result = @shared_values[:client].disputes.retrieve_applicable_defense_reasons(request_body)
|
32
|
+
response_hash = result.response
|
33
|
+
|
34
|
+
expect(result.status)
|
35
|
+
.to eq(200)
|
36
|
+
expect(response_hash)
|
37
|
+
.to eq(JSON.parse(response_body))
|
38
|
+
expect(response_hash)
|
39
|
+
.to be_a Adyen::HashWithAccessors
|
40
|
+
expect(response_hash)
|
41
|
+
.to be_a_kind_of Hash
|
42
|
+
expect(response_hash['disputeServiceResult']['success'])
|
43
|
+
.to eq(true)
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
{
|
2
|
+
"defenseReasons": [
|
3
|
+
{
|
4
|
+
"defenseDocumentTypes": [
|
5
|
+
{
|
6
|
+
"available": false,
|
7
|
+
"defenseDocumentTypeCode": "TIDorInvoice",
|
8
|
+
"requirementLevel": "Optional"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"available": false,
|
12
|
+
"defenseDocumentTypeCode": "GoodsNotReturned",
|
13
|
+
"requirementLevel": "Required"
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"defenseReasonCode": "GoodsNotReturned",
|
17
|
+
"satisfied": false
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"defenseDocumentTypes": [
|
21
|
+
{
|
22
|
+
"available": false,
|
23
|
+
"defenseDocumentTypeCode": "TIDorInvoice",
|
24
|
+
"requirementLevel": "Optional"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"available": false,
|
28
|
+
"defenseDocumentTypeCode": "GoodsRepairedOrReplaced",
|
29
|
+
"requirementLevel": "Required"
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"defenseReasonCode": "GoodsRepairedOrReplaced",
|
33
|
+
"satisfied": false
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"defenseDocumentTypes": [
|
37
|
+
{
|
38
|
+
"available": false,
|
39
|
+
"defenseDocumentTypeCode": "GoodsWereAsDescribed",
|
40
|
+
"requirementLevel": "Required"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"available": false,
|
44
|
+
"defenseDocumentTypeCode": "TIDorInvoice",
|
45
|
+
"requirementLevel": "Required"
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"defenseReasonCode": "GoodsWereAsDescribed",
|
49
|
+
"satisfied": false
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"defenseDocumentTypes": [
|
53
|
+
{
|
54
|
+
"available": false,
|
55
|
+
"defenseDocumentTypeCode": "TIDorInvoice",
|
56
|
+
"requirementLevel": "Optional"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"available": false,
|
60
|
+
"defenseDocumentTypeCode": "DefenseMaterial",
|
61
|
+
"requirementLevel": "Required"
|
62
|
+
}
|
63
|
+
],
|
64
|
+
"defenseReasonCode": "SupplyDefenseMaterial",
|
65
|
+
"satisfied": false
|
66
|
+
}
|
67
|
+
],
|
68
|
+
"disputeServiceResult": {
|
69
|
+
"success": true
|
70
|
+
}
|
71
|
+
}
|
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: 8.0.0.pre.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -84,7 +84,7 @@ files:
|
|
84
84
|
- ".github/release.yml"
|
85
85
|
- ".github/workflows/codeql.yml"
|
86
86
|
- ".github/workflows/gh_release.yml"
|
87
|
-
- ".github/workflows/
|
87
|
+
- ".github/workflows/release.yml"
|
88
88
|
- ".github/workflows/ruby.yml"
|
89
89
|
- ".github/workflows/rubygems_release.yml"
|
90
90
|
- ".github/workflows/services.yml"
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- Makefile
|
98
98
|
- README.md
|
99
99
|
- Rakefile
|
100
|
+
- VERSION
|
100
101
|
- adyen-ruby-api-library.gemspec
|
101
102
|
- bin/console
|
102
103
|
- bin/setup
|
@@ -142,7 +143,7 @@ files:
|
|
142
143
|
- lib/adyen/services/checkout/recurring_api.rb
|
143
144
|
- lib/adyen/services/checkout/utility_api.rb
|
144
145
|
- lib/adyen/services/dataProtection.rb
|
145
|
-
- lib/adyen/services/
|
146
|
+
- lib/adyen/services/disputes.rb
|
146
147
|
- lib/adyen/services/legalEntityManagement.rb
|
147
148
|
- lib/adyen/services/legalEntityManagement/business_lines_api.rb
|
148
149
|
- lib/adyen/services/legalEntityManagement/documents_api.rb
|
@@ -207,7 +208,7 @@ files:
|
|
207
208
|
- spec/checkout_spec.rb
|
208
209
|
- spec/client_spec.rb
|
209
210
|
- spec/data_protection_spec.rb
|
210
|
-
- spec/
|
211
|
+
- spec/disputes_spec.rb
|
211
212
|
- spec/errors_spec.rb
|
212
213
|
- spec/fund_spec.rb
|
213
214
|
- spec/hash_with_accessors_spec.rb
|
@@ -257,10 +258,7 @@ files:
|
|
257
258
|
- spec/mocks/requests/Checkout/sessions.json
|
258
259
|
- spec/mocks/requests/Checkout/verify.json
|
259
260
|
- spec/mocks/requests/DataProtectionService/request_subject_erasure.json
|
260
|
-
- spec/mocks/requests/
|
261
|
-
- spec/mocks/requests/DisputeService/delete_dispute_defense_document.json
|
262
|
-
- spec/mocks/requests/DisputeService/retrieve_applicable_defense_reasons.json
|
263
|
-
- spec/mocks/requests/DisputeService/supply_defense_document.json
|
261
|
+
- spec/mocks/requests/DisputesService/retrieve_applicable_defense_reasons.json
|
264
262
|
- spec/mocks/requests/Fund/account_holder_balance.json
|
265
263
|
- spec/mocks/requests/Fund/account_holder_transaction_list.json
|
266
264
|
- spec/mocks/requests/Fund/payout_account_holder.json
|
@@ -354,10 +352,7 @@ files:
|
|
354
352
|
- spec/mocks/responses/Checkout/update-payment-link.json
|
355
353
|
- spec/mocks/responses/Checkout/verify.json
|
356
354
|
- spec/mocks/responses/DataProtectionService/request_subject_erasure.json
|
357
|
-
- spec/mocks/responses/
|
358
|
-
- spec/mocks/responses/DisputeService/delete_dispute_defense_document.json
|
359
|
-
- spec/mocks/responses/DisputeService/retrieve_applicable_defense_reasons.json
|
360
|
-
- spec/mocks/responses/DisputeService/supply_defense_document.json
|
355
|
+
- spec/mocks/responses/DisputesService/retrieve_applicable_defense_reasons.json
|
361
356
|
- spec/mocks/responses/Fund/account_holder_balance.json
|
362
357
|
- spec/mocks/responses/Fund/account_holder_transaction_list.json
|
363
358
|
- spec/mocks/responses/Fund/payout_account_holder.json
|
@@ -443,9 +438,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
443
438
|
version: 2.7.0
|
444
439
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
445
440
|
requirements:
|
446
|
-
- - "
|
441
|
+
- - ">"
|
447
442
|
- !ruby/object:Gem::Version
|
448
|
-
version:
|
443
|
+
version: 1.3.1
|
449
444
|
requirements: []
|
450
445
|
rubygems_version: 3.4.10
|
451
446
|
signing_key:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
name: Release request
|
2
|
-
|
3
|
-
on:
|
4
|
-
workflow_dispatch:
|
5
|
-
push:
|
6
|
-
branches:
|
7
|
-
- develop
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
release:
|
11
|
-
permissions:
|
12
|
-
contents: write
|
13
|
-
pull-requests: write
|
14
|
-
uses: Adyen/adyen-node-api-library/.github/workflows/lib-release.yml@develop
|
15
|
-
secrets: inherit
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require_relative 'service'
|
2
|
-
|
3
|
-
module Adyen
|
4
|
-
class Dispute < Service
|
5
|
-
attr_accessor :version
|
6
|
-
|
7
|
-
DEFAULT_VERSION = 30
|
8
|
-
|
9
|
-
def initialize(client, version = DEFAULT_VERSION)
|
10
|
-
service = 'DisputeService'
|
11
|
-
method_names = %i[
|
12
|
-
retrieve_applicable_defense_reasons
|
13
|
-
supply_defense_document
|
14
|
-
delete_dispute_defense_document
|
15
|
-
defend_dispute
|
16
|
-
]
|
17
|
-
|
18
|
-
super(client, version, service, method_names)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/spec/dispute_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Adyen::Dispute, service: 'dispute service' do
|
4
|
-
# client instance to be used in dynamically generated tests
|
5
|
-
client = create_client(:basic)
|
6
|
-
|
7
|
-
# methods / values to test for
|
8
|
-
# format is defined in spec_helper
|
9
|
-
test_sets = [
|
10
|
-
['retrieve_applicable_defense_reasons', 'disputeServiceResult', { 'success' => true }],
|
11
|
-
['supply_defense_document', 'disputeServiceResult', { 'success' => true }],
|
12
|
-
['delete_dispute_defense_document', 'disputeServiceResult', { 'success' => true }],
|
13
|
-
['defend_dispute', 'disputeServiceResult', { 'success' => true }]
|
14
|
-
]
|
15
|
-
|
16
|
-
generate_tests(client, 'DisputeService', test_sets, client.dispute)
|
17
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"defenseDocuments": [
|
3
|
-
{
|
4
|
-
"content": "JVBERi0xLjMKJcTl8uXrp...",
|
5
|
-
"contentType": "application/pdf",
|
6
|
-
"defenseDocumentTypeCode": "MerchandiseDescription"
|
7
|
-
}
|
8
|
-
],
|
9
|
-
"disputePspReference": "9913486733050065",
|
10
|
-
"merchantAccountCode": "YOUR_MERCHANT_ACCOUNT"
|
11
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"defenseReasons": [
|
3
|
-
{
|
4
|
-
"defenseDocumentTypes": [
|
5
|
-
{
|
6
|
-
"available": false,
|
7
|
-
"defenseDocumentTypeCode": "TIDorInvoice",
|
8
|
-
"requirementLevel": "Optional"
|
9
|
-
},
|
10
|
-
{
|
11
|
-
"available": false,
|
12
|
-
"defenseDocumentTypeCode": "DefenseMaterial",
|
13
|
-
"requirementLevel": "Required"
|
14
|
-
},
|
15
|
-
{
|
16
|
-
"available": false,
|
17
|
-
"defenseDocumentTypeCode": "AlternativeDefenseMaterial",
|
18
|
-
"requirementLevel": "AlternativeRequired"
|
19
|
-
}
|
20
|
-
],
|
21
|
-
"defenseReasonCode": "SupplyDefenseMaterial",
|
22
|
-
"satisfied": false
|
23
|
-
}
|
24
|
-
],
|
25
|
-
"disputeServiceResult": {
|
26
|
-
"success": true
|
27
|
-
}
|
28
|
-
}
|