import { type FormMetadata, type PaymentFieldComponent } from '@defra/forms-model'; import { type ObjectSchema } from 'joi'; import { FormComponent } from '~/src/server/plugins/engine/components/FormComponent.js'; import { type PaymentState } from '~/src/server/plugins/engine/components/PaymentField.types.js'; import { type FormContext, type FormRequestPayload, type FormResponseToolkit } from '~/src/server/plugins/engine/types/index.js'; import { type ErrorMessageTemplateList, type FormPayload, type FormState, type FormStateValue, type FormSubmissionError, type FormSubmissionState, type PaymentExternalArgs } from '~/src/server/plugins/engine/types.js'; export declare class PaymentField extends FormComponent { options: PaymentFieldComponent['options']; formSchema: ObjectSchema; stateSchema: ObjectSchema; isAppendageStateSingleObject: boolean; constructor(def: PaymentFieldComponent, props: ConstructorParameters[1]); /** * Gets the PaymentState from form submission state */ getPaymentStateFromState(state: FormSubmissionState): PaymentState | undefined; getDisplayStringFromState(state: FormSubmissionState): string; getViewModel(payload: FormPayload, errors?: FormSubmissionError[]): { amount: string; description: string; paymentState: PaymentState | undefined; label: { text: string; }; id: string; name: string; value: import("~/src/server/plugins/engine/types.js").FormValue; type?: string; hint?: { id?: string; text: string; }; prefix?: import("~/src/server/plugins/engine/types/index.js").ComponentText; suffix?: import("~/src/server/plugins/engine/types/index.js").ComponentText; classes?: string; condition?: string; errors?: FormSubmissionError[]; errorMessage?: { text: string; }; summaryHtml?: string; html?: string; attributes: { autocomplete?: string; maxlength?: number; multiple?: string; accept?: string; inputmode?: string; }; content?: import("~/src/server/plugins/engine/types/index.js").Content | import("~/src/server/plugins/engine/types/index.js").Content[] | string; maxlength?: number; maxwords?: number; rows?: number; items?: import("~/src/server/plugins/engine/types/index.js").ListItem[] | import("~/src/server/plugins/engine/types/index.js").DateInputItem[]; fieldset?: { attributes?: string | Record; legend?: import("~/src/server/plugins/engine/types/index.js").Label; }; formGroup?: { classes?: string; attributes?: string | Record; }; showFieldsetError?: boolean; components?: import("~/src/server/plugins/engine/types/index.js").ComponentViewModel[]; upload?: { count: number; summaryList: import("~/src/server/plugins/engine/types.js").SummaryList; }; }; /** * Type guard to check if value is PaymentState */ isPaymentState(value: unknown): value is PaymentState; /** * Static type guard to check if value is PaymentState */ static isPaymentState(value: unknown): value is PaymentState; /** * Override base isState to validate PaymentState */ isState(value?: FormStateValue | FormState): value is FormState; getFormValue(value?: FormStateValue | FormState): NonNullable | undefined; getContextValueFromState(state: FormSubmissionState): string; /** * For error preview page that shows all possible errors on a component */ getAllPossibleErrors(): ErrorMessageTemplateList; /** * Static version of getAllPossibleErrors that doesn't require a component instance. */ static getAllPossibleErrors(): ErrorMessageTemplateList; /** * Dispatcher for external redirect to GOV.UK Pay */ static dispatcher(request: FormRequestPayload, h: FormResponseToolkit, args: PaymentExternalArgs): Promise; /** * Called on form submission to capture the payment * @see https://docs.payments.service.gov.uk/delayed_capture/#delay-taking-a-payment */ onSubmit(request: FormRequestPayload, _metadata: FormMetadata, context: FormContext): Promise; /** * Updates payment state to mark capture as successful * This ensures we don't try to re-capture on submission retry */ private markPaymentCaptured; } /** * Session data stored when dispatching to GOV.UK Pay */ export interface PaymentSessionData { uuid: string; formId: string; reference: string; amount: number; description: string; paymentId: string; componentName: string; returnUrl: string; failureUrl: string; isLivePayment: boolean; }