- Restructure: move backend from new_project/ to backend/ - Add full React/TypeScript frontend (37 pages, 17 services, 16 type defs, 11 query hooks) - Add docs/ with SRS specs, user stories, and workflow documentation - Update .gitignore for new directory layout Workflows implemented: WF1 User Signup, WF2 Placement Test, WF3 Exam Configuration, WF4 General English Exam, WF5 Course Generation, WF6 Entity Student Onboarding, AI Course Generation, Adaptive Learning Engine UI, White-Label Branding, Score Release Made-with: Cursor
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import { api } from "@/lib/api-client";
|
|
import type { Package, Payment, Discount, PaginatedResponse, PaginationParams, ApiSuccessResponse } from "@/types";
|
|
|
|
export const subscriptionsService = {
|
|
async listPackages(): Promise<Package[]> {
|
|
return api.get<Package[]>("/packages");
|
|
},
|
|
|
|
async listPayments(params?: PaginationParams): Promise<PaginatedResponse<Payment>> {
|
|
return api.get<PaginatedResponse<Payment>>("/payments", params as Record<string, string | number | boolean | undefined>);
|
|
},
|
|
|
|
async createStripeCheckout(data: { package_id: number; discount_code?: string }): Promise<{ checkout_url: string }> {
|
|
return api.post("/stripe/checkout", data);
|
|
},
|
|
|
|
async createPaypalCheckout(data: { package_id: number; discount_code?: string }): Promise<{ approval_url: string }> {
|
|
return api.post("/paypal/checkout", data);
|
|
},
|
|
|
|
async createPaymobCheckout(data: { package_id: number; discount_code?: string }): Promise<{ payment_url: string }> {
|
|
return api.post("/paymob/checkout", data);
|
|
},
|
|
|
|
async listDiscounts(params?: PaginationParams): Promise<PaginatedResponse<Discount>> {
|
|
return api.get<PaginatedResponse<Discount>>("/discounts", params as Record<string, string | number | boolean | undefined>);
|
|
},
|
|
|
|
async createDiscount(data: Partial<Discount>): Promise<Discount> {
|
|
return api.post<Discount>("/discounts", data);
|
|
},
|
|
|
|
async deleteDiscount(id: number): Promise<ApiSuccessResponse> {
|
|
return api.delete<ApiSuccessResponse>(`/discounts/${id}`);
|
|
},
|
|
};
|