square_api_client/models/catalog_discount.rs
1//! Model struct for CatalogDiscount type.
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6 enums::{CatalogDiscountModifyTaxBasis, CatalogDiscountType},
7 Money,
8};
9
10/// A discount applicable to items.
11#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
12pub struct CatalogDiscount {
13 /// The discount name. This is a searchable attribute for use in applicable query filters, and
14 /// its value length is of Unicode code points.
15 pub name: Option<String>,
16 /// Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale.
17 pub discount_type: Option<CatalogDiscountType>,
18 /// The percentage of the discount as a string representation of a decimal number, using a `.`
19 /// as the decimal separator and without a `%` sign. A value of `7.5` corresponds to `7.5%`.
20 /// Specify a percentage of `0` if `discount_type` is `VARIABLE_PERCENTAGE`.
21 ///
22 /// Do not use this field for amount-based or variable discounts.
23 pub percentage: Option<String>,
24 /// The amount of the discount. Specify an amount of `0` if `discount_type` is
25 /// `VARIABLE_AMOUNT`.
26 ///
27 /// Do not use this field for percentage-based or variable discounts.
28 pub amount_money: Option<Money>,
29 /// Indicates whether a mobile staff member needs to enter their PIN to apply the discount to a
30 /// payment in the Square Point of Sale app.
31 pub pin_required: Option<bool>,
32 /// The color of the discount display label in the Square Point of Sale app. This must be a
33 /// valid hex color code.
34 pub label_color: Option<String>,
35 /// Indicates whether this discount should reduce the price used to calculate tax.
36 ///
37 /// Most discounts should use `MODIFY_TAX_BASIS`. However, in some circumstances taxes must be
38 /// calculated based on an item's price, ignoring a particular discount. For example, in many US
39 /// jurisdictions, a manufacturer coupon or instant rebate reduces the price a customer pays but
40 /// does not reduce the sale price used to calculate how much sales tax is due. In this case,
41 /// the discount representing that manufacturer coupon should have `DO_NOT_MODIFY_TAX_BASIS` for
42 /// this field.
43 ///
44 /// If you are unsure whether you need to use this field, consult your tax professional.
45 pub modify_tax_basis: Option<CatalogDiscountModifyTaxBasis>,
46 /// For a percentage discount, the maximum absolute value of the discount. For example, if a 50%
47 /// discount has a `maximum_amount_money` of $20, a $100 purchase will yield a $20 discount, not
48 /// a $50 discount.
49 pub maximum_amount_money: Option<Money>,
50}