Skip to main content

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)]
16#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
17pub struct CurrencyConversion {
18    /// description of the conversion, e.g. rate, rounding rules, reference to rules 
19    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
20    pub description: Option<String>,
21    /// ISO 4217 currency codes 
22    #[serde(rename = "originalCurrency")]
23    pub original_currency: String,
24    /// amount in cents 
25    #[serde(rename = "originalAmount")]
26    pub original_amount: i32,
27    /// scale of the amount - the number of positions after the comma 
28    #[serde(rename = "scale", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub scale: Option<Option<i32>>,
30    #[serde(rename = "appliedRate", skip_serializing_if = "Option::is_none")]
31    pub applied_rate: Option<f64>,
32    #[serde(rename = "originalVats", skip_serializing_if = "Option::is_none")]
33    pub original_vats: Option<Vec<models::Vat>>,
34}
35
36impl CurrencyConversion {
37    /// details on a currency conversion applied 
38    pub fn new(original_currency: String, original_amount: i32) -> CurrencyConversion {
39        CurrencyConversion {
40            description: None,
41            original_currency,
42            original_amount,
43            scale: None,
44            applied_rate: None,
45            original_vats: None,
46        }
47    }
48}
49