Skip to content

Conversation

@JasonCWang
Copy link
Contributor

No description provided.

Copy link
Contributor Author

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

@JasonCWang JasonCWang marked this pull request as ready for review January 26, 2026 21:33
@JasonCWang JasonCWang requested a review from shreyav January 26, 2026 21:33
@greptile-apps
Copy link

greptile-apps bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

Added support for four new regional account types (CAD, GBP, PHP, SGD) to achieve parity with Taza's supported payment methods.

Key changes:

  • Canadian accounts (CAD_ACCOUNT): Added validation for 3-digit institution numbers, 5-digit transit numbers, and 7-12 digit account numbers
  • UK accounts (GBP_ACCOUNT): Added validation for 6-digit sort codes (with optional hyphens) and 8-digit account numbers
  • Philippine accounts (PHP_ACCOUNT): Added support with bank name and account number (no format validation)
  • Singapore accounts (SGD_ACCOUNT): Added support with SWIFT/BIC code validation and bank name
  • IBAN enhancement: Added SWIFT/BIC pattern validation to existing IbanAccountInfo schema (addressing previous review feedback)

All new account types follow the established pattern:

  1. Base schema in openapi/components/schemas/common/ with account-specific fields
  2. External account wrapper in openapi/components/schemas/external_accounts/ with beneficiary information
  3. Proper discriminator mapping in ExternalAccountInfo.yaml
  4. Bundled schemas automatically generated in root openapi.yaml and mintlify/openapi.yaml

The implementations include appropriate pattern validation where banking standards are well-defined (CAD, GBP, SGD SWIFT codes), while omitting rigid patterns where formats vary significantly (PHP account numbers).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward OpenAPI schema additions that follow established patterns in the codebase. All new account types include proper validation patterns where appropriate, maintain consistency with existing account implementations, and successfully address previous review feedback by adding SWIFT/BIC validation. The bundled schemas are auto-generated and match the source files correctly.
  • No files require special attention

Important Files Changed

Filename Overview
openapi/components/schemas/common/CadAccountInfo.yaml Added Canadian account type with proper validation patterns for institution number, transit number, and account number
openapi/components/schemas/common/GbpAccountInfo.yaml Added UK account type with validation patterns for sort code (with optional hyphens) and 8-digit account number
openapi/components/schemas/common/PhpAccountInfo.yaml Added Philippine account type with bank name and account number (no pattern validation)
openapi/components/schemas/common/SgdAccountInfo.yaml Added Singapore account type with SWIFT/BIC code validation pattern matching IBAN standard
openapi/components/schemas/common/IbanAccountInfo.yaml Added SWIFT/BIC code pattern validation (previously requested in earlier review)
openapi/components/schemas/external_accounts/ExternalAccountInfo.yaml Registered all four new account types in discriminator mapping and oneOf union

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Grid API
    participant Validator as Schema Validator
    participant DB as Database

    Client->>API: POST /external-accounts
    Note over Client,API: accountType: CAD_ACCOUNT | GBP_ACCOUNT | PHP_ACCOUNT | SGD_ACCOUNT
    
    API->>Validator: Validate account info
    
    alt CAD Account
        Validator->>Validator: Validate bankCode pattern (3 digits)
        Validator->>Validator: Validate branchCode pattern (5 digits)
        Validator->>Validator: Validate accountNumber pattern (7-12 digits)
    else GBP Account
        Validator->>Validator: Validate sortCode pattern (6 digits with optional hyphens)
        Validator->>Validator: Validate accountNumber pattern (8 digits)
    else PHP Account
        Validator->>Validator: Validate bankName (required)
        Validator->>Validator: Validate accountNumber (required, no pattern)
    else SGD Account
        Validator->>Validator: Validate bankName (required)
        Validator->>Validator: Validate swiftCode pattern (SWIFT/BIC format)
        Validator->>Validator: Validate accountNumber (required)
    end
    
    Validator->>Validator: Validate beneficiary (INDIVIDUAL or BUSINESS)
    
    alt Validation Success
        Validator-->>API: Valid
        API->>DB: Store external account
        DB-->>API: Account created
        API-->>Client: 201 Created with account details
    else Validation Failure
        Validator-->>API: Invalid (pattern mismatch)
        API-->>Client: 400 Bad Request with validation error
    end
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@JasonCWang JasonCWang force-pushed the 01-26-add_additional_account_types_to_add_taza_parity branch from 20699b5 to 00952b4 Compare January 26, 2026 21:58
@JasonCWang JasonCWang force-pushed the 01-26-add_additional_account_types_to_add_taza_parity branch from 00952b4 to e47493e Compare January 27, 2026 00:24
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.

2 participants