mollie-api-ruby 4.9.0 → 4.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +25 -0
- data/CHANGELOG.md +18 -0
- data/README.md +1 -1
- data/examples/methods/list.rb +4 -0
- data/examples/orders/create-payment.rb +1 -0
- data/examples/orders/get.rb +4 -1
- data/examples/orders/update-orderline.rb +7 -0
- data/examples/profiles/create.rb +6 -6
- data/lib/mollie/list.rb +4 -2
- data/lib/mollie/method.rb +7 -1
- data/lib/mollie/onboarding.rb +1 -1
- data/lib/mollie/order/line.rb +4 -0
- data/lib/mollie/order/payment.rb +6 -0
- data/lib/mollie/order.rb +29 -1
- data/lib/mollie/payment.rb +6 -1
- data/lib/mollie/profile.rb +3 -1
- data/lib/mollie/version.rb +1 -1
- data/lib/mollie.rb +1 -0
- data/test/fixtures/customer/get.json +36 -0
- data/test/fixtures/customer/list-payments-next.json +30 -0
- data/test/fixtures/customer/list-payments.json +30 -0
- data/test/fixtures/methods/all.json +92 -0
- data/test/fixtures/onboarding/me.json +1 -1
- data/test/fixtures/orders/create_payment.json +38 -0
- data/test/fixtures/orders/get.json +0 -38
- data/test/fixtures/orders/get_embedded_resources.json +369 -0
- data/test/fixtures/orders/update_line.json +226 -0
- data/test/mollie/list_test.rb +60 -0
- data/test/mollie/method_test.rb +13 -0
- data/test/mollie/order/create_payment_test.rb +20 -0
- data/test/mollie/order/line_test.rb +18 -0
- data/test/mollie/order_test.rb +33 -0
- data/test/mollie/profile_test.rb +2 -0
- metadata +21 -1
@@ -0,0 +1,369 @@
|
|
1
|
+
{
|
2
|
+
"resource": "order",
|
3
|
+
"id": "ord_kEn1PlbGa",
|
4
|
+
"profileId": "pfl_URR55HPMGx",
|
5
|
+
"method": "ideal",
|
6
|
+
"amount": {
|
7
|
+
"value": "1027.99",
|
8
|
+
"currency": "EUR"
|
9
|
+
},
|
10
|
+
"amountCaptured": {
|
11
|
+
"value": "1002.99",
|
12
|
+
"currency": "EUR"
|
13
|
+
},
|
14
|
+
"amountRefunded": {
|
15
|
+
"value": "25.00",
|
16
|
+
"currency": "EUR"
|
17
|
+
},
|
18
|
+
"status": "created",
|
19
|
+
"isCancelable": true,
|
20
|
+
"metadata": {
|
21
|
+
"order_id": "1337",
|
22
|
+
"description": "Lego cars"
|
23
|
+
},
|
24
|
+
"createdAt": "2018-08-02T09:29:56+00:00",
|
25
|
+
"expiresAt": "2018-08-30T09:29:56+00:00",
|
26
|
+
"mode": "live",
|
27
|
+
"locale": "nl_NL",
|
28
|
+
"billingAddress": {
|
29
|
+
"organizationName": "Mollie B.V.",
|
30
|
+
"streetAndNumber": "Keizersgracht 313",
|
31
|
+
"postalCode": "1016 EE",
|
32
|
+
"city": "Amsterdam",
|
33
|
+
"country": "nl",
|
34
|
+
"givenName": "Luke",
|
35
|
+
"familyName": "Skywalker",
|
36
|
+
"email": "luke@skywalker.com"
|
37
|
+
},
|
38
|
+
"shopperCountryMustMatchBillingCountry": false,
|
39
|
+
"consumerDateOfBirth": "1993-10-21",
|
40
|
+
"orderNumber": "18475",
|
41
|
+
"shippingAddress": {
|
42
|
+
"organizationName": "Mollie B.V.",
|
43
|
+
"streetAndNumber": "Keizersgracht 313",
|
44
|
+
"postalCode": "1016 EE",
|
45
|
+
"city": "Amsterdam",
|
46
|
+
"country": "nl",
|
47
|
+
"givenName": "Luke",
|
48
|
+
"familyName": "Skywalker",
|
49
|
+
"email": "luke@skywalker.com"
|
50
|
+
},
|
51
|
+
"redirectUrl": "https://example.org/redirect",
|
52
|
+
"webhookUrl": "https://example.org/webhook",
|
53
|
+
"expiredAt": "2018-08-30T09:29:56+00:02",
|
54
|
+
"paidAt": "2018-08-26T09:29:56+00:00",
|
55
|
+
"authorizedAt": "2018-08-25T09:29:56+00:00",
|
56
|
+
"canceledAt": "2018-08-27T09:29:56+00:00",
|
57
|
+
"completedAt": "2018-08-28T09:29:56+00:00",
|
58
|
+
"lines": [
|
59
|
+
{
|
60
|
+
"resource": "orderline",
|
61
|
+
"id": "odl_dgtxyl",
|
62
|
+
"orderId": "ord_kEn1PlbGa",
|
63
|
+
"name": "LEGO 42083 Bugatti Chiron",
|
64
|
+
"sku": "5702016116977",
|
65
|
+
"type": "physical",
|
66
|
+
"status": "created",
|
67
|
+
"metadata": {
|
68
|
+
"order_id": "1337",
|
69
|
+
"description": "Bugatti Chiron"
|
70
|
+
},
|
71
|
+
"isCancelable": true,
|
72
|
+
"quantity": 2,
|
73
|
+
"quantityShipped": 0,
|
74
|
+
"amountShipped": {
|
75
|
+
"value": "0.00",
|
76
|
+
"currency": "EUR"
|
77
|
+
},
|
78
|
+
"quantityRefunded": 0,
|
79
|
+
"amountRefunded": {
|
80
|
+
"value": "0.00",
|
81
|
+
"currency": "EUR"
|
82
|
+
},
|
83
|
+
"quantityCanceled": 0,
|
84
|
+
"amountCanceled": {
|
85
|
+
"value": "0.00",
|
86
|
+
"currency": "EUR"
|
87
|
+
},
|
88
|
+
"shippableQuantity": 0,
|
89
|
+
"refundableQuantity": 0,
|
90
|
+
"cancelableQuantity": 2,
|
91
|
+
"unitPrice": {
|
92
|
+
"value": "399.00",
|
93
|
+
"currency": "EUR"
|
94
|
+
},
|
95
|
+
"vatRate": "21.00",
|
96
|
+
"vatAmount": {
|
97
|
+
"value": "121.14",
|
98
|
+
"currency": "EUR"
|
99
|
+
},
|
100
|
+
"discountAmount": {
|
101
|
+
"value": "100.00",
|
102
|
+
"currency": "EUR"
|
103
|
+
},
|
104
|
+
"totalAmount": {
|
105
|
+
"value": "698.00",
|
106
|
+
"currency": "EUR"
|
107
|
+
},
|
108
|
+
"createdAt": "2018-08-02T09:29:56+00:00",
|
109
|
+
"_links": {
|
110
|
+
"productUrl": {
|
111
|
+
"href": "https://shop.lego.com/nl-NL/Bugatti-Chiron-42083",
|
112
|
+
"type": "text/html"
|
113
|
+
},
|
114
|
+
"imageUrl": {
|
115
|
+
"href": "https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$",
|
116
|
+
"type": "text/html"
|
117
|
+
}
|
118
|
+
}
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"resource": "orderline",
|
122
|
+
"id": "odl_jp31jz",
|
123
|
+
"orderId": "ord_kEn1PlbGa",
|
124
|
+
"name": "LEGO 42056 Porsche 911 GT3 RS",
|
125
|
+
"sku": "5702015594028",
|
126
|
+
"type": "physical",
|
127
|
+
"status": "created",
|
128
|
+
"isCancelable": false,
|
129
|
+
"quantity": 1,
|
130
|
+
"quantityShipped": 0,
|
131
|
+
"amountShipped": {
|
132
|
+
"value": "0.00",
|
133
|
+
"currency": "EUR"
|
134
|
+
},
|
135
|
+
"quantityRefunded": 0,
|
136
|
+
"amountRefunded": {
|
137
|
+
"value": "0.00",
|
138
|
+
"currency": "EUR"
|
139
|
+
},
|
140
|
+
"quantityCanceled": 0,
|
141
|
+
"amountCanceled": {
|
142
|
+
"value": "0.00",
|
143
|
+
"currency": "EUR"
|
144
|
+
},
|
145
|
+
"shippableQuantity": 0,
|
146
|
+
"refundableQuantity": 0,
|
147
|
+
"cancelableQuantity": 0,
|
148
|
+
"unitPrice": {
|
149
|
+
"value": "329.99",
|
150
|
+
"currency": "EUR"
|
151
|
+
},
|
152
|
+
"vatRate": "21.00",
|
153
|
+
"vatAmount": {
|
154
|
+
"value": "57.27",
|
155
|
+
"currency": "EUR"
|
156
|
+
},
|
157
|
+
"totalAmount": {
|
158
|
+
"value": "329.99",
|
159
|
+
"currency": "EUR"
|
160
|
+
},
|
161
|
+
"createdAt": "2018-08-02T09:29:56+00:00",
|
162
|
+
"_links": {
|
163
|
+
"productUrl": {
|
164
|
+
"href": "https://shop.lego.com/nl-NL/Porsche-911-GT3-RS-42056",
|
165
|
+
"type": "text/html"
|
166
|
+
},
|
167
|
+
"imageUrl": {
|
168
|
+
"href": "https://sh-s7-live-s.legocdn.com/is/image/LEGO/42056?$PDPDefault$",
|
169
|
+
"type": "text/html"
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
],
|
174
|
+
"_embedded": {
|
175
|
+
"payments": [
|
176
|
+
{
|
177
|
+
"resource": "payment",
|
178
|
+
"id": "tr_ncaPcAhuUV",
|
179
|
+
"mode": "live",
|
180
|
+
"createdAt": "2018-09-07T12:00:05+00:00",
|
181
|
+
"amount": {
|
182
|
+
"value": "1027.99",
|
183
|
+
"currency": "EUR"
|
184
|
+
},
|
185
|
+
"description": "Order #1337 (Lego cars)",
|
186
|
+
"method": null,
|
187
|
+
"metadata": null,
|
188
|
+
"status": "open",
|
189
|
+
"isCancelable": false,
|
190
|
+
"locale": "nl_NL",
|
191
|
+
"profileId": "pfl_URR55HPMGx",
|
192
|
+
"orderId": "ord_kEn1PlbGa",
|
193
|
+
"sequenceType": "oneoff",
|
194
|
+
"redirectUrl": "https://example.org/redirect",
|
195
|
+
"_links": {
|
196
|
+
"self": {
|
197
|
+
"href": "https://api.mollie.com/v2/payments/tr_ncaPcAhuUV",
|
198
|
+
"type": "application/hal+json"
|
199
|
+
},
|
200
|
+
"checkout": {
|
201
|
+
"href": "https://www.mollie.com/payscreen/select-method/ncaPcAhuUV",
|
202
|
+
"type": "text/html"
|
203
|
+
},
|
204
|
+
"dashboard": {
|
205
|
+
"href": "https://www.mollie.com/dashboard/org_123456789/payments/tr_ncaPcAhuUV",
|
206
|
+
"type": "text/html"
|
207
|
+
},
|
208
|
+
"order": {
|
209
|
+
"href": "https://api.mollie.com/v2/orders/ord_kEn1PlbGa",
|
210
|
+
"type": "application/hal+json"
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
],
|
215
|
+
"refunds": [
|
216
|
+
{
|
217
|
+
"resource": "refund",
|
218
|
+
"id": "re_vD3Jm32wQt",
|
219
|
+
"amount": {
|
220
|
+
"value": "329.99",
|
221
|
+
"currency": "EUR"
|
222
|
+
},
|
223
|
+
"status": "pending",
|
224
|
+
"createdAt": "2019-01-15T15:41:21+00:00",
|
225
|
+
"description": "Required quantity not in stock, refunding one photo book.",
|
226
|
+
"orderId": "ord_kEn1PlbGa",
|
227
|
+
"paymentId": "tr_mjvPwykz3x",
|
228
|
+
"settlementAmount": {
|
229
|
+
"value": "-329.99",
|
230
|
+
"currency": "EUR"
|
231
|
+
},
|
232
|
+
"lines": [
|
233
|
+
{
|
234
|
+
"resource": "orderline",
|
235
|
+
"id": "odl_dgtxyl",
|
236
|
+
"orderId": "ord_kEn1PlbGa",
|
237
|
+
"name": "LEGO 42056 Porsche 911 GT3 RS",
|
238
|
+
"sku": "5702015594028",
|
239
|
+
"type": "physical",
|
240
|
+
"status": "completed",
|
241
|
+
"isCancelable": false,
|
242
|
+
"quantity": 1,
|
243
|
+
"unitPrice": {
|
244
|
+
"value": "329.99",
|
245
|
+
"currency": "EUR"
|
246
|
+
},
|
247
|
+
"vatRate": "21.00",
|
248
|
+
"vatAmount": {
|
249
|
+
"value": "57.27",
|
250
|
+
"currency": "EUR"
|
251
|
+
},
|
252
|
+
"totalAmount": {
|
253
|
+
"value": "329.99",
|
254
|
+
"currency": "EUR"
|
255
|
+
},
|
256
|
+
"createdAt": "2019-01-15T15:22:45+00:00",
|
257
|
+
"_links": {
|
258
|
+
"productUrl": {
|
259
|
+
"href": "https://shop.lego.com/nl-NL/Porsche-911-GT3-RS-42056",
|
260
|
+
"type": "text/html"
|
261
|
+
},
|
262
|
+
"imageUrl": {
|
263
|
+
"href": "https://sh-s7-live-s.legocdn.com/is/image/LEGO/42056?$PDPDefault$",
|
264
|
+
"type": "text/html"
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}
|
268
|
+
],
|
269
|
+
"_links": {
|
270
|
+
"self": {
|
271
|
+
"href": "https://api.mollie.com/v2/payments/tr_mjvPwykz3x/refunds/re_vD3Jm32wQt",
|
272
|
+
"type": "application/hal+json"
|
273
|
+
},
|
274
|
+
"payment": {
|
275
|
+
"href": "https://api.mollie.com/v2/payments/tr_mjvPwykz3x",
|
276
|
+
"type": "application/hal+json"
|
277
|
+
},
|
278
|
+
"order": {
|
279
|
+
"href": "https://api.mollie.com/v2/orders/ord_kEn1PlbGa",
|
280
|
+
"type": "application/hal+json"
|
281
|
+
}
|
282
|
+
}
|
283
|
+
}
|
284
|
+
],
|
285
|
+
"shipments": [
|
286
|
+
{
|
287
|
+
"resource": "shipment",
|
288
|
+
"id": "shp_3wmsgCJN4U",
|
289
|
+
"orderId": "ord_kEn1PlbGa",
|
290
|
+
"createdAt": "2018-08-09T14:33:54+00:00",
|
291
|
+
"tracking": {
|
292
|
+
"carrier": "PostNL",
|
293
|
+
"code": "3SKABA000000000",
|
294
|
+
"url": "http://postnl.nl/tracktrace/?B=3SKABA000000000&P=1015CW&D=NL&T=C"
|
295
|
+
},
|
296
|
+
"lines": [
|
297
|
+
{
|
298
|
+
"resource": "orderline",
|
299
|
+
"id": "odl_dgtxyl",
|
300
|
+
"orderId": "ord_pbjz8x",
|
301
|
+
"name": "LEGO 42083 Bugatti Chiron",
|
302
|
+
"sku": "5702016116977",
|
303
|
+
"type": "physical",
|
304
|
+
"status": "shipping",
|
305
|
+
"metadata": null,
|
306
|
+
"isCancelable": true,
|
307
|
+
"quantity": 1,
|
308
|
+
"unitPrice": {
|
309
|
+
"value": "399.00",
|
310
|
+
"currency": "EUR"
|
311
|
+
},
|
312
|
+
"vatRate": "21.00",
|
313
|
+
"vatAmount": {
|
314
|
+
"value": "51.89",
|
315
|
+
"currency": "EUR"
|
316
|
+
},
|
317
|
+
"discountAmount": {
|
318
|
+
"value": "100.00",
|
319
|
+
"currency": "EUR"
|
320
|
+
},
|
321
|
+
"totalAmount": {
|
322
|
+
"value": "299.00",
|
323
|
+
"currency": "EUR"
|
324
|
+
},
|
325
|
+
"createdAt": "2018-08-02T09:29:56+00:00",
|
326
|
+
"_links": {
|
327
|
+
"productUrl": {
|
328
|
+
"href": "https://shop.lego.com/nl-NL/Bugatti-Chiron-42083",
|
329
|
+
"type": "text/html"
|
330
|
+
},
|
331
|
+
"imageUrl": {
|
332
|
+
"href": "https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$",
|
333
|
+
"type": "text/html"
|
334
|
+
}
|
335
|
+
}
|
336
|
+
}
|
337
|
+
],
|
338
|
+
"_links": {
|
339
|
+
"self": {
|
340
|
+
"href": "https://api.mollie.com/v2/order/ord_kEn1PlbGa/shipments/shp_3wmsgCJN4U",
|
341
|
+
"type": "application/hal+json"
|
342
|
+
},
|
343
|
+
"order": {
|
344
|
+
"href": "https://api.mollie.com/v2/orders/ord_kEn1PlbGa",
|
345
|
+
"type": "application/hal+json"
|
346
|
+
},
|
347
|
+
"documentation": {
|
348
|
+
"href": "https://docs.mollie.com/reference/v2/shipments-api/get-shipment",
|
349
|
+
"type": "text/html"
|
350
|
+
}
|
351
|
+
}
|
352
|
+
}
|
353
|
+
]
|
354
|
+
},
|
355
|
+
"_links": {
|
356
|
+
"self": {
|
357
|
+
"href": "https://api.mollie.com/v2/orders/ord_kEn1PlbGa",
|
358
|
+
"type": "application/hal+json"
|
359
|
+
},
|
360
|
+
"checkout": {
|
361
|
+
"href": "https://www.mollie.com/payscreen/order/checkout/kEn1PlbGa",
|
362
|
+
"type": "text/html"
|
363
|
+
},
|
364
|
+
"documentation": {
|
365
|
+
"href": "https://docs.mollie.com/reference/v2/orders-api/get-order",
|
366
|
+
"type": "text/html"
|
367
|
+
}
|
368
|
+
}
|
369
|
+
}
|
@@ -0,0 +1,226 @@
|
|
1
|
+
{
|
2
|
+
"resource": "order",
|
3
|
+
"id": "ord_kEn1PlbGa",
|
4
|
+
"profileId": "pfl_URR55HPMGx",
|
5
|
+
"method": "ideal",
|
6
|
+
"amount": {
|
7
|
+
"value": "1027.99",
|
8
|
+
"currency": "EUR"
|
9
|
+
},
|
10
|
+
"amountCaptured": {
|
11
|
+
"value": "1002.99",
|
12
|
+
"currency": "EUR"
|
13
|
+
},
|
14
|
+
"amountRefunded": {
|
15
|
+
"value": "25.00",
|
16
|
+
"currency": "EUR"
|
17
|
+
},
|
18
|
+
"status": "created",
|
19
|
+
"isCancelable": true,
|
20
|
+
"metadata": {
|
21
|
+
"order_id": "1337",
|
22
|
+
"description": "Lego cars"
|
23
|
+
},
|
24
|
+
"createdAt": "2018-08-02T09:29:56+00:00",
|
25
|
+
"expiresAt": "2018-08-30T09:29:56+00:00",
|
26
|
+
"mode": "live",
|
27
|
+
"locale": "nl_NL",
|
28
|
+
"billingAddress": {
|
29
|
+
"organizationName": "Mollie B.V.",
|
30
|
+
"streetAndNumber": "Keizersgracht 313",
|
31
|
+
"postalCode": "1016 EE",
|
32
|
+
"city": "Amsterdam",
|
33
|
+
"country": "nl",
|
34
|
+
"givenName": "Luke",
|
35
|
+
"familyName": "Skywalker",
|
36
|
+
"email": "luke@skywalker.com"
|
37
|
+
},
|
38
|
+
"shopperCountryMustMatchBillingCountry": false,
|
39
|
+
"consumerDateOfBirth": "1993-10-21",
|
40
|
+
"orderNumber": "18475",
|
41
|
+
"shippingAddress": {
|
42
|
+
"organizationName": "Mollie B.V.",
|
43
|
+
"streetAndNumber": "Keizersgracht 313",
|
44
|
+
"postalCode": "1016 EE",
|
45
|
+
"city": "Amsterdam",
|
46
|
+
"country": "nl",
|
47
|
+
"givenName": "Luke",
|
48
|
+
"familyName": "Skywalker",
|
49
|
+
"email": "luke@skywalker.com"
|
50
|
+
},
|
51
|
+
"redirectUrl": "https://example.org/redirect",
|
52
|
+
"webhookUrl": "https://example.org/webhook",
|
53
|
+
"expiredAt": "2018-08-30T09:29:56+00:02",
|
54
|
+
"paidAt": "2018-08-26T09:29:56+00:00",
|
55
|
+
"authorizedAt": "2018-08-25T09:29:56+00:00",
|
56
|
+
"canceledAt": "2018-08-27T09:29:56+00:00",
|
57
|
+
"completedAt": "2018-08-28T09:29:56+00:00",
|
58
|
+
"lines": [
|
59
|
+
{
|
60
|
+
"resource": "orderline",
|
61
|
+
"id": "odl_dgtxyl",
|
62
|
+
"orderId": "ord_kEn1PlbGa",
|
63
|
+
"name": "LEGO 42083 Bugatti Chiron",
|
64
|
+
"sku": "new-sku-12345678",
|
65
|
+
"type": "physical",
|
66
|
+
"status": "created",
|
67
|
+
"metadata": {
|
68
|
+
"order_id": "1337",
|
69
|
+
"description": "Bugatti Chiron"
|
70
|
+
},
|
71
|
+
"isCancelable": true,
|
72
|
+
"quantity": 2,
|
73
|
+
"quantityShipped": 0,
|
74
|
+
"amountShipped": {
|
75
|
+
"value": "0.00",
|
76
|
+
"currency": "EUR"
|
77
|
+
},
|
78
|
+
"quantityRefunded": 0,
|
79
|
+
"amountRefunded": {
|
80
|
+
"value": "0.00",
|
81
|
+
"currency": "EUR"
|
82
|
+
},
|
83
|
+
"quantityCanceled": 0,
|
84
|
+
"amountCanceled": {
|
85
|
+
"value": "0.00",
|
86
|
+
"currency": "EUR"
|
87
|
+
},
|
88
|
+
"shippableQuantity": 0,
|
89
|
+
"refundableQuantity": 0,
|
90
|
+
"cancelableQuantity": 2,
|
91
|
+
"unitPrice": {
|
92
|
+
"value": "399.00",
|
93
|
+
"currency": "EUR"
|
94
|
+
},
|
95
|
+
"vatRate": "21.00",
|
96
|
+
"vatAmount": {
|
97
|
+
"value": "121.14",
|
98
|
+
"currency": "EUR"
|
99
|
+
},
|
100
|
+
"discountAmount": {
|
101
|
+
"value": "100.00",
|
102
|
+
"currency": "EUR"
|
103
|
+
},
|
104
|
+
"totalAmount": {
|
105
|
+
"value": "698.00",
|
106
|
+
"currency": "EUR"
|
107
|
+
},
|
108
|
+
"createdAt": "2018-08-02T09:29:56+00:00",
|
109
|
+
"_links": {
|
110
|
+
"productUrl": {
|
111
|
+
"href": "https://shop.lego.com/nl-NL/Bugatti-Chiron-42083",
|
112
|
+
"type": "text/html"
|
113
|
+
},
|
114
|
+
"imageUrl": {
|
115
|
+
"href": "https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$",
|
116
|
+
"type": "text/html"
|
117
|
+
}
|
118
|
+
}
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"resource": "orderline",
|
122
|
+
"id": "odl_jp31jz",
|
123
|
+
"orderId": "ord_kEn1PlbGa",
|
124
|
+
"name": "LEGO 42056 Porsche 911 GT3 RS",
|
125
|
+
"sku": "5702015594028",
|
126
|
+
"type": "physical",
|
127
|
+
"status": "created",
|
128
|
+
"isCancelable": false,
|
129
|
+
"quantity": 1,
|
130
|
+
"quantityShipped": 0,
|
131
|
+
"amountShipped": {
|
132
|
+
"value": "0.00",
|
133
|
+
"currency": "EUR"
|
134
|
+
},
|
135
|
+
"quantityRefunded": 0,
|
136
|
+
"amountRefunded": {
|
137
|
+
"value": "0.00",
|
138
|
+
"currency": "EUR"
|
139
|
+
},
|
140
|
+
"quantityCanceled": 0,
|
141
|
+
"amountCanceled": {
|
142
|
+
"value": "0.00",
|
143
|
+
"currency": "EUR"
|
144
|
+
},
|
145
|
+
"shippableQuantity": 0,
|
146
|
+
"refundableQuantity": 0,
|
147
|
+
"cancelableQuantity": 0,
|
148
|
+
"unitPrice": {
|
149
|
+
"value": "329.99",
|
150
|
+
"currency": "EUR"
|
151
|
+
},
|
152
|
+
"vatRate": "21.00",
|
153
|
+
"vatAmount": {
|
154
|
+
"value": "57.27",
|
155
|
+
"currency": "EUR"
|
156
|
+
},
|
157
|
+
"totalAmount": {
|
158
|
+
"value": "329.99",
|
159
|
+
"currency": "EUR"
|
160
|
+
},
|
161
|
+
"createdAt": "2018-08-02T09:29:56+00:00",
|
162
|
+
"_links": {
|
163
|
+
"productUrl": {
|
164
|
+
"href": "https://shop.lego.com/nl-NL/Porsche-911-GT3-RS-42056",
|
165
|
+
"type": "text/html"
|
166
|
+
},
|
167
|
+
"imageUrl": {
|
168
|
+
"href": "https://sh-s7-live-s.legocdn.com/is/image/LEGO/42056?$PDPDefault$",
|
169
|
+
"type": "text/html"
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
],
|
174
|
+
"_embedded": {
|
175
|
+
"payments": [
|
176
|
+
{
|
177
|
+
"resource": "payment",
|
178
|
+
"id": "tr_ncaPcAhuUV",
|
179
|
+
"mode": "live",
|
180
|
+
"createdAt": "2018-09-07T12:00:05+00:00",
|
181
|
+
"amount": {
|
182
|
+
"value": "1027.99",
|
183
|
+
"currency": "EUR"
|
184
|
+
},
|
185
|
+
"description": "Order #1337 (Lego cars)",
|
186
|
+
"method": null,
|
187
|
+
"metadata": null,
|
188
|
+
"status": "open",
|
189
|
+
"isCancelable": false,
|
190
|
+
"locale": "nl_NL",
|
191
|
+
"profileId": "pfl_URR55HPMGx",
|
192
|
+
"orderId": "ord_kEn1PlbGa",
|
193
|
+
"sequenceType": "oneoff",
|
194
|
+
"redirectUrl": "https://example.org/redirect",
|
195
|
+
"_links": {
|
196
|
+
"self": {
|
197
|
+
"href": "https://api.mollie.com/v2/payments/tr_ncaPcAhuUV",
|
198
|
+
"type": "application/hal+json"
|
199
|
+
},
|
200
|
+
"checkout": {
|
201
|
+
"href": "https://www.mollie.com/payscreen/select-method/ncaPcAhuUV",
|
202
|
+
"type": "text/html"
|
203
|
+
},
|
204
|
+
"order": {
|
205
|
+
"href": "https://api.mollie.com/v2/orders/ord_kEn1PlbGa",
|
206
|
+
"type": "application/hal+json"
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
]
|
211
|
+
},
|
212
|
+
"_links": {
|
213
|
+
"self": {
|
214
|
+
"href": "https://api.mollie.com/v2/orders/ord_kEn1PlbGa",
|
215
|
+
"type": "application/hal+json"
|
216
|
+
},
|
217
|
+
"checkout": {
|
218
|
+
"href": "https://www.mollie.com/payscreen/order/checkout/kEn1PlbGa",
|
219
|
+
"type": "text/html"
|
220
|
+
},
|
221
|
+
"documentation": {
|
222
|
+
"href": "https://docs.mollie.com/reference/v2/orders-api/update-orderline",
|
223
|
+
"type": "text/html"
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
data/test/mollie/list_test.rb
CHANGED
@@ -83,5 +83,65 @@ module Mollie
|
|
83
83
|
list = Mollie::List.new(attributes, Payment)
|
84
84
|
assert_equal 2, list.previous.count
|
85
85
|
end
|
86
|
+
|
87
|
+
def test_pagination_for_nested_resources
|
88
|
+
stub_request(:get, 'https://api.mollie.com/v2/customers/cst_8wmqcHMN4U')
|
89
|
+
.to_return(
|
90
|
+
status: 200,
|
91
|
+
body: read_fixture('customer/get.json'),
|
92
|
+
headers: {}
|
93
|
+
)
|
94
|
+
|
95
|
+
# First page of customer payments
|
96
|
+
stub_request(:get, 'https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?limit=2')
|
97
|
+
.to_return(
|
98
|
+
status: 200,
|
99
|
+
body: read_fixture('customer/list-payments.json'),
|
100
|
+
headers: {}
|
101
|
+
)
|
102
|
+
|
103
|
+
# Second page
|
104
|
+
stub_request(:get, 'https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?from=tr_3&limit=2')
|
105
|
+
.to_return(
|
106
|
+
status: 200,
|
107
|
+
body: read_fixture('customer/list-payments-next.json'),
|
108
|
+
headers: {}
|
109
|
+
)
|
110
|
+
|
111
|
+
# Previous page
|
112
|
+
stub_request(:get, 'https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?from=tr_1&limit=2')
|
113
|
+
.to_return(
|
114
|
+
status: 200,
|
115
|
+
body: read_fixture('customer/list-payments.json'),
|
116
|
+
headers: {}
|
117
|
+
)
|
118
|
+
|
119
|
+
customer = Mollie::Customer.get('cst_8wmqcHMN4U')
|
120
|
+
|
121
|
+
# First page of customer payments
|
122
|
+
payments = customer.payments(limit: 2)
|
123
|
+
|
124
|
+
assert_equal ["tr_1", "tr_2"], payments.map { |p| p.id }
|
125
|
+
assert_equal "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?from=tr_3&limit=2",
|
126
|
+
payments.links["next"]["href"]
|
127
|
+
assert_equal nil, payments.links["previous"]
|
128
|
+
|
129
|
+
# Second page
|
130
|
+
payments = payments.next
|
131
|
+
|
132
|
+
assert_equal ["tr_3", "tr_4"], payments.map { |p| p.id }
|
133
|
+
assert_equal nil, payments.links["next"]
|
134
|
+
assert_equal "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?from=tr_1&limit=2",
|
135
|
+
payments.links["previous"]["href"]
|
136
|
+
|
137
|
+
# Previous page
|
138
|
+
payments = payments.previous
|
139
|
+
|
140
|
+
assert_equal ["tr_1", "tr_2"], payments.map { |p| p.id }
|
141
|
+
assert_equal "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U/payments?from=tr_3&limit=2",
|
142
|
+
payments.links["next"]["href"]
|
143
|
+
assert_equal nil, payments.links["previous"]
|
144
|
+
end
|
145
|
+
|
86
146
|
end
|
87
147
|
end
|