import React, { FC } from 'react'; import { PaymentDetails } from './AccountPayment.model'; export interface PaymentMethodProps { id: string; activeTab?: number; externalId?: string | number; /** * Currently unused at this level — kept for API compatibility with V1 and * existing back-office consumers that already pass it. * * NOTE: not to be confused with the `paymentAccounts` variable inside * `CreditCardForm` / `BankAccountForm`, which is the locally fetched * saved-tokens list and is unrelated to this prop. */ paymentAccounts?: any[]; paymentDetails: PaymentDetails; bankAccountTypes?: any[]; loading: boolean; onTabChange: (event: React.ChangeEvent<{}>, paymentMethodTab: any) => void; onFormStatusChange?: (paymentFormResult: any) => void; onSubmitCompleted?: (event: React.FormEvent | null, result: any) => void; submit?: (event: React.FormEvent) => void; presetDataRequest: (formData: any, paymentMethod: any, isHostedPayment: boolean) => any; children?: React.ReactNode; childrenPosition?: "before" | "after" | "outside"; actionLabel?: string; render?: React.ReactNode | ((params: any) => React.ReactNode); /** * Whether to show the "Sandbox / test mode" banner when the active payment * vendor connection is in non-live mode. Defaults to `true` to preserve the * behaviour back-office consumers rely on. Payer-facing flows (e.g. the * standalone invoice page) should pass `false`. */ showSandboxBanner?: boolean; /** * S2S bearer token obtained by the consuming application via Unity Keeper. * When present the component operates in S2S mode: all Payment Portal API * calls use the `/S2S` endpoint variants and this token as the Authorization * header instead of the Unity user session token. */ s2sToken?: string; /** Tenant ID required alongside `s2sToken` for S2S mode API calls. */ s2sTenantId?: string; /** * Called at the start of submit to obtain a fresh S2S token. Payment-link * tokens can be very short-lived (observed TTL: 60s), so a token minted at * page load is often already expired by the time the payer submits. When * provided, the returned token is used for the submit-path API calls; * on failure the existing token is kept as a fallback. */ refreshS2sToken?: () => Promise; /** * Whether the manual entry forms (card, eCheck) offer the "save this * method" checkbox. Defaults to `true` for account-connected flows. * Guest/standalone flows (e.g. the invoice payment link) should pass * `false` — there is no user account to save the method to. */ allowSavePaymentMethod?: boolean; /** * Visual style of the payment-method picker shown when more than one * method is enabled. Defaults to 'radio'. */ methodPicker?: 'radio' | 'tabs'; /** * Rendered at the start of the action row, before the submit button. * Lets hosts (e.g. a stepper) place secondary actions like "Back" in the * same row as the pay button instead of a second, disconnected button row. */ actionsStart?: React.ReactNode; /** * Notifies the host when payment processing starts (true) and settles * (false). Lets an external submit button — connected via the form * registry (``) when no `submit` prop * is passed — mirror the internal button's loading/disabled behaviour. */ onSubmittingChange?: (submitting: boolean) => void; /** * Notifies the host whether a submit can currently succeed — false while * method discovery is in flight, when no payable method exists, or in * hosted-iframe mode until the vendor iframe reports a token. Lets an * external submit button mirror the internal button's disabled state. */ onReadyChange?: (ready: boolean) => void; } /** * PaymentForm Component * * This component provides a user interface for selecting and handling different payment methods. * It allows users to switch between available payment methods using tabs and handles the form submission process. * Each payment method has its own form component that is displayed based on the selected tab. * * Props: * @param {PaymentMethodProps} props - Object containing the following properties: * @param {string} id - Unique identifier for the payment form. * @param {number} [activeTab=0] - The index of the currently active tab. Defaults to 0. [OPTIONAL] * @param {any[]} [paymentAccounts] - Array of payment accounts associated with the user. [OPTIONAL] * @param {PaymentDetails} paymentDetails - Object containing details about the customer's payment information. * @param {any[]} [bankAccountTypes=DEFAULT_ACCOUNT_TYPES] - Array of available bank account types, with a default value. * @param {boolean} loading - Boolean flag indicating if asynchronous operations like data fetching are in progress. * @param {Function} onTabChange - Function to be called when the active tab changes. * @param {Function} [onFormStatusChange] - Optional function to handle status changes during form interactions. * @param {Function} [onSubmitCompleted] - Optional function to be called upon successful form submission. * @param {Function} presetDataRequest - Function to prepare the data request for payment processing. * @param {Function} [submit] - Optional function to be called on form submission. * @param {any} [children] - Optional elements to be rendered inside the form. * @param {"before" | "after" | "outside"} [childrenPosition="before"] - Position of the children elements relative to the form. * @param {string} [actionLabel] - Optional label for the form action button. * @param {any} [render] - Optional render function for custom rendering inside the component. * * Usage: * The component renders tabs to switch between different payment methods and handles form interactions * for submitting payments. It integrates with Material-UI components to render the form and uses React hooks * for managing state, such as the currently active tab and form interaction data. * * The component uses the `useMemo` hook to optimize rendering performance and to handle the memoization of * computed payment fields. It ensures that the form submission process is smooth, even for hosted payments. * * Each payment method form (e.g., CreditCardForm, eCheckForm, etc.) is conditionally rendered based on the * currently selected payment method, ensuring a consistent user experience. * * Example: * * * Note: * This component should be used within a React environment that supports hooks and functional components. * It relies on Material-UI for UI components and theming. */ export declare const PaymentForm: FC; //# sourceMappingURL=PaymentForm.d.ts.map