fix : extend and upgrade user subscription
This commit is contained in:
@@ -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(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user