This commit accomplishes a few modifications including the elimination of `use-toast.tsx` due to redundancy. The authentication methods in `personal-accounts-server-actions.ts` were refactored to improve service integration and data handling. Additionally, UI components were updated for better readability and clarity. Cascading deletion was enabled in the `schema.sql` file for 'invited_by' reference.
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
import {
|
|
CancelSubscriptionParamsSchema,
|
|
CreateBillingCheckoutSchema,
|
|
CreateBillingPortalSessionSchema,
|
|
RetrieveCheckoutSessionSchema,
|
|
} from '../schema';
|
|
import { ReportBillingUsageSchema } from '../schema/report-billing-usage.schema';
|
|
|
|
export abstract class BillingStrategyProviderService {
|
|
abstract createBillingPortalSession(
|
|
params: z.infer<typeof CreateBillingPortalSessionSchema>,
|
|
): Promise<{
|
|
url: string;
|
|
}>;
|
|
|
|
abstract retrieveCheckoutSession(
|
|
params: z.infer<typeof RetrieveCheckoutSessionSchema>,
|
|
): Promise<{
|
|
checkoutToken: string | null;
|
|
status: 'complete' | 'expired' | 'open';
|
|
isSessionOpen: boolean;
|
|
|
|
customer: {
|
|
email: string | null;
|
|
};
|
|
}>;
|
|
|
|
abstract createCheckoutSession(
|
|
params: z.infer<typeof CreateBillingCheckoutSchema>,
|
|
): Promise<{
|
|
checkoutToken: string;
|
|
}>;
|
|
|
|
abstract cancelSubscription(
|
|
params: z.infer<typeof CancelSubscriptionParamsSchema>,
|
|
): Promise<{
|
|
success: boolean;
|
|
}>;
|
|
|
|
abstract reportUsage(
|
|
params: z.infer<typeof ReportBillingUsageSchema>,
|
|
): Promise<{
|
|
success: boolean;
|
|
}>;
|
|
}
|