commerce_program_client/generated/errors/
commerce_program.rs

1//! This code was AUTOGENERATED using the codama library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun codama to update it.
4//!
5//! <https://github.com/codama-idl/codama>
6//!
7
8use num_derive::FromPrimitive;
9use thiserror::Error;
10
11#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
12pub enum CommerceProgramError {
13    /// 0 - Incorrect mint provided
14    #[error("Incorrect mint provided")]
15    InvalidMint = 0x0,
16    /// 1 - Invalid payment status for the operation
17    #[error("Invalid payment status for the operation")]
18    InvalidPaymentStatus = 0x1,
19    /// 2 - Insufficient settlement amount
20    #[error("Insufficient settlement amount")]
21    InsufficientSettlementAmount = 0x2,
22    /// 3 - Settlement attempted too early
23    #[error("Settlement attempted too early")]
24    SettlementTooEarly = 0x3,
25    /// 4 - Refund amount exceeds policy limit
26    #[error("Refund amount exceeds policy limit")]
27    RefundAmountExceedsPolicyLimit = 0x4,
28    /// 5 - Refund window expired
29    #[error("Refund window expired")]
30    RefundWindowExpired = 0x5,
31    /// 6 - Invalid event authority
32    #[error("Invalid event authority")]
33    InvalidEventAuthority = 0x6,
34    /// 7 - Invalid ATA
35    #[error("Invalid ATA")]
36    InvalidAta = 0x7,
37    /// 8 - Payment close window not reached
38    #[error("Payment close window not reached")]
39    PaymentCloseWindowNotReached = 0x8,
40    /// 9 - Merchant owner does not match expected owner
41    #[error("Merchant owner does not match expected owner")]
42    MerchantOwnerMismatch = 0x9,
43    /// 10 - Merchant PDA is invalid
44    #[error("Merchant PDA is invalid")]
45    MerchantInvalidPda = 0xA,
46    /// 11 - Operator owner does not match expected owner
47    #[error("Operator owner does not match expected owner")]
48    OperatorOwnerMismatch = 0xB,
49    /// 12 - Operator PDA is invalid
50    #[error("Operator PDA is invalid")]
51    OperatorInvalidPda = 0xC,
52    /// 13 - Operator does not match config operator
53    #[error("Operator does not match config operator")]
54    OperatorMismatch = 0xD,
55    /// 14 - Merchant does not match config merchant
56    #[error("Merchant does not match config merchant")]
57    MerchantMismatch = 0xE,
58    /// 15 - Order ID is invalid or already used
59    #[error("Order ID is invalid or already used")]
60    OrderIdInvalid = 0xF,
61    /// 16 - MerchantOperatorConfig PDA is invalid
62    #[error("MerchantOperatorConfig PDA is invalid")]
63    MerchantOperatorConfigInvalidPda = 0x10,
64    /// 17 - Accepted currencies is empty
65    #[error("Accepted currencies is empty")]
66    AcceptedCurrenciesEmpty = 0x11,
67    /// 18 - Duplicate mint in accepted currencies
68    #[error("Duplicate mint in accepted currencies")]
69    DuplicateMint = 0x12,
70}
71
72impl From<CommerceProgramError> for solana_program_error::ProgramError {
73    fn from(e: CommerceProgramError) -> Self {
74        solana_program_error::ProgramError::Custom(e as u32)
75    }
76}
77