import { APIResource } from "../core/resource.mjs"; import { APIPromise } from "../core/api-promise.mjs"; import { CursorPagination, type CursorPaginationParams, PagePromise } from "../core/pagination.mjs"; import { RequestOptions } from "../internal/request-options.mjs"; export declare class Orders extends APIResource { /** * Retrieve an order by id. */ retrieve(id: string, options?: RequestOptions): APIPromise; /** * List orders for the authenticated developer with cursor-based pagination. */ list(query?: OrderListParams | null | undefined, options?: RequestOptions): PagePromise; /** * Request cancellation of an order. * * Order cancellations are subject to each merchant's cancellation policy. */ cancel(id: string, body: OrderCancelParams, options?: RequestOptions): APIPromise; } export type OrdersCursorPagination = CursorPagination; export type Cancellation = Cancellation.RequestedCancellation | Cancellation.CompletedCancellation | Cancellation.DeniedCancellation; export declare namespace Cancellation { interface RequestedCancellation { id: string; checkoutIntentId: string; createdAt: string; marketplaceOrderId: string; reason: RequestedCancellation.Reason; state: 'requested'; } namespace RequestedCancellation { interface Reason { code: 'requested_by_customer' | 'fraud' | 'inventory' | 'payment_issue' | 'staff_error' | 'other'; /** * Optional free-text note explaining the cancellation, forwarded to the merchant * when possible. */ message?: string; } } interface CompletedCancellation { id: string; checkoutIntentId: string; createdAt: string; marketplaceOrderId: string; reason: CompletedCancellation.Reason; state: 'completed'; } namespace CompletedCancellation { interface Reason { code: 'requested_by_customer' | 'fraud' | 'inventory' | 'payment_issue' | 'staff_error' | 'other'; /** * Optional free-text note explaining the cancellation, forwarded to the merchant * when possible. */ message?: string; } } interface DeniedCancellation { id: string; checkoutIntentId: string; createdAt: string; denialReason: DeniedCancellation.DenialReason; marketplaceOrderId: string; reason: DeniedCancellation.Reason; state: 'denied'; } namespace DeniedCancellation { interface DenialReason { code: 'other' | 'already_shipped' | 'non_cancellable_item' | 'cancellation_window_expired'; message: string; } interface Reason { code: 'requested_by_customer' | 'fraud' | 'inventory' | 'payment_issue' | 'staff_error' | 'other'; /** * Optional free-text note explaining the cancellation, forwarded to the merchant * when possible. */ message?: string; } } } /** * Represents a completed order. Orders are created after a checkout intent reaches * the `completed` state. */ export interface Order { id: string; /** * The cancellation for this order, or `null` if none has been requested. Populated * by joining the separate cancellations collection on the order's marketplace * order id. */ cancellation: Cancellation | null; /** * ID of the checkout intent that was responsible for creating this order. */ checkoutIntentId: string; /** * Timestamp the order was persisted to Rye. */ createdAt: string; /** * Timestamp the order was last updated at */ updatedAt: string; /** * The `referenceId` you supplied on the checkout intent, echoed back so you can * reconcile this order against your own records. Absent when none was supplied. */ referenceId?: string; } export interface OrderListParams extends CursorPaginationParams { } export interface OrderCancelParams { reason: OrderCancelParams.Reason; } export declare namespace OrderCancelParams { interface Reason { code: 'requested_by_customer' | 'fraud' | 'inventory' | 'payment_issue' | 'staff_error' | 'other'; /** * Optional free-text note explaining the cancellation, forwarded to the merchant * when possible. */ message?: string; } } export declare namespace Orders { export { type Cancellation as Cancellation, type Order as Order, type OrdersCursorPagination as OrdersCursorPagination, type OrderListParams as OrderListParams, type OrderCancelParams as OrderCancelParams, }; } //# sourceMappingURL=orders.d.mts.map