Commit 562f219
authored
feat(customers): add customer.* webhook events and customer_id list filters (#52)
* feat(customers): add customer.* webhook events and customer_id list filters
The deployed API already accepts these; this is additive and safe against
production today.
- Add customer.new/customer.update/customer.delete to the WebhookEvents
Literal, and fold the previously orphaned receiver.delete (from
src/blindpay/types.py, disconnected from WebhookEvents and never wired
up) into the same Literal alongside it.
- Mark receiver.new/receiver.update/receiver.delete deprecated with a
comment pointing at the same changelog post used by the receivers
namespace deprecation warning in client.py. They are not removed:
receiver.* webhooks are still dual-emitted by the deployed API.
- Retire the stray, publicly exported types.WebhookEvent alias now that
receiver.delete lives in WebhookEvents.
- Add customer_id as an optional list filter on ListPayinsInput and
ListPayoutsInput, alongside the existing receiver_id (not removed).
GET /v1/instances/{id}/payins and /payouts already accept customer_id
as a query filter in the deployed API spec.
- Update the README quickstart example to use blindpay.customers.get()
instead of the runtime-deprecated blindpay.receivers.get().
Deliberately excluded (wave 2, needs blindpay-v2 PR #1799 deployed
first): the remaining 11 receiver_* -> customer_* field renames, and
removal of receiver.* from the webhook enum. Shipping those today would
break every SDK user still on the deployed field names.
Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs
* fix: keep the WebhookEvent export so this release stays additive
The branch had deleted the public `WebhookEvent` alias from types.py and dropped it
from __init__.py's imports and __all__. It is dead inside the repo, but it is an
exported symbol, so `from blindpay import WebhookEvent` would break on what is
otherwise a purely additive minor release.
Restored with its original value and a deprecation note pointing at WebhookEvents,
which is the alias that actually lists every event. Removal belongs in the next major,
alongside dropping the receiver.* members.
Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs
* fix(customers): align response field names with the deployed API
The customer.* rename shims declared customer_id on nested owners,
limit-increase requests, blockchain wallets, and offramp wallets.
The deployed API still sends receiver_id in all four places (server-side
customers rename is not deployed yet). Since these are TypedDicts, a
consumer indexing the declared key gets a KeyError today.
Verified against apps/api/openapi.json: ReceiverOut.owners[], required
receiver_id on BlockchainWalletOut, OfframpWallet, and
GetReceiverLimitIncreaseOut. Updated the wallet test fixtures to match
and added receiver_id assertions so a regression of this exact bug fails
the suite.
bank_accounts.py's owners field is untouched: the deployed
BankAccountOut has neither receiver_id nor customer_id, so that is a
separate pre-existing type-accuracy issue, not this bug.
Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs
* fix(tests): narrow Optional data before subscripting in wallet list assertions
pyright flagged reportOptionalSubscript on response["data"][0] since
BlindpayApiResponse["data"] is Optional. Add the same is-not-None assert
already used elsewhere in the suite to narrow the type.
Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs
* fix(customers): declare customer_id where the middleware alias sends it
Blockchain wallets, offramp wallets and limit-increase responses go through
addCustomerIdMiddleware, which adds customer_id wherever receiver_id is
present today, and both are required in the post-#1799 spec. Revert the
earlier reversion to receiver_id for those three.
Owner is different: it's a nested owners[] element, which the middleware
does not recurse into, so customer_id is not sent today but will be after
#1799. Declare both keys as NotRequired so neither shape breaks.
Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs1 parent 4836206 commit 562f219
9 files changed
Lines changed: 30 additions & 7 deletions
File tree
- src/blindpay
- resources
- customers
- payins
- payouts
- webhooks
- tests/resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
306 | 309 | | |
307 | 310 | | |
308 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
11 | 21 | | |
12 | 22 | | |
13 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
412 | 414 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
| 331 | + | |
| 332 | + | |
329 | 333 | | |
330 | 334 | | |
331 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments