stripe/resources/generated/
api_errors.rs

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