feat: round the price

This commit is contained in:
Mahyargdz
2025-05-11 10:11:15 +03:30
parent ad4bf79afb
commit 78d143fa85
@@ -292,7 +292,8 @@ export class DiscountsService {
} else {
discountAmount = new Decimal(discount.value);
}
subscriptionPlan.price = new Decimal(subscriptionPlan.originalPrice).sub(discountAmount);
// Round the final price to the nearest number
subscriptionPlan.price = new Decimal(subscriptionPlan.originalPrice).sub(discountAmount).round();
}
// Update the discount and set subscription plans in one operation
@@ -353,7 +354,8 @@ export class DiscountsService {
} else {
discountAmount = new Decimal(discount.value);
}
subscriptionPlan.price = new Decimal(subscriptionPlan.originalPrice).sub(discountAmount);
// Round the final price to the nearest number
subscriptionPlan.price = new Decimal(subscriptionPlan.originalPrice).sub(discountAmount).round();
}
console.log(`Setting ${subscriptionPlans.length} subscription plans on discount ${discount.id}`);