lightspark/objects/
currency_amount.rs

1// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2use crate::objects::currency_unit::CurrencyUnit;
3use serde::{Deserialize, Serialize};
4
5/// This object represents the value and unit for an amount of currency.
6#[derive(Debug, Clone, Deserialize, Serialize)]
7pub struct CurrencyAmount {
8    /// The original numeric value for this CurrencyAmount.
9    #[serde(rename = "currency_amount_original_value")]
10    pub original_value: i64,
11
12    /// The original unit of currency for this CurrencyAmount.
13    #[serde(rename = "currency_amount_original_unit")]
14    pub original_unit: CurrencyUnit,
15
16    /// The unit of user's preferred currency.
17    #[serde(rename = "currency_amount_preferred_currency_unit")]
18    pub preferred_currency_unit: CurrencyUnit,
19
20    /// The rounded numeric value for this CurrencyAmount in the very base level of user's preferred currency. For example, for USD, the value will be in cents.
21    #[serde(rename = "currency_amount_preferred_currency_value_rounded")]
22    pub preferred_currency_value_rounded: i64,
23
24    /// The approximate float value for this CurrencyAmount in the very base level of user's preferred currency. For example, for USD, the value will be in cents.
25    #[serde(rename = "currency_amount_preferred_currency_value_approx")]
26    pub preferred_currency_value_approx: f64,
27}
28
29pub const FRAGMENT: &str = "
30fragment CurrencyAmountFragment on CurrencyAmount {
31    __typename
32    currency_amount_original_value: original_value
33    currency_amount_original_unit: original_unit
34    currency_amount_preferred_currency_unit: preferred_currency_unit
35    currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
36    currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
37}
38";