mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: promocode multi-tariff support in cabinet
- Balance page: handle select_subscription response — show subscription picker when promo code adds days and user has multiple tariffs - API: activatePromocode now accepts optional subscriptionId - AdminPromocodeCreate: show trial tariff info when creating trial_subscription promo code, warn if no trial tariff configured
This commit is contained in:
@@ -68,14 +68,21 @@ export const balanceApi = {
|
||||
// Activate promo code
|
||||
activatePromocode: async (
|
||||
code: string,
|
||||
subscriptionId?: number,
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
message: string;
|
||||
balance_before: number;
|
||||
balance_after: number;
|
||||
bonus_description: string | null;
|
||||
message?: string;
|
||||
balance_before?: number;
|
||||
balance_after?: number;
|
||||
bonus_description?: string | null;
|
||||
error?: string;
|
||||
eligible_subscriptions?: Array<{ id: number; tariff_name: string; days_left: number }>;
|
||||
code?: string;
|
||||
}> => {
|
||||
const response = await apiClient.post('/cabinet/promocode/activate', { code });
|
||||
const response = await apiClient.post('/cabinet/promocode/activate', {
|
||||
code,
|
||||
...(subscriptionId ? { subscription_id: subscriptionId } : {}),
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user