crypto_pay_api/models/check/
mod.rs

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