discount for business and personall in discount page

This commit is contained in:
Priec
2026-06-22 00:04:01 +02:00
parent 1df8d66d5d
commit d2b463135b
10 changed files with 158 additions and 44 deletions

View File

@@ -210,7 +210,13 @@ fn detail_for(product: &products::Model, b2b: Option<&B2bContext>) -> PriceDetai
auto_cents = Some(apply_discount_bp(regular, chosen.percent_bp));
}
let business = [manual, auto_cents].into_iter().flatten().min();
// Baseline business discount for all company accounts (set on the discounts
// page), alongside the per-company automated and negotiated layers.
let business_global = product.business_sale_price_cents;
let business = [manual, auto_cents, business_global]
.into_iter()
.flatten()
.min();
let priced = decide(regular, public, business);
PriceDetail {