forked from wangziqi/gongxue-base
feat: add platform invoice dunning workflow
This commit is contained in:
@@ -126,6 +126,24 @@ export interface PlatformInvoiceItem {
|
||||
note?: string | null;
|
||||
}
|
||||
|
||||
export interface PlatformInvoiceReminderItem {
|
||||
id: string;
|
||||
tenantId: string;
|
||||
tenantSlug?: string | null;
|
||||
tenantName?: string | null;
|
||||
invoiceId: string;
|
||||
invoiceNo?: string | null;
|
||||
reminderType?: string | null;
|
||||
channel?: string | null;
|
||||
status?: string | null;
|
||||
reminderDate?: string | null;
|
||||
reminderLevel?: number | string | null;
|
||||
dueDate?: string | null;
|
||||
balanceCentsSnapshot?: number | string | null;
|
||||
message?: string | null;
|
||||
createdAt?: string | null;
|
||||
}
|
||||
|
||||
export interface PlatformUsageItem {
|
||||
id: string;
|
||||
tenantId: string;
|
||||
@@ -265,6 +283,12 @@ export interface ConfirmPlatformInvoicePaymentInput {
|
||||
providerTradeNo?: string;
|
||||
}
|
||||
|
||||
export interface ProcessPlatformOverdueInvoicesInput {
|
||||
dryRun?: boolean;
|
||||
channel?: string;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface RecordPlatformUsageInput {
|
||||
tenantId: string;
|
||||
metricKey: string;
|
||||
@@ -417,6 +441,34 @@ export async function confirmPlatformInvoicePayment(input: ConfirmPlatformInvoic
|
||||
});
|
||||
}
|
||||
|
||||
export async function processPlatformOverdueInvoices(input: ProcessPlatformOverdueInvoicesInput = {}) {
|
||||
return apiRequest<{
|
||||
item?: {
|
||||
dryRun?: boolean;
|
||||
processed?: number;
|
||||
markedOverdue?: number;
|
||||
reminderCreated?: number;
|
||||
skippedReminder?: number;
|
||||
items?: Array<PlatformInvoiceItem & {
|
||||
wouldMarkOverdue?: boolean;
|
||||
wouldCreateReminder?: boolean;
|
||||
reminderCreated?: boolean;
|
||||
}>;
|
||||
};
|
||||
}>('/api/platform-admin/invoices/process-overdue', {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
tenantId: null,
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadPlatformInvoiceReminders(query: { tenantId?: string; invoiceId?: string; status?: string; reminderType?: string; limit?: number } = {}) {
|
||||
return apiRequest<{ items?: PlatformInvoiceReminderItem[] }>('/api/platform-admin/invoices/reminders', {
|
||||
query: { ...query, limit: query.limit || 100 },
|
||||
tenantId: null,
|
||||
});
|
||||
}
|
||||
|
||||
export async function recordPlatformUsage(input: RecordPlatformUsageInput) {
|
||||
return apiRequest<{ item?: Record<string, unknown> }>('/api/platform-admin/usage', {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user