import type { AgentbankMerchant } from '../client.js'; import type { Paginated } from '../types.js'; export type OrderStatus = 'paid' | 'pending_payment' | 'refunded' | 'disputed' | 'canceled'; export type OrderFilters = { status?: OrderStatus; protocol?: string; currency?: string; /** ISO timestamp lower bound (inclusive). */ from?: string; /** ISO timestamp upper bound (inclusive). */ to?: string; limit?: number; offset?: number; }; export type MerchantOrder = { id: string; paymentIntentId: string; curlessMerchantId: string; protocol: string; mode: string; amount: number; currency: string; status: OrderStatus; lineItems: Array<{ id: string; name: string; quantity: number; unitPrice: number; }>; rail?: string | null; railReference?: string | null; network?: string | null; refundedAmount?: number; createdAt: string; }; export type OrderSummary = { merchantId: string; mode: string; count: number; byCurrency: Array<{ currency: string; count: number; totalAmount: number; }>; byProtocol: Array<{ protocol: string; count: number; }>; byStatus: Array<{ status: OrderStatus; count: number; }>; }; export type RefundRequestStatus = 'requested' | 'rejected' | 'approved' | 'refunded' | 'failed'; /** * A refund request, as the API returns it. * * ⚠️ NARROWER THAN THE ROW, deliberately. `paymentIntentId`, * `curlessMerchantId`, `mode`, `curlessRef` and the two `…By` actors were * declared here and returned by the API; every one of them either identifies a * credential, names the payment provider's own reference, or is an internal key. * They reach a model's context through the merchant connectors, and OpenAI's app * review rejected exactly that. They are gone from the API, so they are gone * from the type — a type that promises a field the server no longer sends is * worse than no type. */ export type RefundRequest = { id: string; amount: number; currency: string; status: RefundRequestStatus; /** Free text, written by whoever asked for the refund. */ reason?: string | null; /** Free text, written by the merchant when deciding. */ decisionNote?: string | null; createdAt: string; updatedAt: string; decidedAt?: string | null; }; export declare class OrdersResource { private readonly client; constructor(client: AgentbankMerchant); private merchant; list(filters?: OrderFilters, merchantId?: string): Promise>; get(orderId: string, merchantId?: string): Promise<{ merchantId: string; mode: string; order: MerchantOrder; payment: unknown; }>; summary(filters?: Omit, merchantId?: string): Promise; /** This merchant's refund queue (filter by status, e.g. 'requested'). */ listRefundRequests(filters?: { status?: RefundRequestStatus; }, merchantId?: string): Promise<{ merchantId: string; mode: string; refundRequests: RefundRequest[]; }>; /** Approve a buyer's refund request → forwarded to Curless. */ approveRefund(refundRequestId: string, merchantId?: string): Promise<{ refundRequest: RefundRequest; }>; /** Reject a buyer's refund request (optional note). */ rejectRefund(refundRequestId: string, opts?: { note?: string; }, merchantId?: string): Promise<{ refundRequest: RefundRequest; }>; /** Merchant-initiated direct refund on an order (no buyer request needed). */ refund(orderId: string, opts?: { amount?: number; reason?: string; }, merchantId?: string): Promise<{ refundRequest: RefundRequest; }>; /** * The one-time card UnionPay issued for a payment, for YOUR system to charge * (a hotel's card-guarantee booking, say). TEST MODE ONLY until PCI is * decided - a live key gets 403. * * ⚠️ GIVEN ONCE. The gateway deletes its copy as it answers; a second call is * 410. Hand the card on in the same breath and drop it: never store it, never * log more than `lastFour`. If this call fails in transit after the gateway * answered, the card is gone - the payment cannot proceed, and the guest * confirms again on UnionPay. No security code is returned. */ releaseUaagCredential(paymentIntentId: string, merchantId?: string): Promise; /** * You do not want this payment's one-time UnionPay card - say so when you * void the order. The gateway deletes it now if it holds one, and never * hands over one UnionPay issues later (the guest may still confirm). Safe to * call more than once; `released` means it was already handed to you. */ discardUaagCredential(paymentIntentId: string, merchantId?: string): Promise<{ state: 'discarded' | 'not-issued-yet' | 'released'; deletedNow: boolean; }>; } /** A one-time UnionPay card, as the gateway hands it over - once. */ export type UaagOneTimeCard = { /** A UnionPay token in a card number's shape. */ cardNumber: string; /** Two digits, "01"-"12". */ expMonth: string; /** Four digits. */ expYear: string; lastFour: string; }; //# sourceMappingURL=orders.d.ts.map