Skip to content

add internal account status#469

Merged
wuvictor-95 merged 1 commit into
mainfrom
05-13-add_internal_account_status
May 14, 2026
Merged

add internal account status#469
wuvictor-95 merged 1 commit into
mainfrom
05-13-add_internal_account_status

Conversation

@wuvictor-95
Copy link
Copy Markdown
Contributor

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
grid-flow-builder Ready Ready Preview, Comment May 13, 2026 10:37pm

Request Review

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

✱ Stainless preview builds for grid

This PR will update the grid SDKs with the following commit messages.

kotlin

feat(api): add status field to InternalAccount model

openapi

feat(api): add status field to InternalAccount

python

feat(api): add status field to InternalAccount

typescript

feat(api): add status field to internal account responses
⚠️ grid-python studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗build ✅lint ✅test ✅

pip install https://pkg.stainless.com/s/grid-python/e5181153c2fbebbfe897bc633abc6ff43ccb0fa5/grid-0.0.1-py3-none-any.whl
⚠️ grid-kotlin studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗build ✅lint ✅test ✅

⚠️ grid-openapi studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗

⚠️ grid-typescript studio · code

Your SDK build had a failure in the build CI job, which is a regression from the base state.
generate ❗build ❗lint ❗test ❗


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-05-14 01:14:56 UTC

@wuvictor-95 wuvictor-95 marked this pull request as ready for review May 13, 2026 21:37
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 13, 2026

Greptile Summary

This PR adds a new InternalAccountStatus enum (PENDING, OPEN, CLOSED, FROZEN) as a required field on the InternalAccount schema, updating examples across the path, webhook, and both bundled spec files.

  /\\_/\\   (✿◠‿◠)
 ( ^.^ )  great work victor!
  > ^ <
  • New schema: InternalAccountStatus.yaml introduces four statuses with clear per-value descriptions; status is wired in as a required property on InternalAccount between type and balance.
  • Examples updated: The PATCH /internal-accounts/{id} response and internal-account-status webhook example both now include status: OPEN to match the updated schema.
  • Potential clarification needed: The webhook description uses "status" colloquially to mean account state (i.e. balance updates), but with a literal status field now present, consumers may expect the webhook to fire on status-field transitions — worth a wording tweak or a new INTERNAL_ACCOUNT.STATUS_UPDATED event type.

Confidence Score: 4/5

Safe to merge; the only concern is a documentation ambiguity in the webhook description that should be addressed soon.

The schema additions are clean and consistent across all files. The one thing that needs attention is the webhook description, which says the webhook fires "when the status of an internal account changes" — now that status is a real field with distinct values, this wording will mislead consumers into expecting events for PENDING→OPEN transitions that aren't yet documented.

openapi/webhooks/internal-account-status.yaml — the description should be updated to remove ambiguity between "account status" (colloquial) and the new status field.

Important Files Changed

Filename Overview
openapi/components/schemas/customers/InternalAccountStatus.yaml New enum schema defining four account statuses (PENDING, OPEN, CLOSED, FROZEN) with descriptions and an example — looks clean.
openapi/components/schemas/customers/InternalAccount.yaml Adds status as a required field via $ref to InternalAccountStatus; positioned correctly between type and balance.
openapi/webhooks/internal-account-status.yaml Example updated to include status: OPEN, but the webhook description now ambiguously implies it fires on status field transitions when it only covers INTERNAL_ACCOUNT.BALANCE_UPDATED.
openapi/paths/internal_accounts/internal_accounts_{id}.yaml Example response updated to include status: OPEN; consistent with the schema change.
openapi.yaml Generated bundle updated with InternalAccountStatus schema and required status field on InternalAccount — matches source changes.
mintlify/openapi.yaml Generated Mintlify bundle updated identically to openapi.yaml — consistent.

Sequence Diagram

sequenceDiagram
    participant C as API Consumer
    participant G as Grid API
    participant W as Consumer Webhook

    C->>G: "GET /internal-accounts/{id}"
    G-->>C: "InternalAccount { status: PENDING|OPEN|CLOSED|FROZEN, ... }"

    Note over G,W: Balance change occurs
    G->>W: POST (webhook) INTERNAL_ACCOUNT.BALANCE_UPDATED
    W-->>G: 200 OK
    Note right of W: data.status reflects current account status

    Note over C,G: Status field transitions (PENDING→OPEN etc.) not yet covered by a webhook event
Loading

Comments Outside Diff (1)

  1. openapi/webhooks/internal-account-status.yaml, line 3-6 (link)

    P2 Webhook description now ambiguous with the new status field

    The description reads "Webhook that is called when the status of an internal account changes. This includes balance updates…" — before this PR the word "status" was colloquial. Now that InternalAccount carries a literal status field (PENDING / OPEN / CLOSED / FROZEN), a consumer reading the webhook docs will reasonably expect this webhook to fire when that field transitions (e.g. PENDING → OPEN). The InternalAccountStatusWebhook schema and WebhookType enum only list INTERNAL_ACCOUNT.BALANCE_UPDATED, so status-field transitions are not covered. Consider updating the description to clarify that the webhook fires on balance updates (not status field changes), and/or adding an INTERNAL_ACCOUNT.STATUS_UPDATED event type if those transitions need to be observable.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: openapi/webhooks/internal-account-status.yaml
    Line: 3-6
    
    Comment:
    **Webhook description now ambiguous with the new `status` field**
    
    The description reads *"Webhook that is called when the status of an internal account changes. This includes balance updates…"* — before this PR the word "status" was colloquial. Now that `InternalAccount` carries a literal `status` field (`PENDING` / `OPEN` / `CLOSED` / `FROZEN`), a consumer reading the webhook docs will reasonably expect this webhook to fire when that field transitions (e.g. `PENDING → OPEN`). The `InternalAccountStatusWebhook` schema and `WebhookType` enum only list `INTERNAL_ACCOUNT.BALANCE_UPDATED`, so status-field transitions are not covered. Consider updating the description to clarify that the webhook fires on balance updates (not `status` field changes), and/or adding an `INTERNAL_ACCOUNT.STATUS_UPDATED` event type if those transitions need to be observable.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Fix in Claude Code

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
openapi/webhooks/internal-account-status.yaml:3-6
**Webhook description now ambiguous with the new `status` field**

The description reads *"Webhook that is called when the status of an internal account changes. This includes balance updates…"* — before this PR the word "status" was colloquial. Now that `InternalAccount` carries a literal `status` field (`PENDING` / `OPEN` / `CLOSED` / `FROZEN`), a consumer reading the webhook docs will reasonably expect this webhook to fire when that field transitions (e.g. `PENDING → OPEN`). The `InternalAccountStatusWebhook` schema and `WebhookType` enum only list `INTERNAL_ACCOUNT.BALANCE_UPDATED`, so status-field transitions are not covered. Consider updating the description to clarify that the webhook fires on balance updates (not `status` field changes), and/or adding an `INTERNAL_ACCOUNT.STATUS_UPDATED` event type if those transitions need to be observable.

Reviews (1): Last reviewed commit: "add internal account status" | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@jklein24 jklein24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cool to also update the mintlify docs if any relevant examples need to change.

- `PENDING`: Account is pending activation.
- `OPEN`: Account is open and active.
Copy link
Copy Markdown
Contributor

@pengying pengying May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add more information about the impact of each account state on transactions? Eg can a pending account receive payments? What about recurring debits on frozen accounts?

eg my account is frozen but my monthly phone bill auto debits from the account. does that succeed or fail?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some more context

- `PENDING`: Account is pending activation.
- `OPEN`: Account is open and active.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe ACTIVE is a better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to ACTIVE

- `PENDING`: Account is pending activation.
- `OPEN`: Account is open and active.
Copy link
Copy Markdown
Contributor

@pengying pengying May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a state diagram with markdown?

Can an account be closed with a non zero balance? Or is there a PENDING_CLOSED where debits can occur but no credits before the account is closed?

What triggers an account to go from PENDING > ACTIVE?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had similar questions. Erebor said an account can be frozen or closed entirely for various compliance reasons. Frozen can be recovered, closed cannot. I would imagine the account could not receive or send money in these states but I can double check.

PENDING means the account is being provisioned and undergoing review by the banking partner. Once approved, it moves to OPEN

- `OPEN`: Account is open and active.
- `CLOSED`: Account is closed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can integrators edit these? For example if one of their customers requests their account to be closed is that a patch here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these are updated from our banking provider.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but what if an end customer says hey I want to close my account

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, the only viable option for a user-initiated patch on the internal account status is CLOSED and nothing else. Does that sound right to you?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey someone stole my card

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm asking if that validation logic sounds right to you. If so, I can add it to the patch handler so integrators can expose an option to close their account.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that patch to close sounds right? I think it ties back into can they close an account with a non zero balance. But patch feels like the right mechanism

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to allow

@@ -0,0 +1,19 @@
title: Internal Account Status
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also send webhooks on status changes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added


- `ACTIVE`: The account is ready to send and receive payments.

- `CLOSED`: The account cannot send or receive payments. A customer can
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closed is terminal? No undo right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Some new information here: https://docs.erebor.bank/accounts/deposit-accounts#account-lifecycle

I'm just seeing this since Erebor did not have guides before. But looks like we can follow the same logic of closing it down when balance is 0. I can add some more validation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool. what's the password to the docs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wuvictor-95 please don't respond to that question here in this public repo :-)

@wuvictor-95 wuvictor-95 merged commit cff4d23 into main May 14, 2026
8 checks passed
@wuvictor-95 wuvictor-95 deleted the 05-13-add_internal_account_status branch May 14, 2026 01:06
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.

4 participants