feat(statements): balance changes and statement delivery confirmation - #1078
ls-bolt[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
|
@greptile review |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
|
|
||
| ### 5. `openapi/openapi.yaml` | ||
| - `Periodic Statements` tag after `Internal Accounts`, describing the | ||
| identity `openingBalance + Σ(data[].amount) == closingBalance`, the |
There was a problem hiding this comment.
Reconciliation ignores pagination The plan says opening and closing balances cover the whole window, but
data contains only one page. When hasMore is true, summing that page will generally not reconcile the balances and could make readers mistake a valid response for an error. Specify that the sum includes every page.
| identity `openingBalance + Σ(data[].amount) == closingBalance`, the | |
| identity `openingBalance + Σ(data[].amount across all pages) == closingBalance`, the |
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/plans/2026-09-25-periodic-statements-spec.md
Line: 58
Comment:
**Reconciliation ignores pagination** The plan says opening and closing balances cover the whole window, but `data` contains only one page. When `hasMore` is true, summing that page will generally not reconcile the balances and could make readers mistake a valid response for an error. Specify that the sum includes every page.
```suggestion
identity `openingBalance + Σ(data[].amount across all pages) == closingBalance`, the
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Right, the rollups bound the window and data is one page. The plan now states the identity across all pages, and the spec text will say the same.
5b6561a to
35d9e8f
Compare
|
⚡ Review ledger Round 1
|
Adds the two operations a platform needs to build and evidence a periodic
statement for an internal account: GET /internal-accounts/{id}/balance-changes
returns one row per change to the balance with the window's opening and closing
balances in the same response, and POST
/internal-accounts/{id}/statement-confirmations records that a statement was
delivered. Adds 409 BALANCE_NOT_YET_FINAL and 422 PERIOD_NOT_REPORTABLE.
Co-Authored-By: benwgold <benwgold@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
35d9e8f to
c93cbb5
Compare
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|

Summary
Adds the two operations a platform needs to build and evidence a Regulation E periodic statement for an internal account, under a new Periodic Statements tag.
GET /internal-accounts/{id}/balance-changes— one row per change to the account's balance in a half-open window[from, to), ordered by when the money moved, with the window'sopeningBalanceandclosingBalancein the same response. The balances describe the window rather than the page, so the identityopeningBalance + Σ(data[].amount) == closingBalanceholds across all pages. Paginated withlimit/cursor.POST /internal-accounts/{id}/statement-confirmations— records that a period's statement was delivered to the customer. Idempotent; the stored time is the first delivery.New error codes:
409 BALANCE_NOT_YET_FINAL— card settlement for a window boundary has not closed, so the figures could still change. Retry once settled.422 PERIOD_NOT_REPORTABLE— the window cannot be reported; retrying will not change that.transactionIdon a balance change groups the lines of one movement on a statement. It is documented as not being aTransactionid, since it does not resolve throughGET /transactions/{transactionId}.Changes
openapi/paths/internal_accounts/internal_accounts_{id}_balance-changes.yaml,…_statement-confirmations.yaml— new operationsopenapi/components/schemas/internal_accounts/—BalanceChange,BalanceChangeListResponse,ConfirmStatementDeliveryRequest,StatementDeliveryopenapi/components/schemas/errors/Error409.yaml,Error422.yaml— new codes in both the description table and theenumopenapi/openapi.yaml— tag and path refs.stainless/stainless.yml—customers.list_balance_changes,customers.confirm_statement_delivery, and the four models, alongside the existing internal-account methodsopenapi.yaml,mintlify/openapi.yaml— regeneratedTest plan
make buildbundles cleanly;openapi.yamlandmintlify/openapi.yamlare identicalmake lintpasses: Redocly valid, Spectral 0 errors, and no warnings or infos on any added path or schema (existing repo-wide findings unchanged)anyOfwithtype: 'null', matching the repo's OpenAPI 3.1 convention