fix(payments): reuse checkout attempts and show pending status

This commit is contained in:
2026-09-30 21:14:19 +03:30
parent 450b387228
commit 9f3f3631ac
4 changed files with 191 additions and 67 deletions

View File

@@ -1076,6 +1076,7 @@ class ApiClient {
discount_code?: string | null;
mobile?: string | null;
email?: string | null;
idempotency_key: string;
}) {
return this.request<Types.CreatePaymentOut>(
'/api/payments/create',
@@ -1088,24 +1089,12 @@ class ApiClient {
}
async getPaymentByRef(refId: string) {
return this.request<{
ref_id: string;
authority: string;
base_amount: number;
discount_amount: number;
amount: number;
status: 'INIT' | 'PENDING' | 'PAID' | 'FAILED' | 'CANCELED';
verified_at?: string | null;
event: {
id: number;
title: string;
slug: string;
image_url?: string | null;
success_markdown?: string | null;
};
}>(`/api/payments/by-ref/${encodeURIComponent(refId)}`, { method: 'GET' });
return this.request<Types.PaymentDetailSchema>(`/api/payments/by-ref/${encodeURIComponent(refId)}`, { method: 'GET' });
}
async getPaymentStatus(paymentId: number) {
return this.request<Types.PaymentDetailSchema>(`/api/payments/status/${paymentId}`, { method: 'GET' });
}
async checkDiscountCode(event_id: number, code: string) {
return this.request<{
discount_amount: number;