ic_papi_api/
error.rs

1//! Payment API error types.
2use candid::{CandidType, Deserialize, Principal};
3pub use ic_cycles_ledger_client::Account;
4use ic_cycles_ledger_client::{TransferFromError, WithdrawFromError};
5
6use crate::caller::TokenAmount;
7
8#[derive(Debug, CandidType, Deserialize, Clone, Eq, PartialEq)]
9#[non_exhaustive]
10pub enum PaymentError {
11    UnsupportedPaymentType,
12    LedgerUnreachable {
13        ledger: Principal,
14    },
15    LedgerWithdrawFromError {
16        ledger: Principal,
17        error: WithdrawFromError,
18    },
19    LedgerTransferFromError {
20        ledger: Principal,
21        error: TransferFromError,
22    },
23    InsufficientFunds {
24        needed: TokenAmount,
25        available: TokenAmount,
26    },
27    InvalidPatron,
28}