adyen-ruby-api-library 4.0.1 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/CODEOWNERS +1 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +20 -0
- data/.gitignore +4 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/Gemfile +2 -2
- data/README.md +72 -109
- data/docs/checkout.html +17 -0
- data/docs/marketpay.html +2 -0
- data/lib/adyen/client.rb +57 -24
- data/lib/adyen/errors.rb +44 -2
- data/lib/adyen/services/bin_lookup.rb +18 -0
- data/lib/adyen/services/checkout.rb +90 -8
- data/lib/adyen/services/{checkout_utility.rb → data_protection.rb} +4 -3
- data/lib/adyen/services/dispute.rb +20 -0
- data/lib/adyen/services/marketpay.rb +27 -6
- data/lib/adyen/services/payments.rb +15 -5
- data/lib/adyen/services/payouts.rb +3 -2
- data/lib/adyen/services/postfmapi.rb +19 -0
- data/lib/adyen/services/recurring.rb +3 -2
- data/lib/adyen/services/service.rb +2 -2
- data/lib/adyen/version.rb +1 -1
- data/lib/adyen-ruby-api-library.rb +4 -12
- data/renovate.json +5 -0
- data/spec/account_spec.rb +4 -1
- data/spec/bin_lookup_spec.rb +15 -0
- data/spec/checkout_spec.rb +275 -4
- data/spec/data_protection_spec.rb +14 -0
- data/spec/dispute_spec.rb +17 -0
- data/spec/errors_spec.rb +33 -3
- data/spec/fund_spec.rb +2 -1
- data/spec/hop_spec.rb +14 -0
- data/spec/mocks/requests/Account/check_account_holder.json +5 -0
- data/spec/mocks/requests/Account/delete_payout_methods.json +6 -0
- data/spec/mocks/requests/Account/delete_signatories.json +6 -0
- data/spec/mocks/requests/BinLookup/get_3ds_availability.json +4 -0
- data/spec/mocks/requests/BinLookup/get_cost_estimate.json +8 -0
- data/spec/mocks/requests/Checkout/orders.json +6 -0
- data/spec/mocks/requests/Checkout/orders_cancel.json +7 -0
- data/spec/mocks/requests/Checkout/origin_keys.json +3 -0
- data/spec/mocks/requests/Checkout/payment_links.json +9 -0
- data/spec/mocks/requests/Checkout/payment_methods_balance.json +9 -0
- data/spec/mocks/requests/Checkout/sessions.json +10 -0
- data/spec/mocks/requests/DataProtectionService/request_subject_erasure.json +5 -0
- data/spec/mocks/requests/DisputeService/defend_dispute.json +5 -0
- data/spec/mocks/requests/DisputeService/delete_dispute_defense_document.json +5 -0
- data/spec/mocks/requests/DisputeService/retrieve_applicable_defense_reasons.json +4 -0
- data/spec/mocks/requests/DisputeService/supply_defense_document.json +11 -0
- data/spec/mocks/requests/Fund/refund_funds_transfer.json +7 -0
- data/spec/mocks/requests/Hop/get_onboarding_url.json +4 -0
- data/spec/mocks/requests/Payment/donate.json +10 -0
- data/spec/mocks/requests/Payment/get_authentication_result.json +4 -0
- data/spec/mocks/requests/Payment/retrieve_3ds2_result.json +4 -0
- data/spec/mocks/requests/Payment/technical_cancel.json +4 -0
- data/spec/mocks/requests/Payment/void_pending_refund.json +4 -0
- data/spec/mocks/requests/Payout/payout.json +8 -0
- data/spec/mocks/requests/Recurring/schedule_account_updater.json +12 -0
- data/spec/mocks/requests/Terminal/assign_terminals.json +6 -0
- data/spec/mocks/requests/Terminal/find_terminal.json +3 -0
- data/spec/mocks/requests/Terminal/get_terminals_under_account.json +4 -0
- data/spec/mocks/responses/Account/check_account_holder.json +3 -0
- data/spec/mocks/responses/Account/delete_payout_methods.json +3 -0
- data/spec/mocks/responses/Account/delete_signatories.json +3 -0
- data/spec/mocks/responses/BinLookup/get_3ds_availability.json +8 -0
- data/spec/mocks/responses/BinLookup/get_cost_estimate.json +8 -0
- data/spec/mocks/responses/Checkout/get-payment-link.json +11 -0
- data/spec/mocks/responses/Checkout/orders.json +8 -0
- data/spec/mocks/responses/Checkout/orders_cancel.json +4 -0
- data/spec/mocks/responses/Checkout/origin_keys.json +5 -0
- data/spec/mocks/responses/Checkout/payment_links.json +9 -0
- data/spec/mocks/responses/Checkout/payment_methods_balance.json +3 -0
- data/spec/mocks/responses/Checkout/sessions-success.json +11 -0
- data/spec/mocks/responses/Checkout/update-payment-link.json +11 -0
- data/spec/mocks/responses/DataProtectionService/request_subject_erasure.json +3 -0
- data/spec/mocks/responses/DisputeService/defend_dispute.json +5 -0
- data/spec/mocks/responses/DisputeService/delete_dispute_defense_document.json +5 -0
- data/spec/mocks/responses/DisputeService/retrieve_applicable_defense_reasons.json +28 -0
- data/spec/mocks/responses/DisputeService/supply_defense_document.json +5 -0
- data/spec/mocks/responses/Fund/refund_funds_transfer.json +5 -0
- data/spec/mocks/responses/Hop/get_onboarding_url.json +7 -0
- data/spec/mocks/responses/Payment/donate.json +4 -0
- data/spec/mocks/responses/Payment/get_authentication_result.json +5 -0
- data/spec/mocks/responses/Payment/retrieve_3ds2_result.json +5 -0
- data/spec/mocks/responses/Payment/technical_cancel.json +3 -0
- data/spec/mocks/responses/Payment/void_pending_refund.json +3 -0
- data/spec/mocks/responses/Payout/payout.json +3 -0
- data/spec/mocks/responses/Recurring/schedule_account_updater.json +4 -0
- data/spec/mocks/responses/Terminal/assign_terminals.json +5 -0
- data/spec/mocks/responses/Terminal/find_terminal.json +6 -0
- data/spec/mocks/responses/Terminal/get_terminals_under_account.json +11 -0
- data/spec/payments_spec.rb +6 -1
- data/spec/payouts_spec.rb +2 -1
- data/spec/postfmapi_spec.rb +16 -0
- data/spec/recurring_spec.rb +2 -1
- data/spec/service_spec.rb +4 -0
- data/spec/spec_helper.rb +18 -12
- metadata +78 -9
- data/.travis.yml +0 -14
- data/spec/checkout_utility_spec.rb +0 -29
- data/spec/mocks/requests/CheckoutUtility/origin_keys.json +0 -7
- data/spec/mocks/responses/CheckoutUtility/origin_keys.json +0 -7
data/spec/checkout_spec.rb
CHANGED
@@ -13,9 +13,79 @@ RSpec.describe Adyen::Checkout, service: "checkout" do
|
|
13
13
|
|
14
14
|
# must be created manually because every field in the response is an array
|
15
15
|
it "makes a payment_methods call" do
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
request_body = JSON.parse(json_from_file("mocks/requests/Checkout/payment_methods.json"))
|
17
|
+
|
18
|
+
response_body = json_from_file("mocks/responses/Checkout/payment_methods.json")
|
19
|
+
|
20
|
+
url = @shared_values[:client].service_url(@shared_values[:service], "paymentMethods", @shared_values[:client].checkout.version)
|
21
|
+
WebMock.stub_request(:post, url).
|
22
|
+
with(
|
23
|
+
body: request_body,
|
24
|
+
headers: {
|
25
|
+
"x-api-key" => @shared_values[:client].api_key
|
26
|
+
}
|
27
|
+
).
|
28
|
+
to_return(
|
29
|
+
body: response_body
|
30
|
+
)
|
31
|
+
|
32
|
+
result = @shared_values[:client].checkout.payment_methods(request_body)
|
33
|
+
response_hash = result.response
|
34
|
+
|
35
|
+
expect(result.status).
|
36
|
+
to eq(200)
|
37
|
+
expect(response_hash).
|
38
|
+
to eq(JSON.parse(response_body))
|
39
|
+
expect(response_hash).
|
40
|
+
to be_a Adyen::HashWithAccessors
|
41
|
+
expect(response_hash).
|
42
|
+
to be_a_kind_of Hash
|
43
|
+
end
|
44
|
+
|
45
|
+
it "makes a paymentMethods/balance call" do
|
46
|
+
request_body = JSON.parse(json_from_file("mocks/requests/Checkout/payment_methods_balance.json"))
|
47
|
+
request_body[:applicationInfo] = {}
|
48
|
+
request_body[:applicationInfo][:adyenPaymentSource] = {
|
49
|
+
:name => "adyen-test",
|
50
|
+
:version => "1.0.0",
|
51
|
+
}
|
52
|
+
|
53
|
+
@shared_values[:client].add_application_info(request_body)
|
54
|
+
|
55
|
+
response_body = json_from_file("mocks/responses/Checkout/payment_methods_balance.json")
|
56
|
+
|
57
|
+
url = @shared_values[:client].service_url(@shared_values[:service], "paymentMethods/balance", @shared_values[:client].checkout.version)
|
58
|
+
WebMock.stub_request(:post, url).
|
59
|
+
with(
|
60
|
+
body: request_body,
|
61
|
+
headers: {
|
62
|
+
"x-api-key" => @shared_values[:client].api_key
|
63
|
+
}
|
64
|
+
).
|
65
|
+
to_return(
|
66
|
+
body: response_body
|
67
|
+
)
|
68
|
+
|
69
|
+
result = @shared_values[:client].checkout.payment_methods.balance(request_body)
|
70
|
+
# result.response is already a Ruby hash (rather than an unparsed JSON string)
|
71
|
+
response_hash = result.response
|
72
|
+
|
73
|
+
expect(request_body[:applicationInfo][:adyenLibrary][:name]).
|
74
|
+
to eq(Adyen::NAME)
|
75
|
+
expect(request_body[:applicationInfo][:adyenLibrary][:version]).
|
76
|
+
to eq(Adyen::VERSION)
|
77
|
+
expect(request_body[:applicationInfo][:adyenPaymentSource][:name]).
|
78
|
+
to eq("adyen-test")
|
79
|
+
expect(result.status).
|
80
|
+
to eq(200)
|
81
|
+
expect(response_hash).
|
82
|
+
to eq(JSON.parse(response_body))
|
83
|
+
expect(response_hash).
|
84
|
+
to be_a Adyen::HashWithAccessors
|
85
|
+
expect(response_hash).
|
86
|
+
to be_a_kind_of Hash
|
87
|
+
expect(response_hash["balance"]).
|
88
|
+
to eq("100")
|
19
89
|
end
|
20
90
|
|
21
91
|
# must be created manually due to payments/details format
|
@@ -103,6 +173,206 @@ RSpec.describe Adyen::Checkout, service: "checkout" do
|
|
103
173
|
to eq("Authorised")
|
104
174
|
end
|
105
175
|
|
176
|
+
# must be created manually due to paymentsLinks format
|
177
|
+
it "makes a paymentLinks call" do
|
178
|
+
request_body = JSON.parse(json_from_file("mocks/requests/Checkout/payment_links.json"))
|
179
|
+
request_body[:applicationInfo] = {}
|
180
|
+
request_body[:applicationInfo][:adyenPaymentSource] = {
|
181
|
+
:name => "adyen-test",
|
182
|
+
:version => "1.0.0",
|
183
|
+
}
|
184
|
+
|
185
|
+
@shared_values[:client].add_application_info(request_body)
|
186
|
+
|
187
|
+
response_body = json_from_file("mocks/responses/Checkout/payment_links.json")
|
188
|
+
|
189
|
+
url = @shared_values[:client].service_url(@shared_values[:service], "paymentLinks", @shared_values[:client].checkout.version)
|
190
|
+
WebMock.stub_request(:post, url).
|
191
|
+
with(
|
192
|
+
body: request_body,
|
193
|
+
headers: {
|
194
|
+
"x-api-key" => @shared_values[:client].api_key
|
195
|
+
}
|
196
|
+
).
|
197
|
+
to_return(
|
198
|
+
body: response_body
|
199
|
+
)
|
200
|
+
|
201
|
+
result = @shared_values[:client].checkout.payment_links(request_body)
|
202
|
+
response_hash = result.response
|
203
|
+
|
204
|
+
expect(result.status).
|
205
|
+
to eq(200)
|
206
|
+
expect(response_hash).
|
207
|
+
to eq(JSON.parse(response_body))
|
208
|
+
expect(response_hash).
|
209
|
+
to be_a Adyen::HashWithAccessors
|
210
|
+
expect(response_hash).
|
211
|
+
to be_a_kind_of Hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# must be created manually due to paymentsLinks/{linkId} format
|
215
|
+
it "makes a get paymentLinks/{linkId} call" do
|
216
|
+
response_body = json_from_file("mocks/responses/Checkout/get-payment-link.json")
|
217
|
+
|
218
|
+
url = @shared_values[:client].service_url(@shared_values[:service], "paymentLinks/1", @shared_values[:client].checkout.version)
|
219
|
+
WebMock.stub_request(:get, url).
|
220
|
+
with(
|
221
|
+
headers: {
|
222
|
+
"x-api-key" => @shared_values[:client].api_key
|
223
|
+
}
|
224
|
+
).
|
225
|
+
to_return(
|
226
|
+
body: response_body
|
227
|
+
)
|
228
|
+
|
229
|
+
result = @shared_values[:client].checkout.payment_links.get("1")
|
230
|
+
response_hash = result.response
|
231
|
+
|
232
|
+
expect(result.status).
|
233
|
+
to eq(200)
|
234
|
+
expect(response_hash).
|
235
|
+
to eq(JSON.parse(response_body))
|
236
|
+
expect(response_hash).
|
237
|
+
to be_a Adyen::HashWithAccessors
|
238
|
+
expect(response_hash).
|
239
|
+
to be_a_kind_of Hash
|
240
|
+
expect(response_hash["status"]).
|
241
|
+
to eq("active")
|
242
|
+
expect(response_hash.id).
|
243
|
+
to eq("MockId")
|
244
|
+
end
|
245
|
+
|
246
|
+
# must be created manually due to paymentsLinks/{linkId} format
|
247
|
+
it "makes a patch paymentLinks/{linkId} call" do
|
248
|
+
request_body = {
|
249
|
+
:status => "expired",
|
250
|
+
}
|
251
|
+
|
252
|
+
@shared_values[:client].add_application_info(request_body)
|
253
|
+
response_body = json_from_file("mocks/responses/Checkout/update-payment-link.json")
|
254
|
+
|
255
|
+
url = @shared_values[:client].service_url(@shared_values[:service], "paymentLinks/1", @shared_values[:client].checkout.version)
|
256
|
+
WebMock.stub_request(:patch, url).
|
257
|
+
with(
|
258
|
+
body: request_body,
|
259
|
+
headers: {
|
260
|
+
"x-api-key" => @shared_values[:client].api_key
|
261
|
+
}
|
262
|
+
).
|
263
|
+
to_return(
|
264
|
+
body: response_body
|
265
|
+
)
|
266
|
+
|
267
|
+
result = @shared_values[:client].checkout.payment_links.update("1", request_body)
|
268
|
+
response_hash = result.response
|
269
|
+
|
270
|
+
expect(result.status).
|
271
|
+
to eq(200)
|
272
|
+
expect(response_hash).
|
273
|
+
to eq(JSON.parse(response_body))
|
274
|
+
expect(response_hash).
|
275
|
+
to be_a Adyen::HashWithAccessors
|
276
|
+
expect(response_hash).
|
277
|
+
to be_a_kind_of Hash
|
278
|
+
expect(response_hash["status"]).
|
279
|
+
to eq("expired")
|
280
|
+
expect(response_hash.id).
|
281
|
+
to eq("MockId")
|
282
|
+
end
|
283
|
+
|
284
|
+
it "makes an orders call" do
|
285
|
+
request_body = JSON.parse(json_from_file("mocks/requests/Checkout/orders.json"))
|
286
|
+
|
287
|
+
response_body = json_from_file("mocks/responses/Checkout/orders.json")
|
288
|
+
|
289
|
+
url = @shared_values[:client].service_url(@shared_values[:service], "orders", @shared_values[:client].checkout.version)
|
290
|
+
WebMock.stub_request(:post, url).
|
291
|
+
with(
|
292
|
+
body: request_body,
|
293
|
+
headers: {
|
294
|
+
"x-api-key" => @shared_values[:client].api_key
|
295
|
+
}
|
296
|
+
).
|
297
|
+
to_return(
|
298
|
+
body: response_body
|
299
|
+
)
|
300
|
+
|
301
|
+
result = @shared_values[:client].checkout.orders(request_body)
|
302
|
+
response_hash = result.response
|
303
|
+
|
304
|
+
expect(result.status).
|
305
|
+
to eq(200)
|
306
|
+
expect(response_hash).
|
307
|
+
to eq(JSON.parse(response_body))
|
308
|
+
expect(response_hash).
|
309
|
+
to be_a Adyen::HashWithAccessors
|
310
|
+
expect(response_hash).
|
311
|
+
to be_a_kind_of Hash
|
312
|
+
expect(response_hash["remainingAmount"]["value"]).
|
313
|
+
to eq(100)
|
314
|
+
end
|
315
|
+
|
316
|
+
it "makes an orders/cancel call" do
|
317
|
+
request_body = JSON.parse(json_from_file("mocks/requests/Checkout/orders_cancel.json"))
|
318
|
+
|
319
|
+
response_body = json_from_file("mocks/responses/Checkout/orders_cancel.json")
|
320
|
+
|
321
|
+
url = @shared_values[:client].service_url(@shared_values[:service], "orders/cancel", @shared_values[:client].checkout.version)
|
322
|
+
WebMock.stub_request(:post, url).
|
323
|
+
with(
|
324
|
+
body: request_body,
|
325
|
+
headers: {
|
326
|
+
"x-api-key" => @shared_values[:client].api_key
|
327
|
+
}
|
328
|
+
).
|
329
|
+
to_return(
|
330
|
+
body: response_body
|
331
|
+
)
|
332
|
+
|
333
|
+
result = @shared_values[:client].checkout.orders.cancel(request_body)
|
334
|
+
response_hash = result.response
|
335
|
+
|
336
|
+
expect(result.status).
|
337
|
+
to eq(200)
|
338
|
+
expect(response_hash).
|
339
|
+
to eq(JSON.parse(response_body))
|
340
|
+
expect(response_hash).
|
341
|
+
to be_a Adyen::HashWithAccessors
|
342
|
+
expect(response_hash).
|
343
|
+
to be_a_kind_of Hash
|
344
|
+
expect(response_hash["resultCode"]).
|
345
|
+
to eq("cancelled")
|
346
|
+
end
|
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
|
+
|
106
376
|
# create client for automated tests
|
107
377
|
client = create_client(:api_key)
|
108
378
|
|
@@ -110,7 +380,8 @@ RSpec.describe Adyen::Checkout, service: "checkout" do
|
|
110
380
|
# format is defined in spec_helper
|
111
381
|
test_sets = [
|
112
382
|
["payment_session", "publicKeyToken", "8115054323780109"],
|
113
|
-
["payments", "resultCode", "Authorised"]
|
383
|
+
["payments", "resultCode", "Authorised"],
|
384
|
+
["origin_keys", "originKeys", { "https://adyen.com" => "mocked_origin_key" }]
|
114
385
|
]
|
115
386
|
|
116
387
|
generate_tests(client, "Checkout", test_sets, client.checkout)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Adyen::DataProtection, service: "Data Protection 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
|
+
["request_subject_erasure", "result", "SUCCESS"],
|
11
|
+
]
|
12
|
+
|
13
|
+
generate_tests(client, "DataProtectionService", test_sets, client.data_protection)
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
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
|
data/spec/errors_spec.rb
CHANGED
@@ -3,15 +3,45 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Adyen::AdyenError do
|
6
|
+
before(:all) do
|
7
|
+
@shared_values = {
|
8
|
+
request: {
|
9
|
+
amount: {
|
10
|
+
currency: "USD",
|
11
|
+
value: 1000
|
12
|
+
},
|
13
|
+
reference: "Your order number",
|
14
|
+
paymentMethod: {
|
15
|
+
type: "scheme",
|
16
|
+
number: "4111111111111111",
|
17
|
+
expiryMonth: "10",
|
18
|
+
expiryYear: "2020",
|
19
|
+
holderName: "John Smith",
|
20
|
+
cvc: "737"
|
21
|
+
},
|
22
|
+
returnUrl: "https://your-company.com/",
|
23
|
+
merchantAccount: "YOUR_MERCHANT_ACCOUNT"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
6
28
|
describe '#to_s' do
|
7
29
|
it 'describes using the error properties' do
|
8
|
-
expect(Adyen::AdyenError.new(
|
30
|
+
expect(Adyen::AdyenError.new(@shared_values[:request], 'response', 'message', 'code').to_s).to eq("Adyen::AdyenError code:code, msg:message, request:#{@shared_values[:request]}, response:response")
|
9
31
|
end
|
10
32
|
it 'skips the null properties' do
|
11
|
-
expect(Adyen::AdyenError.new(
|
33
|
+
expect(Adyen::AdyenError.new(@shared_values[:request], nil, nil, 'code').to_s).to eq("Adyen::AdyenError code:code, request:#{@shared_values[:request]}")
|
12
34
|
end
|
13
35
|
it 'uses the proper error class name' do
|
14
|
-
expect(Adyen::PermissionError.new('
|
36
|
+
expect(Adyen::PermissionError.new('message', @shared_values[:request]).to_s).to eq("Adyen::PermissionError code:403, msg:message, request:#{@shared_values[:request]}")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
describe '#masking' do
|
40
|
+
it 'masks card number when logging request in errors' do
|
41
|
+
expect(Adyen::AdyenError.new(@shared_values[:request], 'response', 'message', 'code').request[:paymentMethod][:number]).to eq('411111******1111')
|
42
|
+
end
|
43
|
+
it 'masks CVC when logging request in errors' do
|
44
|
+
expect(Adyen::AdyenError.new(@shared_values[:request], 'response', 'message', 'code').request[:paymentMethod][:cvc]).to eq('***')
|
15
45
|
end
|
16
46
|
end
|
17
47
|
end
|
data/spec/fund_spec.rb
CHANGED
@@ -12,7 +12,8 @@ RSpec.describe Adyen::Payments, service: "marketpay fund service" do
|
|
12
12
|
["account_holder_transaction_list", "pspReference", "9914721175530029"],
|
13
13
|
["refund_not_paid_out_transfers", "pspReference", "9915090894215323"],
|
14
14
|
["setup_beneficiary", "pspReference", "9914860354282596"],
|
15
|
-
["transfer_funds", "pspReference", "9915090893984580"]
|
15
|
+
["transfer_funds", "pspReference", "9915090893984580"],
|
16
|
+
["refund_funds_transfer", "pspReference", "9915090893984580"]
|
16
17
|
]
|
17
18
|
|
18
19
|
generate_tests(client, "Fund", test_sets, client.marketpay.fund)
|
data/spec/hop_spec.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Adyen::Payments, service: "marketpay hop 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
|
+
["get_onboarding_url", "pspReference", "8815850625171183"]
|
11
|
+
]
|
12
|
+
|
13
|
+
generate_tests(client, "Hop", test_sets, client.marketpay.hop)
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
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
|
+
}
|
@@ -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
|
+
}
|