1#[derive(Clone, Copy, clap::ValueEnum, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
15pub enum StripeApiErrorCode {
16 #[serde(rename = "account_already_exists")]
17 AccountAlreadyExists,
18 #[serde(rename = "account_country_invalid_address")]
19 AccountCountryInvalidAddress,
20 #[serde(rename = "account_invalid")]
21 AccountInvalid,
22 #[serde(rename = "account_number_invalid")]
23 AccountNumberInvalid,
24 #[serde(rename = "alipay_upgrade_required")]
25 AlipayUpgradeRequired,
26 #[serde(rename = "amount_too_large")]
27 AmountTooLarge,
28 #[serde(rename = "amount_too_small")]
29 AmountTooSmall,
30 #[serde(rename = "api_key_expired")]
31 ApiKeyExpired,
32 #[serde(rename = "balance_insufficient")]
33 BalanceInsufficient,
34 #[serde(rename = "bank_account_exists")]
35 BankAccountExists,
36 #[serde(rename = "bank_account_unusable")]
37 BankAccountUnusable,
38 #[serde(rename = "bank_account_unverified")]
39 BankAccountUnverified,
40 #[serde(rename = "bitcoin_upgrade_required")]
41 BitcoinUpgradeRequired,
42 #[serde(rename = "card_declined")]
43 CardDeclined,
44 #[serde(rename = "charge_already_captured")]
45 ChargeAlreadyCaptured,
46 #[serde(rename = "charge_already_refunded")]
47 ChargeAlreadyRefunded,
48 #[serde(rename = "charge_disputed")]
49 ChargeDisputed,
50 #[serde(rename = "charge_exceeds_source_limit")]
51 ChargeExceedsSourceLimit,
52 #[serde(rename = "charge_expired_for_capture")]
53 ChargeExpiredForCapture,
54 #[serde(rename = "country_unsupported")]
55 CountryUnsupported,
56 #[serde(rename = "coupon_expired")]
57 CouponExpired,
58 #[serde(rename = "customer_max_subscriptions")]
59 CustomerMaxSubscriptions,
60 #[serde(rename = "email_invalid")]
61 EmailInvalid,
62 #[serde(rename = "expired_card")]
63 ExpiredCard,
64 #[serde(rename = "idempotency_key_in_use")]
65 IdempotencyKeyInUse,
66 #[serde(rename = "incorrect_address")]
67 IncorrectAddress,
68 #[serde(rename = "incorrect_cvc")]
69 IncorrectCvc,
70 #[serde(rename = "incorrect_number")]
71 IncorrectNumber,
72 #[serde(rename = "incorrect_zip")]
73 IncorrectZip,
74 #[serde(rename = "instant_payouts_unsupported")]
75 InstantPayoutsUnsupported,
76 #[serde(rename = "invalid_card_type")]
77 InvalidCardType,
78 #[serde(rename = "invalid_charge_amount")]
79 InvalidChargeAmount,
80 #[serde(rename = "invalid_cvc")]
81 InvalidCvc,
82 #[serde(rename = "invalid_expiry_month")]
83 InvalidExpiryMonth,
84 #[serde(rename = "invalid_expiry_year")]
85 InvalidExpiryYear,
86 #[serde(rename = "invalid_number")]
87 InvalidNumber,
88 #[serde(rename = "invalid_source_usage")]
89 InvalidSourceUsage,
90 #[serde(rename = "invalid_swipe_data")]
91 InvalidSwipeData,
92 #[serde(rename = "invoice_no_customer_line_items")]
93 InvoiceNoCustomerLineItems,
94 #[serde(rename = "invoice_no_subscription_line_items")]
95 InvoiceNoSubscriptionLineItems,
96 #[serde(rename = "invoice_not_editable")]
97 InvoiceNotEditable,
98 #[serde(rename = "invoice_upcoming_none")]
99 InvoiceUpcomingNone,
100 #[serde(rename = "livemode_mismatch")]
101 LivemodeMismatch,
102 #[serde(rename = "missing")]
103 Missing,
104 #[serde(rename = "not_allowed_on_standard_account")]
105 NotAllowedOnStandardAccount,
106 #[serde(rename = "order_creation_failed")]
107 OrderCreationFailed,
108 #[serde(rename = "order_required_settings")]
109 OrderRequiredSettings,
110 #[serde(rename = "order_status_invalid")]
111 OrderStatusInvalid,
112 #[serde(rename = "order_upstream_timeout")]
113 OrderUpstreamTimeout,
114 #[serde(rename = "out_of_inventory")]
115 OutOfInventory,
116 #[serde(rename = "parameter_invalid_empty")]
117 ParameterInvalidEmpty,
118 #[serde(rename = "parameter_invalid_integer")]
119 ParameterInvalidInteger,
120 #[serde(rename = "parameter_invalid_string_blank")]
121 ParameterInvalidStringBlank,
122 #[serde(rename = "parameter_invalid_string_empty")]
123 ParameterInvalidStringEmpty,
124 #[serde(rename = "parameter_missing")]
125 ParameterMissing,
126 #[serde(rename = "parameter_unknown")]
127 ParameterUnknown,
128 #[serde(rename = "parameters_exclusive")]
129 ParametersExclusive,
130 #[serde(rename = "payment_intent_authentication_failure")]
131 PaymentIntentAuthenticationFailure,
132 #[serde(rename = "payment_intent_incompatible_payment_method")]
133 PaymentIntentIncompatiblePaymentMethod,
134 #[serde(rename = "payment_intent_invalid_parameter")]
135 PaymentIntentInvalidParameter,
136 #[serde(rename = "payment_intent_payment_attempt_failed")]
137 PaymentIntentPaymentAttemptFailed,
138 #[serde(rename = "payment_intent_unexpected_state")]
139 PaymentIntentUnexpectedState,
140 #[serde(rename = "payment_method_unactivated")]
141 PaymentMethodUnactivated,
142 #[serde(rename = "payment_method_unexpected_state")]
143 PaymentMethodUnexpectedState,
144 #[serde(rename = "payouts_not_allowed")]
145 PayoutsNotAllowed,
146 #[serde(rename = "platform_api_key_expired")]
147 PlatformApiKeyExpired,
148 #[serde(rename = "postal_code_invalid")]
149 PostalCodeInvalid,
150 #[serde(rename = "processing_error")]
151 ProcessingError,
152 #[serde(rename = "product_inactive")]
153 ProductInactive,
154 #[serde(rename = "rate_limit")]
155 RateLimit,
156 #[serde(rename = "resource_already_exists")]
157 ResourceAlreadyExists,
158 #[serde(rename = "resource_missing")]
159 ResourceMissing,
160 #[serde(rename = "routing_number_invalid")]
161 RoutingNumberInvalid,
162 #[serde(rename = "secret_key_required")]
163 SecretKeyRequired,
164 #[serde(rename = "sepa_unsupported_account")]
165 SepaUnsupportedAccount,
166 #[serde(rename = "shipping_calculation_failed")]
167 ShippingCalculationFailed,
168 #[serde(rename = "sku_inactive")]
169 SkuInactive,
170 #[serde(rename = "state_unsupported")]
171 StateUnsupported,
172 #[serde(rename = "tax_id_invalid")]
173 TaxIdInvalid,
174 #[serde(rename = "taxes_calculation_failed")]
175 TaxesCalculationFailed,
176 #[serde(rename = "testmode_charges_only")]
177 TestmodeChargesOnly,
178 #[serde(rename = "tls_version_unsupported")]
179 TlsVersionUnsupported,
180 #[serde(rename = "token_already_used")]
181 TokenAlreadyUsed,
182 #[serde(rename = "token_in_use")]
183 TokenInUse,
184 #[serde(rename = "transfers_not_allowed")]
185 TransfersNotAllowed,
186 #[serde(rename = "upstream_order_creation_failed")]
187 UpstreamOrderCreationFailed,
188 #[serde(rename = "url_invalid")]
189 UrlInvalid,
190
191}
192
193impl ToString for StripeApiErrorCode {
194 fn to_string(&self) -> String {
195 match self {
196 Self::AccountAlreadyExists => String::from("account_already_exists"),
197 Self::AccountCountryInvalidAddress => String::from("account_country_invalid_address"),
198 Self::AccountInvalid => String::from("account_invalid"),
199 Self::AccountNumberInvalid => String::from("account_number_invalid"),
200 Self::AlipayUpgradeRequired => String::from("alipay_upgrade_required"),
201 Self::AmountTooLarge => String::from("amount_too_large"),
202 Self::AmountTooSmall => String::from("amount_too_small"),
203 Self::ApiKeyExpired => String::from("api_key_expired"),
204 Self::BalanceInsufficient => String::from("balance_insufficient"),
205 Self::BankAccountExists => String::from("bank_account_exists"),
206 Self::BankAccountUnusable => String::from("bank_account_unusable"),
207 Self::BankAccountUnverified => String::from("bank_account_unverified"),
208 Self::BitcoinUpgradeRequired => String::from("bitcoin_upgrade_required"),
209 Self::CardDeclined => String::from("card_declined"),
210 Self::ChargeAlreadyCaptured => String::from("charge_already_captured"),
211 Self::ChargeAlreadyRefunded => String::from("charge_already_refunded"),
212 Self::ChargeDisputed => String::from("charge_disputed"),
213 Self::ChargeExceedsSourceLimit => String::from("charge_exceeds_source_limit"),
214 Self::ChargeExpiredForCapture => String::from("charge_expired_for_capture"),
215 Self::CountryUnsupported => String::from("country_unsupported"),
216 Self::CouponExpired => String::from("coupon_expired"),
217 Self::CustomerMaxSubscriptions => String::from("customer_max_subscriptions"),
218 Self::EmailInvalid => String::from("email_invalid"),
219 Self::ExpiredCard => String::from("expired_card"),
220 Self::IdempotencyKeyInUse => String::from("idempotency_key_in_use"),
221 Self::IncorrectAddress => String::from("incorrect_address"),
222 Self::IncorrectCvc => String::from("incorrect_cvc"),
223 Self::IncorrectNumber => String::from("incorrect_number"),
224 Self::IncorrectZip => String::from("incorrect_zip"),
225 Self::InstantPayoutsUnsupported => String::from("instant_payouts_unsupported"),
226 Self::InvalidCardType => String::from("invalid_card_type"),
227 Self::InvalidChargeAmount => String::from("invalid_charge_amount"),
228 Self::InvalidCvc => String::from("invalid_cvc"),
229 Self::InvalidExpiryMonth => String::from("invalid_expiry_month"),
230 Self::InvalidExpiryYear => String::from("invalid_expiry_year"),
231 Self::InvalidNumber => String::from("invalid_number"),
232 Self::InvalidSourceUsage => String::from("invalid_source_usage"),
233 Self::InvalidSwipeData => String::from("invalid_swipe_data"),
234 Self::InvoiceNoCustomerLineItems => String::from("invoice_no_customer_line_items"),
235 Self::InvoiceNoSubscriptionLineItems => String::from("invoice_no_subscription_line_items"),
236 Self::InvoiceNotEditable => String::from("invoice_not_editable"),
237 Self::InvoiceUpcomingNone => String::from("invoice_upcoming_none"),
238 Self::LivemodeMismatch => String::from("livemode_mismatch"),
239 Self::Missing => String::from("missing"),
240 Self::NotAllowedOnStandardAccount => String::from("not_allowed_on_standard_account"),
241 Self::OrderCreationFailed => String::from("order_creation_failed"),
242 Self::OrderRequiredSettings => String::from("order_required_settings"),
243 Self::OrderStatusInvalid => String::from("order_status_invalid"),
244 Self::OrderUpstreamTimeout => String::from("order_upstream_timeout"),
245 Self::OutOfInventory => String::from("out_of_inventory"),
246 Self::ParameterInvalidEmpty => String::from("parameter_invalid_empty"),
247 Self::ParameterInvalidInteger => String::from("parameter_invalid_integer"),
248 Self::ParameterInvalidStringBlank => String::from("parameter_invalid_string_blank"),
249 Self::ParameterInvalidStringEmpty => String::from("parameter_invalid_string_empty"),
250 Self::ParameterMissing => String::from("parameter_missing"),
251 Self::ParameterUnknown => String::from("parameter_unknown"),
252 Self::ParametersExclusive => String::from("parameters_exclusive"),
253 Self::PaymentIntentAuthenticationFailure => String::from("payment_intent_authentication_failure"),
254 Self::PaymentIntentIncompatiblePaymentMethod => String::from("payment_intent_incompatible_payment_method"),
255 Self::PaymentIntentInvalidParameter => String::from("payment_intent_invalid_parameter"),
256 Self::PaymentIntentPaymentAttemptFailed => String::from("payment_intent_payment_attempt_failed"),
257 Self::PaymentIntentUnexpectedState => String::from("payment_intent_unexpected_state"),
258 Self::PaymentMethodUnactivated => String::from("payment_method_unactivated"),
259 Self::PaymentMethodUnexpectedState => String::from("payment_method_unexpected_state"),
260 Self::PayoutsNotAllowed => String::from("payouts_not_allowed"),
261 Self::PlatformApiKeyExpired => String::from("platform_api_key_expired"),
262 Self::PostalCodeInvalid => String::from("postal_code_invalid"),
263 Self::ProcessingError => String::from("processing_error"),
264 Self::ProductInactive => String::from("product_inactive"),
265 Self::RateLimit => String::from("rate_limit"),
266 Self::ResourceAlreadyExists => String::from("resource_already_exists"),
267 Self::ResourceMissing => String::from("resource_missing"),
268 Self::RoutingNumberInvalid => String::from("routing_number_invalid"),
269 Self::SecretKeyRequired => String::from("secret_key_required"),
270 Self::SepaUnsupportedAccount => String::from("sepa_unsupported_account"),
271 Self::ShippingCalculationFailed => String::from("shipping_calculation_failed"),
272 Self::SkuInactive => String::from("sku_inactive"),
273 Self::StateUnsupported => String::from("state_unsupported"),
274 Self::TaxIdInvalid => String::from("tax_id_invalid"),
275 Self::TaxesCalculationFailed => String::from("taxes_calculation_failed"),
276 Self::TestmodeChargesOnly => String::from("testmode_charges_only"),
277 Self::TlsVersionUnsupported => String::from("tls_version_unsupported"),
278 Self::TokenAlreadyUsed => String::from("token_already_used"),
279 Self::TokenInUse => String::from("token_in_use"),
280 Self::TransfersNotAllowed => String::from("transfers_not_allowed"),
281 Self::UpstreamOrderCreationFailed => String::from("upstream_order_creation_failed"),
282 Self::UrlInvalid => String::from("url_invalid"),
283 }
284 }
285}
286
287impl Default for StripeApiErrorCode {
288 fn default() -> StripeApiErrorCode {
289 Self::AccountAlreadyExists
290 }
291}
292
293
294
295