import type { IBaseAdapter } from '@unchainedshop/utils'; import type { Order, OrderPayment } from '@unchainedshop/core-orders'; import type { PaymentConfiguration, PaymentProvider, PaymentProviderType } from '@unchainedshop/core-payment'; import type { Modules } from '../modules.ts'; export declare const PaymentError: { readonly ADAPTER_NOT_FOUND: "ADAPTER_NOT_FOUND"; readonly NOT_IMPLEMENTED: "NOT_IMPLEMENTED"; readonly INCOMPLETE_CONFIGURATION: "INCOMPLETE_CONFIGURATION"; readonly WRONG_CREDENTIALS: "WRONG_CREDENTIALS"; }; export type PaymentError = (typeof PaymentError)[keyof typeof PaymentError]; export interface ChargeResult { transactionId?: string; [key: string]: any; } export type PaymentChargeActionResult = ChargeResult & { credentials?: { token: string; [key: string]: any; }; }; export interface IPaymentActions { charge: (transactionContext?: any) => Promise; configurationError: (transactionContext?: any) => PaymentError | null; isActive: (transactionContext?: any) => boolean; isPayLaterAllowed: (transactionContext?: any) => boolean; register: (transactionContext?: any) => Promise; sign: (transactionContext?: any) => Promise; validate: (token?: any) => Promise; cancel: (transactionContext?: any) => Promise; confirm: (transactionContext?: any) => Promise; } export interface PaymentContext { userId?: string; order?: Order; orderPayment?: OrderPayment; transactionContext?: any; token?: any; meta?: any; } export type IPaymentAdapter = IBaseAdapter & { initialConfiguration: PaymentConfiguration; typeSupported: (type: PaymentProviderType) => boolean; actions: (config: PaymentConfiguration, context: PaymentContext & { paymentProvider: PaymentProvider; modules: Modules; }) => IPaymentActions; }; export declare const PaymentAdapter: Omit;