1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/// Errors that can occur in ferro-stripe operations.
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Configuration error (missing env var or invalid value).
#[error("stripe config error: {0}")]
Config(String),
/// Stripe API returned an error.
#[error("stripe API error: {0}")]
Stripe(String),
/// No Connect account linked to this tenant.
#[error("no Stripe Connect account linked to this tenant")]
NoConnectAccount,
/// Webhook signature verification failed.
#[error("webhook verification failed: {0}")]
WebhookVerification(String),
/// Event was already processed (idempotency guard).
#[error("stripe event already processed: {0}")]
EventAlreadyProcessed(String),
/// Idempotency key not set on CheckoutBuilder before calling create().
#[error("idempotency key required: call .idempotency_key() before .create()")]
MissingIdempotencyKey,
/// manual_capture() requires Mode::Payment. Mode::Subscription does not support
/// deferred capture — each subscription invoice is charged automatically.
#[error("manual capture requires payment mode; use Mode::Payment with manual_capture()")]
ManualCaptureRequiresPaymentMode,
}
impl From<stripe::StripeError> for Error {
fn from(e: stripe::StripeError) -> Self {
Error::Stripe(e.to_string())
}
}