Skip to main content

quickbooks_types/models/
tax_code.rs

1use serde::{Deserialize, Serialize};
2use serde_with::skip_serializing_none;
3
4use crate::{
5    common::{MetaData, NtRef},
6    QBQueryable, QBReadable,
7};
8
9#[skip_serializing_none]
10#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, Default)]
11#[serde(rename_all = "PascalCase", default)]
12#[cfg_attr(
13    feature = "builder",
14    derive(Builder),
15    builder(default, build_fn(error = "QBTypeError"), setter(into, strip_option))
16)]
17pub struct TaxCode {
18    /// The unique ID of the entity
19    pub id: Option<String>,
20    /// The unique sync token of the entity, used for concurrency control
21    pub sync_token: Option<String>,
22    /// Name of the tax code
23    pub name: Option<String>,
24    /// Description of the tax code
25    pub description: Option<String>,
26    /// Indicates if the tax code is active
27    pub active: Option<bool>,
28    /// Indicates if the tax code is a sales tax code
29    pub sales_tax_code: Option<bool>,
30    /// List of purchase tax rates associated with the tax code
31    pub purchase_tax_rate_list: Option<Vec<TaxRateDetail>>,
32    /// List of sales tax rates associated with the tax code
33    pub sales_tax_rate_list: Option<Vec<TaxRateDetail>>,
34    /// Indicates if the tax code is a tax group
35    pub tax_group: Option<bool>,
36    /// Indicates if the tax code is taxable
37    pub taxable: Option<bool>,
38    /// Indicates if the tax code is hidden
39    pub hidden: Option<bool>,
40    /// Metadata about the entity
41    pub meta_data: Option<MetaData>,
42    /// Flag indicating if the tax code is system defined or user defined
43    pub tax_code_config_type: Option<TaxCodeConfigType>,
44}
45
46#[skip_serializing_none]
47#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
48#[serde(rename_all = "PascalCase")]
49pub struct TaxRateDetail {
50    pub tax_rate_ref: NtRef,
51    pub tax_type_applicable: Option<TaxTypeApplicable>,
52    pub tax_order: Option<i32>,
53}
54
55#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
56#[serde(rename_all = "PascalCase")]
57pub enum TaxTypeApplicable {
58    TaxOnAmount,
59    TaxOnTax,
60    TaxOnAmountPlusTax,
61}
62
63#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
64#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
65pub enum TaxCodeConfigType {
66    UserDefined,
67    SystemGenerated,
68}