Skip to content

feat(account-sets): add member, accounts and balance operations - #5

Merged
bmilleare merged 9 commits into
masterfrom
feat/account-set-membership
Sep 13, 2026
Merged

bmilleare merged 9 commits into
masterfrom
feat/account-set-membership

Conversation

@bmilleare

@bmilleare bmilleare commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The SDK covered only 5 of the 9 account-set operations the API exposes (CRUD + list). This adds the missing four so sets can actually be populated and queried:

Method Route Returns
addMember($id, AccountSetMemberType, $memberId) POST /account-sets/{id}/members AccountSetMember
removeMember($id, AccountSetMemberType, $memberId) DELETE /account-sets/{id}/members AccountSetMember
getAccounts($id) GET /account-sets/{id}/accounts list<Account> — flat, recursive through nested sets, unpaginated
getBalance($id) GET /account-sets/{id}/balance AccountSetBalance

New types: Enums\AccountSetMemberType (account / account_set), Resources\AccountSetMember, Resources\AccountSetBalance. README's Account Sets section extended.

Shapes taken from the core controller annotations (AccountSetController::addMember/removeMember/balance/accounts).

⚠️ Interface change

HttpClientInterface::delete() is now delete(string $path, array $data = []). The API contract puts member_type/member_id in the DELETE request body, and the interface had no way to send one. GuzzleHttpClient only attaches a JSON body when $data is non-empty, so existing deletes are byte-identical on the wire.

This is breaking for anyone implementing HttpClientInterface themselves (PHP rejects the narrower signature). Pre-1.0, but deserves a changelog entry.

Not in this PR

  • AccountSet resource still drops members / member_count from show responses. Cheap follow-up.

Build fixes (needed for CI to be honest)

  • composer.json php: ^8.1 → ^8.2. The codebase uses readonly class in 17 files — a PHP 8.2 feature; 8.1 fails to parse (verified in php:8.1-cli). README requirement updated.
  • Dropped the tests/Integration suite from phpunit.xml — the directory never existed, so composer test / composer quality exited 2 since the initial commit.

CI

Adds .github/workflows/ci.yml: on PRs and pushes to master, matrix PHP 8.2 / 8.3 / 8.4, running composer validate --strict, PHPStan, PHPCS and PHPUnit. Badge added to README.

Test plan

  • Each method written test-first; every test observed failing before implementation
  • composer test — 76 tests / 234 assertions (was 68 / 205)
  • phpstan analyse — no errors
  • phpcs — clean
  • CI green on PHP 8.2, 8.3, 8.4
  • Exercise the lifecycle against staging (create set → add account + nested set → getAccounts → getBalance → removeMember → delete)

🤖 Generated with Claude Code

bmilleare and others added 9 commits September 13, 2026 14:06
Some endpoints (account-set member removal) take a request body on
DELETE. Extend HttpClientInterface::delete() with an optional $data
parameter; GuzzleHttpClient only attaches a JSON body when data is
non-empty so existing deletes are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
POST /account-sets/{id}/members with member_type/member_id. Introduces
AccountSetMemberType enum and AccountSetMember resource for the
response envelope.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
DELETE /account-sets/{id}/members with member_type/member_id in the
request body, as the API contract declares.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GET /account-sets/{id}/accounts returns a flat, unpaginated list of
every account in the set including those reached through nested sets.
Mapped to list<Account>.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GET /account-sets/{id}/balance. Introduces AccountSetBalance resource
(total_balance, currency, account_count plus set identity).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Account Sets section now documents every service method — list/all/
get/create/update/delete plus the membership, accounts and balance
operations — matching the depth of the Accounts section.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The codebase uses readonly classes throughout (17 of them), which are
a PHP 8.2 feature — composer.json's ^8.1 constraint was unsatisfiable
in practice (parse error on 8.1). README updated to match.

phpunit.xml declared a tests/Integration suite whose directory never
existed, so bare `phpunit` (and therefore `composer test` and
`composer quality`) exited 2 since the initial commit. Removed until
integration tests exist.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Triggers on pull requests and pushes to master. Each matrix leg
validates composer.json, installs with caching, then runs the same
three gates as `composer quality`. CI badge added to README.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bmilleare
bmilleare force-pushed the feat/account-set-membership branch from 960b70c to 3af8d06 Compare September 13, 2026 13:37
@bmilleare
bmilleare merged commit 160f1a4 into master Sep 13, 2026
3 checks passed
@bmilleare
bmilleare deleted the feat/account-set-membership branch September 13, 2026 13:41
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.

1 participant