import { apiClient } from './client'; export interface Subscription { id: string; tenantId: string; plan: string; status: string; amount: string; frequency: string; mpPreapprovalId: string | null; createdAt: string; } export interface Payment { id: string; tenantId: string; subscriptionId: string | null; mpPaymentId: string | null; amount: string; status: string; paymentMethod: string | null; paidAt: string | null; createdAt: string; } export async function getSubscription(tenantId: string): Promise { const response = await apiClient.get(`/subscriptions/${tenantId}`); return response.data; } export async function generatePaymentLink(tenantId: string): Promise<{ paymentUrl: string }> { const response = await apiClient.post<{ paymentUrl: string }>(`/subscriptions/${tenantId}/generate-link`); return response.data; } export async function markAsPaid(tenantId: string, amount: number): Promise { const response = await apiClient.post(`/subscriptions/${tenantId}/mark-paid`, { amount }); return response.data; } export async function getPaymentHistory(tenantId: string): Promise { const response = await apiClient.get(`/subscriptions/${tenantId}/payments`); return response.data; }