Skip to main content

lockbook_server_lib/billing/
stripe_model.rs

1use serde::{Deserialize, Serialize};
2
3// This struct provides a fall back to unknown decline codes from Stripe. Since decline codes aren't parsed by "async-stripe" (a crate),
4// we provide our own solution to parse them. Although, there are instances in which we may receive an unknown decline code. Rather than
5// making serde handle this and return an internal error, we still handle the situation appropriately.
6#[derive(Serialize, Deserialize, Debug)]
7#[serde(untagged)]
8pub enum StripeDeclineCodeCatcher {
9    Known(StripeKnownDeclineCode),
10    Unknown(String),
11}
12
13// Decline codes for api version 2020-08-27
14#[derive(Debug, Serialize, Deserialize)]
15#[serde(rename_all = "snake_case")]
16pub enum StripeKnownDeclineCode {
17    ApproveWithId,
18    CallIssuer,
19    CardNotSupported,
20    CardVelocityExceeded,
21    CurrencyNotSupported,
22    DoNotHonor,
23    DoNotTryAgain,
24    ExpiredCard,
25    Fraudulent,
26    GenericDecline,
27    IncorrectNumber,
28    IncorrectCvc,
29    InsufficientFunds,
30    InvalidCvc,
31    InvalidExpiryMonth,
32    InvalidExpiryYear,
33    InvalidNumber,
34    IssuerNotAvailable,
35    LostCard,
36    MerchantBlacklist,
37    NewAccountInformationAvailable,
38    NoActionTaken,
39    NotPermitted,
40    PickupCard,
41    ProcessingError,
42    ReenterTransaction,
43    RestrictedCard,
44    RevocationOfAllAuthorizations,
45    RevocationOfAuthorization,
46    SecurityViolation,
47    ServiceNotAllowed,
48    StolenCard,
49    StopPaymentOrder,
50    TransactionNotAllowed,
51    TryAgainLater,
52    WithdrawalCountLimitExceeded,
53}