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
use crate::controllers::Entity;
use serde::{Deserialize, Serialize};
use crate::controllers::tax_rates::{TaxRateCreateBuilder, TaxRateUpdateBuilder};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TaxRate {
/// Unique identifier for the resource.READ-ONLY
pub id: i32,
/// Country ISO 3166 code.
pub country: String,
/// State code.
pub state: String,
/// Postcode/ZIP, it doesn't support multiple values. Deprecated as of WooCommerce 5.3, postcodes should be used instead.
pub postcode: String,
/// City name, it doesn't support multiple values. Deprecated as of WooCommerce 5.3, postcodes should be used instead.
pub city: String,
/// Postcodes/ZIPs.
pub postcodes: Vec<String>,
/// City names.
pub cities: Vec<String>,
/// Tax rate.
pub rate: String,
/// Tax rate name.
pub name: String,
/// Tax priority. Only 1 matching rate per priority will be used. To define multiple tax rates for a single area you need to specify a different priority per rate. Default is 1.
pub priority: i32,
/// Whether this is a compound rate. Compound tax rates are applied on top of other tax rates. Default is false.
pub compound: bool,
/// Whether this tax rate also gets applied to shipping. Default is true.
pub shipping: bool,
/// Indicates the order that will appear in queries.
pub order: i32,
/// Tax class. Default is standard.
pub class: String,
}
impl Entity for TaxRate {
fn endpoint() -> String {
String::from("taxes/")
}
fn child_endpoint(parent_id: i32) -> String {
let _ = parent_id;
String::new()
}
}
impl TaxRate {
pub fn create() -> TaxRateCreateBuilder {
TaxRateCreateBuilder::default()
}
pub fn update() -> TaxRateUpdateBuilder {
TaxRateUpdateBuilder::default()
}
}