import { a as CatalogSnapshot, c as CheckoutInput, d as OrdersSchema, f as PaymentProvider, h as StaleSplit, i as CatalogEntry, l as IntentStore, m as PricedLine, n as Cart, o as ChargeResult, p as PriceSnapshot, r as CartLine, s as CheckoutDeps, t as BuyerRef, u as Order } from "./types-C7NkGaAR.js";
import { reconcileStuckCharges } from "./reconcile/index.js";
import { Order as Order$1, OrderChargeConflictError, OrderIdempotencyConflictError, OrderNotFoundError, OrdersSchema as OrdersSchema$1, isOrderChargeConflictError, isOrderIdempotencyConflictError, isOrderNotFoundError } from "@platform-modules/commerce-orders";
import { VatRate } from "@platform-modules/tax/rates-table";
import { Cart as Cart$1 } from "@platform-modules/commerce-cart";
import { Querier } from "@platform-modules/db";
//#region src/errors.d.ts
type CheckoutValidationReason = 'EMPTY_CART' | 'STALE_ITEMS' | 'CURRENCY_MISMATCH' | 'INVALID_CHARGE_KEY' | 'UNKNOWN_COUNTRY' | 'INVALID_QTY';
declare class CheckoutValidationError extends Error {
  readonly reason: CheckoutValidationReason;
  readonly stale?: StaleSplit | undefined;
  readonly name = "CheckoutValidationError";
  readonly code: "CHECKOUT_VALIDATION";
  readonly httpStatus: 400 | 409 | 422;
  constructor(reason: CheckoutValidationReason, stale?: StaleSplit | undefined);
}
declare class OrderNotChargeableError extends Error {
  readonly orderId: string;
  readonly name = "OrderNotChargeableError";
  readonly code: "ORDER_NOT_CHARGEABLE";
  readonly httpStatus: 409;
  constructor(orderId: string);
}
declare class PaymentFailedError extends Error {
  readonly cause: unknown;
  readonly name = "PaymentFailedError";
  readonly code: "PAYMENT_FAILED";
  readonly httpStatus: 402;
  constructor(cause: unknown);
}
declare class FulfillmentIncompleteError extends Error {
  readonly context: {
    orderId: string;
    overall: 'partial' | 'unfulfillable';
    failures: {
      lineId: string;
      error: string;
    }[];
  };
  readonly name = "FulfillmentIncompleteError";
  readonly code: "FULFILLMENT_INCOMPLETE";
  readonly httpStatus: 500;
  constructor(context: {
    orderId: string;
    overall: 'partial' | 'unfulfillable';
    failures: {
      lineId: string;
      error: string;
    }[];
  });
}
declare function isCheckoutValidationError(e: unknown): e is CheckoutValidationError;
declare function isOrderNotChargeableError(e: unknown): e is OrderNotChargeableError;
declare function isPaymentFailedError(e: unknown): e is PaymentFailedError;
declare function isFulfillmentIncompleteError(e: unknown): e is FulfillmentIncompleteError;
//#endregion
//#region src/charge-key.d.ts
declare function buildChargeKey(orderId: string): string;
declare function parseOrderId(chargeKey: string): string;
//#endregion
//#region src/validate.d.ts
type ValidateCheckoutInput = {
  cart: Cart$1;
  catalog: CatalogSnapshot;
  currency: string;
  priceMode: 'inclusive' | 'exclusive';
  vatRate: VatRate;
};
type ValidateCheckoutResult = {
  ok: true;
  lines: PricedLine[];
} | {
  ok: false;
  error: 'EMPTY_CART' | 'STALE_ITEMS' | 'CURRENCY_MISMATCH' | 'INVALID_QTY';
  stale?: StaleSplit;
};
declare function validateCheckout(input: ValidateCheckoutInput): ValidateCheckoutResult;
//#endregion
//#region src/start.d.ts
declare function startCheckout<S extends OrdersSchema$1>(deps: CheckoutDeps<S>, input: CheckoutInput): Promise<{
  orderId: string;
  clientSecret?: string;
}>;
//#endregion
//#region src/settle.d.ts
declare function settleCheckout<S extends OrdersSchema$1>(deps: CheckoutDeps<S>, orderId: string, providerRef: string, providerAmount?: number): Promise<Order$1>;
//#endregion
//#region src/status.d.ts
declare function getCheckoutStatus<S extends OrdersSchema$1>(deps: CheckoutDeps<S>, orderId: string, buyerRef: {
  userId: string;
}): Promise<{
  status: Order$1['status'];
  clientSecret?: string;
}>;
//#endregion
//#region src/schema.d.ts
declare const checkoutSession: import("drizzle-orm/pg-core").PgTableWithColumns<{
  name: "checkout_session";
  schema: undefined;
  columns: {
    orderId: import("drizzle-orm/pg-core").PgColumn<{
      name: "order_id";
      tableName: "checkout_session";
      dataType: "string";
      columnType: "PgUUID";
      data: string;
      driverParam: string;
      notNull: true;
      hasDefault: false;
      isPrimaryKey: true;
      isAutoincrement: false;
      hasRuntimeDefault: false;
      enumValues: undefined;
      baseColumn: never;
      identity: undefined;
      generated: undefined;
    }, {}, {}>;
    clientSecret: import("drizzle-orm/pg-core").PgColumn<{
      name: "client_secret";
      tableName: "checkout_session";
      dataType: "string";
      columnType: "PgText";
      data: string;
      driverParam: string;
      notNull: true;
      hasDefault: false;
      isPrimaryKey: false;
      isAutoincrement: false;
      hasRuntimeDefault: false;
      enumValues: [string, ...string[]];
      baseColumn: never;
      identity: undefined;
      generated: undefined;
    }, {}, {}>;
    createdAt: import("drizzle-orm/pg-core").PgColumn<{
      name: "created_at";
      tableName: "checkout_session";
      dataType: "date";
      columnType: "PgTimestamp";
      data: Date;
      driverParam: string;
      notNull: true;
      hasDefault: true;
      isPrimaryKey: false;
      isAutoincrement: false;
      hasRuntimeDefault: false;
      enumValues: undefined;
      baseColumn: never;
      identity: undefined;
      generated: undefined;
    }, {}, {}>;
    updatedAt: import("drizzle-orm/pg-core").PgColumn<{
      name: "updated_at";
      tableName: "checkout_session";
      dataType: "date";
      columnType: "PgTimestamp";
      data: Date;
      driverParam: string;
      notNull: true;
      hasDefault: true;
      isPrimaryKey: false;
      isAutoincrement: false;
      hasRuntimeDefault: false;
      enumValues: undefined;
      baseColumn: never;
      identity: undefined;
      generated: undefined;
    }, {}, {}>;
  };
  dialect: "pg";
}>;
declare const checkoutSchema: {
  checkoutSession: import("drizzle-orm/pg-core").PgTableWithColumns<{
    name: "checkout_session";
    schema: undefined;
    columns: {
      orderId: import("drizzle-orm/pg-core").PgColumn<{
        name: "order_id";
        tableName: "checkout_session";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: true;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      clientSecret: import("drizzle-orm/pg-core").PgColumn<{
        name: "client_secret";
        tableName: "checkout_session";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      createdAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "created_at";
        tableName: "checkout_session";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      updatedAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "updated_at";
        tableName: "checkout_session";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
    };
    dialect: "pg";
  }>;
};
type CheckoutSchema = typeof checkoutSchema;
declare const checkoutDbSchema: {
  order: import("drizzle-orm/pg-core").PgTableWithColumns<{
    name: "order";
    schema: undefined;
    columns: {
      id: import("drizzle-orm/pg-core").PgColumn<{
        name: "id";
        tableName: "order";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: true;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      buyerUserId: import("drizzle-orm/pg-core").PgColumn<{
        name: "buyer_user_id";
        tableName: "order";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: false;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      buyerGuestEmail: import("drizzle-orm/pg-core").PgColumn<{
        name: "buyer_guest_email";
        tableName: "order";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: false;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      status: import("drizzle-orm/pg-core").PgColumn<{
        name: "status";
        tableName: "order";
        dataType: "string";
        columnType: "PgText";
        data: import("@platform-modules/commerce-orders").OrderStatus;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {
        $type: import("@platform-modules/commerce-orders").OrderStatus;
      }>;
      currency: import("drizzle-orm/pg-core").PgColumn<{
        name: "currency";
        tableName: "order";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      priceMode: import("drizzle-orm/pg-core").PgColumn<{
        name: "price_mode";
        tableName: "order";
        dataType: "string";
        columnType: "PgText";
        data: import("@platform-modules/commerce-orders").PriceMode;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {
        $type: import("@platform-modules/commerce-orders").PriceMode;
      }>;
      subtotal: import("drizzle-orm/pg-core").PgColumn<{
        name: "subtotal";
        tableName: "order";
        dataType: "bigint";
        columnType: "PgBigInt64";
        data: bigint;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      tax: import("drizzle-orm/pg-core").PgColumn<{
        name: "tax";
        tableName: "order";
        dataType: "bigint";
        columnType: "PgBigInt64";
        data: bigint;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      discount: import("drizzle-orm/pg-core").PgColumn<{
        name: "discount";
        tableName: "order";
        dataType: "bigint";
        columnType: "PgBigInt64";
        data: bigint;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      total: import("drizzle-orm/pg-core").PgColumn<{
        name: "total";
        tableName: "order";
        dataType: "bigint";
        columnType: "PgBigInt64";
        data: bigint;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      chargeRef: import("drizzle-orm/pg-core").PgColumn<{
        name: "charge_ref";
        tableName: "order";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: false;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      failureReason: import("drizzle-orm/pg-core").PgColumn<{
        name: "failure_reason";
        tableName: "order";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: false;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      idempotencyKey: import("drizzle-orm/pg-core").PgColumn<{
        name: "idempotency_key";
        tableName: "order";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      requestHash: import("drizzle-orm/pg-core").PgColumn<{
        name: "request_hash";
        tableName: "order";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      createdAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "created_at";
        tableName: "order";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      updatedAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "updated_at";
        tableName: "order";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
    };
    dialect: "pg";
  }>;
  orderLine: import("drizzle-orm/pg-core").PgTableWithColumns<{
    name: "order_line";
    schema: undefined;
    columns: {
      id: import("drizzle-orm/pg-core").PgColumn<{
        name: "id";
        tableName: "order_line";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: true;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      orderId: import("drizzle-orm/pg-core").PgColumn<{
        name: "order_id";
        tableName: "order_line";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      variantId: import("drizzle-orm/pg-core").PgColumn<{
        name: "variant_id";
        tableName: "order_line";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      kind: import("drizzle-orm/pg-core").PgColumn<{
        name: "kind";
        tableName: "order_line";
        dataType: "string";
        columnType: "PgText";
        data: import("@platform-modules/commerce-orders").ProductKind;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {
        $type: import("@platform-modules/commerce-orders").ProductKind;
      }>;
      qty: import("drizzle-orm/pg-core").PgColumn<{
        name: "qty";
        tableName: "order_line";
        dataType: "number";
        columnType: "PgInteger";
        data: number;
        driverParam: string | number;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      unitPrice: import("drizzle-orm/pg-core").PgColumn<{
        name: "unit_price";
        tableName: "order_line";
        dataType: "bigint";
        columnType: "PgBigInt64";
        data: bigint;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      lineTotal: import("drizzle-orm/pg-core").PgColumn<{
        name: "line_total";
        tableName: "order_line";
        dataType: "bigint";
        columnType: "PgBigInt64";
        data: bigint;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      vendorId: import("drizzle-orm/pg-core").PgColumn<{
        name: "vendor_id";
        tableName: "order_line";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: false;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      createdAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "created_at";
        tableName: "order_line";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
    };
    dialect: "pg";
  }>;
  vendorSplit: import("drizzle-orm/pg-core").PgTableWithColumns<{
    name: "vendor_split";
    schema: undefined;
    columns: {
      id: import("drizzle-orm/pg-core").PgColumn<{
        name: "id";
        tableName: "vendor_split";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: true;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      orderId: import("drizzle-orm/pg-core").PgColumn<{
        name: "order_id";
        tableName: "vendor_split";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      vendorId: import("drizzle-orm/pg-core").PgColumn<{
        name: "vendor_id";
        tableName: "vendor_split";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: false;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      amount: import("drizzle-orm/pg-core").PgColumn<{
        name: "amount";
        tableName: "vendor_split";
        dataType: "bigint";
        columnType: "PgBigInt64";
        data: bigint;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      funder: import("drizzle-orm/pg-core").PgColumn<{
        name: "funder";
        tableName: "vendor_split";
        dataType: "string";
        columnType: "PgText";
        data: "platform" | "vendor";
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {
        $type: "platform" | "vendor";
      }>;
      createdAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "created_at";
        tableName: "vendor_split";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
    };
    dialect: "pg";
  }>;
  orderStep: import("drizzle-orm/pg-core").PgTableWithColumns<{
    name: "order_step";
    schema: undefined;
    columns: {
      id: import("drizzle-orm/pg-core").PgColumn<{
        name: "id";
        tableName: "order_step";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: true;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      orderId: import("drizzle-orm/pg-core").PgColumn<{
        name: "order_id";
        tableName: "order_step";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      stepId: import("drizzle-orm/pg-core").PgColumn<{
        name: "step_id";
        tableName: "order_step";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      result: import("drizzle-orm/pg-core").PgColumn<{
        name: "result";
        tableName: "order_step";
        dataType: "json";
        columnType: "PgJsonb";
        data: unknown;
        driverParam: unknown;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      createdAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "created_at";
        tableName: "order_step";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
    };
    dialect: "pg";
  }>;
  refundIntent: import("drizzle-orm/pg-core").PgTableWithColumns<{
    name: "refund_intent";
    schema: undefined;
    columns: {
      id: import("drizzle-orm/pg-core").PgColumn<{
        name: "id";
        tableName: "refund_intent";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: true;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      orderId: import("drizzle-orm/pg-core").PgColumn<{
        name: "order_id";
        tableName: "refund_intent";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      seq: import("drizzle-orm/pg-core").PgColumn<{
        name: "seq";
        tableName: "refund_intent";
        dataType: "number";
        columnType: "PgInteger";
        data: number;
        driverParam: string | number;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      amount: import("drizzle-orm/pg-core").PgColumn<{
        name: "amount";
        tableName: "refund_intent";
        dataType: "bigint";
        columnType: "PgBigInt64";
        data: bigint;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      status: import("drizzle-orm/pg-core").PgColumn<{
        name: "status";
        tableName: "refund_intent";
        dataType: "string";
        columnType: "PgText";
        data: "pending" | "failed" | "executed";
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {
        $type: "pending" | "failed" | "executed";
      }>;
      refundKey: import("drizzle-orm/pg-core").PgColumn<{
        name: "refund_key";
        tableName: "refund_intent";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      providerRef: import("drizzle-orm/pg-core").PgColumn<{
        name: "provider_ref";
        tableName: "refund_intent";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: false;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      createdAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "created_at";
        tableName: "refund_intent";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      updatedAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "updated_at";
        tableName: "refund_intent";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
    };
    dialect: "pg";
  }>;
  checkoutSession: import("drizzle-orm/pg-core").PgTableWithColumns<{
    name: "checkout_session";
    schema: undefined;
    columns: {
      orderId: import("drizzle-orm/pg-core").PgColumn<{
        name: "order_id";
        tableName: "checkout_session";
        dataType: "string";
        columnType: "PgUUID";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: true;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      clientSecret: import("drizzle-orm/pg-core").PgColumn<{
        name: "client_secret";
        tableName: "checkout_session";
        dataType: "string";
        columnType: "PgText";
        data: string;
        driverParam: string;
        notNull: true;
        hasDefault: false;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: [string, ...string[]];
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      createdAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "created_at";
        tableName: "checkout_session";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
      updatedAt: import("drizzle-orm/pg-core").PgColumn<{
        name: "updated_at";
        tableName: "checkout_session";
        dataType: "date";
        columnType: "PgTimestamp";
        data: Date;
        driverParam: string;
        notNull: true;
        hasDefault: true;
        isPrimaryKey: false;
        isAutoincrement: false;
        hasRuntimeDefault: false;
        enumValues: undefined;
        baseColumn: never;
        identity: undefined;
        generated: undefined;
      }, {}, {}>;
    };
    dialect: "pg";
  }>;
};
type CheckoutDbSchema = typeof checkoutDbSchema;
//#endregion
//#region src/migrate.d.ts
declare class CheckoutMigrateError extends Error {
  readonly detail: string;
  readonly name = "CheckoutMigrateError";
  readonly code: "CHECKOUT_MIGRATE";
  constructor(detail: string);
}
declare function isCheckoutMigrateError(e: unknown): e is CheckoutMigrateError;
declare function pushSchema(db: Querier<CheckoutSchema>): Promise<void>;
//#endregion
export { type BuyerRef, type Cart, type CartLine, type CatalogEntry, type CatalogSnapshot, type ChargeResult, type CheckoutDbSchema, type CheckoutDeps, type CheckoutInput, CheckoutMigrateError, type CheckoutSchema, CheckoutValidationError, type CheckoutValidationReason, FulfillmentIncompleteError, type IntentStore, type Order, OrderChargeConflictError, OrderIdempotencyConflictError, OrderNotChargeableError, OrderNotFoundError, type OrdersSchema, PaymentFailedError, type PaymentProvider, type PriceSnapshot, type PricedLine, type StaleSplit, type ValidateCheckoutInput, type ValidateCheckoutResult, buildChargeKey, checkoutDbSchema, checkoutSchema, checkoutSession, getCheckoutStatus, isCheckoutMigrateError, isCheckoutValidationError, isFulfillmentIncompleteError, isOrderChargeConflictError, isOrderIdempotencyConflictError, isOrderNotChargeableError, isOrderNotFoundError, isPaymentFailedError, parseOrderId, pushSchema, reconcileStuckCharges, settleCheckout, startCheckout, validateCheckout };