feat: Implement core monetization features including course pricing, payment preference creation, and transaction management with Mercado Pago integration.
This commit is contained in:
@@ -55,9 +55,16 @@ export interface Course {
|
||||
pacing_mode: string;
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
price: number;
|
||||
currency: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface PaymentPreferenceResponse {
|
||||
preference_id: string;
|
||||
init_point: string;
|
||||
}
|
||||
|
||||
export interface QuizQuestion {
|
||||
id: string;
|
||||
question: string;
|
||||
@@ -372,6 +379,13 @@ export const lmsApi = {
|
||||
return apiFetch(`/enrollments/${userId}`);
|
||||
},
|
||||
|
||||
async createPaymentPreference(courseId: string): Promise<PaymentPreferenceResponse> {
|
||||
return apiFetch('/payments/preference', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ course_id: courseId })
|
||||
});
|
||||
},
|
||||
|
||||
async submitScore(userId: string, course_id: string, lessonId: string, score: number, metadata: Record<string, unknown> = {}): Promise<UserGrade> {
|
||||
return apiFetch('/grades', {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user