Skip to content

Commit 37216cc

Browse files
npslaneyclaude
andcommitted
feat(api-contract): add list method to checkout contract
Add pagination-based list endpoint for checkouts with optional status filter. This merges the MCP checkouts.list functionality into the unified checkout contract. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6d00698 commit 37216cc

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

src/contracts/checkout.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { oc } from "@orpc/contract";
22
import { z } from "zod";
33
import { CheckoutSchema } from "../schemas/checkout";
44
import { CurrencySchema } from "../schemas/currency";
5+
import {
6+
PaginationInputSchema,
7+
PaginationOutputSchema,
8+
} from "../schemas/pagination";
59

610
/**
711
* Helper to treat empty strings as undefined (not provided).
@@ -142,10 +146,32 @@ export const paymentReceivedContract = oc
142146
.input(PaymentReceivedInputSchema)
143147
.output(z.object({ ok: z.boolean() }));
144148

149+
// List checkouts schemas
150+
const CheckoutStatusSchema = z.enum([
151+
"UNCONFIRMED",
152+
"CONFIRMED",
153+
"PENDING_PAYMENT",
154+
"PAYMENT_RECEIVED",
155+
"EXPIRED",
156+
]);
157+
158+
const ListCheckoutsInputSchema = PaginationInputSchema.extend({
159+
status: CheckoutStatusSchema.optional(),
160+
});
161+
162+
const ListCheckoutsOutputSchema = PaginationOutputSchema.extend({
163+
checkouts: z.array(CheckoutSchema),
164+
});
165+
166+
export const listCheckoutsContract = oc
167+
.input(ListCheckoutsInputSchema)
168+
.output(ListCheckoutsOutputSchema);
169+
145170
export const checkout = {
146171
get: getCheckoutContract,
147172
create: createCheckoutContract,
148173
confirm: confirmCheckoutContract,
149174
registerInvoice: registerInvoiceContract,
150175
paymentReceived: paymentReceivedContract,
176+
list: listCheckoutsContract,
151177
};

0 commit comments

Comments
 (0)