crypto_pay_api/models/transfer/
mod.rs

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