Files
vitanovaPackages/packages/payment/src/payment.models.ts

19 lines
851 B
TypeScript
Raw Normal View History

export type PaymentMethod = 'qr' | 'card' | 'sbp' | 'yandex-pay';
export type PaymentStatus = 'created' | 'pending' | 'authorized' | 'paid' | 'failed' | 'cancelled' | 'expired';
/** Central payment API resolves amount/currency/routing from this server checkout id. */
export interface PaymentRequest { checkoutSessionId: string; returnUrl?: string; metadata?: Readonly<Record<string, string>>; }
export interface PaymentAttempt {
paymentId: string;
method: PaymentMethod;
status: PaymentStatus;
action?: { type: 'redirect' | 'qr'; url: string };
failureMessage?: string;
}
export interface PaymentResult extends PaymentAttempt { status: 'paid' | 'authorized'; }
export interface PaymentFailure {
method: PaymentMethod;
code: 'configuration' | 'backend' | 'declined' | 'expired' | 'popup_blocked';
message: string;
cause?: unknown;
}