import { type CardFieldName, type CardMaterialStore } from './card-material.js'; import type { CardMaterialRedactor } from './card-redaction.js'; import type { CheckoutPageDriver } from './checkout-page.js'; import type { CheckoutRegistry } from './checkout-registry.js'; /** One field the caller wants filled, and where it is on the page. */ export interface CardFieldTarget { readonly field: CardFieldName; /** Opaque to this module: a snapshot ref, resolved by the driver. */ readonly target: string; } export interface FillCardRequest { readonly sessionId: string; readonly pageId: string; readonly targets: readonly CardFieldTarget[]; /** Some checkouts want `07/2029`, some want `07 / 29`. The caller saw the field. */ readonly expirySeparator?: string | undefined; readonly twoDigitYear?: boolean | undefined; } /** * The only thing that leaves this module. * * `filled` is a list of FIELD NAMES. There is deliberately no field on this * type that could hold a value, so a later change that wanted to echo one back * would have to add it and be seen doing so. */ export interface FillCardResult { readonly ok: boolean; readonly filled: readonly CardFieldName[]; readonly failedField: CardFieldName | null; readonly reason: string | null; } export declare class FillCardRefusal extends Error { readonly fix: string; constructor(message: string, fix: string); } export interface FillCardDeps { readonly registry: CheckoutRegistry; readonly cards: CardMaterialStore; readonly redactor: CardMaterialRedactor; readonly driver: CheckoutPageDriver; } /** * Read the stored card and type it into the page, or refuse. * * The order of operations is load-bearing and is not an implementation detail: * * check the decision ─┐ both before any material is read, so a refused fill * check the origin ─┘ never brings a card number into memory at all * read the material * ARM THE REDACTOR before the first keystroke, never after * type * * Arming before typing rather than after is the difference between a crash * mid-fill leaving redacted material and leaving readable material. A fill that * throws halfway has still put characters in the field. */ export declare function fillCard(request: FillCardRequest, deps: FillCardDeps): Promise; //# sourceMappingURL=fill-card.d.ts.map