Skip to main content

amazon_spapi/models/vendor_orders/
money.rs

1/*
2 * Selling Partner API for Retail Procurement Orders
3 *
4 * The Selling Partner API for Retail Procurement Orders provides programmatic access to vendor orders data.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Money : An amount of money. Includes the currency code and an optional unit of measure for items priced by weight.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Money {
17    /// Three digit currency code in ISO 4217 format. String of length 3.
18    #[serde(rename = "currencyCode", skip_serializing_if = "Option::is_none")]
19    pub currency_code: Option<String>,
20    /// A decimal number with no loss of precision. Useful when precision loss is unacceptable, as with currencies. Follows RFC7159 for number representation. <br>**Pattern** : `^-?(0|([1-9]\\d*))(\\.\\d+)?([eE][+-]?\\d+)?$`.
21    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
22    pub amount: Option<String>,
23    /// The unit of measure for prices of items sold by weight. If this field is absent, the item is sold by eaches.
24    #[serde(rename = "unitOfMeasure", skip_serializing_if = "Option::is_none")]
25    pub unit_of_measure: Option<UnitOfMeasure>,
26}
27
28impl Money {
29    /// An amount of money. Includes the currency code and an optional unit of measure for items priced by weight.
30    pub fn new() -> Money {
31        Money {
32            currency_code: None,
33            amount: None,
34            unit_of_measure: None,
35        }
36    }
37}
38/// The unit of measure for prices of items sold by weight. If this field is absent, the item is sold by eaches.
39#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
40pub enum UnitOfMeasure {
41    #[serde(rename = "POUNDS")]
42    Pounds,
43    #[serde(rename = "OUNCES")]
44    Ounces,
45    #[serde(rename = "GRAMS")]
46    Grams,
47    #[serde(rename = "KILOGRAMS")]
48    Kilograms,
49}
50
51impl Default for UnitOfMeasure {
52    fn default() -> UnitOfMeasure {
53        Self::Pounds
54    }
55}
56