crypto_pay_api/models/check/
mod.rs

1mod builder;
2mod params;
3
4pub use builder::*;
5use chrono::{DateTime, Utc};
6pub use params::*;
7use rust_decimal::Decimal;
8use serde::{Deserialize, Serialize};
9
10use crate::utils::deserialize_decimal_from_string;
11
12use super::CryptoCurrencyCode;
13
14#[derive(Debug, Deserialize)]
15pub struct Check {
16    /// Unique ID for this check.
17    pub check_id: u64,
18
19    /// Hash of the check.
20    pub hash: String,
21
22    /// Cryptocurrency alphabetic code. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).
23    pub asset: CryptoCurrencyCode,
24
25    /// Amount of the check in float.
26    #[serde(deserialize_with = "deserialize_decimal_from_string")]
27    pub amount: Decimal,
28
29    /// URL should be provided to the user to activate the check.
30    pub bot_check_url: String,
31
32    /// Status of the check, can be “active” or “activated”.
33    pub status: CheckStatus,
34
35    /// Date the check was created in ISO 8601 format.
36    pub created_at: DateTime<Utc>,
37
38    /// Date the check was activated in ISO 8601 format.
39    pub activated_at: DateTime<Utc>,
40}
41
42#[derive(Debug, Deserialize, Serialize, PartialEq)]
43#[serde(rename_all = "lowercase")]
44pub enum CheckStatus {
45    Active,
46    Activated,
47}