paymos 1.6.0 → 1.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e0c80046042c2f9d6412a4634125c0a4394e9aab174d20d6b6a26fe60517e76
4
- data.tar.gz: 52280f1bd972bf101b857e697addf3d1c115c09e87ae2287fdfc506c83606e09
3
+ metadata.gz: 7bfc8552db30245323684620dc4db5b8e206de6c2cae9eddeab9f80f68c583a7
4
+ data.tar.gz: eb8c7eace8288653d5beb401e498c279124891fbe0f8a1f448c4b845644c6b7d
5
5
  SHA512:
6
- metadata.gz: 2a205a28f143426bbbedcafe4240751448d4161d60d7f30650570567a4e5eebf7232a4c0e313ad88853bcaa7e49a4170ddfafe3f0f4ad7e41d6946882e052531
7
- data.tar.gz: ce658911f58df1d6b5f30bdb4f9c4c5894118019e57604b94d29ea759f3b9e2e568ddf0265b818eb33c91e1da05d0cd848fca5afe1e545c27ce3172767c3271d
6
+ metadata.gz: 6200473cb3bb0d8f98403bfa9ed512e27e042ea33cfee95cbdfd09662e323bc3a388931caeda284501832c446b6f9aa937338a6fcaf4098aa945f3732bdbb9d0
7
+ data.tar.gz: 53c7e6389ad62f2cc2bc59242c41e49fb096bb2ec565789ea2608e74f0b79decce504be7ec0719f97a1485428879ffa23a561fe5dabae10fc16d038c3a6b3cff
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.6.1] - 2026-11-13
6
+
7
+ - fix(plugins,publicweb): SDK webhook credit recipes, CMS recovery, redirects and CSP logs (audit 2026-11-13)
8
+ - docs(sdk): backfill published mirror changelogs across SDKs and MCP
9
+
5
10
  ## [1.6.0] - 2026-11-03
6
11
 
7
12
  - fix(sdk): resolve preflight lint and conformance vector count for autorelease
data/README.md CHANGED
@@ -66,7 +66,6 @@ outcome. Creation returns 201 and an identical replay returns 200; both yield a
66
66
  `Paymos::ConflictError` (409). Missing or foreign refund IDs raise
67
67
  `Paymos::NotFoundError` (404). List periods use RFC 3339 timestamps, and
68
68
  `paymos.refunds.each` provides the same bounded cursor iteration as invoices.
69
- In sandbox, use `paymos.withdrawals.simulate_completion(refund.withdrawal_id)`,
70
69
  In sandbox, use `paymos.refunds.simulate(refund.withdrawal_id, status: 'completed')`,
71
70
  then read the refund again. Refunds have their own list and do not appear in the
72
71
  ordinary withdrawals list.
@@ -83,7 +82,7 @@ channel.networks.each do |rail|
83
82
  end
84
83
 
85
84
  feed = paymos.payment_channel_deposits.read(cursor: saved_cursor, limit: 100)
86
- feed.items.each { |deposit| credit(deposit) }
85
+ feed.items.each { |deposit| credit_deposit(deposit) } # one credit per deposit.id, see below
87
86
  save_cursor(feed.next_cursor)
88
87
  ```
89
88
 
@@ -121,10 +120,40 @@ to get the same typed model the deposit feed returns:
121
120
  case event.event_type
122
121
  when "payment_channel.deposit.confirmed"
123
122
  deposit = Paymos::PaymentChannelDeposit.from(event.data)
124
- credit(deposit.payment_channel_external_id, deposit.net) if deposit.is_final
123
+ credit_deposit(deposit) if deposit.is_final # once per deposit.id, shared with the feed
125
124
  end
126
125
  ```
127
126
 
127
+ The feed and the deposit webhook report the same deposits, so both go through one
128
+ `credit_deposit` keyed by the deposit's own `id` (`pcd_...`). A sketch with the `pg` gem
129
+ (`credited_deposits.deposit_id` is the primary key):
130
+
131
+ ```ruby
132
+ def credit_deposit(deposit)
133
+ return unless deposit.is_final && deposit.project_id == MY_PROJECT_ID && deposit.is_test == MY_IS_TEST
134
+
135
+ db.transaction do |tx|
136
+ # The insert and the balance update commit together or not at all. A second
137
+ # delivery, a second endpoint's copy, or a re-read feed page inserts nothing.
138
+ inserted = tx.exec_params(
139
+ 'INSERT INTO credited_deposits (deposit_id, payer, amount) VALUES ($1, $2, $3::numeric) ' 'ON CONFLICT (deposit_id) DO NOTHING',
140
+ [deposit.id, deposit.payment_channel_external_id, deposit.net]
141
+ )
142
+ if inserted.cmd_tuples == 1
143
+ tx.exec_params('UPDATE balances SET amount = amount + $1::numeric WHERE payer = $2',
144
+ [deposit.net, deposit.payment_channel_external_id])
145
+ end
146
+ end
147
+ end
148
+ ```
149
+
150
+ `event.event_id` identifies one delivery, not one payment. Paymos creates a separate
151
+ event, with its own `event_id`, for every webhook endpoint subscribed to the event, and
152
+ every later event about the same invoice or deposit has its own `event_id` too. Store
153
+ `event_id` to skip a redelivered request, but key money and fulfilment on the business
154
+ identity: the invoice/order for invoice events, the deposit `id` for deposit events.
155
+ Write that key in the same database transaction as the order or balance change.
156
+
128
157
  `confirming` and `reorged` are advisory and may arrive out of order — a `confirming`
129
158
  can land after the `confirmed` for the same deposit, and a `reorged` can be superseded
130
159
  by a later `confirmed`. Credit only on `payment_channel.deposit.confirmed` with
@@ -0,0 +1,1138 @@
1
+ {
2
+ "schema": 1,
3
+ "base_url": "https://api.paymos.io",
4
+ "user_agent_prefix": "paymos-",
5
+ "request_signing": {
6
+ "algorithm": "HMAC-SHA256",
7
+ "signature_encoding": "base64",
8
+ "timestamp_header": "X-Request-Timestamp",
9
+ "authorization_format": "HMAC-SHA256 {api_key}:{signature}",
10
+ "canonical_format": "{timestamp}\\n{uppercase_method}\\n{path}\\n{query_with_optional_leading_question_mark}\\n{body_hash}",
11
+ "body_hash": "lowercase hex sha256 of the exact body bytes; EMPTY STRING when the request has no body (never sha256(\"\") = e3b0c442...), so a body-less request signs a trailing newline with nothing after it"
12
+ },
13
+ "query": {
14
+ "encoding": "RFC3986",
15
+ "sort_keys": true,
16
+ "sort_repeated_values": true,
17
+ "include_leading_question_mark_in_signature": true
18
+ },
19
+ "retry": {
20
+ "default_max_retries": 2,
21
+ "default_base_delay_ms": 150,
22
+ "retry_after": true,
23
+ "transport_errors": [
24
+ "GET",
25
+ "HEAD",
26
+ "OPTIONS"
27
+ ],
28
+ "http_5xx": [
29
+ "GET",
30
+ "HEAD",
31
+ "OPTIONS"
32
+ ],
33
+ "http_429": [
34
+ "GET",
35
+ "HEAD",
36
+ "OPTIONS",
37
+ "POST"
38
+ ]
39
+ },
40
+ "pagination": {
41
+ "default_max_pages": 100,
42
+ "next_cursor_field": "next_cursor",
43
+ "reject_repeated_cursor": true
44
+ },
45
+ "errors": {
46
+ "400": "validation",
47
+ "401": "authentication",
48
+ "403": "permission",
49
+ "404": "not_found",
50
+ "409": "conflict",
51
+ "410": "gone",
52
+ "429": "rate_limit",
53
+ "500": "server",
54
+ "503": "unavailable"
55
+ },
56
+ "resources": {
57
+ "system": [
58
+ {
59
+ "method": "GET",
60
+ "path": "/v1/time",
61
+ "operation": "time"
62
+ }
63
+ ],
64
+ "invoices": [
65
+ {
66
+ "method": "POST",
67
+ "path": "/v1/invoices",
68
+ "operation": "create"
69
+ },
70
+ {
71
+ "method": "GET",
72
+ "path": "/v1/invoices/{id}",
73
+ "operation": "get"
74
+ },
75
+ {
76
+ "method": "GET",
77
+ "path": "/v1/invoices",
78
+ "operation": "list"
79
+ },
80
+ {
81
+ "method": "POST",
82
+ "path": "/v1/invoices/{id}/cancel",
83
+ "operation": "cancel"
84
+ },
85
+ {
86
+ "method": "POST",
87
+ "path": "/v1/invoices/{id}/confirm-payment",
88
+ "operation": "confirm_payment"
89
+ },
90
+ {
91
+ "method": "POST",
92
+ "path": "/v1/sandbox/invoices/{id}/simulate-payment",
93
+ "operation": "simulate_payment"
94
+ }
95
+ ],
96
+ "withdrawals": [
97
+ {
98
+ "method": "POST",
99
+ "path": "/v1/withdrawals",
100
+ "operation": "create"
101
+ },
102
+ {
103
+ "method": "GET",
104
+ "path": "/v1/withdrawals/{id}",
105
+ "operation": "get"
106
+ },
107
+ {
108
+ "method": "GET",
109
+ "path": "/v1/withdrawals",
110
+ "operation": "list"
111
+ },
112
+ {
113
+ "method": "POST",
114
+ "path": "/v1/withdrawals/{id}/cancel",
115
+ "operation": "cancel"
116
+ },
117
+ {
118
+ "method": "POST",
119
+ "path": "/v1/sandbox/withdrawals/{id}/simulate-completion",
120
+ "operation": "simulate_completion"
121
+ }
122
+ ],
123
+ "refunds": [
124
+ {
125
+ "method": "POST",
126
+ "path": "/v1/refunds",
127
+ "operation": "create"
128
+ },
129
+ {
130
+ "method": "GET",
131
+ "path": "/v1/refunds",
132
+ "operation": "list"
133
+ },
134
+ {
135
+ "method": "GET",
136
+ "path": "/v1/refunds/{id}",
137
+ "operation": "get"
138
+ },
139
+ {
140
+ "method": "POST",
141
+ "path": "/v1/sandbox/refunds/{id}/simulate",
142
+ "operation": "simulate"
143
+ }
144
+ ],
145
+ "balances": [
146
+ {
147
+ "method": "GET",
148
+ "path": "/v1/balances",
149
+ "operation": "get"
150
+ }
151
+ ],
152
+ "payment_channels": [
153
+ {
154
+ "method": "POST",
155
+ "path": "/v1/payment-channels",
156
+ "operation": "create"
157
+ },
158
+ {
159
+ "method": "GET",
160
+ "path": "/v1/payment-channels/{id}",
161
+ "operation": "get"
162
+ },
163
+ {
164
+ "method": "GET",
165
+ "path": "/v1/payment-channels",
166
+ "operation": "list"
167
+ },
168
+ {
169
+ "method": "POST",
170
+ "path": "/v1/payment-channels/{id}/block",
171
+ "operation": "block"
172
+ },
173
+ {
174
+ "method": "POST",
175
+ "path": "/v1/payment-channels/{id}/unblock",
176
+ "operation": "unblock"
177
+ },
178
+ {
179
+ "method": "POST",
180
+ "path": "/v1/sandbox/payment-channels/{id}/simulate-deposit",
181
+ "operation": "simulate_deposit"
182
+ }
183
+ ],
184
+ "payment_channel_deposits": [
185
+ {
186
+ "method": "GET",
187
+ "path": "/v1/payment-channel-deposits",
188
+ "operation": "list"
189
+ },
190
+ {
191
+ "method": "GET",
192
+ "path": "/v1/payment-channel-deposits/{id}",
193
+ "operation": "get"
194
+ }
195
+ ]
196
+ },
197
+ "vectors": {
198
+ "refunds": {
199
+ "authentication": "Payment key with verified HMAC",
200
+ "create": {
201
+ "method": "POST",
202
+ "path": "/v1/refunds",
203
+ "body": {
204
+ "invoice_id": "inv_74BPZFhr9qy9Uz2fbRkdJX",
205
+ "mode": "full",
206
+ "external_order_id": "refund-order-1"
207
+ },
208
+ "new_status": 201,
209
+ "replay_status": 200,
210
+ "changed_mode_status": 409,
211
+ "idempotency_field": "external_order_id",
212
+ "rejected_fields": [
213
+ "amount",
214
+ "currency",
215
+ "network",
216
+ "destination_address",
217
+ "address",
218
+ "parts"
219
+ ]
220
+ },
221
+ "overpayment": {
222
+ "method": "POST",
223
+ "path": "/v1/refunds",
224
+ "body": {
225
+ "invoice_id": "inv_74BPZFhr9qy9Uz2fbRkdJX",
226
+ "mode": "overpayment",
227
+ "external_order_id": "refund-order-2"
228
+ },
229
+ "amount_is_server_calculated": true
230
+ },
231
+ "list": {
232
+ "method": "GET",
233
+ "path": "/v1/refunds",
234
+ "filters": [
235
+ "invoice_id",
236
+ "status",
237
+ "created_from",
238
+ "created_to"
239
+ ],
240
+ "period_format": "RFC 3339",
241
+ "pagination": [
242
+ "cursor",
243
+ "limit"
244
+ ],
245
+ "page_sizes": [
246
+ 100,
247
+ 100,
248
+ 5
249
+ ],
250
+ "invalid_cursor_status": 400,
251
+ "cache_control": "private, no-store"
252
+ },
253
+ "get": {
254
+ "method": "GET",
255
+ "path": "/v1/refunds/{id}",
256
+ "id_is_withdrawal_id": true,
257
+ "foreign_or_missing_status": 404,
258
+ "cache_control": "private, no-store"
259
+ },
260
+ "wire": {
261
+ "modes": [
262
+ "full",
263
+ "overpayment"
264
+ ],
265
+ "required_fields": [
266
+ "withdrawal_id",
267
+ "invoice_id",
268
+ "mode",
269
+ "amount",
270
+ "currency",
271
+ "network",
272
+ "status",
273
+ "first_sender",
274
+ "created_at",
275
+ "type",
276
+ "project_id"
277
+ ],
278
+ "amount_type": "decimal string",
279
+ "timestamps": "Unix seconds",
280
+ "ordinary_withdrawals_exclude_refunds": true,
281
+ "public_invoice_and_widget_exclude_refund_finance": true
282
+ },
283
+ "simulate": {
284
+ "method": "POST",
285
+ "path": "/v1/sandbox/refunds/{id}/simulate",
286
+ "statuses": [
287
+ "completed",
288
+ "failed",
289
+ "cancelled"
290
+ ],
291
+ "body": {
292
+ "status": "completed"
293
+ },
294
+ "foreign_or_production_status": 404,
295
+ "same_terminal_status_is_idempotent": true
296
+ }
297
+ },
298
+ "post_signing": {
299
+ "api_key": "pk_test_key",
300
+ "api_secret": "sk_test_secret",
301
+ "timestamp": "1700000000",
302
+ "method": "POST",
303
+ "path": "/v1/invoices",
304
+ "query": "",
305
+ "body": "{\"amount\":\"10.00\"}",
306
+ "body_sha256": "e9eb495accbce2a0e95bbe079b9f9e42ccae20371c1516e3ed3036d2a787cf53",
307
+ "signature": "AS+pbf8GlSGee9Oh5XhpasBpXB488AGEoqjDMx+dwak=",
308
+ "authorization": "HMAC-SHA256 pk_test_key:AS+pbf8GlSGee9Oh5XhpasBpXB488AGEoqjDMx+dwak="
309
+ },
310
+ "post_empty_body_signing": {
311
+ "note": "POST with NO body: bodyHash is the empty string, never sha256(\"\"). Pins the fork a method-based shortcut (\"only GET is empty\") would miss.",
312
+ "api_key": "pk_test_key",
313
+ "api_secret": "sk_test_secret",
314
+ "timestamp": "1700000000",
315
+ "method": "POST",
316
+ "path": "/v1/invoices/inv_74BPZFhr9qy9Uz2fbRkdJX/cancel",
317
+ "query": "",
318
+ "body": "",
319
+ "body_sha256": "",
320
+ "signature": "3vOr/bIyVDPQWapX33E1H5tdzAseP+orHIX0q/HNuR8=",
321
+ "authorization": "HMAC-SHA256 pk_test_key:3vOr/bIyVDPQWapX33E1H5tdzAseP+orHIX0q/HNuR8="
322
+ },
323
+ "get_query_signing": {
324
+ "api_key": "pk_test_key",
325
+ "api_secret": "sk_test_secret",
326
+ "timestamp": "1700000000",
327
+ "method": "GET",
328
+ "path": "/v1/invoices",
329
+ "query": "?limit=50&project_id=prj%2Fa&status=paid&status=paid_over",
330
+ "body": "",
331
+ "signature": "O8M5GGSzzJAgj5w1jDViIWS4njJvohvnZi7+twuG+e0="
332
+ },
333
+ "ton_webhooks": {
334
+ "description": "Synthetic signed schema 1 TON events with raw and friendly addresses; signature v1 is the HMAC format",
335
+ "secret": "whsec_sdk_fixture",
336
+ "now": 1700000000,
337
+ "vectors": [
338
+ {
339
+ "name": "invoice_raw",
340
+ "event_id": "evt_invoice_raw",
341
+ "event_type": "invoice.paid",
342
+ "version": 1,
343
+ "header": "t=1700000000,v1=a4fa25190387f446a419bb30ab7e77845a420ca711044b55c4e2cc9cb0face4c",
344
+ "raw_body": "{\"event_id\":\"evt_invoice_raw\",\"event_type\":\"invoice.paid\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"invoice_id\":\"inv_1\",\"status\":\"paid\",\"is_test\":false,\"payment\":{\"network\":\"TON\",\"currency\":\"USDT\",\"address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\",\"contract_address\":\"0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe\",\"expected\":\"10.50\"}}}",
345
+ "expect": [
346
+ {
347
+ "path": [
348
+ "payment",
349
+ "address"
350
+ ],
351
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
352
+ },
353
+ {
354
+ "path": [
355
+ "payment",
356
+ "contract_address"
357
+ ],
358
+ "value": "0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe"
359
+ },
360
+ {
361
+ "path": [
362
+ "payment",
363
+ "expected"
364
+ ],
365
+ "value": "10.50"
366
+ },
367
+ {
368
+ "path": [
369
+ "payment",
370
+ "network"
371
+ ],
372
+ "value": "TON"
373
+ },
374
+ {
375
+ "path": [
376
+ "is_test"
377
+ ],
378
+ "value": false
379
+ }
380
+ ]
381
+ },
382
+ {
383
+ "name": "withdrawal_raw",
384
+ "event_id": "evt_withdrawal_raw",
385
+ "event_type": "withdrawal.completed",
386
+ "version": 1,
387
+ "header": "t=1700000000,v1=d2ddcc287aa77e0270f4a75af04e9f4008306ad8bb6f57803e6dc706875eac26",
388
+ "raw_body": "{\"event_id\":\"evt_withdrawal_raw\",\"event_type\":\"withdrawal.completed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"withdrawal_id\":\"wdr_1\",\"status\":\"completed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"amount\":\"10.50\",\"destination_address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\"}}",
389
+ "expect": [
390
+ {
391
+ "path": [
392
+ "destination_address"
393
+ ],
394
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
395
+ },
396
+ {
397
+ "path": [
398
+ "amount"
399
+ ],
400
+ "value": "10.50"
401
+ },
402
+ {
403
+ "path": [
404
+ "network"
405
+ ],
406
+ "value": "TON"
407
+ },
408
+ {
409
+ "path": [
410
+ "is_test"
411
+ ],
412
+ "value": false
413
+ }
414
+ ]
415
+ },
416
+ {
417
+ "name": "refund_raw",
418
+ "event_id": "evt_refund_raw",
419
+ "event_type": "withdrawal.completed",
420
+ "version": 1,
421
+ "header": "t=1700000000,v1=624a1fe24a1af4dbc4937b739dd56e858f38f9077b1424ada3ddcef8e77bf649",
422
+ "raw_body": "{\"event_id\":\"evt_refund_raw\",\"event_type\":\"withdrawal.completed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"withdrawal_id\":\"wdr_2\",\"invoice_id\":\"inv_1\",\"mode\":\"overpayment\",\"external_order_id\":\"refund-order-1\",\"status\":\"completed\",\"is_final\":true,\"is_test\":false,\"amount\":\"10.50\",\"currency\":\"USDT\",\"network\":\"TON\",\"destination_address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\",\"first_sender\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\",\"created_at\":1700000000,\"completed_at\":1700000000}}",
423
+ "expect": [
424
+ {
425
+ "path": [
426
+ "destination_address"
427
+ ],
428
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
429
+ },
430
+ {
431
+ "path": [
432
+ "first_sender"
433
+ ],
434
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
435
+ },
436
+ {
437
+ "path": [
438
+ "amount"
439
+ ],
440
+ "value": "10.50"
441
+ },
442
+ {
443
+ "path": [
444
+ "network"
445
+ ],
446
+ "value": "TON"
447
+ },
448
+ {
449
+ "path": [
450
+ "is_test"
451
+ ],
452
+ "value": false
453
+ },
454
+ {
455
+ "path": [
456
+ "invoice_id"
457
+ ],
458
+ "value": "inv_1"
459
+ },
460
+ {
461
+ "path": [
462
+ "mode"
463
+ ],
464
+ "value": "overpayment"
465
+ },
466
+ {
467
+ "path": [
468
+ "external_order_id"
469
+ ],
470
+ "value": "refund-order-1"
471
+ },
472
+ {
473
+ "path": [
474
+ "is_final"
475
+ ],
476
+ "value": true
477
+ },
478
+ {
479
+ "path": [
480
+ "created_at"
481
+ ],
482
+ "value": 1700000000
483
+ },
484
+ {
485
+ "path": [
486
+ "completed_at"
487
+ ],
488
+ "value": 1700000000
489
+ }
490
+ ]
491
+ },
492
+ {
493
+ "name": "channel_deposit_raw",
494
+ "event_id": "evt_channel_deposit_raw",
495
+ "event_type": "payment_channel.deposit.confirmed",
496
+ "version": 1,
497
+ "header": "t=1700000000,v1=65304a7b178cf3585bd4dbf8896e7819539aa23a66b566f12142cc0f601e304b",
498
+ "raw_body": "{\"event_id\":\"evt_channel_deposit_raw\",\"event_type\":\"payment_channel.deposit.confirmed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"id\":\"pcd_1\",\"status\":\"confirmed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"gross\":\"10.50\",\"contract_address\":\"0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe\",\"source_address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\",\"destination_address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\"}}",
499
+ "expect": [
500
+ {
501
+ "path": [
502
+ "contract_address"
503
+ ],
504
+ "value": "0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe"
505
+ },
506
+ {
507
+ "path": [
508
+ "source_address"
509
+ ],
510
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
511
+ },
512
+ {
513
+ "path": [
514
+ "destination_address"
515
+ ],
516
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
517
+ },
518
+ {
519
+ "path": [
520
+ "gross"
521
+ ],
522
+ "value": "10.50"
523
+ },
524
+ {
525
+ "path": [
526
+ "network"
527
+ ],
528
+ "value": "TON"
529
+ },
530
+ {
531
+ "path": [
532
+ "is_test"
533
+ ],
534
+ "value": false
535
+ }
536
+ ]
537
+ },
538
+ {
539
+ "name": "invoice_friendly",
540
+ "event_id": "evt_invoice_friendly",
541
+ "event_type": "invoice.paid",
542
+ "version": 1,
543
+ "header": "t=1700000000,v1=443f23a357da0190dbe80a62a3543cbe31d901d94a56fbb02164b9670755b4e3",
544
+ "raw_body": "{\"event_id\":\"evt_invoice_friendly\",\"event_type\":\"invoice.paid\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"invoice_id\":\"inv_1\",\"status\":\"paid\",\"is_test\":false,\"payment\":{\"network\":\"TON\",\"currency\":\"USDT\",\"address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\",\"contract_address\":\"EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs\",\"expected\":\"10.50\"}}}",
545
+ "expect": [
546
+ {
547
+ "path": [
548
+ "payment",
549
+ "address"
550
+ ],
551
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
552
+ },
553
+ {
554
+ "path": [
555
+ "payment",
556
+ "contract_address"
557
+ ],
558
+ "value": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"
559
+ },
560
+ {
561
+ "path": [
562
+ "payment",
563
+ "expected"
564
+ ],
565
+ "value": "10.50"
566
+ },
567
+ {
568
+ "path": [
569
+ "payment",
570
+ "network"
571
+ ],
572
+ "value": "TON"
573
+ },
574
+ {
575
+ "path": [
576
+ "is_test"
577
+ ],
578
+ "value": false
579
+ }
580
+ ]
581
+ },
582
+ {
583
+ "name": "withdrawal_friendly",
584
+ "event_id": "evt_withdrawal_friendly",
585
+ "event_type": "withdrawal.completed",
586
+ "version": 1,
587
+ "header": "t=1700000000,v1=db8ec30417aa24b9f9a1fef4029d6ee9783b9c4d51fa910552f3f69f3e85f76e",
588
+ "raw_body": "{\"event_id\":\"evt_withdrawal_friendly\",\"event_type\":\"withdrawal.completed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"withdrawal_id\":\"wdr_1\",\"status\":\"completed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"amount\":\"10.50\",\"destination_address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\"}}",
589
+ "expect": [
590
+ {
591
+ "path": [
592
+ "destination_address"
593
+ ],
594
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
595
+ },
596
+ {
597
+ "path": [
598
+ "amount"
599
+ ],
600
+ "value": "10.50"
601
+ },
602
+ {
603
+ "path": [
604
+ "network"
605
+ ],
606
+ "value": "TON"
607
+ },
608
+ {
609
+ "path": [
610
+ "is_test"
611
+ ],
612
+ "value": false
613
+ }
614
+ ]
615
+ },
616
+ {
617
+ "name": "refund_friendly",
618
+ "event_id": "evt_refund_friendly",
619
+ "event_type": "withdrawal.completed",
620
+ "version": 1,
621
+ "header": "t=1700000000,v1=12091805f2b1ef4272463081317ebe8397d0f435f7cc614b28f621dd76af3a1b",
622
+ "raw_body": "{\"event_id\":\"evt_refund_friendly\",\"event_type\":\"withdrawal.completed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"withdrawal_id\":\"wdr_2\",\"invoice_id\":\"inv_1\",\"mode\":\"overpayment\",\"external_order_id\":\"refund-order-1\",\"status\":\"completed\",\"is_final\":true,\"is_test\":false,\"amount\":\"10.50\",\"currency\":\"USDT\",\"network\":\"TON\",\"destination_address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\",\"first_sender\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\",\"created_at\":1700000000,\"completed_at\":1700000000,\"type\":\"refund\",\"project_id\":\"prj_1\"}}",
623
+ "expect": [
624
+ {
625
+ "path": [
626
+ "destination_address"
627
+ ],
628
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
629
+ },
630
+ {
631
+ "path": [
632
+ "first_sender"
633
+ ],
634
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
635
+ },
636
+ {
637
+ "path": [
638
+ "amount"
639
+ ],
640
+ "value": "10.50"
641
+ },
642
+ {
643
+ "path": [
644
+ "network"
645
+ ],
646
+ "value": "TON"
647
+ },
648
+ {
649
+ "path": [
650
+ "is_test"
651
+ ],
652
+ "value": false
653
+ },
654
+ {
655
+ "path": [
656
+ "invoice_id"
657
+ ],
658
+ "value": "inv_1"
659
+ },
660
+ {
661
+ "path": [
662
+ "mode"
663
+ ],
664
+ "value": "overpayment"
665
+ },
666
+ {
667
+ "path": [
668
+ "external_order_id"
669
+ ],
670
+ "value": "refund-order-1"
671
+ },
672
+ {
673
+ "path": [
674
+ "is_final"
675
+ ],
676
+ "value": true
677
+ },
678
+ {
679
+ "path": [
680
+ "created_at"
681
+ ],
682
+ "value": 1700000000
683
+ },
684
+ {
685
+ "path": [
686
+ "completed_at"
687
+ ],
688
+ "value": 1700000000
689
+ },
690
+ {
691
+ "path": [
692
+ "type"
693
+ ],
694
+ "value": "refund"
695
+ },
696
+ {
697
+ "path": [
698
+ "project_id"
699
+ ],
700
+ "value": "prj_1"
701
+ }
702
+ ]
703
+ },
704
+ {
705
+ "name": "channel_deposit_friendly",
706
+ "event_id": "evt_channel_deposit_friendly",
707
+ "event_type": "payment_channel.deposit.confirmed",
708
+ "version": 1,
709
+ "header": "t=1700000000,v1=71d49447016c1f340b666a1b9098d8389347898e1bbf0eb43dda2b72ae0908c3",
710
+ "raw_body": "{\"event_id\":\"evt_channel_deposit_friendly\",\"event_type\":\"payment_channel.deposit.confirmed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"id\":\"pcd_1\",\"status\":\"confirmed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"gross\":\"10.50\",\"contract_address\":\"EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs\",\"source_address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\",\"destination_address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\"}}",
711
+ "expect": [
712
+ {
713
+ "path": [
714
+ "contract_address"
715
+ ],
716
+ "value": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"
717
+ },
718
+ {
719
+ "path": [
720
+ "source_address"
721
+ ],
722
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
723
+ },
724
+ {
725
+ "path": [
726
+ "destination_address"
727
+ ],
728
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
729
+ },
730
+ {
731
+ "path": [
732
+ "gross"
733
+ ],
734
+ "value": "10.50"
735
+ },
736
+ {
737
+ "path": [
738
+ "network"
739
+ ],
740
+ "value": "TON"
741
+ },
742
+ {
743
+ "path": [
744
+ "is_test"
745
+ ],
746
+ "value": false
747
+ }
748
+ ]
749
+ },
750
+ {
751
+ "name": "invoice_v1",
752
+ "event_id": "evt_invoice_v1",
753
+ "event_type": "invoice.paid",
754
+ "version": 1,
755
+ "header": "t=1700000000,v1=5c3feef93b8332f1d0bb4b66f5bfca34e9d45d6a798ecf195877c3eeefe71196",
756
+ "raw_body": "{\"event_id\":\"evt_invoice_v1\",\"event_type\":\"invoice.paid\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"invoice_id\":\"inv_1\",\"status\":\"paid\",\"is_test\":false,\"payment\":{\"network\":\"TON\",\"currency\":\"USDT\",\"address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\",\"contract_address\":\"0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe\",\"expected\":\"10.50\"}}}",
757
+ "expect": [
758
+ {
759
+ "path": [
760
+ "payment",
761
+ "address"
762
+ ],
763
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
764
+ },
765
+ {
766
+ "path": [
767
+ "payment",
768
+ "contract_address"
769
+ ],
770
+ "value": "0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe"
771
+ },
772
+ {
773
+ "path": [
774
+ "payment",
775
+ "expected"
776
+ ],
777
+ "value": "10.50"
778
+ },
779
+ {
780
+ "path": [
781
+ "payment",
782
+ "network"
783
+ ],
784
+ "value": "TON"
785
+ },
786
+ {
787
+ "path": [
788
+ "is_test"
789
+ ],
790
+ "value": false
791
+ }
792
+ ]
793
+ },
794
+ {
795
+ "name": "withdrawal_v1",
796
+ "event_id": "evt_withdrawal_v1",
797
+ "event_type": "withdrawal.completed",
798
+ "version": 1,
799
+ "header": "t=1700000000,v1=fdbbc099095180b35f8939c8021bf73158cb3d2c99cf478b89ce7fd860447c63",
800
+ "raw_body": "{\"event_id\":\"evt_withdrawal_v1\",\"event_type\":\"withdrawal.completed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"withdrawal_id\":\"wdr_1\",\"status\":\"completed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"amount\":\"10.50\",\"destination_address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\"}}",
801
+ "expect": [
802
+ {
803
+ "path": [
804
+ "destination_address"
805
+ ],
806
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
807
+ },
808
+ {
809
+ "path": [
810
+ "amount"
811
+ ],
812
+ "value": "10.50"
813
+ },
814
+ {
815
+ "path": [
816
+ "network"
817
+ ],
818
+ "value": "TON"
819
+ },
820
+ {
821
+ "path": [
822
+ "is_test"
823
+ ],
824
+ "value": false
825
+ }
826
+ ]
827
+ },
828
+ {
829
+ "name": "refund_v1",
830
+ "event_id": "evt_refund_v1",
831
+ "event_type": "withdrawal.completed",
832
+ "version": 1,
833
+ "header": "t=1700000000,v1=64ea37ea6428a281e13bc1edb5965f9b826f7fdbce04e859548cbf0f5989dbba",
834
+ "raw_body": "{\"event_id\":\"evt_refund_v1\",\"event_type\":\"withdrawal.completed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"withdrawal_id\":\"wdr_2\",\"invoice_id\":\"inv_1\",\"type\":\"refund\",\"status\":\"completed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"amount\":\"10.50\",\"destination_address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\",\"first_sender\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\"}}",
835
+ "expect": [
836
+ {
837
+ "path": [
838
+ "destination_address"
839
+ ],
840
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
841
+ },
842
+ {
843
+ "path": [
844
+ "first_sender"
845
+ ],
846
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
847
+ },
848
+ {
849
+ "path": [
850
+ "amount"
851
+ ],
852
+ "value": "10.50"
853
+ },
854
+ {
855
+ "path": [
856
+ "network"
857
+ ],
858
+ "value": "TON"
859
+ },
860
+ {
861
+ "path": [
862
+ "is_test"
863
+ ],
864
+ "value": false
865
+ },
866
+ {
867
+ "path": [
868
+ "type"
869
+ ],
870
+ "value": "refund"
871
+ },
872
+ {
873
+ "path": [
874
+ "invoice_id"
875
+ ],
876
+ "value": "inv_1"
877
+ }
878
+ ]
879
+ },
880
+ {
881
+ "name": "channel_deposit_v1",
882
+ "event_id": "evt_channel_deposit_v1",
883
+ "event_type": "payment_channel.deposit.confirmed",
884
+ "version": 1,
885
+ "header": "t=1700000000,v1=26171784044cbce51177d844f98bd4dff1ccb33f7ea9be273ee5a266eb396557",
886
+ "raw_body": "{\"event_id\":\"evt_channel_deposit_v1\",\"event_type\":\"payment_channel.deposit.confirmed\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"id\":\"pcd_1\",\"status\":\"confirmed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"gross\":\"10.50\",\"contract_address\":\"0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe\",\"source_address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\",\"destination_address\":\"0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e\"}}",
887
+ "expect": [
888
+ {
889
+ "path": [
890
+ "contract_address"
891
+ ],
892
+ "value": "0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe"
893
+ },
894
+ {
895
+ "path": [
896
+ "source_address"
897
+ ],
898
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
899
+ },
900
+ {
901
+ "path": [
902
+ "destination_address"
903
+ ],
904
+ "value": "0:ca6e321c7cce9ecedf0a8ca2492ec8592494aa5fb5ce0387dff96ef6af982a3e"
905
+ },
906
+ {
907
+ "path": [
908
+ "gross"
909
+ ],
910
+ "value": "10.50"
911
+ },
912
+ {
913
+ "path": [
914
+ "network"
915
+ ],
916
+ "value": "TON"
917
+ },
918
+ {
919
+ "path": [
920
+ "is_test"
921
+ ],
922
+ "value": false
923
+ }
924
+ ]
925
+ },
926
+ {
927
+ "name": "invoice_v2",
928
+ "event_id": "evt_invoice_v2",
929
+ "event_type": "invoice.paid",
930
+ "version": 2,
931
+ "header": "t=1700000000,v1=b8aab224da702b154a069dd39a1c0ffa2bc3b5670436f577fe46e7a7d57e7bea",
932
+ "raw_body": "{\"event_id\":\"evt_invoice_v2\",\"event_type\":\"invoice.paid\",\"version\":2,\"occurred_at\":1700000000,\"data\":{\"invoice_id\":\"inv_1\",\"status\":\"paid\",\"is_test\":false,\"payment\":{\"network\":\"TON\",\"currency\":\"USDT\",\"address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\",\"contract_address\":\"EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs\",\"expected\":\"10.50\"}}}",
933
+ "expect": [
934
+ {
935
+ "path": [
936
+ "payment",
937
+ "address"
938
+ ],
939
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
940
+ },
941
+ {
942
+ "path": [
943
+ "payment",
944
+ "contract_address"
945
+ ],
946
+ "value": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"
947
+ },
948
+ {
949
+ "path": [
950
+ "payment",
951
+ "expected"
952
+ ],
953
+ "value": "10.50"
954
+ },
955
+ {
956
+ "path": [
957
+ "payment",
958
+ "network"
959
+ ],
960
+ "value": "TON"
961
+ },
962
+ {
963
+ "path": [
964
+ "is_test"
965
+ ],
966
+ "value": false
967
+ }
968
+ ]
969
+ },
970
+ {
971
+ "name": "withdrawal_v2",
972
+ "event_id": "evt_withdrawal_v2",
973
+ "event_type": "withdrawal.completed",
974
+ "version": 2,
975
+ "header": "t=1700000000,v1=188597aa50246e9c4906d31728643cc9c539c1e4bdec083cd0a312a305882fc5",
976
+ "raw_body": "{\"event_id\":\"evt_withdrawal_v2\",\"event_type\":\"withdrawal.completed\",\"version\":2,\"occurred_at\":1700000000,\"data\":{\"withdrawal_id\":\"wdr_1\",\"status\":\"completed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"amount\":\"10.50\",\"destination_address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\"}}",
977
+ "expect": [
978
+ {
979
+ "path": [
980
+ "destination_address"
981
+ ],
982
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
983
+ },
984
+ {
985
+ "path": [
986
+ "amount"
987
+ ],
988
+ "value": "10.50"
989
+ },
990
+ {
991
+ "path": [
992
+ "network"
993
+ ],
994
+ "value": "TON"
995
+ },
996
+ {
997
+ "path": [
998
+ "is_test"
999
+ ],
1000
+ "value": false
1001
+ }
1002
+ ]
1003
+ },
1004
+ {
1005
+ "name": "refund_v2",
1006
+ "event_id": "evt_refund_v2",
1007
+ "event_type": "withdrawal.completed",
1008
+ "version": 2,
1009
+ "header": "t=1700000000,v1=7a9ebb281ce92c8e2e3860f5111ba39400ca62b7ca1433d83d541381c1508276",
1010
+ "raw_body": "{\"event_id\":\"evt_refund_v2\",\"event_type\":\"withdrawal.completed\",\"version\":2,\"occurred_at\":1700000000,\"data\":{\"withdrawal_id\":\"wdr_2\",\"invoice_id\":\"inv_1\",\"type\":\"refund\",\"status\":\"completed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"amount\":\"10.50\",\"destination_address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\",\"first_sender\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\"}}",
1011
+ "expect": [
1012
+ {
1013
+ "path": [
1014
+ "destination_address"
1015
+ ],
1016
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
1017
+ },
1018
+ {
1019
+ "path": [
1020
+ "first_sender"
1021
+ ],
1022
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
1023
+ },
1024
+ {
1025
+ "path": [
1026
+ "amount"
1027
+ ],
1028
+ "value": "10.50"
1029
+ },
1030
+ {
1031
+ "path": [
1032
+ "network"
1033
+ ],
1034
+ "value": "TON"
1035
+ },
1036
+ {
1037
+ "path": [
1038
+ "is_test"
1039
+ ],
1040
+ "value": false
1041
+ },
1042
+ {
1043
+ "path": [
1044
+ "type"
1045
+ ],
1046
+ "value": "refund"
1047
+ },
1048
+ {
1049
+ "path": [
1050
+ "invoice_id"
1051
+ ],
1052
+ "value": "inv_1"
1053
+ }
1054
+ ]
1055
+ },
1056
+ {
1057
+ "name": "channel_deposit_v2",
1058
+ "event_id": "evt_channel_deposit_v2",
1059
+ "event_type": "payment_channel.deposit.confirmed",
1060
+ "version": 2,
1061
+ "header": "t=1700000000,v1=97136e2e98719857858cae4a2db9cdc3a4592b8fd45d0b064f81192ecc1d732f",
1062
+ "raw_body": "{\"event_id\":\"evt_channel_deposit_v2\",\"event_type\":\"payment_channel.deposit.confirmed\",\"version\":2,\"occurred_at\":1700000000,\"data\":{\"id\":\"pcd_1\",\"status\":\"confirmed\",\"is_test\":false,\"network\":\"TON\",\"currency\":\"USDT\",\"gross\":\"10.50\",\"contract_address\":\"EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs\",\"source_address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\",\"destination_address\":\"UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA\"}}",
1063
+ "expect": [
1064
+ {
1065
+ "path": [
1066
+ "contract_address"
1067
+ ],
1068
+ "value": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"
1069
+ },
1070
+ {
1071
+ "path": [
1072
+ "source_address"
1073
+ ],
1074
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
1075
+ },
1076
+ {
1077
+ "path": [
1078
+ "destination_address"
1079
+ ],
1080
+ "value": "UQDKbjIcfM6ezt8KjKJJLshZJJSqX7XOA4ff-W72r5gqPuwA"
1081
+ },
1082
+ {
1083
+ "path": [
1084
+ "gross"
1085
+ ],
1086
+ "value": "10.50"
1087
+ },
1088
+ {
1089
+ "path": [
1090
+ "network"
1091
+ ],
1092
+ "value": "TON"
1093
+ },
1094
+ {
1095
+ "path": [
1096
+ "is_test"
1097
+ ],
1098
+ "value": false
1099
+ }
1100
+ ]
1101
+ }
1102
+ ]
1103
+ },
1104
+ "webhook": {
1105
+ "secret": "whsec_test_secret",
1106
+ "timestamp": 1700000000,
1107
+ "now": 1700000000,
1108
+ "tolerance_seconds": 300,
1109
+ "raw_body": "{\"event_id\":\"evt_123\",\"event_type\":\"invoice.paid\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"invoice_id\":\"inv_123\"}}",
1110
+ "signature": "8f62822925c2d12af1b822edcc1e9392ce064c20d003cbbc11f131485348005b",
1111
+ "header": "t=1700000000,v1=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,v1=8f62822925c2d12af1b822edcc1e9392ce064c20d003cbbc11f131485348005b"
1112
+ },
1113
+ "problem_details": {
1114
+ "flat": {
1115
+ "type": "about:blank",
1116
+ "title": "Conflict",
1117
+ "status": 409,
1118
+ "detail": "Conflict.",
1119
+ "code": "conflict",
1120
+ "field": "client_request_id"
1121
+ },
1122
+ "multi": {
1123
+ "type": "about:blank",
1124
+ "title": "Bad Request",
1125
+ "status": 400,
1126
+ "detail": "Validation failed.",
1127
+ "code": "validation_failed",
1128
+ "errors": [
1129
+ {
1130
+ "code": "field_required",
1131
+ "field": "address",
1132
+ "message": "Required."
1133
+ }
1134
+ ]
1135
+ }
1136
+ }
1137
+ }
1138
+ }
data/lib/paymos/client.rb CHANGED
@@ -444,16 +444,19 @@ module Paymos
444
444
  raise ArgumentError, 'max_pages must be a positive integer' unless max_pages.is_a?(Integer) && max_pages.positive?
445
445
 
446
446
  filters = filters.dup
447
- cursor = filters[:cursor]
447
+ # Every cursor this walk has requested, not only the previous one: a cycle A -> B -> A
448
+ # repeats a position without two equal cursors in a row.
449
+ used = {}
450
+ used[filters[:cursor]] = true unless filters[:cursor].nil?
448
451
  max_pages.times do
449
452
  page = fetch.call(**filters)
450
453
  page.items.each(&block)
451
454
  next_cursor = page.next_cursor
452
455
  return if next_cursor.nil? || next_cursor.to_s.empty?
453
- raise Error, 'Paymos API returned the same pagination cursor twice' if next_cursor == cursor
456
+ raise Error, 'Paymos API returned a pagination cursor this walk already used' if used.key?(next_cursor)
454
457
 
455
- cursor = next_cursor
456
- filters[:cursor] = cursor
458
+ used[next_cursor] = true
459
+ filters[:cursor] = next_cursor
457
460
  end
458
461
  end
459
462
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paymos
4
- VERSION = '1.6.0'
4
+ VERSION = '1.6.1'
5
5
  end
data/sig/paymos.rbs CHANGED
@@ -31,6 +31,8 @@ module Paymos
31
31
  end
32
32
  class AuthenticationError < ApiError
33
33
  end
34
+ class PermissionError < AuthenticationError
35
+ end
34
36
  class NotFoundError < ApiError
35
37
  end
36
38
  class ConflictError < ApiError
@@ -44,6 +46,28 @@ module Paymos
44
46
  class UnavailableError < ServerError
45
47
  end
46
48
 
49
+ module InvoiceStatus
50
+ AWAITING_CLIENT: "awaiting_client"
51
+ AWAITING_PAYMENT: "awaiting_payment"
52
+ CONFIRMING: "confirming"
53
+ UNDERPAID_WAITING: "underpaid_waiting"
54
+ PAID: "paid"
55
+ PAID_OVER: "paid_over"
56
+ UNDERPAID: "underpaid"
57
+ EXPIRED: "expired"
58
+ CANCELLED: "cancelled"
59
+ end
60
+
61
+ module WithdrawalStatus
62
+ CREATED: "created"
63
+ PENDING_REVIEW: "pending_review"
64
+ SIGNED: "signed"
65
+ CANCELLING: "cancelling"
66
+ COMPLETED: "completed"
67
+ FAILED: "failed"
68
+ CANCELLED: "cancelled"
69
+ end
70
+
47
71
  class Model
48
72
  def []: (String | Symbol name) -> untyped
49
73
  def to_h: () -> Hash[Symbol, untyped]
@@ -96,6 +120,7 @@ module Paymos
96
120
  attr_reader updated_at: Integer
97
121
  attr_reader expires_at: Integer?
98
122
  attr_reader completed_at: Integer?
123
+ attr_reader paid_late_at: Integer?
99
124
  end
100
125
 
101
126
  class InvoiceListItem < Model
@@ -112,6 +137,7 @@ module Paymos
112
137
  attr_reader created_at: Integer
113
138
  attr_reader expires_at: Integer?
114
139
  attr_reader completed_at: Integer?
140
+ attr_reader paid_late_at: Integer?
115
141
  end
116
142
 
117
143
  class Withdrawal < Model
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paymos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paymos Labs
@@ -33,6 +33,7 @@ files:
33
33
  - CHANGELOG.md
34
34
  - LICENSE
35
35
  - README.md
36
+ - conformance/contract.json
36
37
  - lib/paymos.rb
37
38
  - lib/paymos/client.rb
38
39
  - lib/paymos/errors.rb