import type { JsonObject } from "@decionis/agent-safe-pipeline"; import type { AdapterExecutionResult } from "../AdapterActionHandler.js"; import type { PreparedAction } from "../EffectAdapter.js"; import type { RegisteredEffect } from "../EffectEvidenceRegister.js"; import { type CardAuthorizationRequest, type CardAuthorizationResult, type CardPurchase } from "./CardPurchase.js"; export declare const CARD_EFFECT_TYPE = "CARD_PURCHASE_AUTHORIZATION"; /** * What a card purchase asks for, as a projection the authority binds its * grant to: this card, at this merchant (and category, when one was named), * in this currency, for at most this amount. The amount is a ceiling, which * is why the field says so: an issuer may authorise less than was approved, * and an authorization that stayed inside the ceiling is the authorised * effect, exactly. */ export declare function cardExpectedEffect(purchase: CardPurchase): JsonObject; /** The family's `prepare`: pure, reaching nothing, and the digests the intent is bound to. */ export declare function prepareCardPurchase(purchase: CardPurchase): PreparedAction; export interface CardResultInput { readonly purchase: CardPurchase; readonly prepared: PreparedAction; readonly authorization: CardAuthorizationRequest; readonly result: CardAuthorizationResult; /** The claim's lease had closed when the result arrived: nothing about it can be recorded as known. */ readonly leaseExpired: boolean; readonly observer: { readonly id: string; readonly version: string; }; readonly correlationId: string; readonly idempotencyKey: string; readonly observedAt: string; } /** * The effect record for one card authorization, from what the issuer said * about it. An approval is observed as the issuer stated it: the card, * merchant, category and currency of the authorization it matched, and the * ceiling, which held if the approved amount is at or below it and is the * approved amount itself if it is not, so an issuer that approved more than * was authorised is a mismatch on exactly that field. A decline is a * refusal, and a result after the lease is indeterminate whatever it says, * because the authority stopped accepting a commit for this claim. */ export declare function cardResultRecord(input: CardResultInput): RegisteredEffect; /** * The record in the shape the response's effect block is read from, the * same shape an adapter's handler returns; its outcome may also be * `INDETERMINATE`, which a handler reports by throwing instead. */ export declare function cardExecutionResult(record: RegisteredEffect): Omit & { readonly outcome: RegisteredEffect["outcome"]; }; //# sourceMappingURL=CardEffect.d.ts.map