add internal account status#469
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✱ Stainless preview builds for gridThis PR will update the kotlin openapi python typescript
|
Greptile SummaryThis PR adds a new
Confidence Score: 4/5Safe 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 openapi/webhooks/internal-account-status.yaml — the description should be updated to remove ambiguity between "account status" (colloquial) and the new
|
| 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
Comments Outside Diff (1)
-
openapi/webhooks/internal-account-status.yaml, line 3-6 (link)Webhook description now ambiguous with the new
statusfieldThe 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
InternalAccountcarries a literalstatusfield (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). TheInternalAccountStatusWebhookschema andWebhookTypeenum only listINTERNAL_ACCOUNT.BALANCE_UPDATED, so status-field transitions are not covered. Consider updating the description to clarify that the webhook fires on balance updates (notstatusfield changes), and/or adding anINTERNAL_ACCOUNT.STATUS_UPDATEDevent 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.
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
jklein24
left a comment
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Added some more context
| - `PENDING`: Account is pending activation. | ||
| - `OPEN`: Account is open and active. |
There was a problem hiding this comment.
maybe ACTIVE is a better?
There was a problem hiding this comment.
Changed to ACTIVE
| - `PENDING`: Account is pending activation. | ||
| - `OPEN`: Account is open and active. | ||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Can integrators edit these? For example if one of their customers requests their account to be closed is that a patch here?
There was a problem hiding this comment.
No, these are updated from our banking provider.
There was a problem hiding this comment.
but what if an end customer says hey I want to close my account
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
hey someone stole my card
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
I think it makes sense to allow
| @@ -0,0 +1,19 @@ | |||
| title: Internal Account Status | |||
There was a problem hiding this comment.
should we also send webhooks on status changes?
b32957c to
0ae4fdd
Compare
0ae4fdd to
6b8ad8d
Compare
|
|
||
| - `ACTIVE`: The account is ready to send and receive payments. | ||
|
|
||
| - `CLOSED`: The account cannot send or receive payments. A customer can |
There was a problem hiding this comment.
closed is terminal? No undo right?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
cool. what's the password to the docs?
There was a problem hiding this comment.
@wuvictor-95 please don't respond to that question here in this public repo :-)

No description provided.