Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ grid receiver lookup-account <accountId>

```bash
# List cards
grid cards list [--cardholder-id <id>] [--state ACTIVE]
grid cards list [--customer-id <id>] [--state ACTIVE]

# Get a card
grid cards get <cardId>

# Issue a virtual card
grid cards create \
--cardholder-id <customerId> \
--customer-id <customerId> \
--funding-sources "InternalAccount:1,InternalAccount:2" \
--max-spend-per-transaction 5000

Expand Down
10 changes: 5 additions & 5 deletions cli/src/commands/cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { parseList } from "../parse";

interface Card {
id: string;
cardholderId: string;
customerId: string;
platformCardId?: string;
state: "PENDING_KYC" | "PROCESSING" | "ACTIVE" | "FROZEN" | "CLOSED";
form: "VIRTUAL";
Expand Down Expand Up @@ -48,7 +48,7 @@ export function registerCardsCommand(
cardsCmd
.command("list")
.description("List cards")
.option("--cardholder-id <id>", "Filter by cardholder (customer) ID")
.option("--customer-id <id>", "Filter by customer ID")
.option("--account-id <id>", "Filter by a bound funding-source account ID")
.option("--platform-card-id <id>", "Filter by platform card ID")
.option("--state <state>", "Filter by state (PENDING_KYC, PROCESSING, ACTIVE, FROZEN, CLOSED)")
Expand All @@ -68,7 +68,7 @@ export function registerCardsCommand(
}

const params: Record<string, string | number | undefined> = {
cardholderId: options.cardholderId,
customerId: options.customerId,

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 Server rollout breaks commands

If this CLI change is merged or released before the server update, cards list --customer-id sends a query parameter the current server rejects, while cards create --customer-id sends customerId instead of the required cardholderId at line 121. Both commands therefore fail against the current server. Coordinate the server rollout or retain temporary compatibility until server support lands.

Knowledge Base Used:

Prompt To Fix With AI
This is a comment left during a code review.
Path: cli/src/commands/cards.ts
Line: 71

Comment:
**Server rollout breaks commands**

If this CLI change is merged or released before the server update, `cards list --customer-id` sends a query parameter the current server rejects, while `cards create --customer-id` sends `customerId` instead of the required `cardholderId` at line 121. Both commands therefore fail against the current server. Coordinate the server rollout or retain temporary compatibility until server support lands.

**Knowledge Base Used:**
- [Grid command-line client](https://app.greptile.com/lightspark/-/custom-context/knowledge-base/lightsparkdev/grid-api/-/docs/grid-cli.md)
- [Client integration tooling](https://app.greptile.com/lightspark/-/custom-context/knowledge-base/lightsparkdev/grid-api/-/docs/client-integrations.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

accountId: options.accountId,
platformCardId: options.platformCardId,
state: options.state,
Expand Down Expand Up @@ -96,7 +96,7 @@ export function registerCardsCommand(
cardsCmd
.command("create")
.description("Issue a card")
.requiredOption("--cardholder-id <id>", "Cardholder (customer) ID")
.requiredOption("--customer-id <id>", "Customer ID")
.requiredOption("--funding-sources <list>", "Comma-separated internal account IDs, in priority order")
.option("--form <form>", "Card form (VIRTUAL)", "VIRTUAL")
.option("--platform-card-id <id>", "Your platform's identifier for the card")
Expand All @@ -118,7 +118,7 @@ export function registerCardsCommand(
}

const body: Record<string, unknown> = {
cardholderId: options.cardholderId,
customerId: options.customerId,
form: options.form,
fundingSources,
};
Expand Down
12 changes: 6 additions & 6 deletions cli/test/cards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ describe("cards list", () => {
const { request } = await runCli([
"cards",
"list",
"--cardholder-id",
"--customer-id",
"Customer:abc",
"--state",
"ACTIVE",
]);

expect(request?.path).toBe("/grid/v1/cards");
expect(request?.query).toMatchObject({
cardholderId: "Customer:abc",
customerId: "Customer:abc",
state: "ACTIVE",
});
});
Expand All @@ -25,7 +25,7 @@ describe("cards create", () => {
const { request } = await runCli([
"cards",
"create",
"--cardholder-id",
"--customer-id",
"Customer:abc",
"--funding-sources",
"InternalAccount:1,InternalAccount:2",
Expand All @@ -34,7 +34,7 @@ describe("cards create", () => {
expect(request?.method).toBe("POST");
expect(request?.path).toBe("/grid/v1/cards");
expect(request?.body).toMatchObject({
cardholderId: "Customer:abc",
customerId: "Customer:abc",
form: "VIRTUAL",
fundingSources: ["InternalAccount:1", "InternalAccount:2"],
});
Expand All @@ -44,7 +44,7 @@ describe("cards create", () => {
const { request } = await runCli([
"cards",
"create",
"--cardholder-id",
"--customer-id",
"Customer:abc",
"--funding-sources",
"InternalAccount:1",
Expand All @@ -60,7 +60,7 @@ describe("cards create", () => {
runCli([
"cards",
"create",
"--cardholder-id",
"--customer-id",
"Customer:abc",
"--funding-sources",
"InternalAccount:1",
Expand Down
Loading