adyen-ruby-api-library 4.4.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  3. data/README.md +73 -136
  4. data/lib/adyen-ruby-api-library.rb +0 -1
  5. data/lib/adyen/client.rb +28 -16
  6. data/lib/adyen/services/checkout.rb +80 -4
  7. data/lib/adyen/services/marketpay.rb +9 -7
  8. data/lib/adyen/services/payments.rb +5 -1
  9. data/lib/adyen/services/payouts.rb +3 -2
  10. data/lib/adyen/services/recurring.rb +3 -2
  11. data/lib/adyen/version.rb +1 -1
  12. data/spec/account_spec.rb +3 -1
  13. data/spec/checkout_spec.rb +247 -5
  14. data/spec/fund_spec.rb +2 -1
  15. data/spec/mocks/requests/Account/check_account_holder.json +5 -0
  16. data/spec/mocks/requests/Account/delete_payout_methods.json +6 -0
  17. data/spec/mocks/requests/Checkout/orders.json +6 -0
  18. data/spec/mocks/requests/Checkout/orders_cancel.json +7 -0
  19. data/spec/mocks/requests/Checkout/origin_keys.json +3 -0
  20. data/spec/mocks/requests/Checkout/payment_methods_balance.json +9 -0
  21. data/spec/mocks/requests/Fund/refund_funds_transfer.json +7 -0
  22. data/spec/mocks/requests/Payment/get_authentication_result.json +4 -0
  23. data/spec/mocks/requests/Payment/retrieve_3ds2_result.json +4 -0
  24. data/spec/mocks/requests/Payment/technical_cancel.json +4 -0
  25. data/spec/mocks/requests/Payment/void_pending_refund.json +4 -0
  26. data/spec/mocks/requests/Payout/payout.json +8 -0
  27. data/spec/mocks/requests/Recurring/schedule_account_updater.json +12 -0
  28. data/spec/mocks/responses/Account/check_account_holder.json +3 -0
  29. data/spec/mocks/responses/Account/delete_payout_methods.json +3 -0
  30. data/spec/mocks/responses/Checkout/get-payment-link.json +11 -0
  31. data/spec/mocks/responses/Checkout/orders.json +8 -0
  32. data/spec/mocks/responses/Checkout/orders_cancel.json +4 -0
  33. data/spec/mocks/responses/Checkout/origin_keys.json +5 -0
  34. data/spec/mocks/responses/Checkout/payment_methods_balance.json +3 -0
  35. data/spec/mocks/responses/Checkout/update-payment-link.json +11 -0
  36. data/spec/mocks/responses/Fund/refund_funds_transfer.json +5 -0
  37. data/spec/mocks/responses/Payment/get_authentication_result.json +5 -0
  38. data/spec/mocks/responses/Payment/retrieve_3ds2_result.json +5 -0
  39. data/spec/mocks/responses/Payment/technical_cancel.json +3 -0
  40. data/spec/mocks/responses/Payment/void_pending_refund.json +3 -0
  41. data/spec/mocks/responses/Payout/payout.json +3 -0
  42. data/spec/mocks/responses/Recurring/schedule_account_updater.json +4 -0
  43. data/spec/payments_spec.rb +5 -1
  44. data/spec/payouts_spec.rb +2 -1
  45. data/spec/recurring_spec.rb +2 -1
  46. data/spec/spec_helper.rb +0 -1
  47. metadata +32 -7
  48. data/lib/adyen/services/checkout_utility.rb +0 -16
  49. data/spec/checkout_utility_spec.rb +0 -29
  50. data/spec/mocks/requests/CheckoutUtility/origin_keys.json +0 -7
  51. data/spec/mocks/responses/CheckoutUtility/origin_keys.json +0 -7
@@ -0,0 +1,3 @@
1
+ {
2
+ "originDomains": "https://adyen.com"
3
+ }
@@ -0,0 +1,9 @@
1
+
2
+ {
3
+ "paymentMethod": {
4
+ "type": "givex",
5
+ "number": "4126491073027401",
6
+ "cvc": "737"
7
+ },
8
+ "merchantAccount": "YOUR_MERCHANT_ACCOUNT"
9
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "originalReference": "190324759",
3
+ "amount": {
4
+ "currency": "EUR",
5
+ "value": 2000
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "pspReference": "9914694372990637"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "pspReference": "9914694372990637"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "originalReference": "9914694372990637"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "originalReference": "9914694372990637"
4
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "amount": {
3
+ "currency": "USD",
4
+ "value": 1000
5
+ },
6
+ "merchantAccount": "MERCHANT_ACCOUNT",
7
+ "reference": "9876543210"
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "card": {
3
+ "number": "4111111111111111",
4
+ "expiryMonth": "8",
5
+ "expiryYear": "2018",
6
+ "cvc": "737",
7
+ "holderName": "John Smith"
8
+ },
9
+ "reference": "Merchant Reference",
10
+ "merchantAccount": "TestMerchant",
11
+ "shopperReference": "shopperReference"
12
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "pspReference":"9914694372990637"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "pspReference": "9914694372990637"
3
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "amount": {
3
+ "currency": "USD",
4
+ "value": 1000
5
+ },
6
+ "id": "MockId",
7
+ "merchantAccount": "TestMerchant",
8
+ "reference": "Merchant Reference",
9
+ "status": "active",
10
+ "url": "https://adyen.com"
11
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "expiresAt": "1970-01-01",
3
+ "orderData": "mockedOrderData",
4
+ "remainingAmount": {
5
+ "currency": "USD",
6
+ "value": 100
7
+ }
8
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "pspReference": "mocked_psp_ref",
3
+ "resultCode": "cancelled"
4
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "originKeys": {
3
+ "https://adyen.com": "mocked_origin_key"
4
+ }
5
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "balance": "100"
3
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "amount": {
3
+ "currency": "USD",
4
+ "value": 1000
5
+ },
6
+ "id": "MockId",
7
+ "merchantAccount": "TestMerchant",
8
+ "reference": "Merchant Reference",
9
+ "status": "expired",
10
+ "url": "https://adyen.com"
11
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "pspReference": "9915090893984580",
3
+ "merchantReference": "MerchantReference",
4
+ "resultCode": "Received"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "threeDS2Result": {
3
+ "transStatus": "Y"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "threeDS2Result": {
3
+ "transStatus": "Y"
4
+ }
5
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "originalReference": "9914694372990637"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "pspReference": "9914694372990637"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "resultCode": "Success"
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "pspReference": "8815260599791117",
3
+ "result": "Success"
4
+ }
@@ -15,7 +15,11 @@ RSpec.describe Adyen::Payments, service: "payments service" do
15
15
  ["cancel_or_refund", "response", "[cancelOrRefund-received]"],
16
16
  ["capture", "response", "[capture-received]"],
17
17
  ["refund", "response", "[refund-received]"],
18
- ["donate", "response", "[donation-received]"]
18
+ ["donate", "response", "[donation-received]"],
19
+ ["get_authentication_result", "threeDS2Result", {"transStatus" => "Y"}],
20
+ ["retrieve_3ds2_result", "threeDS2Result", {"transStatus" => "Y"}],
21
+ ["technical_cancel", "originalReference", "9914694372990637"],
22
+ ["void_pending_refund", "pspReference", "9914694372990637"]
19
23
  ]
20
24
 
21
25
  generate_tests(client, "Payment", test_sets, client.payments)
data/spec/payouts_spec.rb CHANGED
@@ -11,7 +11,8 @@ RSpec.describe Adyen::Payments, service: "payouts service" do
11
11
  ["store_detail_and_submit_third_party", "resultCode", "[payout-submit-received]"],
12
12
  ["submit_third_party", "resultCode", "[payout-submit-received]"],
13
13
  ["confirm_third_party", "response", "[payout-confirm-received]"],
14
- ["decline_third_party", "response", "[payout-decline-received]"]
14
+ ["decline_third_party", "response", "[payout-decline-received]"],
15
+ ["payout", "resultCode", "Success"]
15
16
  ]
16
17
 
17
18
  generate_tests(client, "Payout", test_sets, client.payouts)
@@ -10,7 +10,8 @@ RSpec.describe Adyen::Payments, service: "recurring service" do
10
10
  test_sets = [
11
11
  ["list_recurring_details", "creationDate", "2017-03-01T11:53:11+01:00"],
12
12
  ["disable", "response", "[detail-successfully-disabled]"],
13
- ["store_token", "result", "Success"]
13
+ ["store_token", "result", "Success"],
14
+ ["schedule_account_updater", "result", "Success"]
14
15
  ]
15
16
 
16
17
  generate_tests(client, "Recurring", test_sets, client.recurring)
data/spec/spec_helper.rb CHANGED
@@ -24,7 +24,6 @@ def create_test(client, service, method_name, parent_object)
24
24
  "authorise3ds2",
25
25
  "payments",
26
26
  "payment_session",
27
- "payment_links",
28
27
  ]
29
28
  if with_application_info.include?(method_name)
30
29
  client.add_application_info(request_body)
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.4.0
4
+ version: 5.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: 2020-11-16 00:00:00.000000000 Z
11
+ date: 2021-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -113,7 +113,6 @@ files:
113
113
  - lib/adyen/result.rb
114
114
  - lib/adyen/services/bin_lookup.rb
115
115
  - lib/adyen/services/checkout.rb
116
- - lib/adyen/services/checkout_utility.rb
117
116
  - lib/adyen/services/data_protection.rb
118
117
  - lib/adyen/services/dispute.rb
119
118
  - lib/adyen/services/marketpay.rb
@@ -128,7 +127,6 @@ files:
128
127
  - spec/account_spec.rb
129
128
  - spec/bin_lookup_spec.rb
130
129
  - spec/checkout_spec.rb
131
- - spec/checkout_utility_spec.rb
132
130
  - spec/client_spec.rb
133
131
  - spec/data_protection_spec.rb
134
132
  - spec/dispute_spec.rb
@@ -136,11 +134,13 @@ files:
136
134
  - spec/fund_spec.rb
137
135
  - spec/hash_with_accessors_spec.rb
138
136
  - spec/hop_spec.rb
137
+ - spec/mocks/requests/Account/check_account_holder.json
139
138
  - spec/mocks/requests/Account/close_account.json
140
139
  - spec/mocks/requests/Account/close_account_holder.json
141
140
  - spec/mocks/requests/Account/create_account.json
142
141
  - spec/mocks/requests/Account/create_account_holder.json
143
142
  - spec/mocks/requests/Account/delete_bank_accounts.json
143
+ - spec/mocks/requests/Account/delete_payout_methods.json
144
144
  - spec/mocks/requests/Account/delete_shareholders.json
145
145
  - spec/mocks/requests/Account/get_account_holder.json
146
146
  - spec/mocks/requests/Account/get_uploaded_documents.json
@@ -152,14 +152,17 @@ files:
152
152
  - spec/mocks/requests/Account/upload_document.json
153
153
  - spec/mocks/requests/BinLookup/get_3ds_availability.json
154
154
  - spec/mocks/requests/BinLookup/get_cost_estimate.json
155
+ - spec/mocks/requests/Checkout/orders.json
156
+ - spec/mocks/requests/Checkout/orders_cancel.json
157
+ - spec/mocks/requests/Checkout/origin_keys.json
155
158
  - spec/mocks/requests/Checkout/payment-details.json
156
159
  - spec/mocks/requests/Checkout/payment-result.json
157
160
  - spec/mocks/requests/Checkout/payment_links.json
158
161
  - spec/mocks/requests/Checkout/payment_methods.json
162
+ - spec/mocks/requests/Checkout/payment_methods_balance.json
159
163
  - spec/mocks/requests/Checkout/payment_session.json
160
164
  - spec/mocks/requests/Checkout/payments.json
161
165
  - spec/mocks/requests/Checkout/verify.json
162
- - spec/mocks/requests/CheckoutUtility/origin_keys.json
163
166
  - spec/mocks/requests/DataProtectionService/request_subject_erasure.json
164
167
  - spec/mocks/requests/DisputeService/defend_dispute.json
165
168
  - spec/mocks/requests/DisputeService/delete_dispute_defense_document.json
@@ -168,6 +171,7 @@ files:
168
171
  - spec/mocks/requests/Fund/account_holder_balance.json
169
172
  - spec/mocks/requests/Fund/account_holder_transaction_list.json
170
173
  - spec/mocks/requests/Fund/payout_account_holder.json
174
+ - spec/mocks/requests/Fund/refund_funds_transfer.json
171
175
  - spec/mocks/requests/Fund/refund_not_paid_out_transfers.json
172
176
  - spec/mocks/requests/Fund/setup_beneficiary.json
173
177
  - spec/mocks/requests/Fund/transfer_funds.json
@@ -186,23 +190,31 @@ files:
186
190
  - spec/mocks/requests/Payment/cancel_or_refund.json
187
191
  - spec/mocks/requests/Payment/capture.json
188
192
  - spec/mocks/requests/Payment/donate.json
193
+ - spec/mocks/requests/Payment/get_authentication_result.json
189
194
  - spec/mocks/requests/Payment/refund.json
195
+ - spec/mocks/requests/Payment/retrieve_3ds2_result.json
196
+ - spec/mocks/requests/Payment/technical_cancel.json
197
+ - spec/mocks/requests/Payment/void_pending_refund.json
190
198
  - spec/mocks/requests/Payout/confirm_third_party.json
191
199
  - spec/mocks/requests/Payout/decline_third_party.json
200
+ - spec/mocks/requests/Payout/payout.json
192
201
  - spec/mocks/requests/Payout/store_detail.json
193
202
  - spec/mocks/requests/Payout/store_detail_and_submit_third_party.json
194
203
  - spec/mocks/requests/Payout/submit_third_party.json
195
204
  - spec/mocks/requests/Recurring/disable.json
196
205
  - spec/mocks/requests/Recurring/list_recurring_details.json
206
+ - spec/mocks/requests/Recurring/schedule_account_updater.json
197
207
  - spec/mocks/requests/Recurring/store_token.json
198
208
  - spec/mocks/requests/Terminal/assign_terminals.json
199
209
  - spec/mocks/requests/Terminal/find_terminal.json
200
210
  - spec/mocks/requests/Terminal/get_terminals_under_account.json
211
+ - spec/mocks/responses/Account/check_account_holder.json
201
212
  - spec/mocks/responses/Account/close_account.json
202
213
  - spec/mocks/responses/Account/close_account_holder.json
203
214
  - spec/mocks/responses/Account/create_account.json
204
215
  - spec/mocks/responses/Account/create_account_holder.json
205
216
  - spec/mocks/responses/Account/delete_bank_accounts.json
217
+ - spec/mocks/responses/Account/delete_payout_methods.json
206
218
  - spec/mocks/responses/Account/delete_shareholders.json
207
219
  - spec/mocks/responses/Account/get_account_holder.json
208
220
  - spec/mocks/responses/Account/get_uploaded_documents.json
@@ -214,14 +226,19 @@ files:
214
226
  - spec/mocks/responses/Account/upload_document.json
215
227
  - spec/mocks/responses/BinLookup/get_3ds_availability.json
216
228
  - spec/mocks/responses/BinLookup/get_cost_estimate.json
229
+ - spec/mocks/responses/Checkout/get-payment-link.json
230
+ - spec/mocks/responses/Checkout/orders.json
231
+ - spec/mocks/responses/Checkout/orders_cancel.json
232
+ - spec/mocks/responses/Checkout/origin_keys.json
217
233
  - spec/mocks/responses/Checkout/payment-details.json
218
234
  - spec/mocks/responses/Checkout/payment-result.json
219
235
  - spec/mocks/responses/Checkout/payment_links.json
220
236
  - spec/mocks/responses/Checkout/payment_methods.json
237
+ - spec/mocks/responses/Checkout/payment_methods_balance.json
221
238
  - spec/mocks/responses/Checkout/payment_session.json
222
239
  - spec/mocks/responses/Checkout/payments.json
240
+ - spec/mocks/responses/Checkout/update-payment-link.json
223
241
  - spec/mocks/responses/Checkout/verify.json
224
- - spec/mocks/responses/CheckoutUtility/origin_keys.json
225
242
  - spec/mocks/responses/DataProtectionService/request_subject_erasure.json
226
243
  - spec/mocks/responses/DisputeService/defend_dispute.json
227
244
  - spec/mocks/responses/DisputeService/delete_dispute_defense_document.json
@@ -230,6 +247,7 @@ files:
230
247
  - spec/mocks/responses/Fund/account_holder_balance.json
231
248
  - spec/mocks/responses/Fund/account_holder_transaction_list.json
232
249
  - spec/mocks/responses/Fund/payout_account_holder.json
250
+ - spec/mocks/responses/Fund/refund_funds_transfer.json
233
251
  - spec/mocks/responses/Fund/refund_not_paid_out_transfers.json
234
252
  - spec/mocks/responses/Fund/setup_beneficiary.json
235
253
  - spec/mocks/responses/Fund/transfer_funds.json
@@ -248,14 +266,20 @@ files:
248
266
  - spec/mocks/responses/Payment/cancel_or_refund.json
249
267
  - spec/mocks/responses/Payment/capture.json
250
268
  - spec/mocks/responses/Payment/donate.json
269
+ - spec/mocks/responses/Payment/get_authentication_result.json
251
270
  - spec/mocks/responses/Payment/refund.json
271
+ - spec/mocks/responses/Payment/retrieve_3ds2_result.json
272
+ - spec/mocks/responses/Payment/technical_cancel.json
273
+ - spec/mocks/responses/Payment/void_pending_refund.json
252
274
  - spec/mocks/responses/Payout/confirm_third_party.json
253
275
  - spec/mocks/responses/Payout/decline_third_party.json
276
+ - spec/mocks/responses/Payout/payout.json
254
277
  - spec/mocks/responses/Payout/store_detail.json
255
278
  - spec/mocks/responses/Payout/store_detail_and_submit_third_party.json
256
279
  - spec/mocks/responses/Payout/submit_third_party.json
257
280
  - spec/mocks/responses/Recurring/disable.json
258
281
  - spec/mocks/responses/Recurring/list_recurring_details.json
282
+ - spec/mocks/responses/Recurring/schedule_account_updater.json
259
283
  - spec/mocks/responses/Recurring/store_token.json
260
284
  - spec/mocks/responses/Terminal/assign_terminals.json
261
285
  - spec/mocks/responses/Terminal/find_terminal.json
@@ -290,7 +314,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
314
  - !ruby/object:Gem::Version
291
315
  version: '0'
292
316
  requirements: []
293
- rubygems_version: 3.1.2
317
+ rubyforge_project:
318
+ rubygems_version: 2.7.8
294
319
  signing_key:
295
320
  specification_version: 4
296
321
  summary: Official Adyen Ruby API Library
@@ -1,16 +0,0 @@
1
- require_relative 'service'
2
-
3
- module Adyen
4
- class CheckoutUtility < Service
5
- DEFAULT_VERSION = 1
6
-
7
- def initialize(client, version = DEFAULT_VERSION)
8
- service = 'Checkout'
9
- method_names = [
10
- :origin_keys
11
- ]
12
-
13
- super(client, version, service, method_names)
14
- end
15
- end
16
- end
@@ -1,29 +0,0 @@
1
- require "spec_helper"
2
- require "json"
3
-
4
- # rubocop:disable Metrics/BlockLength
5
-
6
- RSpec.describe Adyen::CheckoutUtility, service: "checkout utility" do
7
- before(:all) do
8
- @shared_values = {
9
- client: create_client(:api_key),
10
- service: "CheckoutUtility",
11
- }
12
- end
13
-
14
- it "sets the correct service URL base" do
15
- client = Adyen::Client.new(env: :test)
16
- expect(client.service_url_base(@shared_values[:service])).to eq("https://checkout-test.adyen.com/checkout")
17
- end
18
-
19
- # must be created manually because every field in the response is an array
20
- it "makes an origin_keys call" do
21
- parsed_body = create_test(@shared_values[:client], @shared_values[:service], "origin_keys", @shared_values[:client].checkout_utility)
22
- expect(parsed_body["originKeys"]).
23
- to be_a Adyen::HashWithAccessors
24
- expect(parsed_body["originKeys"]).
25
- to be_a_kind_of Hash
26
- end
27
- end
28
-
29
- # rubocop:enable Metrics/BlockLength
@@ -1,7 +0,0 @@
1
- {
2
- "originDomains": [
3
- "https://www.your-domain1.com",
4
- "https://www.your-domain2.com",
5
- "https://www.your-domain3.com"
6
- ]
7
- }