diff --git a/src/modules/discounts/providers/discounts.service.ts b/src/modules/discounts/providers/discounts.service.ts index 26e9382..c5cafdb 100755 --- a/src/modules/discounts/providers/discounts.service.ts +++ b/src/modules/discounts/providers/discounts.service.ts @@ -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}`);