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,356 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.trolley.com/v1/batches/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"sourceCurrency":"USD","description":"Integration Test Create"}'
9
+ headers:
10
+ X-Pr-Timestamp:
11
+ - '1688741004'
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:43:24 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '370'
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
+ - '573'
61
+ X-Rate-Limit-Reset:
62
+ - '1688741046'
63
+ Vary:
64
+ - Origin
65
+ Etag:
66
+ - W/"172-lVLnW4Bmn63hV3NM/DOg2/hzRZE"
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"ok":true,"batch":{"id":"B-HciRzdAdgB1JXE6bJ6Q82G","status":"open","tags":[],"amount":"0.00","currency":"USD","totalPayments":0,"description":"Integration
70
+ Test Create","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:43:24.718Z","updatedAt":"2023-07-07T14:43:24.718Z","quoteExpiredAt":null,"payments":{"payments":[],"meta":{"page":1,"pages":0,"records":0}}}}'
71
+ recorded_at: Fri, 07 Jul 2023 14:43:24 GMT
72
+ - request:
73
+ method: get
74
+ uri: https://api.trolley.com/v1/batches/
75
+ body:
76
+ encoding: US-ASCII
77
+ string: ''
78
+ headers:
79
+ X-Pr-Timestamp:
80
+ - '1688741004'
81
+ Content-Type:
82
+ - application/json
83
+ Accept-Encoding:
84
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
85
+ Accept:
86
+ - "*/*"
87
+ User-Agent:
88
+ - Ruby
89
+ response:
90
+ status:
91
+ code: 200
92
+ message: OK
93
+ headers:
94
+ Date:
95
+ - Fri, 07 Jul 2023 14:43:25 GMT
96
+ Content-Type:
97
+ - application/json; charset=utf-8
98
+ Content-Length:
99
+ - '3026'
100
+ Connection:
101
+ - keep-alive
102
+ Cache-Control:
103
+ - no-store, no-cache
104
+ Content-Security-Policy:
105
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
106
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
107
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
108
+ X-Dns-Prefetch-Control:
109
+ - 'off'
110
+ Expect-Ct:
111
+ - max-age=0
112
+ Strict-Transport-Security:
113
+ - max-age=15552000; includeSubDomains
114
+ X-Download-Options:
115
+ - noopen
116
+ X-Content-Type-Options:
117
+ - nosniff
118
+ X-Permitted-Cross-Domain-Policies:
119
+ - none
120
+ Referrer-Policy:
121
+ - no-referrer
122
+ X-Xss-Protection:
123
+ - '0'
124
+ Access-Control-Allow-Origin:
125
+ - "*"
126
+ X-Rate-Limit-Limit:
127
+ - '600'
128
+ X-Rate-Limit-Remaining:
129
+ - '572'
130
+ X-Rate-Limit-Reset:
131
+ - '1688741046'
132
+ Vary:
133
+ - Origin
134
+ Etag:
135
+ - W/"bd2-nBFVQAqL4Mc1fGoFE/LXptTlSOI"
136
+ body:
137
+ encoding: UTF-8
138
+ string: '{"ok":true,"batches":[{"id":"B-HciRzdAdgB1JXE6bJ6Q82G","status":"open","tags":[],"amount":"0.00","currency":"USD","totalPayments":0,"description":"Integration
139
+ Test Create","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:43:24.718Z","updatedAt":"2023-07-07T14:43:24.718Z","quoteExpiredAt":null},{"id":"B-7mfvs7TYDW94FCm2FnnUDi","status":"awaiting_approval","tags":[],"amount":"27.16","currency":"USD","totalPayments":2,"description":"Integration
140
+ Test Payments","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:43:20.935Z","updatedAt":"2023-07-07T14:43:24.235Z","quoteExpiredAt":"2023-07-07T16:43:21.594Z"},{"id":"B-Pt3X27Gm9XTYaxBfJZMhYg","status":"open","tags":[],"amount":"0.00","currency":"USD","totalPayments":0,"description":"Integration
141
+ Test Payments","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:43:13.721Z","updatedAt":"2023-07-07T14:43:18.078Z","quoteExpiredAt":null},{"id":"B-KVJo8qid2eg9XnyJVkffBN","status":"open","tags":[],"amount":"27.16","currency":"USD","totalPayments":2,"description":"Integration
142
+ Test Payments","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:43:10.099Z","updatedAt":"2023-07-07T14:43:10.401Z","quoteExpiredAt":"2023-07-07T16:43:10.293Z"},{"id":"B-3hA3kNRJSiGjFGTqbdou17","status":"open","tags":[],"amount":"0.00","currency":"USD","totalPayments":0,"description":"Integration
143
+ Test Create","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:43:06.649Z","updatedAt":"2023-07-07T14:43:06.649Z","quoteExpiredAt":null},{"id":"B-BqvhcfA7i9u8UkZoyoNMU1","status":"open","tags":[],"amount":"6686.85","currency":"CAD","totalPayments":1,"description":"Payouts
144
+ on 7 Jul 2023 #371","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:17:29.495Z","updatedAt":"2023-07-07T14:17:30.950Z","quoteExpiredAt":null},{"id":"B-8AkMne6o6WQmarnZWTLgqW","status":"open","tags":[],"amount":"0.00","currency":"CAD","totalPayments":0,"description":"Payouts
145
+ on 7 Jul 2023 #370","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:17:24.476Z","updatedAt":"2023-07-07T14:17:25.881Z","quoteExpiredAt":null},{"id":"B-FrChBr4R8h1UWiHsVgb4nF","status":"open","tags":[],"amount":"2675.94","currency":"CAD","totalPayments":1,"description":"Payouts
146
+ on 7 Jul 2023 #369","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:17:19.870Z","updatedAt":"2023-07-07T14:17:20.226Z","quoteExpiredAt":null},{"id":"B-A599DE7QzjYdZWQftGqUfg","status":"awaiting_approval","tags":[],"amount":"27.13","currency":"USD","totalPayments":2,"description":"Integration
147
+ Test Payments","sentAt":null,"completedAt":null,"createdAt":"2023-07-06T05:35:37.870Z","updatedAt":"2023-07-06T05:35:39.746Z","quoteExpiredAt":"2023-07-06T07:35:38.107Z"},{"id":"B-KEKg7rPZDKHzVke59Nhmq3","status":"open","tags":[],"amount":"0.00","currency":"USD","totalPayments":0,"description":"Integration
148
+ Test Payments","sentAt":null,"completedAt":null,"createdAt":"2023-07-06T05:35:33.381Z","updatedAt":"2023-07-06T05:35:35.981Z","quoteExpiredAt":null}],"meta":{"page":1,"pages":27,"records":264}}'
149
+ recorded_at: Fri, 07 Jul 2023 14:43:25 GMT
150
+ - request:
151
+ method: patch
152
+ uri: https://api.trolley.com/v1/batches/B-HciRzdAdgB1JXE6bJ6Q82G
153
+ body:
154
+ encoding: UTF-8
155
+ string: '{"description":"Integration Update"}'
156
+ headers:
157
+ X-Pr-Timestamp:
158
+ - '1688741005'
159
+ Content-Type:
160
+ - application/json
161
+ Accept-Encoding:
162
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
163
+ Accept:
164
+ - "*/*"
165
+ User-Agent:
166
+ - Ruby
167
+ response:
168
+ status:
169
+ code: 200
170
+ message: OK
171
+ headers:
172
+ Date:
173
+ - Fri, 07 Jul 2023 14:43:27 GMT
174
+ Content-Type:
175
+ - application/json; charset=utf-8
176
+ Content-Length:
177
+ - '298'
178
+ Connection:
179
+ - keep-alive
180
+ Cache-Control:
181
+ - no-store, no-cache
182
+ Content-Security-Policy:
183
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
184
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
185
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
186
+ X-Dns-Prefetch-Control:
187
+ - 'off'
188
+ Expect-Ct:
189
+ - max-age=0
190
+ Strict-Transport-Security:
191
+ - max-age=15552000; includeSubDomains
192
+ X-Download-Options:
193
+ - noopen
194
+ X-Content-Type-Options:
195
+ - nosniff
196
+ X-Permitted-Cross-Domain-Policies:
197
+ - none
198
+ Referrer-Policy:
199
+ - no-referrer
200
+ X-Xss-Protection:
201
+ - '0'
202
+ Access-Control-Allow-Origin:
203
+ - "*"
204
+ X-Rate-Limit-Limit:
205
+ - '600'
206
+ X-Rate-Limit-Remaining:
207
+ - '571'
208
+ X-Rate-Limit-Reset:
209
+ - '1688741046'
210
+ Vary:
211
+ - Origin
212
+ Etag:
213
+ - W/"12a-h1VHavjiBL0bF/j4cyJYbNQIOV8"
214
+ body:
215
+ encoding: UTF-8
216
+ string: '{"ok":true,"batch":{"id":"B-HciRzdAdgB1JXE6bJ6Q82G","status":"open","tags":[],"amount":"0.00","currency":"USD","totalPayments":0,"description":"Integration
217
+ Update","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:43:24.718Z","updatedAt":"2023-07-07T14:43:27.116Z","quoteExpiredAt":null}}'
218
+ recorded_at: Fri, 07 Jul 2023 14:43:27 GMT
219
+ - request:
220
+ method: get
221
+ uri: https://api.trolley.com/v1/batches/B-HciRzdAdgB1JXE6bJ6Q82G
222
+ body:
223
+ encoding: US-ASCII
224
+ string: ''
225
+ headers:
226
+ X-Pr-Timestamp:
227
+ - '1688741007'
228
+ Content-Type:
229
+ - application/json
230
+ Accept-Encoding:
231
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
232
+ Accept:
233
+ - "*/*"
234
+ User-Agent:
235
+ - Ruby
236
+ response:
237
+ status:
238
+ code: 200
239
+ message: OK
240
+ headers:
241
+ Date:
242
+ - Fri, 07 Jul 2023 14:43:27 GMT
243
+ Content-Type:
244
+ - application/json; charset=utf-8
245
+ Content-Length:
246
+ - '365'
247
+ Connection:
248
+ - keep-alive
249
+ Cache-Control:
250
+ - no-store, no-cache
251
+ Content-Security-Policy:
252
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
253
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
254
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
255
+ X-Dns-Prefetch-Control:
256
+ - 'off'
257
+ Expect-Ct:
258
+ - max-age=0
259
+ Strict-Transport-Security:
260
+ - max-age=15552000; includeSubDomains
261
+ X-Download-Options:
262
+ - noopen
263
+ X-Content-Type-Options:
264
+ - nosniff
265
+ X-Permitted-Cross-Domain-Policies:
266
+ - none
267
+ Referrer-Policy:
268
+ - no-referrer
269
+ X-Xss-Protection:
270
+ - '0'
271
+ Access-Control-Allow-Origin:
272
+ - "*"
273
+ X-Rate-Limit-Limit:
274
+ - '600'
275
+ X-Rate-Limit-Remaining:
276
+ - '570'
277
+ X-Rate-Limit-Reset:
278
+ - '1688741046'
279
+ Vary:
280
+ - Origin
281
+ Etag:
282
+ - W/"16d-aCyFWx1lVO+qlE9rePzldAlMnBw"
283
+ body:
284
+ encoding: UTF-8
285
+ string: '{"ok":true,"batch":{"id":"B-HciRzdAdgB1JXE6bJ6Q82G","status":"open","tags":[],"amount":"0.00","currency":"USD","totalPayments":0,"description":"Integration
286
+ Update","sentAt":null,"completedAt":null,"createdAt":"2023-07-07T14:43:24.718Z","updatedAt":"2023-07-07T14:43:27.116Z","quoteExpiredAt":null,"payments":{"payments":[],"meta":{"page":1,"pages":0,"records":0}}}}'
287
+ recorded_at: Fri, 07 Jul 2023 14:43:27 GMT
288
+ - request:
289
+ method: delete
290
+ uri: https://api.trolley.com/v1/batches/B-HciRzdAdgB1JXE6bJ6Q82G
291
+ body:
292
+ encoding: UTF-8
293
+ string: ''
294
+ headers:
295
+ X-Pr-Timestamp:
296
+ - '1688741007'
297
+ Content-Type:
298
+ - application/json
299
+ Accept-Encoding:
300
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
301
+ Accept:
302
+ - "*/*"
303
+ User-Agent:
304
+ - Ruby
305
+ response:
306
+ status:
307
+ code: 200
308
+ message: OK
309
+ headers:
310
+ Date:
311
+ - Fri, 07 Jul 2023 14:43:28 GMT
312
+ Content-Type:
313
+ - application/json; charset=utf-8
314
+ Content-Length:
315
+ - '11'
316
+ Connection:
317
+ - keep-alive
318
+ Cache-Control:
319
+ - no-store, no-cache
320
+ Content-Security-Policy:
321
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
322
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
323
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
324
+ X-Dns-Prefetch-Control:
325
+ - 'off'
326
+ Expect-Ct:
327
+ - max-age=0
328
+ Strict-Transport-Security:
329
+ - max-age=15552000; includeSubDomains
330
+ X-Download-Options:
331
+ - noopen
332
+ X-Content-Type-Options:
333
+ - nosniff
334
+ X-Permitted-Cross-Domain-Policies:
335
+ - none
336
+ Referrer-Policy:
337
+ - no-referrer
338
+ X-Xss-Protection:
339
+ - '0'
340
+ Access-Control-Allow-Origin:
341
+ - "*"
342
+ X-Rate-Limit-Limit:
343
+ - '600'
344
+ X-Rate-Limit-Remaining:
345
+ - '569'
346
+ X-Rate-Limit-Reset:
347
+ - '1688741046'
348
+ Vary:
349
+ - Origin
350
+ Etag:
351
+ - W/"b-Ai2R8hgEarLmHKwesT1qcY913ys"
352
+ body:
353
+ encoding: UTF-8
354
+ string: '{"ok":true}'
355
+ recorded_at: Fri, 07 Jul 2023 14:43:28 GMT
356
+ recorded_with: VCR 6.2.0