trolley 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trolley/Client.rb +6 -1
  3. data/lib/trolley/Gateway.rb +7 -1
  4. data/lib/trolley/InvoicePayment.rb +6 -1
  5. data/lib/trolley/OfflinePayment.rb +2 -1
  6. data/lib/trolley/Payment.rb +4 -1
  7. data/lib/trolley/Recipient.rb +0 -2
  8. data/lib/trolley/RecipientAccount.rb +4 -1
  9. data/lib/trolley/RecipientLog.rb +12 -0
  10. data/lib/trolley/gateways/BalanceGateway.rb +18 -1
  11. data/lib/trolley/gateways/PaymentGateway.rb +5 -0
  12. data/lib/trolley/gateways/RecipientGateway.rb +5 -1
  13. data/lib/trolley/gateways/VerificationGateway.rb +40 -0
  14. data/lib/trolley/utils/PaginatedArray.rb +8 -3
  15. data/lib/trolley/utils/ResponseMapper.rb +1 -0
  16. data/lib/trolley.rb +3 -1
  17. data/test/fixtures/BalanceTest/test_find.yml +71 -0
  18. data/test/fixtures/BalanceTest/test_find_with_term.yml +71 -0
  19. data/test/fixtures/BatchTest/test_create.yml +150 -0
  20. data/test/fixtures/BatchTest/test_create_with_payments.yml +541 -0
  21. data/test/fixtures/BatchTest/test_delete_multiple.yml +209 -0
  22. data/test/fixtures/BatchTest/test_payments.yml +434 -0
  23. data/test/fixtures/BatchTest/test_processing.yml +578 -0
  24. data/test/fixtures/BatchTest/test_summary.yml +440 -0
  25. data/test/fixtures/BatchTest/test_update.yml +356 -0
  26. data/test/fixtures/InvoicePaymentTest/test_create.yml +489 -0
  27. data/test/fixtures/InvoicePaymentTest/test_delete.yml +634 -0
  28. data/test/fixtures/InvoicePaymentTest/test_find.yml +420 -0
  29. data/test/fixtures/InvoicePaymentTest/test_update.yml +634 -0
  30. data/test/fixtures/InvoiceTest/test_create.yml +293 -0
  31. data/test/fixtures/InvoiceTest/test_create_line.yml +353 -0
  32. data/test/fixtures/InvoiceTest/test_delete.yml +433 -0
  33. data/test/fixtures/InvoiceTest/test_delete_line.yml +353 -0
  34. data/test/fixtures/InvoiceTest/test_find.yml +284 -0
  35. data/test/fixtures/InvoiceTest/test_search.yml +293 -0
  36. data/test/fixtures/InvoiceTest/test_support_error_arrays.yml +71 -0
  37. data/test/fixtures/InvoiceTest/test_update.yml +428 -0
  38. data/test/fixtures/InvoiceTest/test_update_line.yml +422 -0
  39. data/test/fixtures/OfflinePaymentTest/test_create.yml +213 -0
  40. data/test/fixtures/OfflinePaymentTest/test_delete.yml +281 -0
  41. data/test/fixtures/OfflinePaymentTest/test_search.yml +281 -0
  42. data/test/fixtures/OfflinePaymentTest/test_update.yml +281 -0
  43. data/test/fixtures/PaymentTest/test_crud.yml +510 -0
  44. data/test/fixtures/PaymentTest/test_search.yml +366 -0
  45. data/test/fixtures/RecipientAccountTest/test_basic_crud.yml +351 -0
  46. data/test/fixtures/RecipientTest/test_account.yml +499 -0
  47. data/test/fixtures/RecipientTest/test_create.yml +72 -0
  48. data/test/fixtures/RecipientTest/test_delete_multiple.yml +347 -0
  49. data/test/fixtures/RecipientTest/test_find_logs.yml +278 -0
  50. data/test/fixtures/RecipientTest/test_find_payments.yml +512 -0
  51. data/test/fixtures/RecipientTest/test_lifecycle.yml +347 -0
  52. data/test/integration/BalanceTest.rb +22 -0
  53. data/test/integration/BatchTest.rb +157 -0
  54. data/test/integration/InvoicePaymentTest.rb +109 -0
  55. data/test/integration/InvoiceTest.rb +156 -0
  56. data/test/integration/OfflinePaymentTest.rb +109 -0
  57. data/test/integration/PaymentTest.rb +73 -0
  58. data/test/integration/RecipientAccountTest.rb +52 -0
  59. data/test/integration/RecipientTest.rb +176 -0
  60. data/test/test_helper.rb +45 -0
  61. data/test/unit/ClientRequestTest.rb +54 -0
  62. data/{spec → test}/unit/ConfigurationTest.rb +1 -1
  63. data/test/unit/GatewayParityTest.rb +184 -0
  64. data/{spec → test}/unit/PaginatedArrayTest.rb +3 -1
  65. data/{spec → test}/unit/TrolleyTest.rb +1 -1
  66. data/trolley.gemspec +10 -7
  67. metadata +101 -17
  68. data/spec/integration/BatchTest.rb +0 -126
  69. data/spec/integration/InvoicePaymentTest.rb +0 -92
  70. data/spec/integration/InvoiceTest.rb +0 -128
  71. data/spec/integration/RecipientAccountTest.rb +0 -48
  72. data/spec/integration/RecipientTest.rb +0 -159
  73. data/spec/integration/helper.rb +0 -19
  74. /data/{spec → test}/unit/ResponseMapperTest.rb +0 -0
@@ -0,0 +1,351 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.trolley.com/v1/recipients/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"individual","firstName":"Tom","lastName":"Jones","email":"test.create4237ca96-b313-4061-ad7b-7fa462a32d18@example.com"}'
9
+ headers:
10
+ X-Pr-Timestamp:
11
+ - '1688741330'
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Fri, 07 Jul 2023 14:48:51 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '1263'
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-store, no-cache
35
+ Content-Security-Policy:
36
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
37
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
38
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
39
+ X-Dns-Prefetch-Control:
40
+ - 'off'
41
+ Expect-Ct:
42
+ - max-age=0
43
+ Strict-Transport-Security:
44
+ - max-age=15552000; includeSubDomains
45
+ X-Download-Options:
46
+ - noopen
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Xss-Protection:
54
+ - '0'
55
+ Access-Control-Allow-Origin:
56
+ - "*"
57
+ X-Rate-Limit-Limit:
58
+ - '600'
59
+ X-Rate-Limit-Remaining:
60
+ - '599'
61
+ X-Rate-Limit-Reset:
62
+ - '1688741391'
63
+ Vary:
64
+ - Origin
65
+ Etag:
66
+ - W/"4ef-6jsofikZdpsuTHcS+HDYKlPAo2c"
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"ok":true,"recipient":{"id":"R-3jNqCdbdaNuq5wq9vXNMgf","referenceId":"R-3jNqCdbdaNuq5wq9vXNMgf","parentRecipientId":null,"email":"test.create4237ca96-b313-4061-ad7b-7fa462a32d18@example.com","name":"Tom
70
+ Jones","lastName":"Jones","firstName":"Tom","legalName":"","type":"individual","status":"incomplete","language":"en","complianceStatus":"pending","dob":null,"passport":"","placeOfBirth":null,"updatedAt":"2023-07-07T14:48:51.568Z","createdAt":"2023-07-07T14:48:51.568Z","tags":[],"isPortalUser":false,"taxDeliveryType":"mail","contactEmails":[],"occupation":"","address":{"street1":"","street2":"","city":"","postalCode":"","country":null,"region":null,"phone":"","phoneValidated":false},"compliance":{"status":"pending","checkedAt":null},"gravatarUrl":"https://www.gravatar.com/avatar/cef4f020db92bec5aee19de9e10f6cf9?d=404","governmentId":null,"ssn":null,"governmentIds":[],"birthplace":{"country":null,"region":null,"city":null},"citizenships":[],"routeType":null,"routeMinimum":null,"estimatedFees":null,"accounts":[],"payoutMethod":null,"primaryCurrency":null,"riskScore":null,"riskScoreLabel":null,"merchantId":"M-C7AsydAeAqW3husDNHSAND","inactiveReasons":{"primaryAccount":"missing"},"taxWithholdingPercentage":null,"taxForm":null,"taxFormStatus":null}}'
71
+ recorded_at: Fri, 07 Jul 2023 14:48:51 GMT
72
+ - request:
73
+ method: post
74
+ uri: https://api.trolley.com/v1/recipients/R-3jNqCdbdaNuq5wq9vXNMgf/accounts
75
+ body:
76
+ encoding: UTF-8
77
+ string: '{"type":"bank-transfer","currency":"EUR","country":"DE","iban":"DE89
78
+ 3704 0044 0532 0130 00"}'
79
+ headers:
80
+ X-Pr-Timestamp:
81
+ - '1688741331'
82
+ Content-Type:
83
+ - application/json
84
+ Accept-Encoding:
85
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
86
+ Accept:
87
+ - "*/*"
88
+ User-Agent:
89
+ - Ruby
90
+ response:
91
+ status:
92
+ code: 200
93
+ message: OK
94
+ headers:
95
+ Date:
96
+ - Fri, 07 Jul 2023 14:48:52 GMT
97
+ Content-Type:
98
+ - application/json; charset=utf-8
99
+ Content-Length:
100
+ - '657'
101
+ Connection:
102
+ - keep-alive
103
+ Cache-Control:
104
+ - no-store, no-cache
105
+ Content-Security-Policy:
106
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
107
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
108
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
109
+ X-Dns-Prefetch-Control:
110
+ - 'off'
111
+ Expect-Ct:
112
+ - max-age=0
113
+ Strict-Transport-Security:
114
+ - max-age=15552000; includeSubDomains
115
+ X-Download-Options:
116
+ - noopen
117
+ X-Content-Type-Options:
118
+ - nosniff
119
+ X-Permitted-Cross-Domain-Policies:
120
+ - none
121
+ Referrer-Policy:
122
+ - no-referrer
123
+ X-Xss-Protection:
124
+ - '0'
125
+ Access-Control-Allow-Origin:
126
+ - "*"
127
+ X-Rate-Limit-Limit:
128
+ - '600'
129
+ X-Rate-Limit-Remaining:
130
+ - '598'
131
+ X-Rate-Limit-Reset:
132
+ - '1688741391'
133
+ Vary:
134
+ - Origin
135
+ Etag:
136
+ - W/"291-yIB0SU69W9RqSJN1VCizaVu7w8Y"
137
+ body:
138
+ encoding: UTF-8
139
+ string: '{"ok":true,"account":{"status":"primary","type":"bank-transfer","primary":true,"currency":"EUR","id":"A-JDBbcfDB9gjk8RipHt93qi","recipientId":"R-3jNqCdbdaNuq5wq9vXNMgf","recipientAccountId":"A-JDBbcfDB9gjk8RipHt93qi","disabledAt":null,"deliveryBusinessDaysEstimate":5,"country":"DE","iban":"********************00","accountNum":"","bankAccountType":null,"bankCodeMappingId":null,"accountHolderName":"Tom
140
+ Jones","swiftBic":"COBADEFFXXX","branchId":"","bankId":"","bankName":"Commerzbank
141
+ AG","bankAddress":"Unter Sachsenhausen 21-27","bankCity":"Cologne","bankRegionCode":"Nordrhein-Westfalen","bankPostalCode":"50667","routeType":"sepa","recipientFees":"2"}}'
142
+ recorded_at: Fri, 07 Jul 2023 14:48:52 GMT
143
+ - request:
144
+ method: patch
145
+ uri: https://api.trolley.com/v1/recipients/R-3jNqCdbdaNuq5wq9vXNMgf/accounts/A-JDBbcfDB9gjk8RipHt93qi
146
+ body:
147
+ encoding: UTF-8
148
+ string: '{"primary":true}'
149
+ headers:
150
+ X-Pr-Timestamp:
151
+ - '1688741332'
152
+ Content-Type:
153
+ - application/json
154
+ Accept-Encoding:
155
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
156
+ Accept:
157
+ - "*/*"
158
+ User-Agent:
159
+ - Ruby
160
+ response:
161
+ status:
162
+ code: 200
163
+ message: OK
164
+ headers:
165
+ Date:
166
+ - Fri, 07 Jul 2023 14:48:52 GMT
167
+ Content-Type:
168
+ - application/json; charset=utf-8
169
+ Content-Length:
170
+ - '657'
171
+ Connection:
172
+ - keep-alive
173
+ Cache-Control:
174
+ - no-store, no-cache
175
+ Content-Security-Policy:
176
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
177
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
178
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
179
+ X-Dns-Prefetch-Control:
180
+ - 'off'
181
+ Expect-Ct:
182
+ - max-age=0
183
+ Strict-Transport-Security:
184
+ - max-age=15552000; includeSubDomains
185
+ X-Download-Options:
186
+ - noopen
187
+ X-Content-Type-Options:
188
+ - nosniff
189
+ X-Permitted-Cross-Domain-Policies:
190
+ - none
191
+ Referrer-Policy:
192
+ - no-referrer
193
+ X-Xss-Protection:
194
+ - '0'
195
+ Access-Control-Allow-Origin:
196
+ - "*"
197
+ X-Rate-Limit-Limit:
198
+ - '600'
199
+ X-Rate-Limit-Remaining:
200
+ - '597'
201
+ X-Rate-Limit-Reset:
202
+ - '1688741391'
203
+ Vary:
204
+ - Origin
205
+ Etag:
206
+ - W/"291-yIB0SU69W9RqSJN1VCizaVu7w8Y"
207
+ body:
208
+ encoding: UTF-8
209
+ string: '{"ok":true,"account":{"status":"primary","type":"bank-transfer","primary":true,"currency":"EUR","id":"A-JDBbcfDB9gjk8RipHt93qi","recipientId":"R-3jNqCdbdaNuq5wq9vXNMgf","recipientAccountId":"A-JDBbcfDB9gjk8RipHt93qi","disabledAt":null,"deliveryBusinessDaysEstimate":5,"country":"DE","iban":"********************00","accountNum":"","bankAccountType":null,"bankCodeMappingId":null,"accountHolderName":"Tom
210
+ Jones","swiftBic":"COBADEFFXXX","branchId":"","bankId":"","bankName":"Commerzbank
211
+ AG","bankAddress":"Unter Sachsenhausen 21-27","bankCity":"Cologne","bankRegionCode":"Nordrhein-Westfalen","bankPostalCode":"50667","routeType":"sepa","recipientFees":"2"}}'
212
+ recorded_at: Fri, 07 Jul 2023 14:48:52 GMT
213
+ - request:
214
+ method: get
215
+ uri: https://api.trolley.com/v1/recipients/R-3jNqCdbdaNuq5wq9vXNMgf/accounts/A-JDBbcfDB9gjk8RipHt93qi
216
+ body:
217
+ encoding: US-ASCII
218
+ string: ''
219
+ headers:
220
+ X-Pr-Timestamp:
221
+ - '1688741332'
222
+ Content-Type:
223
+ - application/json
224
+ Accept-Encoding:
225
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
226
+ Accept:
227
+ - "*/*"
228
+ User-Agent:
229
+ - Ruby
230
+ response:
231
+ status:
232
+ code: 200
233
+ message: OK
234
+ headers:
235
+ Date:
236
+ - Fri, 07 Jul 2023 14:48:53 GMT
237
+ Content-Type:
238
+ - application/json; charset=utf-8
239
+ Content-Length:
240
+ - '657'
241
+ Connection:
242
+ - keep-alive
243
+ Cache-Control:
244
+ - no-store, no-cache
245
+ Content-Security-Policy:
246
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
247
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
248
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
249
+ X-Dns-Prefetch-Control:
250
+ - 'off'
251
+ Expect-Ct:
252
+ - max-age=0
253
+ Strict-Transport-Security:
254
+ - max-age=15552000; includeSubDomains
255
+ X-Download-Options:
256
+ - noopen
257
+ X-Content-Type-Options:
258
+ - nosniff
259
+ X-Permitted-Cross-Domain-Policies:
260
+ - none
261
+ Referrer-Policy:
262
+ - no-referrer
263
+ X-Xss-Protection:
264
+ - '0'
265
+ Access-Control-Allow-Origin:
266
+ - "*"
267
+ X-Rate-Limit-Limit:
268
+ - '600'
269
+ X-Rate-Limit-Remaining:
270
+ - '596'
271
+ X-Rate-Limit-Reset:
272
+ - '1688741391'
273
+ Vary:
274
+ - Origin
275
+ Etag:
276
+ - W/"291-yIB0SU69W9RqSJN1VCizaVu7w8Y"
277
+ body:
278
+ encoding: UTF-8
279
+ string: '{"ok":true,"account":{"status":"primary","type":"bank-transfer","primary":true,"currency":"EUR","id":"A-JDBbcfDB9gjk8RipHt93qi","recipientId":"R-3jNqCdbdaNuq5wq9vXNMgf","recipientAccountId":"A-JDBbcfDB9gjk8RipHt93qi","disabledAt":null,"deliveryBusinessDaysEstimate":5,"country":"DE","iban":"********************00","accountNum":"","bankAccountType":null,"bankCodeMappingId":null,"accountHolderName":"Tom
280
+ Jones","swiftBic":"COBADEFFXXX","branchId":"","bankId":"","bankName":"Commerzbank
281
+ AG","bankAddress":"Unter Sachsenhausen 21-27","bankCity":"Cologne","bankRegionCode":"Nordrhein-Westfalen","bankPostalCode":"50667","routeType":"sepa","recipientFees":"2"}}'
282
+ recorded_at: Fri, 07 Jul 2023 14:48:53 GMT
283
+ - request:
284
+ method: delete
285
+ uri: https://api.trolley.com/v1/recipients/R-3jNqCdbdaNuq5wq9vXNMgf/accounts/A-JDBbcfDB9gjk8RipHt93qi
286
+ body:
287
+ encoding: UTF-8
288
+ string: ''
289
+ headers:
290
+ X-Pr-Timestamp:
291
+ - '1688741333'
292
+ Content-Type:
293
+ - application/json
294
+ Accept-Encoding:
295
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
296
+ Accept:
297
+ - "*/*"
298
+ User-Agent:
299
+ - Ruby
300
+ response:
301
+ status:
302
+ code: 200
303
+ message: OK
304
+ headers:
305
+ Date:
306
+ - Fri, 07 Jul 2023 14:48:53 GMT
307
+ Content-Type:
308
+ - application/json; charset=utf-8
309
+ Content-Length:
310
+ - '11'
311
+ Connection:
312
+ - keep-alive
313
+ Cache-Control:
314
+ - no-store, no-cache
315
+ Content-Security-Policy:
316
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
317
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
318
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
319
+ X-Dns-Prefetch-Control:
320
+ - 'off'
321
+ Expect-Ct:
322
+ - max-age=0
323
+ Strict-Transport-Security:
324
+ - max-age=15552000; includeSubDomains
325
+ X-Download-Options:
326
+ - noopen
327
+ X-Content-Type-Options:
328
+ - nosniff
329
+ X-Permitted-Cross-Domain-Policies:
330
+ - none
331
+ Referrer-Policy:
332
+ - no-referrer
333
+ X-Xss-Protection:
334
+ - '0'
335
+ Access-Control-Allow-Origin:
336
+ - "*"
337
+ X-Rate-Limit-Limit:
338
+ - '600'
339
+ X-Rate-Limit-Remaining:
340
+ - '595'
341
+ X-Rate-Limit-Reset:
342
+ - '1688741391'
343
+ Vary:
344
+ - Origin
345
+ Etag:
346
+ - W/"b-Ai2R8hgEarLmHKwesT1qcY913ys"
347
+ body:
348
+ encoding: UTF-8
349
+ string: '{"ok":true}'
350
+ recorded_at: Fri, 07 Jul 2023 14:48:53 GMT
351
+ recorded_with: VCR 6.2.0