feat(events): unify registration checkout and receipts

This commit is contained in:
2026-10-01 12:21:27 +03:30
parent 9f3f3631ac
commit 0f5ec429d0
21 changed files with 1593 additions and 840 deletions

View File

@@ -877,6 +877,10 @@ class ApiClient {
return this.request<Types.EventDetailSchema>(`/api/events/slug/${encodeURIComponent(slug)}`, { method: 'GET' });
}
async getEventById(eventId: number) {
return this.request<Types.EventDetailSchema>(`/api/events/${eventId}`, { method: 'GET' });
}
async getEventAdminDetail(eventId: number) {
return this.request<Types.EventAdminDetailSchema>(`/api/events/${eventId}/admin-detail`);
}
@@ -1014,6 +1018,12 @@ class ApiClient {
});
}
async cancelRegistrationCheckout(eventId: number) {
return this.request<Types.MessageSchema>(`/api/events/${eventId}/checkout/cancel`, {
method: "POST",
});
}
async verifyMyRegistration(ticket_id: string) {
return this.request<{
event_image: string;
@@ -1069,6 +1079,20 @@ class ApiClient {
);
}
async getRegistrationHubStatus(
eventSlug: string,
identifiers: { registration_id?: string | null; payment_id?: number | null } = {},
) {
const query = new URLSearchParams();
if (identifiers.registration_id) query.set("registration_id", identifiers.registration_id);
if (identifiers.payment_id) query.set("payment_id", String(identifiers.payment_id));
const suffix = query.size ? `?${query.toString()}` : "";
return this.request<Types.RegistrationHubSchema>(
`/api/events/${encodeURIComponent(eventSlug)}/registration/status${suffix}`,
{ method: "GET" },
);
}
// ============= Payment Endpoints =============
async createPayment(input: {
event_id: number;
@@ -1088,13 +1112,10 @@ class ApiClient {
);
}
async getPaymentByRef(refId: string) {
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;