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.
- checksums.yaml +4 -4
- data/lib/trolley/Client.rb +6 -1
- data/lib/trolley/Gateway.rb +7 -1
- data/lib/trolley/InvoicePayment.rb +6 -1
- data/lib/trolley/OfflinePayment.rb +2 -1
- data/lib/trolley/Payment.rb +4 -1
- data/lib/trolley/Recipient.rb +0 -2
- data/lib/trolley/RecipientAccount.rb +4 -1
- data/lib/trolley/RecipientLog.rb +12 -0
- data/lib/trolley/gateways/BalanceGateway.rb +18 -1
- data/lib/trolley/gateways/PaymentGateway.rb +5 -0
- data/lib/trolley/gateways/RecipientGateway.rb +5 -1
- data/lib/trolley/gateways/VerificationGateway.rb +40 -0
- data/lib/trolley/utils/PaginatedArray.rb +8 -3
- data/lib/trolley/utils/ResponseMapper.rb +2 -1
- data/lib/trolley.rb +3 -1
- data/test/fixtures/BalanceTest/test_find.yml +71 -0
- data/test/fixtures/BalanceTest/test_find_with_term.yml +71 -0
- data/test/fixtures/BatchTest/test_create.yml +150 -0
- data/test/fixtures/BatchTest/test_create_with_payments.yml +541 -0
- data/test/fixtures/BatchTest/test_delete_multiple.yml +209 -0
- data/test/fixtures/BatchTest/test_payments.yml +434 -0
- data/test/fixtures/BatchTest/test_processing.yml +578 -0
- data/test/fixtures/BatchTest/test_summary.yml +440 -0
- data/test/fixtures/BatchTest/test_update.yml +356 -0
- data/test/fixtures/InvoicePaymentTest/test_create.yml +489 -0
- data/test/fixtures/InvoicePaymentTest/test_delete.yml +634 -0
- data/test/fixtures/InvoicePaymentTest/test_find.yml +420 -0
- data/test/fixtures/InvoicePaymentTest/test_update.yml +634 -0
- data/test/fixtures/InvoiceTest/test_create.yml +293 -0
- data/test/fixtures/InvoiceTest/test_create_line.yml +353 -0
- data/test/fixtures/InvoiceTest/test_delete.yml +433 -0
- data/test/fixtures/InvoiceTest/test_delete_line.yml +353 -0
- data/test/fixtures/InvoiceTest/test_find.yml +284 -0
- data/test/fixtures/InvoiceTest/test_search.yml +293 -0
- data/test/fixtures/InvoiceTest/test_support_error_arrays.yml +71 -0
- data/test/fixtures/InvoiceTest/test_update.yml +428 -0
- data/test/fixtures/InvoiceTest/test_update_line.yml +422 -0
- data/test/fixtures/OfflinePaymentTest/test_create.yml +213 -0
- data/test/fixtures/OfflinePaymentTest/test_delete.yml +281 -0
- data/test/fixtures/OfflinePaymentTest/test_search.yml +281 -0
- data/test/fixtures/OfflinePaymentTest/test_update.yml +281 -0
- data/test/fixtures/PaymentTest/test_crud.yml +510 -0
- data/test/fixtures/PaymentTest/test_search.yml +366 -0
- data/test/fixtures/RecipientAccountTest/test_basic_crud.yml +351 -0
- data/test/fixtures/RecipientTest/test_account.yml +499 -0
- data/test/fixtures/RecipientTest/test_create.yml +72 -0
- data/test/fixtures/RecipientTest/test_delete_multiple.yml +347 -0
- data/test/fixtures/RecipientTest/test_find_logs.yml +278 -0
- data/test/fixtures/RecipientTest/test_find_payments.yml +512 -0
- data/test/fixtures/RecipientTest/test_lifecycle.yml +347 -0
- data/test/integration/BalanceTest.rb +22 -0
- data/test/integration/BatchTest.rb +157 -0
- data/test/integration/InvoicePaymentTest.rb +109 -0
- data/test/integration/InvoiceTest.rb +156 -0
- data/test/integration/OfflinePaymentTest.rb +109 -0
- data/test/integration/PaymentTest.rb +73 -0
- data/test/integration/RecipientAccountTest.rb +52 -0
- data/test/integration/RecipientTest.rb +176 -0
- data/test/test_helper.rb +45 -0
- data/test/unit/ClientRequestTest.rb +54 -0
- data/{spec → test}/unit/ConfigurationTest.rb +1 -1
- data/test/unit/GatewayParityTest.rb +184 -0
- data/{spec → test}/unit/PaginatedArrayTest.rb +3 -1
- data/{spec → test}/unit/TrolleyTest.rb +2 -2
- data/trolley.gemspec +11 -8
- metadata +101 -18
- data/spec/integration/BatchTest.rb +0 -126
- data/spec/integration/InvoicePaymentTest.rb +0 -92
- data/spec/integration/InvoiceTest.rb +0 -128
- data/spec/integration/RecipientAccountTest.rb +0 -48
- data/spec/integration/RecipientTest.rb +0 -159
- data/spec/integration/helper.rb +0 -19
- /data/{spec → test}/unit/ResponseMapperTest.rb +0 -0
|
@@ -0,0 +1,347 @@
|
|
|
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.create50a9ae30-3e12-422d-afb5-cb1ad12b8f36@example.com"}'
|
|
9
|
+
headers:
|
|
10
|
+
X-Pr-Timestamp:
|
|
11
|
+
- '1688741570'
|
|
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:52: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
|
+
- '575'
|
|
61
|
+
X-Rate-Limit-Reset:
|
|
62
|
+
- '1688741619'
|
|
63
|
+
Vary:
|
|
64
|
+
- Origin
|
|
65
|
+
Etag:
|
|
66
|
+
- W/"4ef-/HAcVDifh0winYlZjGYUzD4Vlfk"
|
|
67
|
+
body:
|
|
68
|
+
encoding: UTF-8
|
|
69
|
+
string: '{"ok":true,"recipient":{"id":"R-KoYN6EFnFVBpr6LjQvZiUM","referenceId":"R-KoYN6EFnFVBpr6LjQvZiUM","parentRecipientId":null,"email":"test.create50a9ae30-3e12-422d-afb5-cb1ad12b8f36@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:52:51.142Z","createdAt":"2023-07-07T14:52:51.142Z","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/781825e57457fd0b8197c1786678dc05?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:52:51 GMT
|
|
72
|
+
- request:
|
|
73
|
+
method: patch
|
|
74
|
+
uri: https://api.trolley.com/v1/recipients/R-KoYN6EFnFVBpr6LjQvZiUM
|
|
75
|
+
body:
|
|
76
|
+
encoding: UTF-8
|
|
77
|
+
string: '{"firstName":"Bob"}'
|
|
78
|
+
headers:
|
|
79
|
+
X-Pr-Timestamp:
|
|
80
|
+
- '1688741571'
|
|
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:52:51 GMT
|
|
96
|
+
Content-Type:
|
|
97
|
+
- application/json; charset=utf-8
|
|
98
|
+
Content-Length:
|
|
99
|
+
- '1263'
|
|
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
|
+
- '574'
|
|
130
|
+
X-Rate-Limit-Reset:
|
|
131
|
+
- '1688741619'
|
|
132
|
+
Vary:
|
|
133
|
+
- Origin
|
|
134
|
+
Etag:
|
|
135
|
+
- W/"4ef-ewA+g1ibNxKdgeBaEASSSoW+JQU"
|
|
136
|
+
body:
|
|
137
|
+
encoding: UTF-8
|
|
138
|
+
string: '{"ok":true,"recipient":{"id":"R-KoYN6EFnFVBpr6LjQvZiUM","referenceId":"R-KoYN6EFnFVBpr6LjQvZiUM","parentRecipientId":null,"email":"test.create50a9ae30-3e12-422d-afb5-cb1ad12b8f36@example.com","name":"Bob
|
|
139
|
+
Jones","lastName":"Jones","firstName":"Bob","legalName":"","type":"individual","status":"incomplete","language":"en","complianceStatus":"pending","dob":null,"passport":"","placeOfBirth":null,"updatedAt":"2023-07-07T14:52:51.616Z","createdAt":"2023-07-07T14:52:51.142Z","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/781825e57457fd0b8197c1786678dc05?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}}'
|
|
140
|
+
recorded_at: Fri, 07 Jul 2023 14:52:51 GMT
|
|
141
|
+
- request:
|
|
142
|
+
method: get
|
|
143
|
+
uri: https://api.trolley.com/v1/recipients/R-KoYN6EFnFVBpr6LjQvZiUM
|
|
144
|
+
body:
|
|
145
|
+
encoding: US-ASCII
|
|
146
|
+
string: ''
|
|
147
|
+
headers:
|
|
148
|
+
X-Pr-Timestamp:
|
|
149
|
+
- '1688741571'
|
|
150
|
+
Content-Type:
|
|
151
|
+
- application/json
|
|
152
|
+
Accept-Encoding:
|
|
153
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
154
|
+
Accept:
|
|
155
|
+
- "*/*"
|
|
156
|
+
User-Agent:
|
|
157
|
+
- Ruby
|
|
158
|
+
response:
|
|
159
|
+
status:
|
|
160
|
+
code: 200
|
|
161
|
+
message: OK
|
|
162
|
+
headers:
|
|
163
|
+
Date:
|
|
164
|
+
- Fri, 07 Jul 2023 14:52:52 GMT
|
|
165
|
+
Content-Type:
|
|
166
|
+
- application/json; charset=utf-8
|
|
167
|
+
Content-Length:
|
|
168
|
+
- '1263'
|
|
169
|
+
Connection:
|
|
170
|
+
- keep-alive
|
|
171
|
+
Cache-Control:
|
|
172
|
+
- no-store, no-cache
|
|
173
|
+
Content-Security-Policy:
|
|
174
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
|
175
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
|
176
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
|
177
|
+
X-Dns-Prefetch-Control:
|
|
178
|
+
- 'off'
|
|
179
|
+
Expect-Ct:
|
|
180
|
+
- max-age=0
|
|
181
|
+
Strict-Transport-Security:
|
|
182
|
+
- max-age=15552000; includeSubDomains
|
|
183
|
+
X-Download-Options:
|
|
184
|
+
- noopen
|
|
185
|
+
X-Content-Type-Options:
|
|
186
|
+
- nosniff
|
|
187
|
+
X-Permitted-Cross-Domain-Policies:
|
|
188
|
+
- none
|
|
189
|
+
Referrer-Policy:
|
|
190
|
+
- no-referrer
|
|
191
|
+
X-Xss-Protection:
|
|
192
|
+
- '0'
|
|
193
|
+
Access-Control-Allow-Origin:
|
|
194
|
+
- "*"
|
|
195
|
+
X-Rate-Limit-Limit:
|
|
196
|
+
- '600'
|
|
197
|
+
X-Rate-Limit-Remaining:
|
|
198
|
+
- '573'
|
|
199
|
+
X-Rate-Limit-Reset:
|
|
200
|
+
- '1688741619'
|
|
201
|
+
Vary:
|
|
202
|
+
- Origin
|
|
203
|
+
Etag:
|
|
204
|
+
- W/"4ef-ewA+g1ibNxKdgeBaEASSSoW+JQU"
|
|
205
|
+
body:
|
|
206
|
+
encoding: UTF-8
|
|
207
|
+
string: '{"ok":true,"recipient":{"id":"R-KoYN6EFnFVBpr6LjQvZiUM","referenceId":"R-KoYN6EFnFVBpr6LjQvZiUM","parentRecipientId":null,"email":"test.create50a9ae30-3e12-422d-afb5-cb1ad12b8f36@example.com","name":"Bob
|
|
208
|
+
Jones","lastName":"Jones","firstName":"Bob","legalName":"","type":"individual","status":"incomplete","language":"en","complianceStatus":"pending","dob":null,"passport":"","placeOfBirth":null,"updatedAt":"2023-07-07T14:52:51.616Z","createdAt":"2023-07-07T14:52:51.142Z","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/781825e57457fd0b8197c1786678dc05?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}}'
|
|
209
|
+
recorded_at: Fri, 07 Jul 2023 14:52:52 GMT
|
|
210
|
+
- request:
|
|
211
|
+
method: delete
|
|
212
|
+
uri: https://api.trolley.com/v1/recipients/R-KoYN6EFnFVBpr6LjQvZiUM
|
|
213
|
+
body:
|
|
214
|
+
encoding: UTF-8
|
|
215
|
+
string: ''
|
|
216
|
+
headers:
|
|
217
|
+
X-Pr-Timestamp:
|
|
218
|
+
- '1688741572'
|
|
219
|
+
Content-Type:
|
|
220
|
+
- application/json
|
|
221
|
+
Accept-Encoding:
|
|
222
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
223
|
+
Accept:
|
|
224
|
+
- "*/*"
|
|
225
|
+
User-Agent:
|
|
226
|
+
- Ruby
|
|
227
|
+
response:
|
|
228
|
+
status:
|
|
229
|
+
code: 200
|
|
230
|
+
message: OK
|
|
231
|
+
headers:
|
|
232
|
+
Date:
|
|
233
|
+
- Fri, 07 Jul 2023 14:52:52 GMT
|
|
234
|
+
Content-Type:
|
|
235
|
+
- application/json; charset=utf-8
|
|
236
|
+
Content-Length:
|
|
237
|
+
- '11'
|
|
238
|
+
Connection:
|
|
239
|
+
- keep-alive
|
|
240
|
+
Cache-Control:
|
|
241
|
+
- no-store, no-cache
|
|
242
|
+
Content-Security-Policy:
|
|
243
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
|
244
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
|
245
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
|
246
|
+
X-Dns-Prefetch-Control:
|
|
247
|
+
- 'off'
|
|
248
|
+
Expect-Ct:
|
|
249
|
+
- max-age=0
|
|
250
|
+
Strict-Transport-Security:
|
|
251
|
+
- max-age=15552000; includeSubDomains
|
|
252
|
+
X-Download-Options:
|
|
253
|
+
- noopen
|
|
254
|
+
X-Content-Type-Options:
|
|
255
|
+
- nosniff
|
|
256
|
+
X-Permitted-Cross-Domain-Policies:
|
|
257
|
+
- none
|
|
258
|
+
Referrer-Policy:
|
|
259
|
+
- no-referrer
|
|
260
|
+
X-Xss-Protection:
|
|
261
|
+
- '0'
|
|
262
|
+
Access-Control-Allow-Origin:
|
|
263
|
+
- "*"
|
|
264
|
+
X-Rate-Limit-Limit:
|
|
265
|
+
- '600'
|
|
266
|
+
X-Rate-Limit-Remaining:
|
|
267
|
+
- '572'
|
|
268
|
+
X-Rate-Limit-Reset:
|
|
269
|
+
- '1688741619'
|
|
270
|
+
Vary:
|
|
271
|
+
- Origin
|
|
272
|
+
Etag:
|
|
273
|
+
- W/"b-Ai2R8hgEarLmHKwesT1qcY913ys"
|
|
274
|
+
body:
|
|
275
|
+
encoding: UTF-8
|
|
276
|
+
string: '{"ok":true}'
|
|
277
|
+
recorded_at: Fri, 07 Jul 2023 14:52:52 GMT
|
|
278
|
+
- request:
|
|
279
|
+
method: get
|
|
280
|
+
uri: https://api.trolley.com/v1/recipients/R-KoYN6EFnFVBpr6LjQvZiUM
|
|
281
|
+
body:
|
|
282
|
+
encoding: US-ASCII
|
|
283
|
+
string: ''
|
|
284
|
+
headers:
|
|
285
|
+
X-Pr-Timestamp:
|
|
286
|
+
- '1688741572'
|
|
287
|
+
Content-Type:
|
|
288
|
+
- application/json
|
|
289
|
+
Accept-Encoding:
|
|
290
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
291
|
+
Accept:
|
|
292
|
+
- "*/*"
|
|
293
|
+
User-Agent:
|
|
294
|
+
- Ruby
|
|
295
|
+
response:
|
|
296
|
+
status:
|
|
297
|
+
code: 200
|
|
298
|
+
message: OK
|
|
299
|
+
headers:
|
|
300
|
+
Date:
|
|
301
|
+
- Fri, 07 Jul 2023 14:52:53 GMT
|
|
302
|
+
Content-Type:
|
|
303
|
+
- application/json; charset=utf-8
|
|
304
|
+
Content-Length:
|
|
305
|
+
- '1235'
|
|
306
|
+
Connection:
|
|
307
|
+
- keep-alive
|
|
308
|
+
Cache-Control:
|
|
309
|
+
- no-store, no-cache
|
|
310
|
+
Content-Security-Policy:
|
|
311
|
+
- 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
|
|
312
|
+
https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
|
|
313
|
+
''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
|
|
314
|
+
X-Dns-Prefetch-Control:
|
|
315
|
+
- 'off'
|
|
316
|
+
Expect-Ct:
|
|
317
|
+
- max-age=0
|
|
318
|
+
Strict-Transport-Security:
|
|
319
|
+
- max-age=15552000; includeSubDomains
|
|
320
|
+
X-Download-Options:
|
|
321
|
+
- noopen
|
|
322
|
+
X-Content-Type-Options:
|
|
323
|
+
- nosniff
|
|
324
|
+
X-Permitted-Cross-Domain-Policies:
|
|
325
|
+
- none
|
|
326
|
+
Referrer-Policy:
|
|
327
|
+
- no-referrer
|
|
328
|
+
X-Xss-Protection:
|
|
329
|
+
- '0'
|
|
330
|
+
Access-Control-Allow-Origin:
|
|
331
|
+
- "*"
|
|
332
|
+
X-Rate-Limit-Limit:
|
|
333
|
+
- '600'
|
|
334
|
+
X-Rate-Limit-Remaining:
|
|
335
|
+
- '571'
|
|
336
|
+
X-Rate-Limit-Reset:
|
|
337
|
+
- '1688741619'
|
|
338
|
+
Vary:
|
|
339
|
+
- Origin
|
|
340
|
+
Etag:
|
|
341
|
+
- W/"4d3-qUNKgvMPZsJ2B+0KtJkNglb0kpg"
|
|
342
|
+
body:
|
|
343
|
+
encoding: UTF-8
|
|
344
|
+
string: '{"ok":true,"recipient":{"id":"R-KoYN6EFnFVBpr6LjQvZiUM","referenceId":"R-KoYN6EFnFVBpr6LjQvZiUM","parentRecipientId":null,"email":"test.create50a9ae30-3e12-422d-afb5-cb1ad12b8f36@example.com","name":"Bob
|
|
345
|
+
Jones","lastName":"Jones","firstName":"Bob","legalName":"","type":"individual","status":"archived","language":"en","complianceStatus":"pending","dob":null,"passport":"","placeOfBirth":null,"updatedAt":"2023-07-07T14:52:52.556Z","createdAt":"2023-07-07T14:52:51.142Z","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/781825e57457fd0b8197c1786678dc05?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":{},"taxWithholdingPercentage":null,"taxForm":null,"taxFormStatus":null}}'
|
|
346
|
+
recorded_at: Fri, 07 Jul 2023 14:52:53 GMT
|
|
347
|
+
recorded_with: VCR 6.2.0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require_relative '../test_helper'
|
|
2
|
+
|
|
3
|
+
class BalanceTest < Test::Unit::TestCase
|
|
4
|
+
include TestHelper
|
|
5
|
+
|
|
6
|
+
def test_find
|
|
7
|
+
with_vcr do
|
|
8
|
+
balances = @client.balance.find
|
|
9
|
+
assert_true(balances.balances.count.positive?)
|
|
10
|
+
assert_not_nil(balances.balances[0].type)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_find_with_term
|
|
15
|
+
with_vcr do
|
|
16
|
+
balances = @client.balance.find('paymentrails')
|
|
17
|
+
assert_true(balances.balances.count.positive?)
|
|
18
|
+
assert_not_nil(balances.balances[0].type)
|
|
19
|
+
assert_equal('paymentrails', balances.balances[0].type)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
require_relative '../test_helper'
|
|
2
|
+
class BatchTest < Test::Unit::TestCase
|
|
3
|
+
include TestHelper
|
|
4
|
+
|
|
5
|
+
def create_recipient
|
|
6
|
+
uuid = SecureRandom.uuid.to_s
|
|
7
|
+
recipient = @client.recipient.create(
|
|
8
|
+
type: 'individual',
|
|
9
|
+
firstName: 'Tom',
|
|
10
|
+
lastName: 'Jones',
|
|
11
|
+
email: "test.batch#{uuid}@example.com",
|
|
12
|
+
address: {
|
|
13
|
+
street1: '123 Wolfstrasse',
|
|
14
|
+
city: 'Berlin',
|
|
15
|
+
country: 'DE',
|
|
16
|
+
postalCode: '123123'
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
@client.recipient_account.create(recipient.id, type: 'bank-transfer', currency: 'EUR', country: 'DE', iban: 'DE89 3704 0044 0532 0130 00')
|
|
20
|
+
recipient
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_create
|
|
24
|
+
with_vcr do
|
|
25
|
+
batch = @client.batch.create(sourceCurrency: 'USD', description: 'Integration Test Create')
|
|
26
|
+
assert_not_nil(batch)
|
|
27
|
+
assert_not_nil(batch.id)
|
|
28
|
+
|
|
29
|
+
batch = @client.batch.all
|
|
30
|
+
assert_true(batch.count.positive?)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_update
|
|
35
|
+
with_vcr do
|
|
36
|
+
batch = @client.batch.create(sourceCurrency: 'USD', description: 'Integration Test Create')
|
|
37
|
+
assert_not_nil(batch)
|
|
38
|
+
assert_not_nil(batch.id)
|
|
39
|
+
|
|
40
|
+
all = @client.batch.all
|
|
41
|
+
assert_true(all.count.positive?)
|
|
42
|
+
|
|
43
|
+
response = @client.batch.update(batch.id, description: 'Integration Update')
|
|
44
|
+
assert_true(response)
|
|
45
|
+
findBatch = @client.batch.find(batch.id)
|
|
46
|
+
assert_equal('Integration Update', findBatch.description)
|
|
47
|
+
assert_equal('open', batch.status)
|
|
48
|
+
|
|
49
|
+
response = @client.batch.delete(batch.id)
|
|
50
|
+
assert_true(response)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_create_with_payments
|
|
55
|
+
with_vcr do
|
|
56
|
+
recipientAlpha = create_recipient
|
|
57
|
+
recipientBeta = create_recipient
|
|
58
|
+
|
|
59
|
+
batch = @client.batch.create(
|
|
60
|
+
sourceCurrency: 'USD', description: 'Integration Test Payments', payments: [
|
|
61
|
+
{ targetAmount: '10.00', targetCurrency: 'EUR', recipient: { id: recipientAlpha.id } },
|
|
62
|
+
{ sourceAmount: '10.00', recipient: { id: recipientBeta.id } }
|
|
63
|
+
]
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
assert_not_nil(batch)
|
|
67
|
+
assert_not_nil(batch.id)
|
|
68
|
+
|
|
69
|
+
findBatch = @client.batch.find(batch.id)
|
|
70
|
+
assert_not_nil(findBatch)
|
|
71
|
+
assert_equal(2, findBatch.totalPayments)
|
|
72
|
+
|
|
73
|
+
payments = @client.payment.search(batch.id)
|
|
74
|
+
payments.each { |item| assert_equal('pending', item.status) }
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def test_payments
|
|
79
|
+
with_vcr do
|
|
80
|
+
batch = @client.batch.create(sourceCurrency: 'USD', description: 'Integration Test Payments')
|
|
81
|
+
assert_not_nil(batch)
|
|
82
|
+
assert_not_nil(batch.id)
|
|
83
|
+
|
|
84
|
+
recipient = create_recipient
|
|
85
|
+
|
|
86
|
+
payment = @client.payment.create(batch.id, sourceAmount: '10.00', recipient: { id: recipient.id })
|
|
87
|
+
|
|
88
|
+
assert_not_nil(payment)
|
|
89
|
+
assert_not_nil(payment.id)
|
|
90
|
+
|
|
91
|
+
response = @client.payment.update(batch.id, payment.id, sourceAmount: '20.00')
|
|
92
|
+
assert_true(response)
|
|
93
|
+
|
|
94
|
+
response = @client.payment.delete(batch.id, payment.id)
|
|
95
|
+
assert_true(response)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def test_processing
|
|
100
|
+
with_vcr do
|
|
101
|
+
recipientAlpha = create_recipient
|
|
102
|
+
recipientBeta = create_recipient
|
|
103
|
+
|
|
104
|
+
batch = @client.batch.create(
|
|
105
|
+
sourceCurrency: 'USD', description: 'Integration Test Payments', payments: [
|
|
106
|
+
{ targetAmount: '10.00', targetCurrency: 'EUR', recipient: { id: recipientAlpha.id } },
|
|
107
|
+
{ sourceAmount: '10.00', recipient: { id: recipientBeta.id } }
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
assert_not_nil(batch)
|
|
111
|
+
assert_not_nil(batch.id)
|
|
112
|
+
|
|
113
|
+
summary = @client.batch.summary(batch.id)
|
|
114
|
+
assert_equal(2, summary.detail['bank-transfer']['count'])
|
|
115
|
+
|
|
116
|
+
quote = @client.batch.generate_quote(batch.id)
|
|
117
|
+
assert_not_nil(quote)
|
|
118
|
+
|
|
119
|
+
start = @client.batch.start_processing(batch.id)
|
|
120
|
+
assert_not_nil(start)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_delete_multiple
|
|
125
|
+
with_vcr do
|
|
126
|
+
batch = @client.batch.create(sourceCurrency: 'USD', description: 'Integration Test Create')
|
|
127
|
+
assert_not_nil(batch)
|
|
128
|
+
assert_not_nil(batch.id)
|
|
129
|
+
|
|
130
|
+
batch2 = @client.batch.create(sourceCurrency: 'USD', description: 'Integration Test Create')
|
|
131
|
+
assert_not_nil(batch2)
|
|
132
|
+
assert_not_nil(batch2.id)
|
|
133
|
+
|
|
134
|
+
response = @client.batch.delete([batch.id, batch2.id])
|
|
135
|
+
assert_true(response)
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def test_summary
|
|
140
|
+
with_vcr do
|
|
141
|
+
recipientAlpha = create_recipient
|
|
142
|
+
recipientBeta = create_recipient
|
|
143
|
+
|
|
144
|
+
batch = @client.batch.create(
|
|
145
|
+
sourceCurrency: 'USD', description: 'Integration Test Payments', payments: [
|
|
146
|
+
{ targetAmount: '10.00', targetCurrency: 'EUR', recipient: { id: recipientAlpha.id } },
|
|
147
|
+
{ sourceAmount: '10.00', recipient: { id: recipientBeta.id } }
|
|
148
|
+
]
|
|
149
|
+
)
|
|
150
|
+
assert_not_nil(batch)
|
|
151
|
+
assert_not_nil(batch.id)
|
|
152
|
+
|
|
153
|
+
summary = @client.batch.summary(batch.id)
|
|
154
|
+
assert_equal(2, summary.detail['bank-transfer']['count'])
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
require_relative '../test_helper'
|
|
2
|
+
|
|
3
|
+
class InvoicePaymentTest < Test::Unit::TestCase
|
|
4
|
+
include TestHelper
|
|
5
|
+
|
|
6
|
+
def create_recipient
|
|
7
|
+
uuid = SecureRandom.uuid.to_s
|
|
8
|
+
recipient = @client.recipient.create(
|
|
9
|
+
type: 'individual',
|
|
10
|
+
firstName: 'Tom',
|
|
11
|
+
lastName: 'Jones',
|
|
12
|
+
email: "test.batch#{uuid}@example.com",
|
|
13
|
+
address: {
|
|
14
|
+
street1: '123 Wolfstrasse',
|
|
15
|
+
city: 'Berlin',
|
|
16
|
+
country: 'DE',
|
|
17
|
+
postalCode: '123123'
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
@client.recipient_account.create(recipient.id, type: 'bank-transfer', currency: 'EUR', country: 'DE', iban: 'DE89 3704 0044 0532 0130 00')
|
|
21
|
+
recipient
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_find
|
|
25
|
+
with_vcr do
|
|
26
|
+
recipient = create_recipient
|
|
27
|
+
invoice = @client.invoice.create(recipientId: recipient.id, description: 'Integration Test Invoice Create')
|
|
28
|
+
@client.invoice.create_line(invoiceId: invoice.id, lines: [{ unitAmount: { value: '2000', currency: 'USD' } }])
|
|
29
|
+
@client.invoice_payment.create(ids: [invoiceId: invoice.id])
|
|
30
|
+
invoice_payments = @client.invoice_payment.search({ invoiceIds: [invoice.id] })
|
|
31
|
+
assert_true(invoice_payments.count.positive?)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_create
|
|
36
|
+
with_vcr do
|
|
37
|
+
recipient = create_recipient
|
|
38
|
+
invoice = @client.invoice.create(recipientId: recipient.id, description: 'Integration Test Invoice Create')
|
|
39
|
+
assert_not_nil(invoice)
|
|
40
|
+
assert_not_nil(invoice.id)
|
|
41
|
+
assert_equal('open', invoice.status)
|
|
42
|
+
|
|
43
|
+
invoice_line = @client.invoice.create_line(invoiceId: invoice.id, lines: [{ unitAmount: { value: '2000', currency: 'USD' } }])
|
|
44
|
+
assert_not_nil(invoice_line.lines)
|
|
45
|
+
assert_not_nil(invoice_line.lines.first['id'])
|
|
46
|
+
|
|
47
|
+
@client.invoice_payment.create(ids: [invoiceId: invoice.id])
|
|
48
|
+
invoice_payments = @client.invoice_payment.search(invoiceIds: [invoice.id])
|
|
49
|
+
assert_true(invoice_payments.count.positive?)
|
|
50
|
+
|
|
51
|
+
findInvoice = @client.invoice.find(invoiceId: invoice.id)
|
|
52
|
+
assert_equal('pending', findInvoice.status)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_update
|
|
57
|
+
with_vcr do
|
|
58
|
+
recipient = create_recipient
|
|
59
|
+
|
|
60
|
+
invoice = @client.invoice.create(recipientId: recipient.id, description: 'Integration Test Invoice Create')
|
|
61
|
+
assert_not_nil(invoice)
|
|
62
|
+
assert_not_nil(invoice.id)
|
|
63
|
+
|
|
64
|
+
invoices = @client.invoice.search({})
|
|
65
|
+
assert_true(invoices.count.positive?)
|
|
66
|
+
|
|
67
|
+
invoice_line = @client.invoice.create_line(invoiceId: invoice.id, lines: [{ unitAmount: { value: '2000', currency: 'USD' } }])
|
|
68
|
+
assert_not_nil(invoice_line.lines)
|
|
69
|
+
assert_not_nil(invoice_line.lines.first['id'])
|
|
70
|
+
|
|
71
|
+
invoice_payment = @client.invoice_payment.create(ids: [invoiceId: invoice.id])
|
|
72
|
+
invoice_payments = @client.invoice_payment.search(invoiceIds: [invoice.id])
|
|
73
|
+
assert_true(invoice_payments.count.positive?)
|
|
74
|
+
assert_equal('2000.00', invoice_payments.first.amount['value'])
|
|
75
|
+
|
|
76
|
+
response = @client.invoice_payment.update(paymentId: invoice_payment.paymentId, invoiceLineId: invoice_payment.invoicePayments.first['invoiceLineId'], amount: { value: '5000', currency: 'USD' })
|
|
77
|
+
assert_true(response)
|
|
78
|
+
invoice_payments = @client.invoice_payment.search(invoiceIds: [invoice.id])
|
|
79
|
+
assert_true(invoice_payments.count.positive?)
|
|
80
|
+
assert_equal('5000.00', invoice_payments.first.amount['value'])
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def test_delete
|
|
85
|
+
with_vcr do
|
|
86
|
+
recipient = create_recipient
|
|
87
|
+
|
|
88
|
+
invoice = @client.invoice.create(recipientId: recipient.id, description: 'Integration Test Invoice Create')
|
|
89
|
+
assert_not_nil(invoice)
|
|
90
|
+
assert_not_nil(invoice.id)
|
|
91
|
+
|
|
92
|
+
invoices = @client.invoice.search({})
|
|
93
|
+
assert_true(invoices.count.positive?)
|
|
94
|
+
|
|
95
|
+
invoice_line = @client.invoice.create_line(invoiceId: invoice.id, lines: [{ unitAmount: { value: '2000', currency: 'USD' } }])
|
|
96
|
+
assert_not_nil(invoice_line.lines)
|
|
97
|
+
assert_not_nil(invoice_line.lines.first['id'])
|
|
98
|
+
|
|
99
|
+
invoice_payment = @client.invoice_payment.create(ids: [invoiceId: invoice.id])
|
|
100
|
+
invoice_payments = @client.invoice_payment.search(invoiceIds: [invoice.id])
|
|
101
|
+
assert_true(invoice_payments.count.positive?)
|
|
102
|
+
|
|
103
|
+
response = @client.invoice_payment.delete(paymentId: invoice_payment.paymentId, invoiceLineIds: [invoice_payment.invoicePayments.first['invoiceLineId']])
|
|
104
|
+
assert_true(response)
|
|
105
|
+
invoice_payments = @client.invoice_payment.search(invoiceIds: [invoice.id])
|
|
106
|
+
assert_true(invoice_payments.count.zero?)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|