etopay_sdk/core/viviswap/
mod.rs

1//! The Sdk struct is responsible for handling the Viviswap-related functionality and acts as a bridge between the Viviswap API and the application.
2#[cfg(feature = "viviswap-swap")]
3mod swap;
4
5#[cfg(feature = "viviswap-kyc")]
6mod kyc;
7
8/// Viviswap related errors
9#[derive(Debug, thiserror::Error)]
10pub enum ViviswapError {
11    /// Error raises if field for kyc verification is invalid
12    #[error("Viviswap validation error. Invalid field: {0}. Reason: {1}")]
13    Validation(String, String),
14
15    /// Error raises viviswap state is invalid
16    #[error("Viviswap invalid state error")]
17    InvalidState,
18
19    /// Error occurs if viviawap user has an existing state
20    #[error("Viviswap user state existing")]
21    UserStateExisting,
22
23    /// Error raises if there is an error with viviswap api
24    #[error("Viviswap api error: {0}")]
25    Api(String),
26
27    /// Error occurs is viviswap user is not found
28    #[error("Missing Viviswap user")]
29    MissingUser,
30
31    /// Error occurs if a filed is missing
32    #[error("Viviswap `{field}` is empty")]
33    MissingField {
34        /// the name of the field which is missing
35        field: String,
36    },
37
38    /// Variant to hold a collection of errors
39    #[error("Aggregate errors: {:?}", 0)]
40    Aggregate(Vec<crate::Error>),
41}