use super::*;
#[derive(Clone, Debug, Eq, PartialEq, thiserror::Error)]
pub enum StripeParseError {
#[error("unknown currency code: {0}")]
UnknownCurrency(String),
#[error("unrecognised Stripe identifier: {0}")]
UnrecognisedId(String),
#[error("cannot combine {left} and {right}: Stripe never converts between currencies")]
CurrencyMismatch {
left: Currency,
right: Currency,
},
#[error("amount overflow: the sum exceeds the 64-bit range Stripe accepts")]
AmountOverflow,
}
#[derive(Clone, Debug, Eq, PartialEq, thiserror::Error)]
pub enum StripeError {
#[error("stripe error {code}: {message}")]
Api {
code: String,
message: String,
request_id: String,
},
#[error("stripe transport error: {0}")]
Transport(String),
#[error("webhook signature verification failed: {0}")]
SignatureVerification(String),
#[error(transparent)]
Parse(#[from] StripeParseError),
#[error("malformed stripe response: {0}")]
Malformed(String),
}