Skip to content

Sync Grid Visualizer with PaymentRail enum#351

Open
claude[bot] wants to merge 1 commit intomainfrom
docs/sync-20260418
Open

Sync Grid Visualizer with PaymentRail enum#351
claude[bot] wants to merge 1 commit intomainfrom
docs/sync-20260418

Conversation

@claude
Copy link
Copy Markdown
Contributor

@claude claude bot commented Apr 18, 2026

Summary

Syncs the Grid Visualizer with the new PaymentRail enum added in #347:

  • currencies.ts: Update payment rail values to use SCREAMING_SNAKE_CASE format matching the OpenAPI PaymentRail enum (e.g., FEDNOW instead of FedNow, FASTER_PAYMENTS instead of Faster Payments, SEPA_INSTANT instead of SEPA Instant, BANK_TRANSFER instead of Bank Transfer, MOBILE_MONEY instead of Mobile Money)
  • code-generator.ts: Add paymentRails array to generated external account creation requests, matching the documented workflow examples in .claude/skills/grid-api/references/workflows.md

Trigger

OpenAPI schema changes in commit 4d89702:

  • openapi/components/schemas/common/PaymentRail.yaml (new enum)
  • openapi/components/schemas/exchange_rates/ExchangeRate.yaml (added destinationPaymentRail)
  • openapi/components/schemas/quotes/AccountDestination.yaml (added optional paymentRail)

Test plan

  • Verify generated API code in Grid Visualizer uses correct enum values
  • Test external account creation flow shows paymentRails in request body

🤖 Generated with Claude Code

Update currencies.ts to use SCREAMING_SNAKE_CASE payment rail values
that match the PaymentRail enum in the OpenAPI spec (e.g., FEDNOW,
FASTER_PAYMENTS, SEPA_INSTANT, BANK_TRANSFER, MOBILE_MONEY).

Add paymentRails field to generated external account creation requests
in code-generator.ts to match documented workflow examples.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@claude claude bot requested review from pengying and shreyav April 18, 2026 08:22
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 18, 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 Apr 18, 2026 8:22am

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 18, 2026

Greptile Summary

This PR syncs the Grid Visualizer with the new PaymentRail enum from PR #347, correctly updating all rail string values in currencies.ts to SCREAMING_SNAKE_CASE. However, the code-generator.ts change also injects paymentRails inside accountInfo in external account creation requests, and that field is defined only in response-side schemas (*AccountInfo) — not in the create-request schemas (*AccountInfoBase) used by POST /customers/external-accounts. This would produce example API calls that include an undocumented field, potentially causing 400 errors or misleading developers who copy the generated code.

Confidence Score: 4/5

The currencies.ts enum update is safe, but code-generator.ts injects a response-only field into create request bodies which would produce incorrect example code.

One P1 finding: paymentRails is injected into accountInfo for external account creation requests, but the field is absent from all create-request schemas (*AccountInfoBase). This generates misleading or broken example API calls, which is the core purpose of this visualizer. The P2 (enum values in prose) is minor. Score is 4 until the P1 is resolved.

components/grid-visualizer/src/lib/code-generator.ts — paymentRails field placement in buildAccountInfoBody

Important Files Changed

Filename Overview
components/grid-visualizer/src/data/currencies.ts Rail values updated to SCREAMING_SNAKE_CASE matching the PaymentRail enum; all new values (FEDNOW, WIRE, SEPA_INSTANT, FASTER_PAYMENTS, BANK_TRANSFER, MOBILE_MONEY, PAYNOW) are valid enum members.
components/grid-visualizer/src/lib/code-generator.ts Adds paymentRails to accountInfo in external account create requests, but this field exists only in response schemas (*AccountInfo), not create request schemas (*AccountInfoBase) — the generated example code would send an undocumented field to the API.

Sequence Diagram

sequenceDiagram
    participant UI as Grid Visualizer UI
    participant CG as code-generator.ts
    participant CUR as currencies.ts (PaymentRail enum)
    participant API as Grid API

    UI->>CG: generateSteps(source, destination)
    CG->>CUR: find(c => c.code === sel.code)
    CUR-->>CG: fiat.allRails (SCREAMING_SNAKE_CASE)
    CG->>CG: buildAccountInfoBody() sets info.paymentRails = allRails
    CG-->>UI: ApiStep with accountInfo.paymentRails
    UI->>API: POST /customers/external-accounts { accountInfo: { ..., paymentRails: [...] } }
    Note over API: paymentRails not in create schema, only in response schema
Loading

Comments Outside Diff (1)

  1. components/grid-visualizer/src/lib/code-generator.ts, line 309 (link)

    P2 Raw enum values in user-facing note text

    getJitPaymentMethod() now returns strings like "FEDNOW transfer" or "SEPA_INSTANT transfer" from fiat.instantRails[0], which appear directly in the step note shown to the user: "Trigger the payment by sending a SEPA_INSTANT transfer to the deposit address...". The previous human-readable names (FedNow, SEPA Instant) were better suited for this prose context.

    Consider either keeping a separate display-name map for prose use or adding a formatting helper that converts SEPA_INSTANTSEPA Instant for the note text.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: components/grid-visualizer/src/lib/code-generator.ts
    Line: 309
    
    Comment:
    **Raw enum values in user-facing note text**
    
    `getJitPaymentMethod()` now returns strings like `"FEDNOW transfer"` or `"SEPA_INSTANT transfer"` from `fiat.instantRails[0]`, which appear directly in the step note shown to the user: *"Trigger the payment by sending a SEPA_INSTANT transfer to the deposit address..."*. The previous human-readable names (`FedNow`, `SEPA Instant`) were better suited for this prose context.
    
    Consider either keeping a separate display-name map for prose use or adding a formatting helper that converts `SEPA_INSTANT``SEPA Instant` for the note text.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    Fix in Claude Code

Fix All in Claude Code

Prompt To Fix All With AI
This is a comment left during a code review.
Path: components/grid-visualizer/src/lib/code-generator.ts
Line: 51-57

Comment:
**`paymentRails` is a response-only field**

`paymentRails` is not part of the external account creation request schema. Every `*ExternalAccountCreateInfo` schema (e.g. `UsdExternalAccountCreateInfo`) extends `*AccountInfoBase`, and none of those base schemas include `paymentRails`. The field only appears in the response-side `*AccountInfo` schemas (e.g. `UsdAccountInfo`) that the API returns after creation.

Sending `paymentRails` inside `accountInfo` will either cause a 400 validation error or be silently ignored — either way it generates misleading example code for developers using this visualizer as a reference. The OpenAPI spec examples in `customers_external_accounts.yaml` also omit it from create request bodies.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: components/grid-visualizer/src/lib/code-generator.ts
Line: 309

Comment:
**Raw enum values in user-facing note text**

`getJitPaymentMethod()` now returns strings like `"FEDNOW transfer"` or `"SEPA_INSTANT transfer"` from `fiat.instantRails[0]`, which appear directly in the step note shown to the user: *"Trigger the payment by sending a SEPA_INSTANT transfer to the deposit address..."*. The previous human-readable names (`FedNow`, `SEPA Instant`) were better suited for this prose context.

Consider either keeping a separate display-name map for prose use or adding a formatting helper that converts `SEPA_INSTANT``SEPA Instant` for the note text.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Sync Grid Visualizer with PaymentRail en..." | Re-trigger Greptile

Comment on lines +51 to +57
// Add paymentRails for fiat currencies
if (sel.type === 'fiat') {
const fiat = currencies.find((c) => c.code === sel.code);
if (fiat && fiat.allRails.length > 0) {
info.paymentRails = fiat.allRails;
}
}
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.

P1 paymentRails is a response-only field

paymentRails is not part of the external account creation request schema. Every *ExternalAccountCreateInfo schema (e.g. UsdExternalAccountCreateInfo) extends *AccountInfoBase, and none of those base schemas include paymentRails. The field only appears in the response-side *AccountInfo schemas (e.g. UsdAccountInfo) that the API returns after creation.

Sending paymentRails inside accountInfo will either cause a 400 validation error or be silently ignored — either way it generates misleading example code for developers using this visualizer as a reference. The OpenAPI spec examples in customers_external_accounts.yaml also omit it from create request bodies.

Prompt To Fix With AI
This is a comment left during a code review.
Path: components/grid-visualizer/src/lib/code-generator.ts
Line: 51-57

Comment:
**`paymentRails` is a response-only field**

`paymentRails` is not part of the external account creation request schema. Every `*ExternalAccountCreateInfo` schema (e.g. `UsdExternalAccountCreateInfo`) extends `*AccountInfoBase`, and none of those base schemas include `paymentRails`. The field only appears in the response-side `*AccountInfo` schemas (e.g. `UsdAccountInfo`) that the API returns after creation.

Sending `paymentRails` inside `accountInfo` will either cause a 400 validation error or be silently ignored — either way it generates misleading example code for developers using this visualizer as a reference. The OpenAPI spec examples in `customers_external_accounts.yaml` also omit it from create request bodies.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

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.

0 participants