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

@@ -17,6 +17,7 @@ pub struct Model {
pub description: Option<String>,
pub price_cents: i64,
pub sale_price_cents: Option<i64>,
pub business_sale_price_cents: Option<i64>,
pub currency: String,
pub sku: Option<String>,
pub stock: i32,

View File

@@ -37,6 +37,13 @@ impl Model {
self.price_cents
}
}
/// Whether a baseline business discount (for all company accounts) is set and
/// actually below the regular price.
#[must_use]
pub fn business_on_sale(&self) -> bool {
matches!(self.business_sale_price_cents, Some(sale) if sale < self.price_cents)
}
}
// implement your write-oriented logic here