feat(packages): add standalone auth and payment
This commit is contained in:
18
packages/payment/src/payment.models.ts
Normal file
18
packages/payment/src/payment.models.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user