1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* Pipedrive API v1
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
/// GetProductAttachementResponse200Data : The updated product object attached to the deal
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetProductAttachementResponse200Data {
/// The ID of the product
#[serde(rename = "product_id")]
pub product_id: i32,
/// The price at which this product will be added to the deal
#[serde(rename = "item_price")]
pub item_price: f32,
/// Quantity – e.g. how many items of this product will be added to the deal
#[serde(rename = "quantity")]
pub quantity: i32,
/// The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage.
#[serde(rename = "discount", skip_serializing_if = "Option::is_none")]
pub discount: Option<f32>,
/// The type of the discount's value.
#[serde(rename = "discount_type", skip_serializing_if = "Option::is_none")]
pub discount_type: Option<DiscountType>,
/// The duration of the product. If omitted, will be set to 1.
#[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
pub duration: Option<f32>,
/// The type of the duration. (For example hourly, daily, etc.)
#[serde(rename = "duration_unit", skip_serializing_if = "Option::is_none")]
pub duration_unit: Option<String>,
/// The ID of the product variation to use. When omitted, no variation will be used.
#[serde(rename = "product_variation_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub product_variation_id: Option<Option<i32>>,
/// A textual comment associated with this product-deal attachment
#[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
pub comments: Option<String>,
/// The product tax
#[serde(rename = "tax", skip_serializing_if = "Option::is_none")]
pub tax: Option<f32>,
/// The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal.
#[serde(rename = "tax_method", skip_serializing_if = "Option::is_none")]
pub tax_method: Option<TaxMethod>,
/// Whether the product is enabled for a deal or not. This makes it possible to add products to a deal with a specific price and discount criteria, but keep them disabled, which refrains them from being included in the deal value calculation. When omitted, the product will be marked as enabled by default.
#[serde(rename = "enabled_flag", skip_serializing_if = "Option::is_none")]
pub enabled_flag: Option<bool>,
/// The ID of the deal-product (the ID of the product attached to the deal)
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<i32>,
/// The ID of the company
#[serde(rename = "company_id", skip_serializing_if = "Option::is_none")]
pub company_id: Option<i32>,
/// The ID of the deal
#[serde(rename = "deal_id", skip_serializing_if = "Option::is_none")]
pub deal_id: Option<i32>,
/// The sum of all the products attached to the deal
#[serde(rename = "sum", skip_serializing_if = "Option::is_none")]
pub sum: Option<f32>,
/// The currency associated with the deal product
#[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
pub currency: Option<String>,
/// The date and time when the product was added to the deal
#[serde(rename = "add_time", skip_serializing_if = "Option::is_none")]
pub add_time: Option<String>,
/// The date and time when the deal product was last edited
#[serde(rename = "last_edit", skip_serializing_if = "Option::is_none")]
pub last_edit: Option<String>,
/// Whether the product is active or not
#[serde(rename = "active_flag", skip_serializing_if = "Option::is_none")]
pub active_flag: Option<bool>,
/// The product name
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
impl GetProductAttachementResponse200Data {
/// The updated product object attached to the deal
pub fn new(product_id: i32, item_price: f32, quantity: i32) -> GetProductAttachementResponse200Data {
GetProductAttachementResponse200Data {
product_id,
item_price,
quantity,
discount: None,
discount_type: None,
duration: None,
duration_unit: None,
product_variation_id: None,
comments: None,
tax: None,
tax_method: None,
enabled_flag: None,
id: None,
company_id: None,
deal_id: None,
sum: None,
currency: None,
add_time: None,
last_edit: None,
active_flag: None,
name: None,
}
}
}
/// The type of the discount's value.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DiscountType {
#[serde(rename = "percentage")]
Percentage,
#[serde(rename = "amount")]
Amount,
}
impl Default for DiscountType {
fn default() -> DiscountType {
Self::Percentage
}
}
/// The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TaxMethod {
#[serde(rename = "exclusive")]
Exclusive,
#[serde(rename = "inclusive")]
Inclusive,
#[serde(rename = "none")]
None,
}
impl Default for TaxMethod {
fn default() -> TaxMethod {
Self::Exclusive
}
}