feat: round the price
This commit is contained in:
@@ -292,7 +292,8 @@ export class DiscountsService {
|
|||||||
} else {
|
} else {
|
||||||
discountAmount = new Decimal(discount.value);
|
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
|
// Update the discount and set subscription plans in one operation
|
||||||
@@ -353,7 +354,8 @@ export class DiscountsService {
|
|||||||
} else {
|
} else {
|
||||||
discountAmount = new Decimal(discount.value);
|
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}`);
|
console.log(`Setting ${subscriptionPlans.length} subscription plans on discount ${discount.id}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user