stripe/resources/generated/
api_errors.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use serde::{Deserialize, Serialize};
6
7use crate::resources::{PaymentIntent, PaymentMethod, PaymentSource, SetupIntent};
8
9/// The resource representing a Stripe "APIErrors".
10#[derive(Clone, Debug, Default, Deserialize, Serialize)]
11pub struct ApiErrors {
12    /// For card errors, the ID of the failed charge.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub charge: Option<String>,
15
16    /// For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub code: Option<ApiErrorsCode>,
19
20    /// For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub decline_code: Option<String>,
23
24    /// A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub doc_url: Option<String>,
27
28    /// A human-readable message providing more details about the error.
29    ///
30    /// For card errors, these messages can be shown to your users.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub message: Option<String>,
33
34    /// If the error is parameter-specific, the parameter related to the error.
35    ///
36    /// For example, you can use this to display a message near the correct form field.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub param: Option<String>,
39
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub payment_intent: Option<PaymentIntent>,
42
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub payment_method: Option<PaymentMethod>,
45
46    /// If the error is specific to the type of payment method, the payment method type that had a problem.
47    ///
48    /// This field is only populated for invoice-related errors.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub payment_method_type: Option<String>,
51
52    /// A URL to the request log entry in your dashboard.
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub request_log_url: Option<String>,
55
56    #[serde(skip_serializing_if = "Option::is_none")]
57    pub setup_intent: Option<SetupIntent>,
58
59    #[serde(skip_serializing_if = "Option::is_none")]
60    pub source: Option<PaymentSource>,
61
62    /// The type of error returned.
63    ///
64    /// One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error`.
65    #[serde(rename = "type")]
66    pub type_: ApiErrorsType,
67}
68
69/// An enum representing the possible values of an `ApiErrors`'s `code` field.
70#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
71#[serde(rename_all = "snake_case")]
72pub enum ApiErrorsCode {
73    AccountClosed,
74    AccountCountryInvalidAddress,
75    AccountErrorCountryChangeRequiresAdditionalSteps,
76    AccountInformationMismatch,
77    AccountInvalid,
78    AccountNumberInvalid,
79    AcssDebitSessionIncomplete,
80    AlipayUpgradeRequired,
81    AmountTooLarge,
82    AmountTooSmall,
83    ApiKeyExpired,
84    ApplicationFeesNotAllowed,
85    AuthenticationRequired,
86    BalanceInsufficient,
87    BalanceInvalidParameter,
88    BankAccountBadRoutingNumbers,
89    BankAccountDeclined,
90    BankAccountExists,
91    BankAccountRestricted,
92    BankAccountUnusable,
93    BankAccountUnverified,
94    BankAccountVerificationFailed,
95    BillingInvalidMandate,
96    BitcoinUpgradeRequired,
97    CaptureChargeAuthorizationExpired,
98    CaptureUnauthorizedPayment,
99    CardDeclineRateLimitExceeded,
100    CardDeclined,
101    CardholderPhoneNumberRequired,
102    ChargeAlreadyCaptured,
103    ChargeAlreadyRefunded,
104    ChargeDisputed,
105    ChargeExceedsSourceLimit,
106    ChargeExpiredForCapture,
107    ChargeInvalidParameter,
108    ChargeNotRefundable,
109    ClearingCodeUnsupported,
110    CountryCodeInvalid,
111    CountryUnsupported,
112    CouponExpired,
113    CustomerMaxPaymentMethods,
114    CustomerMaxSubscriptions,
115    CustomerTaxLocationInvalid,
116    DebitNotAuthorized,
117    EmailInvalid,
118    ExpiredCard,
119    FinancialConnectionsAccountInactive,
120    FinancialConnectionsNoSuccessfulTransactionRefresh,
121    IdempotencyKeyInUse,
122    IncorrectAddress,
123    IncorrectCvc,
124    IncorrectNumber,
125    IncorrectZip,
126    InstantPayoutsConfigDisabled,
127    InstantPayoutsCurrencyDisabled,
128    InstantPayoutsLimitExceeded,
129    InstantPayoutsUnsupported,
130    InsufficientFunds,
131    IntentInvalidState,
132    IntentVerificationMethodMissing,
133    InvalidCardType,
134    InvalidCharacters,
135    InvalidChargeAmount,
136    InvalidCvc,
137    InvalidExpiryMonth,
138    InvalidExpiryYear,
139    InvalidNumber,
140    InvalidSourceUsage,
141    InvalidTaxLocation,
142    InvoiceNoCustomerLineItems,
143    InvoiceNoPaymentMethodTypes,
144    InvoiceNoSubscriptionLineItems,
145    InvoiceNotEditable,
146    InvoiceOnBehalfOfNotEditable,
147    InvoicePaymentIntentRequiresAction,
148    InvoiceUpcomingNone,
149    LivemodeMismatch,
150    LockTimeout,
151    Missing,
152    NoAccount,
153    NotAllowedOnStandardAccount,
154    OutOfInventory,
155    OwnershipDeclarationNotAllowed,
156    ParameterInvalidEmpty,
157    ParameterInvalidInteger,
158    ParameterInvalidStringBlank,
159    ParameterInvalidStringEmpty,
160    ParameterMissing,
161    ParameterUnknown,
162    ParametersExclusive,
163    PaymentIntentActionRequired,
164    PaymentIntentAuthenticationFailure,
165    PaymentIntentIncompatiblePaymentMethod,
166    PaymentIntentInvalidParameter,
167    PaymentIntentKonbiniRejectedConfirmationNumber,
168    PaymentIntentMandateInvalid,
169    PaymentIntentPaymentAttemptExpired,
170    PaymentIntentPaymentAttemptFailed,
171    PaymentIntentUnexpectedState,
172    PaymentMethodBankAccountAlreadyVerified,
173    PaymentMethodBankAccountBlocked,
174    PaymentMethodBillingDetailsAddressMissing,
175    PaymentMethodConfigurationFailures,
176    PaymentMethodCurrencyMismatch,
177    PaymentMethodCustomerDecline,
178    PaymentMethodInvalidParameter,
179    PaymentMethodInvalidParameterTestmode,
180    PaymentMethodMicrodepositFailed,
181    PaymentMethodMicrodepositVerificationAmountsInvalid,
182    PaymentMethodMicrodepositVerificationAmountsMismatch,
183    PaymentMethodMicrodepositVerificationAttemptsExceeded,
184    PaymentMethodMicrodepositVerificationDescriptorCodeMismatch,
185    PaymentMethodMicrodepositVerificationTimeout,
186    PaymentMethodNotAvailable,
187    PaymentMethodProviderDecline,
188    PaymentMethodProviderTimeout,
189    PaymentMethodUnactivated,
190    PaymentMethodUnexpectedState,
191    PaymentMethodUnsupportedType,
192    PayoutReconciliationNotReady,
193    PayoutsLimitExceeded,
194    PayoutsNotAllowed,
195    PlatformAccountRequired,
196    PlatformApiKeyExpired,
197    PostalCodeInvalid,
198    ProcessingError,
199    ProductInactive,
200    ProgressiveOnboardingLimitExceeded,
201    RateLimit,
202    ReferToCustomer,
203    RefundDisputedPayment,
204    ResourceAlreadyExists,
205    ResourceMissing,
206    ReturnIntentAlreadyProcessed,
207    RoutingNumberInvalid,
208    SecretKeyRequired,
209    SepaUnsupportedAccount,
210    SetupAttemptFailed,
211    SetupIntentAuthenticationFailure,
212    SetupIntentInvalidParameter,
213    SetupIntentMandateInvalid,
214    SetupIntentSetupAttemptExpired,
215    SetupIntentUnexpectedState,
216    ShippingCalculationFailed,
217    SkuInactive,
218    StateUnsupported,
219    StatusTransitionInvalid,
220    StripeTaxInactive,
221    TaxIdInvalid,
222    TaxesCalculationFailed,
223    TerminalLocationCountryUnsupported,
224    TerminalReaderBusy,
225    TerminalReaderHardwareFault,
226    TerminalReaderOffline,
227    TerminalReaderTimeout,
228    TestmodeChargesOnly,
229    TlsVersionUnsupported,
230    TokenAlreadyUsed,
231    TokenCardNetworkInvalid,
232    TokenInUse,
233    TransferSourceBalanceParametersMismatch,
234    TransfersNotAllowed,
235    UrlInvalid,
236}
237
238impl ApiErrorsCode {
239    pub fn as_str(self) -> &'static str {
240        match self {
241            ApiErrorsCode::AccountClosed => "account_closed",
242            ApiErrorsCode::AccountCountryInvalidAddress => "account_country_invalid_address",
243            ApiErrorsCode::AccountErrorCountryChangeRequiresAdditionalSteps => {
244                "account_error_country_change_requires_additional_steps"
245            }
246            ApiErrorsCode::AccountInformationMismatch => "account_information_mismatch",
247            ApiErrorsCode::AccountInvalid => "account_invalid",
248            ApiErrorsCode::AccountNumberInvalid => "account_number_invalid",
249            ApiErrorsCode::AcssDebitSessionIncomplete => "acss_debit_session_incomplete",
250            ApiErrorsCode::AlipayUpgradeRequired => "alipay_upgrade_required",
251            ApiErrorsCode::AmountTooLarge => "amount_too_large",
252            ApiErrorsCode::AmountTooSmall => "amount_too_small",
253            ApiErrorsCode::ApiKeyExpired => "api_key_expired",
254            ApiErrorsCode::ApplicationFeesNotAllowed => "application_fees_not_allowed",
255            ApiErrorsCode::AuthenticationRequired => "authentication_required",
256            ApiErrorsCode::BalanceInsufficient => "balance_insufficient",
257            ApiErrorsCode::BalanceInvalidParameter => "balance_invalid_parameter",
258            ApiErrorsCode::BankAccountBadRoutingNumbers => "bank_account_bad_routing_numbers",
259            ApiErrorsCode::BankAccountDeclined => "bank_account_declined",
260            ApiErrorsCode::BankAccountExists => "bank_account_exists",
261            ApiErrorsCode::BankAccountRestricted => "bank_account_restricted",
262            ApiErrorsCode::BankAccountUnusable => "bank_account_unusable",
263            ApiErrorsCode::BankAccountUnverified => "bank_account_unverified",
264            ApiErrorsCode::BankAccountVerificationFailed => "bank_account_verification_failed",
265            ApiErrorsCode::BillingInvalidMandate => "billing_invalid_mandate",
266            ApiErrorsCode::BitcoinUpgradeRequired => "bitcoin_upgrade_required",
267            ApiErrorsCode::CaptureChargeAuthorizationExpired => {
268                "capture_charge_authorization_expired"
269            }
270            ApiErrorsCode::CaptureUnauthorizedPayment => "capture_unauthorized_payment",
271            ApiErrorsCode::CardDeclineRateLimitExceeded => "card_decline_rate_limit_exceeded",
272            ApiErrorsCode::CardDeclined => "card_declined",
273            ApiErrorsCode::CardholderPhoneNumberRequired => "cardholder_phone_number_required",
274            ApiErrorsCode::ChargeAlreadyCaptured => "charge_already_captured",
275            ApiErrorsCode::ChargeAlreadyRefunded => "charge_already_refunded",
276            ApiErrorsCode::ChargeDisputed => "charge_disputed",
277            ApiErrorsCode::ChargeExceedsSourceLimit => "charge_exceeds_source_limit",
278            ApiErrorsCode::ChargeExpiredForCapture => "charge_expired_for_capture",
279            ApiErrorsCode::ChargeInvalidParameter => "charge_invalid_parameter",
280            ApiErrorsCode::ChargeNotRefundable => "charge_not_refundable",
281            ApiErrorsCode::ClearingCodeUnsupported => "clearing_code_unsupported",
282            ApiErrorsCode::CountryCodeInvalid => "country_code_invalid",
283            ApiErrorsCode::CountryUnsupported => "country_unsupported",
284            ApiErrorsCode::CouponExpired => "coupon_expired",
285            ApiErrorsCode::CustomerMaxPaymentMethods => "customer_max_payment_methods",
286            ApiErrorsCode::CustomerMaxSubscriptions => "customer_max_subscriptions",
287            ApiErrorsCode::CustomerTaxLocationInvalid => "customer_tax_location_invalid",
288            ApiErrorsCode::DebitNotAuthorized => "debit_not_authorized",
289            ApiErrorsCode::EmailInvalid => "email_invalid",
290            ApiErrorsCode::ExpiredCard => "expired_card",
291            ApiErrorsCode::FinancialConnectionsAccountInactive => {
292                "financial_connections_account_inactive"
293            }
294            ApiErrorsCode::FinancialConnectionsNoSuccessfulTransactionRefresh => {
295                "financial_connections_no_successful_transaction_refresh"
296            }
297            ApiErrorsCode::IdempotencyKeyInUse => "idempotency_key_in_use",
298            ApiErrorsCode::IncorrectAddress => "incorrect_address",
299            ApiErrorsCode::IncorrectCvc => "incorrect_cvc",
300            ApiErrorsCode::IncorrectNumber => "incorrect_number",
301            ApiErrorsCode::IncorrectZip => "incorrect_zip",
302            ApiErrorsCode::InstantPayoutsConfigDisabled => "instant_payouts_config_disabled",
303            ApiErrorsCode::InstantPayoutsCurrencyDisabled => "instant_payouts_currency_disabled",
304            ApiErrorsCode::InstantPayoutsLimitExceeded => "instant_payouts_limit_exceeded",
305            ApiErrorsCode::InstantPayoutsUnsupported => "instant_payouts_unsupported",
306            ApiErrorsCode::InsufficientFunds => "insufficient_funds",
307            ApiErrorsCode::IntentInvalidState => "intent_invalid_state",
308            ApiErrorsCode::IntentVerificationMethodMissing => "intent_verification_method_missing",
309            ApiErrorsCode::InvalidCardType => "invalid_card_type",
310            ApiErrorsCode::InvalidCharacters => "invalid_characters",
311            ApiErrorsCode::InvalidChargeAmount => "invalid_charge_amount",
312            ApiErrorsCode::InvalidCvc => "invalid_cvc",
313            ApiErrorsCode::InvalidExpiryMonth => "invalid_expiry_month",
314            ApiErrorsCode::InvalidExpiryYear => "invalid_expiry_year",
315            ApiErrorsCode::InvalidNumber => "invalid_number",
316            ApiErrorsCode::InvalidSourceUsage => "invalid_source_usage",
317            ApiErrorsCode::InvalidTaxLocation => "invalid_tax_location",
318            ApiErrorsCode::InvoiceNoCustomerLineItems => "invoice_no_customer_line_items",
319            ApiErrorsCode::InvoiceNoPaymentMethodTypes => "invoice_no_payment_method_types",
320            ApiErrorsCode::InvoiceNoSubscriptionLineItems => "invoice_no_subscription_line_items",
321            ApiErrorsCode::InvoiceNotEditable => "invoice_not_editable",
322            ApiErrorsCode::InvoiceOnBehalfOfNotEditable => "invoice_on_behalf_of_not_editable",
323            ApiErrorsCode::InvoicePaymentIntentRequiresAction => {
324                "invoice_payment_intent_requires_action"
325            }
326            ApiErrorsCode::InvoiceUpcomingNone => "invoice_upcoming_none",
327            ApiErrorsCode::LivemodeMismatch => "livemode_mismatch",
328            ApiErrorsCode::LockTimeout => "lock_timeout",
329            ApiErrorsCode::Missing => "missing",
330            ApiErrorsCode::NoAccount => "no_account",
331            ApiErrorsCode::NotAllowedOnStandardAccount => "not_allowed_on_standard_account",
332            ApiErrorsCode::OutOfInventory => "out_of_inventory",
333            ApiErrorsCode::OwnershipDeclarationNotAllowed => "ownership_declaration_not_allowed",
334            ApiErrorsCode::ParameterInvalidEmpty => "parameter_invalid_empty",
335            ApiErrorsCode::ParameterInvalidInteger => "parameter_invalid_integer",
336            ApiErrorsCode::ParameterInvalidStringBlank => "parameter_invalid_string_blank",
337            ApiErrorsCode::ParameterInvalidStringEmpty => "parameter_invalid_string_empty",
338            ApiErrorsCode::ParameterMissing => "parameter_missing",
339            ApiErrorsCode::ParameterUnknown => "parameter_unknown",
340            ApiErrorsCode::ParametersExclusive => "parameters_exclusive",
341            ApiErrorsCode::PaymentIntentActionRequired => "payment_intent_action_required",
342            ApiErrorsCode::PaymentIntentAuthenticationFailure => {
343                "payment_intent_authentication_failure"
344            }
345            ApiErrorsCode::PaymentIntentIncompatiblePaymentMethod => {
346                "payment_intent_incompatible_payment_method"
347            }
348            ApiErrorsCode::PaymentIntentInvalidParameter => "payment_intent_invalid_parameter",
349            ApiErrorsCode::PaymentIntentKonbiniRejectedConfirmationNumber => {
350                "payment_intent_konbini_rejected_confirmation_number"
351            }
352            ApiErrorsCode::PaymentIntentMandateInvalid => "payment_intent_mandate_invalid",
353            ApiErrorsCode::PaymentIntentPaymentAttemptExpired => {
354                "payment_intent_payment_attempt_expired"
355            }
356            ApiErrorsCode::PaymentIntentPaymentAttemptFailed => {
357                "payment_intent_payment_attempt_failed"
358            }
359            ApiErrorsCode::PaymentIntentUnexpectedState => "payment_intent_unexpected_state",
360            ApiErrorsCode::PaymentMethodBankAccountAlreadyVerified => {
361                "payment_method_bank_account_already_verified"
362            }
363            ApiErrorsCode::PaymentMethodBankAccountBlocked => "payment_method_bank_account_blocked",
364            ApiErrorsCode::PaymentMethodBillingDetailsAddressMissing => {
365                "payment_method_billing_details_address_missing"
366            }
367            ApiErrorsCode::PaymentMethodConfigurationFailures => {
368                "payment_method_configuration_failures"
369            }
370            ApiErrorsCode::PaymentMethodCurrencyMismatch => "payment_method_currency_mismatch",
371            ApiErrorsCode::PaymentMethodCustomerDecline => "payment_method_customer_decline",
372            ApiErrorsCode::PaymentMethodInvalidParameter => "payment_method_invalid_parameter",
373            ApiErrorsCode::PaymentMethodInvalidParameterTestmode => {
374                "payment_method_invalid_parameter_testmode"
375            }
376            ApiErrorsCode::PaymentMethodMicrodepositFailed => "payment_method_microdeposit_failed",
377            ApiErrorsCode::PaymentMethodMicrodepositVerificationAmountsInvalid => {
378                "payment_method_microdeposit_verification_amounts_invalid"
379            }
380            ApiErrorsCode::PaymentMethodMicrodepositVerificationAmountsMismatch => {
381                "payment_method_microdeposit_verification_amounts_mismatch"
382            }
383            ApiErrorsCode::PaymentMethodMicrodepositVerificationAttemptsExceeded => {
384                "payment_method_microdeposit_verification_attempts_exceeded"
385            }
386            ApiErrorsCode::PaymentMethodMicrodepositVerificationDescriptorCodeMismatch => {
387                "payment_method_microdeposit_verification_descriptor_code_mismatch"
388            }
389            ApiErrorsCode::PaymentMethodMicrodepositVerificationTimeout => {
390                "payment_method_microdeposit_verification_timeout"
391            }
392            ApiErrorsCode::PaymentMethodNotAvailable => "payment_method_not_available",
393            ApiErrorsCode::PaymentMethodProviderDecline => "payment_method_provider_decline",
394            ApiErrorsCode::PaymentMethodProviderTimeout => "payment_method_provider_timeout",
395            ApiErrorsCode::PaymentMethodUnactivated => "payment_method_unactivated",
396            ApiErrorsCode::PaymentMethodUnexpectedState => "payment_method_unexpected_state",
397            ApiErrorsCode::PaymentMethodUnsupportedType => "payment_method_unsupported_type",
398            ApiErrorsCode::PayoutReconciliationNotReady => "payout_reconciliation_not_ready",
399            ApiErrorsCode::PayoutsLimitExceeded => "payouts_limit_exceeded",
400            ApiErrorsCode::PayoutsNotAllowed => "payouts_not_allowed",
401            ApiErrorsCode::PlatformAccountRequired => "platform_account_required",
402            ApiErrorsCode::PlatformApiKeyExpired => "platform_api_key_expired",
403            ApiErrorsCode::PostalCodeInvalid => "postal_code_invalid",
404            ApiErrorsCode::ProcessingError => "processing_error",
405            ApiErrorsCode::ProductInactive => "product_inactive",
406            ApiErrorsCode::ProgressiveOnboardingLimitExceeded => {
407                "progressive_onboarding_limit_exceeded"
408            }
409            ApiErrorsCode::RateLimit => "rate_limit",
410            ApiErrorsCode::ReferToCustomer => "refer_to_customer",
411            ApiErrorsCode::RefundDisputedPayment => "refund_disputed_payment",
412            ApiErrorsCode::ResourceAlreadyExists => "resource_already_exists",
413            ApiErrorsCode::ResourceMissing => "resource_missing",
414            ApiErrorsCode::ReturnIntentAlreadyProcessed => "return_intent_already_processed",
415            ApiErrorsCode::RoutingNumberInvalid => "routing_number_invalid",
416            ApiErrorsCode::SecretKeyRequired => "secret_key_required",
417            ApiErrorsCode::SepaUnsupportedAccount => "sepa_unsupported_account",
418            ApiErrorsCode::SetupAttemptFailed => "setup_attempt_failed",
419            ApiErrorsCode::SetupIntentAuthenticationFailure => {
420                "setup_intent_authentication_failure"
421            }
422            ApiErrorsCode::SetupIntentInvalidParameter => "setup_intent_invalid_parameter",
423            ApiErrorsCode::SetupIntentMandateInvalid => "setup_intent_mandate_invalid",
424            ApiErrorsCode::SetupIntentSetupAttemptExpired => "setup_intent_setup_attempt_expired",
425            ApiErrorsCode::SetupIntentUnexpectedState => "setup_intent_unexpected_state",
426            ApiErrorsCode::ShippingCalculationFailed => "shipping_calculation_failed",
427            ApiErrorsCode::SkuInactive => "sku_inactive",
428            ApiErrorsCode::StateUnsupported => "state_unsupported",
429            ApiErrorsCode::StatusTransitionInvalid => "status_transition_invalid",
430            ApiErrorsCode::StripeTaxInactive => "stripe_tax_inactive",
431            ApiErrorsCode::TaxIdInvalid => "tax_id_invalid",
432            ApiErrorsCode::TaxesCalculationFailed => "taxes_calculation_failed",
433            ApiErrorsCode::TerminalLocationCountryUnsupported => {
434                "terminal_location_country_unsupported"
435            }
436            ApiErrorsCode::TerminalReaderBusy => "terminal_reader_busy",
437            ApiErrorsCode::TerminalReaderHardwareFault => "terminal_reader_hardware_fault",
438            ApiErrorsCode::TerminalReaderOffline => "terminal_reader_offline",
439            ApiErrorsCode::TerminalReaderTimeout => "terminal_reader_timeout",
440            ApiErrorsCode::TestmodeChargesOnly => "testmode_charges_only",
441            ApiErrorsCode::TlsVersionUnsupported => "tls_version_unsupported",
442            ApiErrorsCode::TokenAlreadyUsed => "token_already_used",
443            ApiErrorsCode::TokenCardNetworkInvalid => "token_card_network_invalid",
444            ApiErrorsCode::TokenInUse => "token_in_use",
445            ApiErrorsCode::TransferSourceBalanceParametersMismatch => {
446                "transfer_source_balance_parameters_mismatch"
447            }
448            ApiErrorsCode::TransfersNotAllowed => "transfers_not_allowed",
449            ApiErrorsCode::UrlInvalid => "url_invalid",
450        }
451    }
452}
453
454impl AsRef<str> for ApiErrorsCode {
455    fn as_ref(&self) -> &str {
456        self.as_str()
457    }
458}
459
460impl std::fmt::Display for ApiErrorsCode {
461    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
462        self.as_str().fmt(f)
463    }
464}
465impl std::default::Default for ApiErrorsCode {
466    fn default() -> Self {
467        Self::AccountClosed
468    }
469}
470
471/// An enum representing the possible values of an `ApiErrors`'s `type` field.
472#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
473#[serde(rename_all = "snake_case")]
474pub enum ApiErrorsType {
475    ApiError,
476    CardError,
477    IdempotencyError,
478    InvalidRequestError,
479}
480
481impl ApiErrorsType {
482    pub fn as_str(self) -> &'static str {
483        match self {
484            ApiErrorsType::ApiError => "api_error",
485            ApiErrorsType::CardError => "card_error",
486            ApiErrorsType::IdempotencyError => "idempotency_error",
487            ApiErrorsType::InvalidRequestError => "invalid_request_error",
488        }
489    }
490}
491
492impl AsRef<str> for ApiErrorsType {
493    fn as_ref(&self) -> &str {
494        self.as_str()
495    }
496}
497
498impl std::fmt::Display for ApiErrorsType {
499    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
500        self.as_str().fmt(f)
501    }
502}
503impl std::default::Default for ApiErrorsType {
504    fn default() -> Self {
505        Self::ApiError
506    }
507}