Add subcription feature 9
This commit is contained in:
@@ -252,8 +252,12 @@ export class SubscriptionService {
|
||||
return apiClient.get<PlanUpgradeValidation>(`/tenants/${tenantId}/subscription/validate-upgrade/${planKey}`);
|
||||
}
|
||||
|
||||
async upgradePlan(tenantId: string, planKey: string): Promise<PlanUpgradeResult> {
|
||||
return apiClient.post<PlanUpgradeResult>(`/tenants/${tenantId}/subscription/upgrade`, { new_plan: planKey });
|
||||
async upgradePlan(tenantId: string, planKey: string, billingCycle: BillingCycle = 'monthly'): Promise<PlanUpgradeResult> {
|
||||
// The backend expects new_plan and billing_cycle as query parameters
|
||||
return apiClient.post<PlanUpgradeResult>(
|
||||
`/tenants/${tenantId}/subscription/upgrade?new_plan=${planKey}&billing_cycle=${billingCycle}`,
|
||||
{}
|
||||
);
|
||||
}
|
||||
|
||||
async canAddLocation(tenantId: string): Promise<{ can_add: boolean; reason?: string; current_count?: number; max_allowed?: number }> {
|
||||
|
||||
@@ -261,11 +261,16 @@ export interface PlanUpgradeResult {
|
||||
success: boolean;
|
||||
message: string;
|
||||
new_plan: SubscriptionTier;
|
||||
effective_date: string;
|
||||
effective_date?: string;
|
||||
old_plan?: string;
|
||||
new_monthly_price?: number;
|
||||
validation?: any;
|
||||
requires_token_refresh?: boolean; // Backend signals that token should be refreshed
|
||||
// Trial handling fields
|
||||
is_trialing?: boolean;
|
||||
trial_ends_at?: string;
|
||||
stripe_updated?: boolean;
|
||||
trial_preserved?: boolean;
|
||||
}
|
||||
|
||||
export interface SubscriptionInvoice {
|
||||
|
||||
Reference in New Issue
Block a user