feat: dont inactive the old suport plan and after pay the invoice make it inactive
This commit is contained in:
@@ -552,6 +552,14 @@ export class InvoicesService {
|
||||
await this.addNotifyAdminForSubscriptionPaymentToQueue(invoice);
|
||||
//
|
||||
} else if (invoice.items[0]?.supportPlan) {
|
||||
const oldUserSupportPlan = await queryRunner.manager.findOne(UserSupportPlan, {
|
||||
where: { user: { id: user.id }, status: UserSupportPlanStatus.ACTIVE },
|
||||
});
|
||||
|
||||
if (oldUserSupportPlan) {
|
||||
await queryRunner.manager.update(UserSupportPlan, oldUserSupportPlan.id, { status: UserSupportPlanStatus.INACTIVE });
|
||||
}
|
||||
|
||||
const userSupportPlan = invoice.items[0].supportPlan;
|
||||
userSupportPlan.status = UserSupportPlanStatus.ACTIVE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user