square_rust/api/models/objects/
money.rs

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