adyen-ruby-api-library 4.3.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  3. data/.github/workflows/ruby.yml +20 -0
  4. data/.gitignore +4 -0
  5. data/README.md +73 -124
  6. data/docs/marketpay.html +2 -0
  7. data/lib/adyen/client.rb +43 -24
  8. data/lib/adyen/services/{checkout_utility.rb → bin_lookup.rb} +6 -4
  9. data/lib/adyen/services/checkout.rb +89 -8
  10. data/lib/adyen/services/dispute.rb +20 -0
  11. data/lib/adyen/services/marketpay.rb +10 -7
  12. data/lib/adyen/services/payments.rb +14 -5
  13. data/lib/adyen/services/payouts.rb +3 -2
  14. data/lib/adyen/services/recurring.rb +3 -2
  15. data/lib/adyen/services/service.rb +2 -2
  16. data/lib/adyen/version.rb +1 -1
  17. data/lib/adyen-ruby-api-library.rb +2 -1
  18. data/spec/account_spec.rb +4 -1
  19. data/spec/bin_lookup_spec.rb +15 -0
  20. data/spec/checkout_spec.rb +275 -5
  21. data/spec/dispute_spec.rb +17 -0
  22. data/spec/fund_spec.rb +2 -1
  23. data/spec/mocks/requests/Account/check_account_holder.json +5 -0
  24. data/spec/mocks/requests/Account/delete_payout_methods.json +6 -0
  25. data/spec/mocks/requests/Account/delete_signatories.json +6 -0
  26. data/spec/mocks/requests/BinLookup/get_3ds_availability.json +4 -0
  27. data/spec/mocks/requests/BinLookup/get_cost_estimate.json +8 -0
  28. data/spec/mocks/requests/Checkout/orders.json +6 -0
  29. data/spec/mocks/requests/Checkout/orders_cancel.json +7 -0
  30. data/spec/mocks/requests/Checkout/origin_keys.json +3 -0
  31. data/spec/mocks/requests/Checkout/payment_methods_balance.json +9 -0
  32. data/spec/mocks/requests/Checkout/sessions.json +10 -0
  33. data/spec/mocks/requests/DisputeService/defend_dispute.json +5 -0
  34. data/spec/mocks/requests/DisputeService/delete_dispute_defense_document.json +5 -0
  35. data/spec/mocks/requests/DisputeService/retrieve_applicable_defense_reasons.json +4 -0
  36. data/spec/mocks/requests/DisputeService/supply_defense_document.json +11 -0
  37. data/spec/mocks/requests/Fund/refund_funds_transfer.json +7 -0
  38. data/spec/mocks/requests/Payment/get_authentication_result.json +4 -0
  39. data/spec/mocks/requests/Payment/retrieve_3ds2_result.json +4 -0
  40. data/spec/mocks/requests/Payment/technical_cancel.json +4 -0
  41. data/spec/mocks/requests/Payment/void_pending_refund.json +4 -0
  42. data/spec/mocks/requests/Payout/payout.json +8 -0
  43. data/spec/mocks/requests/Recurring/schedule_account_updater.json +12 -0
  44. data/spec/mocks/responses/Account/check_account_holder.json +3 -0
  45. data/spec/mocks/responses/Account/delete_payout_methods.json +3 -0
  46. data/spec/mocks/responses/Account/delete_signatories.json +3 -0
  47. data/spec/mocks/responses/BinLookup/get_3ds_availability.json +8 -0
  48. data/spec/mocks/responses/BinLookup/get_cost_estimate.json +8 -0
  49. data/spec/mocks/responses/Checkout/get-payment-link.json +11 -0
  50. data/spec/mocks/responses/Checkout/orders.json +8 -0
  51. data/spec/mocks/responses/Checkout/orders_cancel.json +4 -0
  52. data/spec/mocks/responses/Checkout/origin_keys.json +5 -0
  53. data/spec/mocks/responses/Checkout/payment_methods_balance.json +3 -0
  54. data/spec/mocks/responses/Checkout/sessions-success.json +11 -0
  55. data/spec/mocks/responses/Checkout/update-payment-link.json +11 -0
  56. data/spec/mocks/responses/DisputeService/defend_dispute.json +5 -0
  57. data/spec/mocks/responses/DisputeService/delete_dispute_defense_document.json +5 -0
  58. data/spec/mocks/responses/DisputeService/retrieve_applicable_defense_reasons.json +28 -0
  59. data/spec/mocks/responses/DisputeService/supply_defense_document.json +5 -0
  60. data/spec/mocks/responses/Fund/refund_funds_transfer.json +5 -0
  61. data/spec/mocks/responses/Payment/get_authentication_result.json +5 -0
  62. data/spec/mocks/responses/Payment/retrieve_3ds2_result.json +5 -0
  63. data/spec/mocks/responses/Payment/technical_cancel.json +3 -0
  64. data/spec/mocks/responses/Payment/void_pending_refund.json +3 -0
  65. data/spec/mocks/responses/Payout/payout.json +3 -0
  66. data/spec/mocks/responses/Recurring/schedule_account_updater.json +4 -0
  67. data/spec/payments_spec.rb +5 -1
  68. data/spec/payouts_spec.rb +2 -1
  69. data/spec/recurring_spec.rb +2 -1
  70. data/spec/service_spec.rb +1 -0
  71. data/spec/spec_helper.rb +18 -12
  72. metadata +52 -8
  73. data/.travis.yml +0 -14
  74. data/spec/checkout_utility_spec.rb +0 -29
  75. data/spec/mocks/requests/CheckoutUtility/origin_keys.json +0 -7
  76. data/spec/mocks/responses/CheckoutUtility/origin_keys.json +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d77315c126cb7ae2f8600f5bc8e853fd868a6bc6c30c36add08cfbe93285488
4
- data.tar.gz: bf4c1f6498020da769aecba45b4fe6ce43f017ca71e083723b2bfa8903d3932e
3
+ metadata.gz: 61215b9de7ba034430b475ae7e70caaf9e28403e9932d7dee5c2092cab206843
4
+ data.tar.gz: e0363ffc4090d847ecc2e1a7c976a91adf58d3f70d75d88609a51aee5f4dc518
5
5
  SHA512:
6
- metadata.gz: dd3c31163dae11854ef0d921ff772ddd3d5b526c2bef106a26edd150e2f517fd306cde43e7839313e134dd72f86eb6f0c37a2a19cb52efc169892e8849b9ceb0
7
- data.tar.gz: c51e518693653f525a5dc06ee71d859614f5a741b4109ded91a29e9327c768c9b7c0c5f1783fdceeb740b1e6f95074bfc7f0336b7228eb1a3e66a34bd3730bd1
6
+ metadata.gz: 2dc2019edf4bb02922b573b45e151a472cb3cb178b55677ffbb52d3867fb3514b1aabf76458338a8d832d1116a215fa0286c963a086c8ed2fd156ee94b4e5422
7
+ data.tar.gz: 45dee79d7372364092e9b3a9fd789d2b7553ac4052ebf0d6701bed7f2c62ad0772b7eb25702233feffe9ed13d158af7c958fa0a71f07a5740e869dda88402351
data/.github/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @crrood @hbkwong @KadoBOT @Aleffio @rikterbeek
1
+ * @crrood @Aleffio @wboereboom @cyattilakiss
@@ -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
@@ -11,3 +11,7 @@ design.txt
11
11
 
12
12
  .bundle
13
13
  .ruby-version
14
+
15
+ .DS_Store
16
+
17
+ .idea
data/README.md CHANGED
@@ -1,53 +1,69 @@
1
1
  # Adyen API Library for Ruby
2
2
 
3
- The Adyen API Library for Ruby lets you easily work with Adyen's API.
3
+
4
+ This is the officially supported Ruby library for using Adyen's APIs.
4
5
 
5
6
  ## Integration
7
+ The library supports all APIs under the following services:
6
8
 
7
- The Library supports all APIs under the following services:
9
+ * [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v68/overview): Our latest integration for accepting online payments. Current supported version: **v68**
10
+ * [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v64/overview): Our classic integration for online payments. Current supported version: **v64**
11
+ * [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v49/overview): Endpoints for managing saved payment details. Current supported version: **v49**
12
+ * [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v64/overview): Endpoints for sending funds to your customers. Current supported version: **v64**
13
+ * [Platforms APIs](https://docs.adyen.com/platforms/api): Set of APIs when using Adyen for Platforms.
14
+ * [Account API](https://docs.adyen.com/api-explorer/#/Account/v6/overview) Current supported version: **v6**
15
+ * [Fund API](https://docs.adyen.com/api-explorer/#/Fund/v6/overview) Current supported version: **v6**
16
+ * [Notification Configuration API](https://docs.adyen.com/api-explorer/#/NotificationConfigurationService/v6/overview) Current supported version: **v6**
17
+ * [POS Terminal Management API](https://docs.adyen.com/api-explorer/#/postfmapi/v1/overview): Current supported version: **v1**
18
+ * [Adyen BinLookup API](https://docs.adyen.com/api-explorer/#/BinLookup/v50/overview): Current supported version: **v50**
19
+ * [Data Protection API](https://docs.adyen.com/development-resources/data-protection-api): Current supported version: **v1**
20
+ * [Disputes API](https://docs.adyen.com/risk-management/disputes-api): Current supported version: **v50**
8
21
 
9
- * checkout
10
- * checkout utility
11
- * payments
12
- * modifications
13
- * payouts
14
- * recurring
15
- * marketpay
16
- * postfmapi
17
- * data_protection
18
22
 
19
- ## Requirements
23
+ For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/).
20
24
 
21
- Built for Ruby >= 2.1
25
+ ## Prerequisites
26
+ - [Adyen test account](https://docs.adyen.com/get-started-with-adyen)
27
+ - [API key](https://docs.adyen.com/development-resources/api-credentials#generate-api-key). For testing, your API credential needs to have the [API PCI Payments role](https://docs.adyen.com/development-resources/api-credentials#roles).
28
+ - Ruby >= 2.1
22
29
 
23
30
  ## Installation
24
31
 
25
- The sole dependency is faraday for http communication - run `bundle install` to install faraday if you don't already have it
32
+ The sole dependency is faraday for HTTP communication. Run the following command to install faraday if you don't already have it:
33
+
34
+ ~~~~bash
35
+ bundle install
36
+ ~~~~
26
37
 
27
- To validate functionality of client, use `bundle install --with development` and `rspec` to run mock API tests.
38
+ To validate functionality of client and run mock API tests use
28
39
 
40
+ ~~~~bash
41
+ bundle install --with development
42
+ ~~~~
43
+ and
44
+ ~~~~bash
45
+ rspec
46
+ ~~~~
29
47
  ## Documentation
30
48
 
31
49
  Follow the rest of our guides from the [documentation](https://adyen.github.io/adyen-ruby-api-library/) on how to use this library.
32
50
 
33
- ## Usage
51
+ ## Using the library
34
52
 
35
- ### Create a client to connect to the Adyen API
36
- ```ruby
37
- require 'adyen-ruby-api-library'
53
+ ### General use with API key
38
54
 
55
+ ~~~~bash
56
+ require 'adyen-ruby-api-library'
57
+ ~~~~
58
+ ~~~~ruby
39
59
  adyen = Adyen::Client.new
40
60
 
41
- # for API-key based implementations
42
61
  adyen.api_key = 'AF5XXXXXXXXXXXXXXXXXXXX'
43
62
 
44
- # for basic-auth based implementations
45
- adyen.ws_user = 'ws@Company.Adyen'
46
- adyen.ws_password = 'super_secure_password123'
47
- ```
63
+ ~~~~
48
64
 
49
- ### Make a Payment
50
- ```ruby
65
+ - Make a Payment
66
+ ~~~~ruby
51
67
  response = adyen.checkout.payments({
52
68
  :amount => {
53
69
  :currency => "EUR",
@@ -56,112 +72,45 @@ response = adyen.checkout.payments({
56
72
  :reference => "Your order number",
57
73
  :paymentMethod => {
58
74
  :type => "scheme",
59
- :encryptedCardNumber => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
60
- :encryptedExpiryMonth => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
61
- :encryptedExpiryYear => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
62
- :encryptedSecurityCode => "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
75
+ :encryptedCardNumber => "test_4111111111111111",
76
+ :encryptedExpiryMonth => "test_03",
77
+ :encryptedExpiryYear => "test_2030",
78
+ :encryptedSecurityCode => "test_737"
63
79
  },
64
80
  :returnUrl => "https://your-company.com/checkout/",
65
81
  :merchantAccount => "YourMerchantAccount"
66
82
  })
67
- ```
68
-
69
- ### Change API Version
70
- ```ruby
71
- adyen.checkout.version = 50
72
- ```
73
-
74
- ## List of supported methods
75
-
76
- **checkout:**
77
- - payment_session
78
- - payments.result
79
- - payment_methods
80
- - payments
81
- - payments.details
82
- - payment_links
83
-
84
- **checkout utility:**
85
- - origin_keys
86
-
87
- **payments:**
88
- - authorise
89
- - authorise3d
90
-
91
- **modifications:**
92
- - capture
93
- - cancel
94
- - refund
95
- - cancel_or_refund
96
- - adjust_authorisation
97
- - donate
98
-
99
- **payouts:**
100
- - confirm_third_party
101
- - decline_third_party
102
- - store_detail
103
- - submit_third_party
104
- - store_detail_and_submit_third_party
105
-
106
- **recurring:**
107
- - list_recurring_details
108
- - disable
109
- - store_token
110
-
111
- **marketpay.account:**
112
- - create_account_holder
113
- - get_account_holder
114
- - update_account_holder
115
- - update_account_holder_state
116
- - suspend_account_holder
117
- - un_suspend_account_holder
118
- - close_account_holder
119
- - create_account
120
- - update_account
121
- - close_account
122
- - upload_document
123
- - get_uploaded_documents
124
- - delete_bank_accounts
125
- - delete_shareholders
126
-
127
- **marketpay.fund:**
128
- - account_holder_balance
129
- - account_holder_transaction_list
130
- - payout_account_holder
131
- - transfer_funds
132
- - setup_beneficiary
133
- - refund_not_paid_out_transfers
134
-
135
- **marketpay.notification:**
136
- - create_notification_configuration
137
- - get_notification_configuration
138
- - get_notification_configuration_list
139
- - test_notification_configuration
140
- - update_notification_configuration
141
- - delete_notification_configurations
142
-
143
- **marketpay.hop:**
144
- - get_onboarding_url
145
-
146
- **postfmapi:**
147
- - assign_terminals
148
- - find_terminal
149
- - get_terminals_under_account
150
-
151
- **data_protection:**
152
- - request_subject_erasure
83
+ ~~~~
153
84
 
154
- ## Support
155
- If you have a feature request, or spotted a bug or a technical problem, create a GitHub issue. For other questions, contact our [support team](https://support.adyen.com/hc/en-us/requests/new?ticket_form_id=360000705420).
85
+ - Change API Version
86
+ ~~~~ruby
87
+ adyen.checkout.version = 68
88
+ ~~~~
89
+
90
+ ### Example integration
91
+
92
+ For a closer look at how our Ruby library works, clone our [example integration](https://github.com/adyen-examples/adyen-rails-online-payments). This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.
93
+
94
+ ### Running the tests
95
+ To run the tests use :
96
+ ~~~~bash
97
+ bundle install --with development
98
+ ~~~~
156
99
 
157
100
  ## Contributing
158
- We strongly encourage you to join us in contributing to this repository so everyone can benefit from:
159
- * New features and functionality
160
- * Resolved bug fixes and issues
161
- * Any general improvements
162
101
 
163
- Read our [**contribution guidelines**](CONTRIBUTING.md) to find out how.
102
+ We encourage you to contribute to this repository, so everyone can benefit from new features, bug fixes, and any other improvements.
103
+ Have a look at our [contributing guidelines](https://github.com/Adyen/adyen-ruby-api-library/blob/develop/CONTRIBUTING.md) to find out how to raise a pull request.
104
+
105
+ ## Support
106
+ If you have a feature request, or spotted a bug or a technical problem, [create an issue here](https://github.com/Adyen/adyen-ruby-api-library/issues/new/choose).
107
+
108
+ For other questions, [contact our Support Team](https://www.adyen.help/hc/en-us/requests/new?ticket_form_id=360000705420).
164
109
 
165
110
  ## Licence
111
+ This repository is available under the [MIT license](https://github.com/Adyen/adyen-ruby-api-library/blob/master/LICENSE).
166
112
 
167
- MIT license. For more information, see the LICENSE file.
113
+ ## See also
114
+ * [Example integration](https://github.com/adyen-examples/adyen-rails-online-payments)
115
+ * [Adyen docs](https://docs.adyen.com/)
116
+ * [API Explorer](https://docs.adyen.com/api-explorer/)
data/docs/marketpay.html CHANGED
@@ -61,6 +61,8 @@
61
61
  <li>delete_bank_accounts</li>
62
62
 
63
63
  <li>delete_shareholders</li>
64
+
65
+ <li>delete_signatories</li>
64
66
  </ul>
65
67
 
66
68
  <h4 id="marketpayfund">marketpay.fund:</h4>
data/lib/adyen/client.rb CHANGED
@@ -42,19 +42,16 @@ module Adyen
42
42
  when "Checkout"
43
43
  url = "https://checkout-#{@env}.adyen.com/checkout"
44
44
  supports_live_url_prefix = true
45
- when "CheckoutUtility"
46
- url = "https://checkout-#{@env}.adyen.com/checkout"
47
- supports_live_url_prefix = true
48
45
  when "Account", "Fund", "Notification", "Hop"
49
46
  url = "https://cal-#{@env}.adyen.com/cal/services"
50
47
  supports_live_url_prefix = false
51
- when "Recurring", "Payment", "Payout"
48
+ when "Recurring", "Payment", "Payout", "BinLookup"
52
49
  url = "https://pal-#{@env}.adyen.com/pal/servlet"
53
50
  supports_live_url_prefix = true
54
51
  when "Terminal"
55
52
  url = "https://postfmapi-#{@env}.adyen.com/postfmapi/terminal"
56
53
  supports_live_url_prefix = false
57
- when "DataProtectionService"
54
+ when "DataProtectionService", "DisputeService"
58
55
  url = "https://ca-#{@env}.adyen.com/ca/services"
59
56
  supports_live_url_prefix = false
60
57
  else
@@ -72,7 +69,7 @@ module Adyen
72
69
 
73
70
  # construct full URL from service and endpoint
74
71
  def service_url(service, action, version)
75
- if service == "Checkout" || service == "CheckoutUtility" || service == "Terminal"
72
+ if service == "Checkout" || service == "Terminal"
76
73
  "#{service_url_base(service)}/v#{version}/#{action}"
77
74
  else
78
75
  "#{service_url_base(service)}/#{service}/v#{version}/#{action}"
@@ -80,9 +77,9 @@ module Adyen
80
77
  end
81
78
 
82
79
  # send request to adyen API
83
- def call_adyen_api(service, action, request_data, headers, version)
80
+ def call_adyen_api(service, action, request_data, headers, version, with_application_info = false)
84
81
  # get URL for requested endpoint
85
- url = service_url(service, action, version)
82
+ url = service_url(service, action.is_a?(String) ? action : action.fetch(:url), version)
86
83
 
87
84
  # make sure right authentication has been provided
88
85
  # will use api_key if present, otherwise ws_user and ws_password
@@ -125,20 +122,39 @@ module Adyen
125
122
  end
126
123
 
127
124
  # add application only on checkout service
128
- if service == 'Checkout' || service == 'CheckoutUtility'
125
+ if with_application_info
129
126
  add_application_info(request_data)
130
127
  end
131
128
 
132
129
  # convert to json
133
130
  request_data = request_data.to_json
134
131
 
135
- # post request to Adyen
136
- begin
137
- response = conn.post do |req|
138
- req.body = request_data
139
- end # handle client errors
140
- rescue Faraday::ConnectionFailed => connection_error
141
- raise connection_error, "Connection to #{url} failed"
132
+ if action.is_a?(::Hash)
133
+ if action.fetch(:method) == "get"
134
+ begin
135
+ response = conn.get
136
+ rescue Faraday::ConnectionFailed => connection_error
137
+ raise connection_error, "Connection to #{url} failed"
138
+ end
139
+ end
140
+ if action.fetch(:method) == "patch"
141
+ begin
142
+ response = conn.patch do |req|
143
+ req.body = request_data
144
+ end
145
+ rescue Faraday::ConnectionFailed => connection_error
146
+ raise connection_error, "Connection to #{url} failed"
147
+ end
148
+ end
149
+ else
150
+ # post request to Adyen
151
+ begin
152
+ response = conn.post do |req|
153
+ req.body = request_data
154
+ end # handle client errors
155
+ rescue Faraday::ConnectionFailed => connection_error
156
+ raise connection_error, "Connection to #{url} failed"
157
+ end
142
158
  end
143
159
 
144
160
  # check for API errors
@@ -157,16 +173,15 @@ module Adyen
157
173
  # add application_info for analytics
158
174
  def add_application_info(request_data)
159
175
  adyenLibrary = {
160
- :name => Adyen::NAME,
161
- :version => Adyen::VERSION.to_s
176
+ :name => Adyen::NAME,
177
+ :version => Adyen::VERSION.to_s,
162
178
  }
163
179
 
164
180
  if request_data[:applicationInfo].nil?
165
- request_data[:applicationInfo] = {};
181
+ request_data[:applicationInfo] = {}
166
182
  end
167
183
 
168
184
  request_data[:applicationInfo][:adyenLibrary] = adyenLibrary
169
- request_data[:applicationInfo][:adyenLibraryTest] = adyenLibrary
170
185
  end
171
186
 
172
187
  # services
@@ -174,10 +189,6 @@ module Adyen
174
189
  @checkout ||= Adyen::Checkout.new(self)
175
190
  end
176
191
 
177
- def checkout_utility
178
- @checkout_utility ||= Adyen::CheckoutUtility.new(self)
179
- end
180
-
181
192
  def payments
182
193
  @payments ||= Adyen::Payments.new(self)
183
194
  end
@@ -201,5 +212,13 @@ module Adyen
201
212
  def data_protection
202
213
  @data_protection ||= Adyen::DataProtection.new(self)
203
214
  end
215
+
216
+ def dispute
217
+ @dispute ||= Adyen::Dispute.new(self)
218
+ end
219
+
220
+ def bin_lookup
221
+ @bin_lookup ||= Adyen::BinLookup.new(self)
222
+ end
204
223
  end
205
224
  end
@@ -1,13 +1,15 @@
1
1
  require_relative 'service'
2
2
 
3
3
  module Adyen
4
- class CheckoutUtility < Service
5
- DEFAULT_VERSION = 1
4
+ class BinLookup < Service
5
+ attr_accessor :version
6
+ DEFAULT_VERSION = 50
6
7
 
7
8
  def initialize(client, version = DEFAULT_VERSION)
8
- service = 'Checkout'
9
+ service = 'BinLookup'
9
10
  method_names = [
10
- :origin_keys
11
+ :get_3ds_availability,
12
+ :get_cost_estimate
11
13
  ]
12
14
 
13
15
  super(client, version, service, method_names)
@@ -1,18 +1,22 @@
1
- require_relative 'service'
1
+ require_relative "service"
2
2
 
3
3
  module Adyen
4
4
  class Checkout < Service
5
- DEFAULT_VERSION = 50
5
+ DEFAULT_VERSION = 68
6
6
 
7
7
  def initialize(client, version = DEFAULT_VERSION)
8
- service = 'Checkout'
8
+ service = "Checkout"
9
9
  method_names = [
10
- :payment_methods,
11
10
  :payment_session,
12
- :payment_links
11
+ :origin_keys,
12
+ :sessions
13
13
  ]
14
14
 
15
- super(client, version, service, method_names)
15
+ with_application_info = [
16
+ :payment_session,
17
+ ]
18
+
19
+ super(client, version, service, method_names, with_application_info)
16
20
  end
17
21
 
18
22
  # This method can't be dynamically defined because
@@ -25,7 +29,40 @@ module Adyen
25
29
  when 0
26
30
  Adyen::CheckoutDetail.new(@client, @version)
27
31
  else
28
- action = 'payments'
32
+ action = "payments"
33
+ args[1] ||= {} # optional headers arg
34
+ @client.call_adyen_api(@service, action, args[0], args[1], @version, true)
35
+ end
36
+ end
37
+
38
+ def payment_links(*args)
39
+ case args.size
40
+ when 0
41
+ Adyen::CheckoutLink.new(@client, @version)
42
+ else
43
+ action = "paymentLinks"
44
+ args[1] ||= {} # optional headers arg
45
+ @client.call_adyen_api(@service, action, args[0], args[1], @version, true)
46
+ end
47
+ end
48
+
49
+ def payment_methods(*args)
50
+ case args.size
51
+ when 0
52
+ Adyen::CheckoutMethod.new(@client, @version)
53
+ else
54
+ action = "paymentMethods"
55
+ args[1] ||= {} # optional headers arg
56
+ @client.call_adyen_api(@service, action, args[0], args[1], @version)
57
+ end
58
+ end
59
+
60
+ def orders(*args)
61
+ case args.size
62
+ when 0
63
+ Adyen::CheckoutOrder.new(@client, @version)
64
+ else
65
+ action = "orders"
29
66
  args[1] ||= {} # optional headers arg
30
67
  @client.call_adyen_api(@service, action, args[0], args[1], @version)
31
68
  end
@@ -34,7 +71,7 @@ module Adyen
34
71
 
35
72
  class CheckoutDetail < Service
36
73
  def initialize(client, version = DEFAULT_VERSION)
37
- @service = 'Checkout'
74
+ @service = "Checkout"
38
75
  @client = client
39
76
  @version = version
40
77
  end
@@ -49,4 +86,48 @@ module Adyen
49
86
  @client.call_adyen_api(@service, action, request, headers, @version)
50
87
  end
51
88
  end
89
+
90
+ class CheckoutLink < Service
91
+ def initialize(client, version = DEFAULT_VERSION)
92
+ @service = "Checkout"
93
+ @client = client
94
+ @version = version
95
+ end
96
+
97
+ def get(linkId, headers = {})
98
+ action = { method: 'get', url: "paymentLinks/" + linkId }
99
+ @client.call_adyen_api(@service, action, {}, headers, @version, true)
100
+ end
101
+
102
+ def update(linkId, request, headers = {})
103
+ action = { method: 'patch', url: "paymentLinks/" + linkId }
104
+ @client.call_adyen_api(@service, action, request, headers, @version, false)
105
+ end
106
+ end
107
+
108
+ class CheckoutMethod < Service
109
+ def initialize(client, version = DEFAULT_VERSION)
110
+ @service = "Checkout"
111
+ @client = client
112
+ @version = version
113
+ end
114
+
115
+ def balance(request, headers = {})
116
+ action = "paymentMethods/balance"
117
+ @client.call_adyen_api(@service, action, request, headers, @version, true)
118
+ end
119
+ end
120
+
121
+ class CheckoutOrder < Service
122
+ def initialize(client, version = DEFAULT_VERSION)
123
+ @service = "Checkout"
124
+ @client = client
125
+ @version = version
126
+ end
127
+
128
+ def cancel(request, headers = {})
129
+ action = "orders/cancel"
130
+ @client.call_adyen_api(@service, action, request, headers, @version)
131
+ end
132
+ end
52
133
  end
@@ -0,0 +1,20 @@
1
+ require_relative 'service'
2
+
3
+ module Adyen
4
+ class Dispute < Service
5
+ attr_accessor :version
6
+ DEFAULT_VERSION = 30
7
+
8
+ def initialize(client, version = DEFAULT_VERSION)
9
+ service = 'DisputeService'
10
+ method_names = [
11
+ :retrieve_applicable_defense_reasons,
12
+ :supply_defense_document,
13
+ :delete_dispute_defense_document,
14
+ :defend_dispute,
15
+ ]
16
+
17
+ super(client, version, service, method_names)
18
+ end
19
+ end
20
+ end
@@ -29,7 +29,7 @@ module Adyen
29
29
 
30
30
  class Account < Service
31
31
  attr_accessor :version
32
- DEFAULT_VERSION = 4
32
+ DEFAULT_VERSION = 6
33
33
 
34
34
  def initialize(client, version = DEFAULT_VERSION)
35
35
  service = 'Account'
@@ -44,11 +44,13 @@ module Adyen
44
44
  :update_account_holder_state,
45
45
  :delete_bank_accounts,
46
46
  :delete_shareholders,
47
+ :delete_signatories,
47
48
  :close_account,
48
49
  :close_account_holder,
49
- :get_tier_configuration,
50
50
  :suspend_account_holder,
51
- :un_suspend_account_holder
51
+ :un_suspend_account_holder,
52
+ :delete_payout_methods,
53
+ :check_account_holder
52
54
  ]
53
55
 
54
56
  super(client, version, service, method_names)
@@ -57,7 +59,7 @@ module Adyen
57
59
 
58
60
  class Fund < Service
59
61
  attr_accessor :version
60
- DEFAULT_VERSION = 3
62
+ DEFAULT_VERSION = 6
61
63
 
62
64
  def initialize(client, version = DEFAULT_VERSION)
63
65
  service = 'Fund'
@@ -67,7 +69,8 @@ module Adyen
67
69
  :account_holder_transaction_list,
68
70
  :refund_not_paid_out_transfers,
69
71
  :setup_beneficiary,
70
- :transfer_funds
72
+ :transfer_funds,
73
+ :refund_funds_transfer
71
74
  ]
72
75
 
73
76
  super(client, version, service, method_names)
@@ -76,7 +79,7 @@ module Adyen
76
79
 
77
80
  class Notification < Service
78
81
  attr_accessor :version
79
- DEFAULT_VERSION = 5
82
+ DEFAULT_VERSION = 6
80
83
 
81
84
  def initialize(client, version = DEFAULT_VERSION)
82
85
  service = 'Notification'
@@ -95,7 +98,7 @@ module Adyen
95
98
 
96
99
  class Hop < Service
97
100
  attr_accessor :version
98
- DEFAULT_VERSION = 1
101
+ DEFAULT_VERSION = 6
99
102
 
100
103
  def initialize(client, version = DEFAULT_VERSION)
101
104
  service = 'Hop'