fix : extend and upgrade user subscription

This commit is contained in:
2026-02-01 11:54:51 +03:30
parent 3a80ce021d
commit 0ba027d4e3
7 changed files with 110 additions and 56 deletions
@@ -200,6 +200,7 @@ export class RestaurantService {
async getRestaurantSubscription(subscriptionId: string) {
try {
console.log('subscriptionId', subscriptionId)
const { data } = await firstValueFrom(
this.httpService
.get(`${this.config.baseUrl}/super-admin/restaurants/subscription/${subscriptionId}`, {
@@ -212,6 +213,7 @@ export class RestaurantService {
}),
),
);
console.log('data', data)
return data;
} catch (error: unknown) {
if (error instanceof AxiosError && error.response) {
@@ -378,13 +380,13 @@ export class RestaurantService {
}
}
async upgradeSubscription(subscriptionId: string, newPlan: string, subscriptionEndDate: string) {
async upgradeSubscription(subscriptionId: string, newPlan: 'base' | 'premium', subscriptionEndDate: Date) {
try {
const { data } = await firstValueFrom(
this.httpService
.patch(`${this.config.baseUrl}/super-admin/restaurants/subscription/${subscriptionId}/upgrade`, {
plan: newPlan,
subscriptionEndDate,
newPlan,
subscriptionEndDate
}, {
headers: this.getHeaders(),
})