crypto_pay_api/models/transfer/
mod.rs

1mod builder;
2mod params;
3
4pub use builder::*;
5pub use params::*;
6
7use super::CryptoCurrencyCode;
8use chrono::{DateTime, Utc};
9use rust_decimal::Decimal;
10use serde::{Deserialize, Serialize};
11
12use crate::utils::deserialize_decimal;
13
14#[derive(Debug, Deserialize)]
15pub struct Transfer {
16    /// Unique ID for this transfer.
17    pub transfer_id: u64,
18
19    /// Unique UTF-8 string.
20    pub spend_id: String,
21
22    /// Telegram user ID the transfer was sent to.
23    pub user_id: u64,
24
25    /// Cryptocurrency alphabetic code. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).
26    pub asset: CryptoCurrencyCode,
27
28    /// Amount of the transfer in float.
29    #[serde(deserialize_with = "deserialize_decimal")]
30    pub amount: Decimal,
31
32    /// Status of the transfer, can only be “completed”.
33    pub status: TransferStatus,
34
35    /// Date the transfer was completed in ISO 8601 format.
36    pub completed_at: DateTime<Utc>,
37
38    /// Optional. Comment for this transfer.
39    pub comment: Option<String>,
40}
41
42#[derive(Debug, Deserialize, Serialize, PartialEq)]
43#[serde(rename_all = "lowercase")]
44pub enum TransferStatus {
45    Completed,
46}