osdm_sys/models/
currency_conversion.rs

1/*
2 * UIC 90918-10 - OSDM
3 *
4 * Specifications for the OSDM API standard. The OSDM specification supports two modes of operation: Retailer Mode and Distributor Mode. The API works identically in both modes, except that in distributor mode the API also returns fare information.  The following resources are key to get started:    -  [Processes](https://osdm.io/spec/processes/)   -  [Models](https://osdm.io/spec/models/)   -  [Getting started](https://osdm.io/spec/getting-started/) 
5 *
6 * The version of the OpenAPI document: 3.7.0
7 * Contact: osdm@uic.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CurrencyConversion : details on a currency conversion applied 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CurrencyConversion {
17    /// description of the conversion, e.g. rate, rounding rules, reference to rules 
18    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
19    pub description: Option<String>,
20    /// ISO 4217 currency codes 
21    #[serde(rename = "originalCurrency")]
22    pub original_currency: String,
23    /// amount in cents 
24    #[serde(rename = "originalAmount")]
25    pub original_amount: i32,
26    /// scale of the amount - the number of positions after the comma 
27    #[serde(rename = "scale", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub scale: Option<Option<i32>>,
29    #[serde(rename = "appliedRate", skip_serializing_if = "Option::is_none")]
30    pub applied_rate: Option<f64>,
31    #[serde(rename = "originalVats", skip_serializing_if = "Option::is_none")]
32    pub original_vats: Option<Vec<models::Vat>>,
33}
34
35impl CurrencyConversion {
36    /// details on a currency conversion applied 
37    pub fn new(original_currency: String, original_amount: i32) -> CurrencyConversion {
38        CurrencyConversion {
39            description: None,
40            original_currency,
41            original_amount,
42            scale: None,
43            applied_rate: None,
44            original_vats: None,
45        }
46    }
47}
48