trolley 1.0.2 → 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 +2 -1
  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 +2 -2
  66. data/trolley.gemspec +11 -8
  67. metadata +101 -18
  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,281 @@
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.batche214c5b7-0a7c-4dbf-bbef-4bcdf9eae87e@example.com","address":{"street1":"123
9
+ Wolfstrasse","city":"Berlin","country":"DE","postalCode":"123123"}}'
10
+ headers:
11
+ X-Pr-Timestamp:
12
+ - '1691540970'
13
+ Content-Type:
14
+ - application/json
15
+ Accept-Encoding:
16
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
17
+ Accept:
18
+ - "*/*"
19
+ User-Agent:
20
+ - Ruby
21
+ response:
22
+ status:
23
+ code: 200
24
+ message: OK
25
+ headers:
26
+ Date:
27
+ - Wed, 09 Aug 2023 00:29:30 GMT
28
+ Content-Type:
29
+ - application/json; charset=utf-8
30
+ Content-Length:
31
+ - '1289'
32
+ Connection:
33
+ - keep-alive
34
+ Cache-Control:
35
+ - no-store, no-cache
36
+ Content-Security-Policy:
37
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
38
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
39
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
40
+ X-Dns-Prefetch-Control:
41
+ - 'off'
42
+ Expect-Ct:
43
+ - max-age=0
44
+ Strict-Transport-Security:
45
+ - max-age=15552000; includeSubDomains
46
+ X-Download-Options:
47
+ - noopen
48
+ X-Content-Type-Options:
49
+ - nosniff
50
+ X-Permitted-Cross-Domain-Policies:
51
+ - none
52
+ Referrer-Policy:
53
+ - no-referrer
54
+ X-Xss-Protection:
55
+ - '0'
56
+ Access-Control-Allow-Origin:
57
+ - "*"
58
+ X-Rate-Limit-Limit:
59
+ - '600'
60
+ X-Rate-Limit-Remaining:
61
+ - '576'
62
+ X-Rate-Limit-Reset:
63
+ - '1691541008'
64
+ Vary:
65
+ - Origin
66
+ Etag:
67
+ - W/"509-03DLB5l+Q0DLrDiUCq6h+OdSlE0"
68
+ body:
69
+ encoding: UTF-8
70
+ string: '{"ok":true,"recipient":{"id":"R-7bgrfuEeXSWvVxqTpMXLDW","referenceId":"R-7bgrfuEeXSWvVxqTpMXLDW","parentRecipientId":null,"email":"test.batche214c5b7-0a7c-4dbf-bbef-4bcdf9eae87e@example.com","name":"Tom
71
+ Jones","lastName":"Jones","firstName":"Tom","legalName":"","type":"individual","status":"incomplete","language":"en","complianceStatus":"pending","dob":null,"passport":"","placeOfBirth":null,"updatedAt":"2023-08-09T00:29:30.369Z","createdAt":"2023-08-09T00:29:30.369Z","tags":[],"isPortalUser":false,"taxDeliveryType":"mail","contactEmails":[],"occupation":"","address":{"street1":"123
72
+ Wolfstrasse","street2":"","city":"Berlin","postalCode":"123123","country":"DE","region":null,"phone":"","phoneValidated":false},"compliance":{"status":"pending","checkedAt":null},"gravatarUrl":"https://www.gravatar.com/avatar/29031b7a766c40a3bdbc2544eda496a8?d=404","governmentId":null,"ssn":null,"governmentIds":[],"birthplace":{"country":null,"region":null,"city":null},"citizenships":[],"routeType":"sepa","routeMinimum":"0","estimatedFees":"3","accounts":[],"payoutMethod":null,"primaryCurrency":null,"riskScore":null,"riskScoreLabel":null,"merchantId":"M-C7AsydAeAqW3husDNHSAND","inactiveReasons":{"primaryAccount":"missing"},"taxWithholdingPercentage":null,"taxForm":null,"taxFormStatus":null}}'
73
+ recorded_at: Wed, 09 Aug 2023 00:29:30 GMT
74
+ - request:
75
+ method: post
76
+ uri: https://api.trolley.com/v1/recipients/R-7bgrfuEeXSWvVxqTpMXLDW/accounts
77
+ body:
78
+ encoding: UTF-8
79
+ string: '{"type":"bank-transfer","currency":"EUR","country":"DE","iban":"DE89
80
+ 3704 0044 0532 0130 00"}'
81
+ headers:
82
+ X-Pr-Timestamp:
83
+ - '1691540970'
84
+ Content-Type:
85
+ - application/json
86
+ Accept-Encoding:
87
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
88
+ Accept:
89
+ - "*/*"
90
+ User-Agent:
91
+ - Ruby
92
+ response:
93
+ status:
94
+ code: 200
95
+ message: OK
96
+ headers:
97
+ Date:
98
+ - Wed, 09 Aug 2023 00:29:30 GMT
99
+ Content-Type:
100
+ - application/json; charset=utf-8
101
+ Content-Length:
102
+ - '657'
103
+ Connection:
104
+ - keep-alive
105
+ Cache-Control:
106
+ - no-store, no-cache
107
+ Content-Security-Policy:
108
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
109
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
110
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
111
+ X-Dns-Prefetch-Control:
112
+ - 'off'
113
+ Expect-Ct:
114
+ - max-age=0
115
+ Strict-Transport-Security:
116
+ - max-age=15552000; includeSubDomains
117
+ X-Download-Options:
118
+ - noopen
119
+ X-Content-Type-Options:
120
+ - nosniff
121
+ X-Permitted-Cross-Domain-Policies:
122
+ - none
123
+ Referrer-Policy:
124
+ - no-referrer
125
+ X-Xss-Protection:
126
+ - '0'
127
+ Access-Control-Allow-Origin:
128
+ - "*"
129
+ X-Rate-Limit-Limit:
130
+ - '600'
131
+ X-Rate-Limit-Remaining:
132
+ - '575'
133
+ X-Rate-Limit-Reset:
134
+ - '1691541008'
135
+ Vary:
136
+ - Origin
137
+ Etag:
138
+ - W/"291-XRHAkDSaLQRCeOOEKrWhQKmi1uw"
139
+ body:
140
+ encoding: UTF-8
141
+ string: '{"ok":true,"account":{"status":"primary","type":"bank-transfer","primary":true,"currency":"EUR","id":"A-EoyEU3Dmcud6UtF7vTqjjx","recipientId":"R-7bgrfuEeXSWvVxqTpMXLDW","recipientAccountId":"A-EoyEU3Dmcud6UtF7vTqjjx","disabledAt":null,"deliveryBusinessDaysEstimate":5,"country":"DE","iban":"********************00","accountNum":"","bankAccountType":null,"bankCodeMappingId":null,"accountHolderName":"Tom
142
+ Jones","swiftBic":"COBADEFFXXX","branchId":"","bankId":"","bankName":"Commerzbank
143
+ AG","bankAddress":"Unter Sachsenhausen 21-27","bankCity":"Cologne","bankRegionCode":"Nordrhein-Westfalen","bankPostalCode":"50667","routeType":"sepa","recipientFees":"2"}}'
144
+ recorded_at: Wed, 09 Aug 2023 00:29:30 GMT
145
+ - request:
146
+ method: post
147
+ uri: https://api.trolley.com/v1/recipients/R-7bgrfuEeXSWvVxqTpMXLDW/offlinePayments
148
+ body:
149
+ encoding: UTF-8
150
+ string: '{"amount":"10.00","currency":"EUR","category":"services"}'
151
+ headers:
152
+ X-Pr-Timestamp:
153
+ - '1691540970'
154
+ Content-Type:
155
+ - application/json
156
+ Accept-Encoding:
157
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
158
+ Accept:
159
+ - "*/*"
160
+ User-Agent:
161
+ - Ruby
162
+ response:
163
+ status:
164
+ code: 200
165
+ message: OK
166
+ headers:
167
+ Date:
168
+ - Wed, 09 Aug 2023 00:29:31 GMT
169
+ Content-Type:
170
+ - application/json; charset=utf-8
171
+ Content-Length:
172
+ - '957'
173
+ Connection:
174
+ - keep-alive
175
+ Cache-Control:
176
+ - no-store, no-cache
177
+ Content-Security-Policy:
178
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
179
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
180
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
181
+ X-Dns-Prefetch-Control:
182
+ - 'off'
183
+ Expect-Ct:
184
+ - max-age=0
185
+ Strict-Transport-Security:
186
+ - max-age=15552000; includeSubDomains
187
+ X-Download-Options:
188
+ - noopen
189
+ X-Content-Type-Options:
190
+ - nosniff
191
+ X-Permitted-Cross-Domain-Policies:
192
+ - none
193
+ Referrer-Policy:
194
+ - no-referrer
195
+ X-Xss-Protection:
196
+ - '0'
197
+ Access-Control-Allow-Origin:
198
+ - "*"
199
+ X-Rate-Limit-Limit:
200
+ - '600'
201
+ X-Rate-Limit-Remaining:
202
+ - '574'
203
+ X-Rate-Limit-Reset:
204
+ - '1691541008'
205
+ Vary:
206
+ - Origin
207
+ Etag:
208
+ - W/"3bd-bjSnmi/makI5pZr2ASu6FHE686w"
209
+ body:
210
+ encoding: UTF-8
211
+ string: '{"ok":true,"offlinePayment":{"id":"OP-FwRHf6o9WeBD96VWAVcvn3","recipientId":"R-7bgrfuEeXSWvVxqTpMXLDW","taxFormId":null,"entered":{"value":"10.00","currency":"EUR"},"withholding":{"value":"0.00","currency":"EUR"},"equivalentWithholding":{"value":"0.00","currency":"USD"},"amount":"10.00","currency":"EUR","withholdingAmount":"0.00","withholdingCurrency":"EUR","equivalentWithholdingAmount":"0.00","equivalentWithholdingCurrency":"USD","paymentId":null,"externalId":null,"memo":"","payoutMethod":null,"tags":[],"taxReportable":true,"category":"services","processedAt":"2023-08-09T00:29:31.346Z","forceUsTaxActivity":false,"taxWithholdingReason":null,"equivalentUntaxedAmount":{"value":"10.96","currency":"USD"},"modifiedSinceCreation":false,"taxPaidByWithholdingAgents":"0","status":"processed","enteredAmount":{"value":"10.00","currency":"EUR"},"updatedAt":"2023-08-09T00:29:31.346Z","createdAt":"2023-08-09T00:29:31.346Z","deletedAt":null,"dac7Meta":null}}'
212
+ recorded_at: Wed, 09 Aug 2023 00:29:31 GMT
213
+ - request:
214
+ method: patch
215
+ uri: https://api.trolley.com/v1/recipients/R-7bgrfuEeXSWvVxqTpMXLDW/offlinePayments/OP-FwRHf6o9WeBD96VWAVcvn3
216
+ body:
217
+ encoding: UTF-8
218
+ string: '{"category":"royalties"}'
219
+ headers:
220
+ X-Pr-Timestamp:
221
+ - '1691540971'
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
+ - Wed, 09 Aug 2023 00:29:31 GMT
237
+ Content-Type:
238
+ - application/json; charset=utf-8
239
+ Content-Length:
240
+ - '957'
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
+ - '573'
271
+ X-Rate-Limit-Reset:
272
+ - '1691541008'
273
+ Vary:
274
+ - Origin
275
+ Etag:
276
+ - W/"3bd-R/Nwn/StdHLtxVgZF5g10RSbdBg"
277
+ body:
278
+ encoding: UTF-8
279
+ string: '{"ok":true,"offlinePayment":{"id":"OP-FwRHf6o9WeBD96VWAVcvn3","recipientId":"R-7bgrfuEeXSWvVxqTpMXLDW","taxFormId":null,"entered":{"value":"10.00","currency":"EUR"},"withholding":{"value":"0.00","currency":"EUR"},"equivalentWithholding":{"value":"0.00","currency":"USD"},"amount":"10.00","currency":"EUR","withholdingAmount":"0.00","withholdingCurrency":"EUR","equivalentWithholdingAmount":"0.00","equivalentWithholdingCurrency":"USD","paymentId":null,"externalId":null,"memo":"","payoutMethod":null,"tags":[],"taxReportable":true,"category":"royalties","processedAt":"2023-08-09T00:29:31.346Z","forceUsTaxActivity":false,"taxWithholdingReason":null,"equivalentUntaxedAmount":{"value":"10.96","currency":"USD"},"modifiedSinceCreation":true,"taxPaidByWithholdingAgents":"0","status":"processed","enteredAmount":{"value":"10.00","currency":"EUR"},"updatedAt":"2023-08-09T00:29:31.823Z","createdAt":"2023-08-09T00:29:31.346Z","deletedAt":null,"dac7Meta":null}}'
280
+ recorded_at: Wed, 09 Aug 2023 00:29:31 GMT
281
+ recorded_with: VCR 6.2.0