discount for business and personall in discount page
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user