feat: implement support plan upgrade functionality with invoice creation

This commit is contained in:
mahyargdz
2025-05-06 12:31:55 +03:30
parent 1ea3195f4f
commit 8b4267807b
11 changed files with 153 additions and 19 deletions
@@ -383,9 +383,16 @@ export class InvoicesService {
return invoice;
}
//********************************** */
async createInvoiceForSupportPlan(user: User, supPlan: SupportPlan, userSupPlan: UserSupportPlan, dueDate: Date, qryRnr: QueryRunner) {
async createInvoiceForSupportPlan(
user: User,
supPlan: SupportPlan,
userSupPlan: UserSupportPlan,
dueDate: Date,
qryRnr: QueryRunner,
price?: number,
) {
const originalPrice = supPlan.price;
const finalPrice = supPlan.price;
const finalPrice = price || supPlan.price;
const invoiceItem = {
name: supPlan.name,
@@ -593,6 +600,9 @@ export class InvoicesService {
subscriptionPlan: {
plan: true,
},
supportPlan: {
supportPlan: true,
},
},
},
});