Invoice

Struct Invoice 

Source
pub struct Invoice {
Show 37 fields pub invoice_id: u64, pub hash: String, pub currency_type: CurrencyType, pub asset: Option<CryptoCurrencyCode>, pub fiat: Option<FiatCurrencyCode>, pub amount: Decimal, pub paid_asset: Option<CryptoCurrencyCode>, pub paid_amount: Option<Decimal>, pub paid_fiat_rate: Option<Decimal>, pub accept_asset: Option<Vec<CryptoCurrencyCode>>, pub fee_asset: Option<String>, pub fee_amount: Option<Decimal>, pub bot_invoice_url: String, pub mini_app_invoice_url: String, pub web_app_invoice_url: String, pub description: Option<String>, pub status: InvoiceStatus, pub swap_to: Option<SwapToAssets>, pub is_swapped: Option<String>, pub swapped_uid: Option<String>, pub swapped_to: Option<SwapToAssets>, pub swapped_rate: Option<Decimal>, pub swapped_output: Option<Decimal>, pub swapped_usd_amount: Option<Decimal>, pub swapped_usd_rate: Option<Decimal>, pub created_at: DateTime<Utc>, pub paid_usd_rate: Option<Decimal>, pub allow_comments: bool, pub allow_anonymous: bool, pub expires_date: Option<DateTime<Utc>>, pub paid_at: Option<DateTime<Utc>>, pub paid_anonymously: Option<bool>, pub comment: Option<String>, pub hidden_message: Option<String>, pub payload: Option<String>, pub paid_btn_name: Option<PayButtonName>, pub paid_btn_url: Option<String>,
}

Fields§

§invoice_id: u64

Unique ID for this invoice.

§hash: String

Hash of the invoice.

§currency_type: CurrencyType

Type of the price, can be “crypto” or “fiat”.

§asset: Option<CryptoCurrencyCode>

Optional. Cryptocurrency code. Available only if the value of the field currency_type is “crypto”. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).

§fiat: Option<FiatCurrencyCode>

Optional. Fiat currency code. Available only if the value of the field currency_type is “fiat”. Currently one of “USD”, “EUR”, “RUB”, “BYN”, “UAH”, “GBP”, “CNY”, “KZT”, “UZS”, “GEL”, “TRY”, “AMD”, “THB”, “INR”, “BRL”, “IDR”, “AZN”, “AED”, “PLN” and “ILS”.

§amount: Decimal

Amount of the invoice for which the invoice was created.

§paid_asset: Option<CryptoCurrencyCode>

Optional. Cryptocurrency alphabetic code for which the invoice was paid. Available only if currency_type is “crypto” and status is “paid”.

§paid_amount: Option<Decimal>

Optional. Amount of the invoice for which the invoice was paid. Available only if currency_type is “fiat” and status is “paid”.

§paid_fiat_rate: Option<Decimal>

Optional. The rate of the paid_asset valued in the fiat currency. Available only if the value of the field currency_type is “fiat” and the value of the field status is “paid”.

§accept_asset: Option<Vec<CryptoCurrencyCode>>

Optional. List of assets which can be used to pay the invoice. Available only if currency_type is “fiat”. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (“JET” for testnet).

§fee_asset: Option<String>

Optional. Asset of service fees charged when the invoice was paid. Available only if status is “paid”.

§fee_amount: Option<Decimal>

Optional. Amount of service fees charged when the invoice was paid. Available only if status is “paid”.

§bot_invoice_url: String

URL should be provided to the user to pay the invoice.

§mini_app_invoice_url: String

Use this URL to pay an invoice to the Telegram Mini App version.

§web_app_invoice_url: String

Use this URL to pay an invoice to the Web version of Crypto Bot.

§description: Option<String>

Optional. Description for this invoice.

§status: InvoiceStatus

Status of the transfer, can be “active”, “paid” or “expired”.

§swap_to: Option<SwapToAssets>

Optional. The asset that will be attempted to be swapped into after the user makes a payment (the swap is not guaranteed). Supported assets: “USDT”, “TON”, “TRX”, “ETH”, “SOL”, “BTC”, “LTC”.

§is_swapped: Option<String>

Optional. For invoices with the “paid” status, this flag indicates whether the swap was successful (only applicable if swap_to is set).

§swapped_uid: Option<String>

Optional. If is_swapped is true, stores the unique identifier of the swap.

§swapped_to: Option<SwapToAssets>

Optional. If is_swapped is true, stores the asset into which the swap was made.

§swapped_rate: Option<Decimal>

Optional. If is_swapped is true, stores the exchange rate at which the swap was executed.

§swapped_output: Option<Decimal>

Optional. If is_swapped is true, stores the amount received as a result of the swap (in the swapped_to asset).

§swapped_usd_amount: Option<Decimal>

Optional. If is_swapped is true, stores the resulting swap amount in USD.

§swapped_usd_rate: Option<Decimal>

Optional. If is_swapped is true, stores the USD exchange rate of the currency from swapped_to.

§created_at: DateTime<Utc>

Date the invoice was created in ISO 8601 format.

§paid_usd_rate: Option<Decimal>

Optional. Price of the asset in USD. Available only if status is “paid”.

§allow_comments: bool

True, if the user can add comment to the payment.

§allow_anonymous: bool

True, if the user can pay the invoice anonymously.

§expires_date: Option<DateTime<Utc>>

Optional. Date the invoice expires in ISO 8601 format.

§paid_at: Option<DateTime<Utc>>

Optional. Date the invoice was paid in ISO 8601 format.

§paid_anonymously: Option<bool>

True, if the invoice was paid anonymously.

§comment: Option<String>

Optional. Comment to the payment from the user.

§hidden_message: Option<String>

Optional. Text of the hidden message for this invoice.

§payload: Option<String>

Optional. Previously provided data for this invoice.

§paid_btn_name: Option<PayButtonName>

Optional. Label of the button, can be “viewItem”, “openChannel”, “openBot” or “callback”.

§paid_btn_url: Option<String>

Optional. URL opened using the button.

Trait Implementations§

Source§

impl Clone for Invoice

Source§

fn clone(&self) -> Invoice

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Invoice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Invoice

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,