mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
feat(subscription): API и утилиты СБП-автопродления Platega
This commit is contained in:
@@ -21,6 +21,8 @@ export interface UserSubscriptionInfo {
|
||||
tariff_id: number | null;
|
||||
tariff_name: string | null;
|
||||
autopay_enabled: boolean;
|
||||
sbp_recurring_status: string | null;
|
||||
sbp_recurring_id: number | null;
|
||||
is_active: boolean;
|
||||
days_remaining: number;
|
||||
purchased_traffic_gb: number;
|
||||
@@ -508,6 +510,14 @@ export const adminUsersApi = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Cancel a user's SBP (Platega) recurring auto-payment
|
||||
cancelSbpRecurring: async (userId: number, subId: number): Promise<{ status: string }> => {
|
||||
const response = await apiClient.post(
|
||||
`/cabinet/admin/users/${userId}/subscriptions/${subId}/cancel-sbp-recurring`,
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Update status
|
||||
updateStatus: async (
|
||||
userId: number,
|
||||
|
||||
@@ -12,6 +12,7 @@ import type {
|
||||
PurchaseSelection,
|
||||
PurchasePreview,
|
||||
AppConfig,
|
||||
SbpRecurringInfo,
|
||||
} from '../types';
|
||||
|
||||
/** Helper: build query params with optional subscription_id */
|
||||
@@ -349,6 +350,34 @@ export const subscriptionApi = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// ── SBP recurring (Platega) ───────────────────────────────────────────
|
||||
|
||||
getSbpRecurring: async (subscriptionId?: number): Promise<SbpRecurringInfo> => {
|
||||
const response = await apiClient.get<SbpRecurringInfo>(
|
||||
'/cabinet/subscription/platega-recurrent',
|
||||
withSubId(subscriptionId),
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
enableSbpRecurring: async (
|
||||
subscriptionId?: number,
|
||||
): Promise<{ status: string; redirect_url: string | null }> => {
|
||||
const response = await apiClient.post(
|
||||
'/cabinet/subscription/platega-recurrent/enable',
|
||||
...bodyWithSubId({}, subscriptionId),
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
cancelSbpRecurring: async (subscriptionId?: number): Promise<{ status: string }> => {
|
||||
const response = await apiClient.post(
|
||||
'/cabinet/subscription/platega-recurrent/cancel',
|
||||
...bodyWithSubId({}, subscriptionId),
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// ── Trial ───────────────────────────────────────────────────────────
|
||||
|
||||
getTrialInfo: async (): Promise<TrialInfo> => {
|
||||
|
||||
Reference in New Issue
Block a user