Skip to content

Wave 1: customer.* webhook events, customer_id filters, live-bug fixes - #32

Merged
ericviana merged 2 commits into
mainfrom
eric/customers-webhooks-and-shims
Jul 27, 2026
Merged

Wave 1: customer.* webhook events, customer_id filters, live-bug fixes#32
ericviana merged 2 commits into
mainfrom
eric/customers-webhooks-and-shims

Conversation

@ericviana

Copy link
Copy Markdown
Member

What

Ships the part of the receivers-to-customers rename that the currently deployed BlindPay API already accepts, ahead of blindpay-v2 PR #1799 (still open, not deployed). Verified field-by-field against the deployed openapi.json vs the PR #1799 spec.

  • WebhookEvents (the active enum used by CreateWebhookEndpointInput/WebhookEndpoint) gains CUSTOMER_NEW = 'customer.new', CUSTOMER_UPDATE = 'customer.update', CUSTOMER_DELETE = 'customer.delete', purely additive. RECEIVER_NEW/RECEIVER_UPDATE are kept and marked @deprecated (same idiom already used for $receivers in BlindPay.php).
  • ListPayinsInput and ListPayoutsInput gain an additive customerId filter (mapped to customer_id) alongside the existing receiverId/receiver_id.
  • Two live bugs fixed in Customers.php (not future work, broken today in shipped v2.4.0): Owner::fromArray and LimitIncreaseRequest::fromArray were reading $data['customer_id'] for nested response fields the deployed API still keys receiver_id (no dual-emit at that nesting level). Since both are non-nullable string constructor params, this threw a TypeError for any business customer with owners, and for every call to getLimitIncreaseRequests(). Both now read receiver_id again, matching what the deployed API actually returns.
  • Deleted src/Types/WebhookEvent.php: a dead, unused duplicate of the events enum (confirmed zero references) that also failed php -l from a duplicated RECEIVER_DELETE case.
  • Documented the Customers/CustomersWrapper resource in CLAUDE.md (it existed since an earlier commit but was never mentioned), noted Receivers as deprecated, and fixed a few doc examples that still referenced receivers/receiverId paths that no longer match the shipped code (bank-accounts nesting and blockchain wallet list already take customerId).
  • Bumped VERSION in BlindPay.php from 2.4.0 to 2.5.0 (minor, additive only).

Why the webhook additions are safe today

The deployed WebhookEndpointIn.events enum in openapi.json already lists customer.new / customer.update / customer.delete alongside the receiver.* values, and the API dual-emits both event families. Subscribing to the new values works against production right now with no server-side changes needed.

What is deliberately NOT in this PR

The remaining wave-2 renames are held back because the deployed API does not accept them until blindpay-v2 PR #1799 ships:

  • 11 field renames (customer_local_amount, customer_wallet_address, customer_network, customer_token, customer_invite_redirect_url, customer_rfi_emails_enabled, customers_amount, customer_type, customer_kyc_status, customer_aiprise_session_id, customer_aiprise_user_profile_id) - six of these aren't modeled in this SDK at all today, nothing to rename yet.
  • RECEIVERS_* -> CUSTOMERS_* error codes - this SDK has no error-code enum (errors are a generic passthrough string), so N/A.
  • Removing the legacy Receivers resource.
  • Removing receiver.* from the webhook event enums.

Shipping any of that today would break every SDK user, since the deployed API doesn't have the corresponding server-side support yet.

Explicitly preserved (verified untouched)

receiver_amount (singular) on Payin, CreateEvmPayinResponse, Payout, Transfer, and both quote response types, plus CurrencyType::RECEIVER = 'receiver', are all unchanged - these mean "amount the receiving side gets" / currency_type value, not a reference to the customer resource, and are not part of this migration.

Build output

$ composer install --prefer-dist --no-progress --ignore-platform-req=php
... (installs cleanly; --ignore-platform-req=php needed only because the local test
environment runs PHP 8.5, newer than paratest's ~8.4 constraint in composer.lock -
pre-existing, unrelated to this change)

$ composer run test
  Tests:    91 deprecated (712 assertions)
  Duration: 0.17s
(all passing; "deprecated" here is PHPUnit flagging ReflectionProperty::setAccessible()
as a no-op deprecation under PHP 8.5 in the test harness itself, pre-existing across
the whole suite and unrelated to this change - baseline run before any edits showed
the identical 90 deprecated / 0 failed)

$ composer run lint:check
    PASS   .......................................................... 83 files

https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs

Adds the parts of the receivers-to-customers rename that the currently
deployed API already supports, ahead of blindpay-v2 PR #1799:

- WebhookEvents gains CUSTOMER_NEW/CUSTOMER_UPDATE/CUSTOMER_DELETE
  cases, additive alongside the existing RECEIVER_NEW/RECEIVER_UPDATE
  cases (now marked @deprecated). The deployed WebhookEndpointIn.events
  enum already lists the customer.* values and dual-emits, so
  subscribing today is safe.
- ListPayinsInput and ListPayoutsInput gain an additive customerId
  filter mapped to customer_id, since GET /payins and GET /payouts
  already accept that query param today. receiverId/receiver_id is
  kept for backward compatibility.
- Fix two live TypeErrors in Customers.php: Owner::fromArray and
  LimitIncreaseRequest::fromArray were reading customer_id for nested
  fields the deployed API still keys receiver_id (no dual-emit at
  that nesting level), so any business customer with owners or any
  getLimitIncreaseRequests() call threw today.
- Delete src/Types/WebhookEvent.php, a dead duplicate enum that also
  failed php -l from a duplicated case.
- Document the Customers/CustomersWrapper resource in CLAUDE.md
  (previously undocumented) and fix stale receiver_id/receivers
  references in doc examples that no longer match the shipped code.
- Bump VERSION to 2.5.0 (minor, additive only).

The other 11 field renames (customer_local_amount, customer_type,
customer_kyc_status, etc.), RECEIVERS_* error codes, and removing the
legacy Receivers resource are intentionally NOT included here: the
deployed API does not accept those yet and shipping them now would
break every user of this SDK until blindpay-v2 PR #1799 deploys.

Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs
@BernardoSM

BernardoSM commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

…t-increase id parsing

RECEIVER_DELETE was dropped from the active WebhookEvents enum when
WebhookEvent.php was deleted, silently breaking the only way to subscribe
to receiver.delete, which the API still emits. Restored it as @deprecated.

LimitIncreaseRequest::fromArray read receiver_id, but the response
middleware only ever supplies customer_id on this route; switched to
customer_id.

Owner::fromArray read receiver_id, but nested owners[] elements are not
covered by the response middleware, so customer_id is not present there
today. Made customerId nullable and read customer_id first, falling back
to receiver_id, so it works both before and after the customer_id
migration lands server-side.

Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs
@ericviana
ericviana merged commit 4bf4ddc into main Jul 27, 2026
3 of 4 checks passed
@ericviana
ericviana deleted the eric/customers-webhooks-and-shims branch July 27, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants