Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 3.4.3
-
Fix Version/s: 3.5.2
-
Component/s: None
-
Labels:None
Description
TL;DR
Invoice creation must use the blesta/pricing library.
When a coupon line item is generated for a service, the coupon calculates its discount from the full service price. However, the full service price may not be the actual price billed.
For example, if proration is enabled, the service price being billed may be less than the full service price. The coupon will then discount from the full price rather than the prorated price, causing too large of a discount, which may even lead to an invoice for a negative amount.
e.g.
$10.00 service
$0.50 prorated cost of the service
10% discount
Line Item Cost $0.50
Discount Amount $1.00 ($10 * 0.1)
Total: -$0.50
This issue applies to the coupon line item price when it is generated for an invoice. The totals displayed before the invoice is created appear to be correct as-is because they come from a separate calculation. When this issue is updated to support proration, we should consider the possibility of adding two line items for the coupons. One for the prorated amount over the prorated date range, and one for the full amount after the cut off day (if after the cut off day). Note that we must also consider whether the coupon recurs, and if not, it can only be applied to the prorated amount, and not the full amount after proration.
A temporary work-around was added in lieu of the pricing being refactored into item pricing.