square_api_client/models/
money.rs

1//! Model struct for Money type
2
3use serde::{Deserialize, Serialize};
4
5use super::enums::Currency;
6
7/// Represents an amount of money.
8///
9/// `Money` fields can be signed or unsigned. Fields that do not explicitly define whether they are
10/// signed or unsigned are considered unsigned and can only hold positive amounts. For signed
11/// fields, the sign of the value indicates the purpose of the money transfer. See
12/// [Working with Monetary
13/// Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
14/// for more information.
15#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
16pub struct Money {
17    /// The amount of money, in the smallest denomination of the currency indicated by `currency`.
18    /// For example, when `currency` is `USD`, `amount` is in cents. Monetary amounts can be
19    /// positive or negative. See the specific field description to determine the meaning of the
20    /// sign in a particular case.
21    pub amount: i32,
22    /// The type of currency, in ISO 4217 format. For example, the currency code for US dollars is
23    /// `USD`.
24    pub currency: Currency,
25}