quickbooks_types/models/
tax_code.rs1use 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 pub id: Option<String>,
20 pub sync_token: Option<String>,
22 pub name: Option<String>,
24 pub description: Option<String>,
26 pub active: Option<bool>,
28 pub sales_tax_code: Option<bool>,
30 pub purchase_tax_rate_list: Option<Vec<TaxRateDetail>>,
32 pub sales_tax_rate_list: Option<Vec<TaxRateDetail>>,
34 pub tax_group: Option<bool>,
36 pub taxable: Option<bool>,
38 pub hidden: Option<bool>,
40 pub meta_data: Option<MetaData>,
42 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}