mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 07:10:53 +00:00
Refactor ProjectService to update subscription status
This commit is contained in:
parent
956ac101a2
commit
1d85490c55
@ -347,6 +347,17 @@ export class ProjectService extends DatabaseService<Model> {
|
||||
" completed.",
|
||||
);
|
||||
|
||||
// refresh subscription status.
|
||||
const subscriptionState: SubscriptionStatus =
|
||||
await BillingService.getSubscriptionStatus(
|
||||
subscription.subscriptionId as string,
|
||||
);
|
||||
|
||||
const meteredSubscriptionState: SubscriptionStatus =
|
||||
await BillingService.getSubscriptionStatus(
|
||||
subscription.meteredSubscriptionId as string,
|
||||
);
|
||||
|
||||
await this.updateOneById({
|
||||
id: new ObjectID(updateBy.query._id! as string),
|
||||
data: {
|
||||
@ -357,6 +368,9 @@ export class ProjectService extends DatabaseService<Model> {
|
||||
planName: SubscriptionPlan.getPlanType(
|
||||
updateBy.data.paymentProviderPlanId! as string,
|
||||
),
|
||||
paymentProviderMeteredSubscriptionStatus:
|
||||
meteredSubscriptionState,
|
||||
paymentProviderSubscriptionStatus: subscriptionState,
|
||||
},
|
||||
props: {
|
||||
isRoot: true,
|
||||
|
Loading…
Reference in New Issue
Block a user