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
/*
* Hanzo Cloud API
*
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Cart {
/// CreatedAt is when the cart was opened, RFC3339.
#[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>,
/// Currency is the ISO 4217 code every amount below is denominated in.
#[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
pub currency: Option<String>,
/// DiscountCents is what coupons and promotions took off, in whole cents.
#[serde(rename = "discountCents", skip_serializing_if = "Option::is_none")]
pub discount_cents: Option<i32>,
/// Email is the shopper's address, when the cart carries one.
#[serde(rename = "email", skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
/// ID is the cart's id — what every other cart op addresses it by, and what a storefront persists against the browser session.
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// Items are the cart's lines, in the order they were added.
#[serde(rename = "items", skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<models::CartItem>>,
/// LineTotalCents is the sum of the lines before any discount, in whole cents.
#[serde(rename = "lineTotalCents", skip_serializing_if = "Option::is_none")]
pub line_total_cents: Option<i32>,
/// Order is the order this cart became, once checkout completed it. Empty until then, and its presence is what makes a cart final.
#[serde(rename = "order", skip_serializing_if = "Option::is_none")]
pub order: Option<String>,
/// ShippingCents is the shipping charge, in whole cents. It stays zero until a shipping option is priced at checkout.
#[serde(rename = "shippingCents", skip_serializing_if = "Option::is_none")]
pub shipping_cents: Option<i32>,
/// Status is \"active\" for a cart still being filled, \"ordered\" once checkout turned it into an order, and \"discarded\" when the shopper abandoned it.
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
/// Store is the storefront the cart is being filled on.
#[serde(rename = "store", skip_serializing_if = "Option::is_none")]
pub store: Option<String>,
/// SubtotalCents is LineTotalCents less DiscountCents, in whole cents.
#[serde(rename = "subtotalCents", skip_serializing_if = "Option::is_none")]
pub subtotal_cents: Option<i32>,
/// TaxCents is the sales tax, in whole cents. It stays zero until checkout resolves the shopper's tax region.
#[serde(rename = "taxCents", skip_serializing_if = "Option::is_none")]
pub tax_cents: Option<i32>,
/// TotalCents is what the shopper pays: subtotal plus shipping plus tax, in whole cents.
#[serde(rename = "totalCents", skip_serializing_if = "Option::is_none")]
pub total_cents: Option<i32>,
/// UpdatedAt is when the cart was last amended, RFC3339.
#[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")]
pub updated_at: Option<String>,
/// User is the signed-in shopper this cart belongs to, empty for a guest cart.
#[serde(rename = "user", skip_serializing_if = "Option::is_none")]
pub user: Option<String>,
}
impl Cart {
pub fn new() -> Cart {
Cart {
created_at: None,
currency: None,
discount_cents: None,
email: None,
id: None,
items: None,
line_total_cents: None,
order: None,
shipping_cents: None,
status: None,
store: None,
subtotal_cents: None,
tax_cents: None,
total_cents: None,
updated_at: None,
user: None,
}
}
}