-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add isPlatformAccount to PaymentInstructions and remove PaymentAccountOrWalletInfo refs #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add isPlatformAccount to PaymentInstructions and remove PaymentAccountOrWalletInfo refs #128
Conversation
Greptile OverviewGreptile SummaryThis PR successfully refactors the payment account schema architecture by removing the Key changes:
The refactoring maintains backward compatibility for the discriminator pattern in Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/common/PaymentInstructions.yaml | Added isPlatformAccount boolean field to distinguish between platform and customer accounts. Removed FBO Account from oneOf and discriminator mapping. |
| openapi/components/schemas/common/PaymentAccountOrWalletInfo.yaml | File deleted - removed base schema with discriminator pattern that was previously used for polymorphic account/wallet types. |
| openapi/components/schemas/common/PaymentLightningInvoiceInfo.yaml | Changed from allOf inheritance to standalone type: object, replaced enum with const for accountType, added missing type: string declaration. |
| openapi/components/schemas/common/PaymentFboAccountInfo.yaml | File deleted - FBO account type removed from payment instructions schema. |
| openapi/components/schemas/common/PaymentTronWalletInfo.yaml | Removed reference to PaymentAccountOrWalletInfo, replaced enum with const for assetType (USDT). |
| openapi/components/schemas/common/PaymentPolygonWalletInfo.yaml | Removed reference to PaymentAccountOrWalletInfo, replaced enum with const for assetType (USDC). |
| openapi/components/schemas/common/PaymentBaseWalletInfo.yaml | Removed reference to PaymentAccountOrWalletInfo, replaced enum with const for assetType (USDC). |
Sequence Diagram
sequenceDiagram
participant Client
participant API as Grid API
participant Schema as Payment Schema
Note over Client,Schema: Before: PaymentAccountOrWalletInfo Pattern
Client->>API: Request Payment Instructions
API->>Schema: Resolve PaymentAccountOrWalletInfo discriminator
Schema->>Schema: Check accountType discriminator
Schema->>Schema: Map to specific Payment* schema via allOf
Schema-->>API: Return polymorphic account info
API-->>Client: Payment instructions with account details
Note over Client,Schema: After: Simplified Inheritance Pattern
Client->>API: Request Payment Instructions
API->>Schema: Access PaymentInstructions with isPlatformAccount
Schema->>Schema: Resolve oneOf based on accountType
Schema->>Schema: Direct reference to base *Info schema
Schema-->>API: Return account info with const accountType
API-->>Client: Payment instructions with isPlatformAccount flag
a26b5f1 to
8e458b0
Compare
e11522c to
1ccf581
Compare
8e458b0 to
8f5820a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
Additional Comments (2)
Prompt To Fix With AIThis is a comment left during a code review.
Path: openapi/components/schemas/common/PaymentInstructions.yaml
Line: 41:55
Comment:
Missing `NGN_ACCOUNT` (Nigerian account) from discriminator mapping. The old `PaymentAccountOrWalletInfo` schema included NGN_ACCOUNT, but it's absent here. Add:
```suggestion
mapping:
CLABE: ../common/PaymentClabeAccountInfo.yaml
US_ACCOUNT: ../common/PaymentUsAccountInfo.yaml
PIX: ../common/PaymentPixAccountInfo.yaml
IBAN: ../common/PaymentIbanAccountInfo.yaml
FBO: ../common/PaymentFboAccountInfo.yaml
UPI: ../common/PaymentUpiAccountInfo.yaml
NGN_ACCOUNT: ../common/PaymentNgnAccountInfo.yaml
SPARK_WALLET: ../common/PaymentSparkWalletInfo.yaml
LIGHTNING: ../common/PaymentLightningInvoiceInfo.yaml
SOLANA_WALLET: ../common/PaymentSolanaWalletInfo.yaml
TRON_WALLET: ../common/PaymentTronWalletInfo.yaml
POLYGON_WALLET: ../common/PaymentPolygonWalletInfo.yaml
BASE_WALLET: ../common/PaymentBaseWalletInfo.yaml
```
How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix With AIThis is a comment left during a code review.
Path: openapi/components/schemas/common/PaymentInstructions.yaml
Line: 15:40
Comment:
Missing Nigerian Account from oneOf list. Add after UPI Account:
```suggestion
accountOrWalletInfo:
oneOf:
- title: CLABE Account
$ref: ../common/PaymentClabeAccountInfo.yaml
- title: US Bank Account
$ref: ../common/PaymentUsAccountInfo.yaml
- title: PIX Account
$ref: ../common/PaymentPixAccountInfo.yaml
- title: IBAN Account
$ref: ../common/PaymentIbanAccountInfo.yaml
- title: FBO Account
$ref: ../common/PaymentFboAccountInfo.yaml
- title: UPI Account
$ref: ../common/PaymentUpiAccountInfo.yaml
- title: NGN Account
$ref: ../common/PaymentNgnAccountInfo.yaml
- title: Spark Wallet
$ref: ../common/PaymentSparkWalletInfo.yaml
- title: Lightning Invoice
$ref: ../common/PaymentLightningInvoiceInfo.yaml
- title: Solana Wallet
$ref: ../common/PaymentSolanaWalletInfo.yaml
- title: Tron Wallet
$ref: ../common/PaymentTronWalletInfo.yaml
- title: Polygon Wallet
$ref: ../common/PaymentPolygonWalletInfo.yaml
- title: Base Wallet
$ref: ../common/PaymentBaseWalletInfo.yaml
```
How can I resolve this? If you propose a fix, please make it concise. |
8f5820a to
941bc27
Compare
1ccf581 to
10fa3eb
Compare
b9e7d56 to
13de662
Compare
| accountType: | ||
| const: FBO | ||
| example: FBO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this? wouldn't it serve the same purpose as the isPlatformAccount boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good catch. I'll remove PaymentFboAccount info from paymentInstructions and remove this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
Additional Comments (1)
Add the following to the Prompt To Fix With AIThis is a comment left during a code review.
Path: openapi/components/schemas/common/PaymentInstructions.yaml
Line: 15:55
Comment:
`PaymentNgnAccountInfo` is missing from the `oneOf` list and discriminator mapping. While `PaymentNgnAccountInfo.yaml` was updated to remove the `PaymentAccountOrWalletInfo` inheritance, it was not added to the `PaymentInstructions` schema's `accountOrWalletInfo` field.
Add the following to the `oneOf` list:
```suggestion
accountOrWalletInfo:
oneOf:
- title: CLABE Account
$ref: ../common/PaymentClabeAccountInfo.yaml
- title: US Bank Account
$ref: ../common/PaymentUsAccountInfo.yaml
- title: PIX Account
$ref: ../common/PaymentPixAccountInfo.yaml
- title: IBAN Account
$ref: ../common/PaymentIbanAccountInfo.yaml
- title: FBO Account
$ref: ../common/PaymentFboAccountInfo.yaml
- title: UPI Account
$ref: ../common/PaymentUpiAccountInfo.yaml
- title: NGN Account
$ref: ../common/PaymentNgnAccountInfo.yaml
- title: Spark Wallet
$ref: ../common/PaymentSparkWalletInfo.yaml
- title: Lightning Invoice
$ref: ../common/PaymentLightningInvoiceInfo.yaml
- title: Solana Wallet
$ref: ../common/PaymentSolanaWalletInfo.yaml
- title: Tron Wallet
$ref: ../common/PaymentTronWalletInfo.yaml
- title: Polygon Wallet
$ref: ../common/PaymentPolygonWalletInfo.yaml
- title: Base Wallet
$ref: ../common/PaymentBaseWalletInfo.yaml
discriminator:
propertyName: accountType
mapping:
CLABE: ../common/PaymentClabeAccountInfo.yaml
US_ACCOUNT: ../common/PaymentUsAccountInfo.yaml
PIX: ../common/PaymentPixAccountInfo.yaml
IBAN: ../common/PaymentIbanAccountInfo.yaml
FBO: ../common/PaymentFboAccountInfo.yaml
UPI: ../common/PaymentUpiAccountInfo.yaml
NGN_ACCOUNT: ../common/PaymentNgnAccountInfo.yaml
SPARK_WALLET: ../common/PaymentSparkWalletInfo.yaml
LIGHTNING: ../common/PaymentLightningInvoiceInfo.yaml
SOLANA_WALLET: ../common/PaymentSolanaWalletInfo.yaml
TRON_WALLET: ../common/PaymentTronWalletInfo.yaml
POLYGON_WALLET: ../common/PaymentPolygonWalletInfo.yaml
BASE_WALLET: ../common/PaymentBaseWalletInfo.yaml
```
How can I resolve this? If you propose a fix, please make it concise. |
…AccountOrWalletInfo refs
13de662 to
98da0bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment

TL;DR
Refactored payment account schemas to simplify the inheritance structure and added platform account identification.
What changed?
PaymentAccountOrWalletInfobase schema and its discriminator patternenumwithconstfor account types and asset types to improve type safetyClabeAccountInfoschema to a more logical position in the schema hierarchyisPlatformAccountboolean field toPaymentInstructionsto distinguish between platform and customer accountsNgnAccountInfoschema to maintain better organization