paymos 1.5.2 → 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 +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +32 -3
- data/conformance/contract.json +1138 -0
- data/lib/paymos/client.rb +9 -28
- data/lib/paymos/version.rb +1 -1
- data/sig/paymos.rbs +26 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7bfc8552db30245323684620dc4db5b8e206de6c2cae9eddeab9f80f68c583a7
|
|
4
|
+
data.tar.gz: eb8c7eace8288653d5beb401e498c279124891fbe0f8a1f448c4b845644c6b7d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6200473cb3bb0d8f98403bfa9ed512e27e042ea33cfee95cbdfd09662e323bc3a388931caeda284501832c446b6f9aa937338a6fcaf4098aa945f3732bdbb9d0
|
|
7
|
+
data.tar.gz: 53c7e6389ad62f2cc2bc59242c41e49fb096bb2ec565789ea2608e74f0b79decce504be7ec0719f97a1485428879ffa23a561fe5dabae10fc16d038c3a6b3cff
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
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
|
+
|
|
10
|
+
## [1.6.0] - 2026-11-03
|
|
11
|
+
|
|
12
|
+
- fix(sdk): resolve preflight lint and conformance vector count for autorelease
|
|
13
|
+
- feat(refunds): finalize clean merchant refunds spec, SDKs, CMS plugins, and targeted test scripts
|
|
14
|
+
|
|
15
|
+
- **403 is no longer reported as an authentication failure.** `Paymos::PermissionError` (subclasses `Paymos::AuthenticationError`, so existing `rescue` blocks keep working) now carries every 403.
|
|
16
|
+
- **Base URL must use HTTPS.** Plain HTTP is accepted only against a loopback host, which is what a local integration test points at. The API secret signs every request, so a plaintext base URL put that credential on the wire.
|
|
17
|
+
|
|
5
18
|
## [1.5.2] - 2026-11-02
|
|
6
19
|
|
|
7
20
|
- wip: snapshot shared working tree before merging main
|
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|
|
|
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
|
-
|
|
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
|