import type { ReactNode, FC, ForwardRefExoticComponent, RefAttributes } from "react"; import type { PaymentGateway } from "../helpers"; import type { PersonInterface, QuestionInterface } from "@churchapps/helpers"; import type { PaperProps } from "@mui/material/Paper"; /** Uniform token from any provider's payment widget; id is provider's reference (PM id/nonce/order). */ export interface PaymentToken { id: string; type: "card" | "bank" | "paypal"; saved?: boolean; brand?: string; last4?: string; expMonth?: string; expYear?: string; customerId?: string; } /** All payload builder context for a gift in flight; funds compact for all providers. */ export interface ChargeContext { provider: string; gatewayId?: string; churchId: string; amount: number; funds: { id: string; amount: number; }[]; person: { id: string; email: string; name: string; }; notes?: string; church: { name: string; subDomain: string; churchURL: string; logo: string; }; recurring: boolean; interval?: { interval_count: number; interval: string; }; billingCycleAnchor?: number; saveCard?: boolean; captchaPass?: string; customerId?: string; currency?: string; } export interface ChargeRequest { endpoint: "/donate/charge" | "/donate/subscribe"; body: any; } export interface FinalizeResult { result: any; requiresAction?: boolean; success?: boolean; error?: string; } export interface ProviderCapabilities { savedCard: boolean; savedBank: boolean; guestAch: boolean; memberNewCard: boolean; recurring: boolean; editRecurring: boolean; pauseRecurring?: boolean; implicitSaveOnTokenize?: boolean; } export interface ProviderDescriptor { adminValue: string; label: string; keyLabels: { public: string; private: string; webhook?: string; }; feeFields: ("card" | "ach" | "paypal" | "kf")[]; currencies: string[] | "all"; selectableInAdmin: boolean; betaOnly?: boolean; setupInstructionsKey?: string; webhookInstructionsKey?: string; signupUrl?: (church: any, user: any) => string; currencyHelpUrl?: string; eventUrl?: (eventId: string) => string; defaultFees?: Record; } export interface MemberEntryHandle { tokenize(): Promise; } export interface MemberEntryProps { gateway: PaymentGateway; getContext?: () => ChargeContext; } export interface GuestFormProps { churchId: string; gateway: PaymentGateway; recaptchaSiteKey: string; mainContainerCssProps?: PaperProps; showHeader?: boolean; churchLogo?: string; allowSingleGift?: boolean; allowRecurring?: boolean; showFundSelector?: boolean; allowedFundIds?: string[]; defaultFundId?: string; } export interface MethodEditFormProps { method: any; verify?: boolean; customerId: string; person: PersonInterface; gateway?: PaymentGateway; onCancel: () => void; onDelete: () => void; onUpdated: (message?: string) => void; } export interface FormPaymentHandle { handlePayment(): Promise<{ paymentSuccessful: boolean; name?: string; errors: string[]; captchaPass?: string; }>; questionId?: string; } export interface FormPaymentProps { churchId: string; question: QuestionInterface; gateway: PaymentGateway; } export interface PaymentProvider { readonly key: string; readonly descriptor: ProviderDescriptor; readonly capabilities: ProviderCapabilities; MemberWrapper?: FC<{ gateway?: PaymentGateway | null; children: ReactNode; }>; MemberEntry?: ForwardRefExoticComponent>; buildChargeRequest(ctx: ChargeContext, token: PaymentToken): ChargeRequest; finalizeResult?(result: any): Promise; GuestForm: FC; MethodEditForm?: FC; FormPayment?: ForwardRefExoticComponent>; } //# sourceMappingURL=types.d.ts.map