1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct ApiErrors {
5 pub advice_code: Option<String>,
7 pub charge: Option<String>,
9 pub code: Option<ApiErrorsCode>,
11 pub decline_code: Option<String>,
13 pub doc_url: Option<String>,
15 pub message: Option<String>,
18 pub network_advice_code: Option<String>,
20 pub network_decline_code: Option<String>,
22 pub param: Option<String>,
25 pub payment_intent: Option<stripe_shared::PaymentIntent>,
26 pub payment_method: Option<stripe_shared::PaymentMethod>,
27 pub payment_method_type: Option<String>,
30 pub request_log_url: Option<String>,
32 pub setup_intent: Option<stripe_shared::SetupIntent>,
33 pub source: Option<stripe_shared::PaymentSource>,
34 #[cfg_attr(any(feature = "deserialize", feature = "serialize"), serde(rename = "type"))]
37 pub type_: ApiErrorsType,
38}
39#[doc(hidden)]
40pub struct ApiErrorsBuilder {
41 advice_code: Option<Option<String>>,
42 charge: Option<Option<String>>,
43 code: Option<Option<ApiErrorsCode>>,
44 decline_code: Option<Option<String>>,
45 doc_url: Option<Option<String>>,
46 message: Option<Option<String>>,
47 network_advice_code: Option<Option<String>>,
48 network_decline_code: Option<Option<String>>,
49 param: Option<Option<String>>,
50 payment_intent: Option<Option<stripe_shared::PaymentIntent>>,
51 payment_method: Option<Option<stripe_shared::PaymentMethod>>,
52 payment_method_type: Option<Option<String>>,
53 request_log_url: Option<Option<String>>,
54 setup_intent: Option<Option<stripe_shared::SetupIntent>>,
55 source: Option<Option<stripe_shared::PaymentSource>>,
56 type_: Option<ApiErrorsType>,
57}
58
59#[allow(
60 unused_variables,
61 irrefutable_let_patterns,
62 clippy::let_unit_value,
63 clippy::match_single_binding,
64 clippy::single_match
65)]
66const _: () = {
67 use miniserde::de::{Map, Visitor};
68 use miniserde::json::Value;
69 use miniserde::{Deserialize, Result, make_place};
70 use stripe_types::miniserde_helpers::FromValueOpt;
71 use stripe_types::{MapBuilder, ObjectDeser};
72
73 make_place!(Place);
74
75 impl Deserialize for ApiErrors {
76 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
77 Place::new(out)
78 }
79 }
80
81 struct Builder<'a> {
82 out: &'a mut Option<ApiErrors>,
83 builder: ApiErrorsBuilder,
84 }
85
86 impl Visitor for Place<ApiErrors> {
87 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
88 Ok(Box::new(Builder { out: &mut self.out, builder: ApiErrorsBuilder::deser_default() }))
89 }
90 }
91
92 impl MapBuilder for ApiErrorsBuilder {
93 type Out = ApiErrors;
94 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
95 Ok(match k {
96 "advice_code" => Deserialize::begin(&mut self.advice_code),
97 "charge" => Deserialize::begin(&mut self.charge),
98 "code" => Deserialize::begin(&mut self.code),
99 "decline_code" => Deserialize::begin(&mut self.decline_code),
100 "doc_url" => Deserialize::begin(&mut self.doc_url),
101 "message" => Deserialize::begin(&mut self.message),
102 "network_advice_code" => Deserialize::begin(&mut self.network_advice_code),
103 "network_decline_code" => Deserialize::begin(&mut self.network_decline_code),
104 "param" => Deserialize::begin(&mut self.param),
105 "payment_intent" => Deserialize::begin(&mut self.payment_intent),
106 "payment_method" => Deserialize::begin(&mut self.payment_method),
107 "payment_method_type" => Deserialize::begin(&mut self.payment_method_type),
108 "request_log_url" => Deserialize::begin(&mut self.request_log_url),
109 "setup_intent" => Deserialize::begin(&mut self.setup_intent),
110 "source" => Deserialize::begin(&mut self.source),
111 "type" => Deserialize::begin(&mut self.type_),
112
113 _ => <dyn Visitor>::ignore(),
114 })
115 }
116
117 fn deser_default() -> Self {
118 Self {
119 advice_code: Deserialize::default(),
120 charge: Deserialize::default(),
121 code: Deserialize::default(),
122 decline_code: Deserialize::default(),
123 doc_url: Deserialize::default(),
124 message: Deserialize::default(),
125 network_advice_code: Deserialize::default(),
126 network_decline_code: Deserialize::default(),
127 param: Deserialize::default(),
128 payment_intent: Deserialize::default(),
129 payment_method: Deserialize::default(),
130 payment_method_type: Deserialize::default(),
131 request_log_url: Deserialize::default(),
132 setup_intent: Deserialize::default(),
133 source: Deserialize::default(),
134 type_: Deserialize::default(),
135 }
136 }
137
138 fn take_out(&mut self) -> Option<Self::Out> {
139 let (
140 Some(advice_code),
141 Some(charge),
142 Some(code),
143 Some(decline_code),
144 Some(doc_url),
145 Some(message),
146 Some(network_advice_code),
147 Some(network_decline_code),
148 Some(param),
149 Some(payment_intent),
150 Some(payment_method),
151 Some(payment_method_type),
152 Some(request_log_url),
153 Some(setup_intent),
154 Some(source),
155 Some(type_),
156 ) = (
157 self.advice_code.take(),
158 self.charge.take(),
159 self.code.take(),
160 self.decline_code.take(),
161 self.doc_url.take(),
162 self.message.take(),
163 self.network_advice_code.take(),
164 self.network_decline_code.take(),
165 self.param.take(),
166 self.payment_intent.take(),
167 self.payment_method.take(),
168 self.payment_method_type.take(),
169 self.request_log_url.take(),
170 self.setup_intent.take(),
171 self.source.take(),
172 self.type_,
173 )
174 else {
175 return None;
176 };
177 Some(Self::Out {
178 advice_code,
179 charge,
180 code,
181 decline_code,
182 doc_url,
183 message,
184 network_advice_code,
185 network_decline_code,
186 param,
187 payment_intent,
188 payment_method,
189 payment_method_type,
190 request_log_url,
191 setup_intent,
192 source,
193 type_,
194 })
195 }
196 }
197
198 impl Map for Builder<'_> {
199 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
200 self.builder.key(k)
201 }
202
203 fn finish(&mut self) -> Result<()> {
204 *self.out = self.builder.take_out();
205 Ok(())
206 }
207 }
208
209 impl ObjectDeser for ApiErrors {
210 type Builder = ApiErrorsBuilder;
211 }
212
213 impl FromValueOpt for ApiErrors {
214 fn from_value(v: Value) -> Option<Self> {
215 let Value::Object(obj) = v else {
216 return None;
217 };
218 let mut b = ApiErrorsBuilder::deser_default();
219 for (k, v) in obj {
220 match k.as_str() {
221 "advice_code" => b.advice_code = FromValueOpt::from_value(v),
222 "charge" => b.charge = FromValueOpt::from_value(v),
223 "code" => b.code = FromValueOpt::from_value(v),
224 "decline_code" => b.decline_code = FromValueOpt::from_value(v),
225 "doc_url" => b.doc_url = FromValueOpt::from_value(v),
226 "message" => b.message = FromValueOpt::from_value(v),
227 "network_advice_code" => b.network_advice_code = FromValueOpt::from_value(v),
228 "network_decline_code" => b.network_decline_code = FromValueOpt::from_value(v),
229 "param" => b.param = FromValueOpt::from_value(v),
230 "payment_intent" => b.payment_intent = FromValueOpt::from_value(v),
231 "payment_method" => b.payment_method = FromValueOpt::from_value(v),
232 "payment_method_type" => b.payment_method_type = FromValueOpt::from_value(v),
233 "request_log_url" => b.request_log_url = FromValueOpt::from_value(v),
234 "setup_intent" => b.setup_intent = FromValueOpt::from_value(v),
235 "source" => b.source = FromValueOpt::from_value(v),
236 "type" => b.type_ = FromValueOpt::from_value(v),
237
238 _ => {}
239 }
240 }
241 b.take_out()
242 }
243 }
244};
245#[derive(Clone, Eq, PartialEq)]
247#[non_exhaustive]
248pub enum ApiErrorsCode {
249 AccountClosed,
250 AccountCountryInvalidAddress,
251 AccountErrorCountryChangeRequiresAdditionalSteps,
252 AccountInformationMismatch,
253 AccountInvalid,
254 AccountNumberInvalid,
255 AcssDebitSessionIncomplete,
256 AlipayUpgradeRequired,
257 AmountTooLarge,
258 AmountTooSmall,
259 ApiKeyExpired,
260 ApplicationFeesNotAllowed,
261 AuthenticationRequired,
262 BalanceInsufficient,
263 BalanceInvalidParameter,
264 BankAccountBadRoutingNumbers,
265 BankAccountDeclined,
266 BankAccountExists,
267 BankAccountRestricted,
268 BankAccountUnusable,
269 BankAccountUnverified,
270 BankAccountVerificationFailed,
271 BillingInvalidMandate,
272 BitcoinUpgradeRequired,
273 CaptureChargeAuthorizationExpired,
274 CaptureUnauthorizedPayment,
275 CardDeclineRateLimitExceeded,
276 CardDeclined,
277 CardholderPhoneNumberRequired,
278 ChargeAlreadyCaptured,
279 ChargeAlreadyRefunded,
280 ChargeDisputed,
281 ChargeExceedsSourceLimit,
282 ChargeExceedsTransactionLimit,
283 ChargeExpiredForCapture,
284 ChargeInvalidParameter,
285 ChargeNotRefundable,
286 ClearingCodeUnsupported,
287 CountryCodeInvalid,
288 CountryUnsupported,
289 CouponExpired,
290 CustomerMaxPaymentMethods,
291 CustomerMaxSubscriptions,
292 CustomerSessionExpired,
293 CustomerTaxLocationInvalid,
294 DebitNotAuthorized,
295 EmailInvalid,
296 ExpiredCard,
297 FinancialConnectionsAccountInactive,
298 FinancialConnectionsAccountPendingAccountNumbers,
299 FinancialConnectionsAccountUnavailableAccountNumbers,
300 FinancialConnectionsNoSuccessfulTransactionRefresh,
301 ForwardingApiInactive,
302 ForwardingApiInvalidParameter,
303 ForwardingApiRetryableUpstreamError,
304 ForwardingApiUpstreamConnectionError,
305 ForwardingApiUpstreamConnectionTimeout,
306 ForwardingApiUpstreamError,
307 IdempotencyKeyInUse,
308 IncorrectAddress,
309 IncorrectCvc,
310 IncorrectNumber,
311 IncorrectZip,
312 IndiaRecurringPaymentMandateCanceled,
313 InstantPayoutsConfigDisabled,
314 InstantPayoutsCurrencyDisabled,
315 InstantPayoutsLimitExceeded,
316 InstantPayoutsUnsupported,
317 InsufficientFunds,
318 IntentInvalidState,
319 IntentVerificationMethodMissing,
320 InvalidCardType,
321 InvalidCharacters,
322 InvalidChargeAmount,
323 InvalidCvc,
324 InvalidExpiryMonth,
325 InvalidExpiryYear,
326 InvalidMandateReferencePrefixFormat,
327 InvalidNumber,
328 InvalidSourceUsage,
329 InvalidTaxLocation,
330 InvoiceNoCustomerLineItems,
331 InvoiceNoPaymentMethodTypes,
332 InvoiceNoSubscriptionLineItems,
333 InvoiceNotEditable,
334 InvoiceOnBehalfOfNotEditable,
335 InvoicePaymentIntentRequiresAction,
336 InvoiceUpcomingNone,
337 LivemodeMismatch,
338 LockTimeout,
339 Missing,
340 NoAccount,
341 NotAllowedOnStandardAccount,
342 OutOfInventory,
343 OwnershipDeclarationNotAllowed,
344 ParameterInvalidEmpty,
345 ParameterInvalidInteger,
346 ParameterInvalidStringBlank,
347 ParameterInvalidStringEmpty,
348 ParameterMissing,
349 ParameterUnknown,
350 ParametersExclusive,
351 PaymentIntentActionRequired,
352 PaymentIntentAuthenticationFailure,
353 PaymentIntentIncompatiblePaymentMethod,
354 PaymentIntentInvalidParameter,
355 PaymentIntentKonbiniRejectedConfirmationNumber,
356 PaymentIntentMandateInvalid,
357 PaymentIntentPaymentAttemptExpired,
358 PaymentIntentPaymentAttemptFailed,
359 PaymentIntentUnexpectedState,
360 PaymentMethodBankAccountAlreadyVerified,
361 PaymentMethodBankAccountBlocked,
362 PaymentMethodBillingDetailsAddressMissing,
363 PaymentMethodConfigurationFailures,
364 PaymentMethodCurrencyMismatch,
365 PaymentMethodCustomerDecline,
366 PaymentMethodInvalidParameter,
367 PaymentMethodInvalidParameterTestmode,
368 PaymentMethodMicrodepositFailed,
369 PaymentMethodMicrodepositVerificationAmountsInvalid,
370 PaymentMethodMicrodepositVerificationAmountsMismatch,
371 PaymentMethodMicrodepositVerificationAttemptsExceeded,
372 PaymentMethodMicrodepositVerificationDescriptorCodeMismatch,
373 PaymentMethodMicrodepositVerificationTimeout,
374 PaymentMethodNotAvailable,
375 PaymentMethodProviderDecline,
376 PaymentMethodProviderTimeout,
377 PaymentMethodUnactivated,
378 PaymentMethodUnexpectedState,
379 PaymentMethodUnsupportedType,
380 PayoutReconciliationNotReady,
381 PayoutsLimitExceeded,
382 PayoutsNotAllowed,
383 PlatformAccountRequired,
384 PlatformApiKeyExpired,
385 PostalCodeInvalid,
386 ProcessingError,
387 ProductInactive,
388 ProgressiveOnboardingLimitExceeded,
389 RateLimit,
390 ReferToCustomer,
391 RefundDisputedPayment,
392 ResourceAlreadyExists,
393 ResourceMissing,
394 ReturnIntentAlreadyProcessed,
395 RoutingNumberInvalid,
396 SecretKeyRequired,
397 SepaUnsupportedAccount,
398 SetupAttemptFailed,
399 SetupIntentAuthenticationFailure,
400 SetupIntentInvalidParameter,
401 SetupIntentMandateInvalid,
402 SetupIntentMobileWalletUnsupported,
403 SetupIntentSetupAttemptExpired,
404 SetupIntentUnexpectedState,
405 ShippingAddressInvalid,
406 ShippingCalculationFailed,
407 SkuInactive,
408 StateUnsupported,
409 StatusTransitionInvalid,
410 StripeTaxInactive,
411 TaxIdInvalid,
412 TaxIdProhibited,
413 TaxesCalculationFailed,
414 TerminalLocationCountryUnsupported,
415 TerminalReaderBusy,
416 TerminalReaderHardwareFault,
417 TerminalReaderInvalidLocationForActivation,
418 TerminalReaderInvalidLocationForPayment,
419 TerminalReaderOffline,
420 TerminalReaderTimeout,
421 TestmodeChargesOnly,
422 TlsVersionUnsupported,
423 TokenAlreadyUsed,
424 TokenCardNetworkInvalid,
425 TokenInUse,
426 TransferSourceBalanceParametersMismatch,
427 TransfersNotAllowed,
428 UrlInvalid,
429 Unknown(String),
431}
432impl ApiErrorsCode {
433 pub fn as_str(&self) -> &str {
434 use ApiErrorsCode::*;
435 match self {
436 AccountClosed => "account_closed",
437 AccountCountryInvalidAddress => "account_country_invalid_address",
438 AccountErrorCountryChangeRequiresAdditionalSteps => {
439 "account_error_country_change_requires_additional_steps"
440 }
441 AccountInformationMismatch => "account_information_mismatch",
442 AccountInvalid => "account_invalid",
443 AccountNumberInvalid => "account_number_invalid",
444 AcssDebitSessionIncomplete => "acss_debit_session_incomplete",
445 AlipayUpgradeRequired => "alipay_upgrade_required",
446 AmountTooLarge => "amount_too_large",
447 AmountTooSmall => "amount_too_small",
448 ApiKeyExpired => "api_key_expired",
449 ApplicationFeesNotAllowed => "application_fees_not_allowed",
450 AuthenticationRequired => "authentication_required",
451 BalanceInsufficient => "balance_insufficient",
452 BalanceInvalidParameter => "balance_invalid_parameter",
453 BankAccountBadRoutingNumbers => "bank_account_bad_routing_numbers",
454 BankAccountDeclined => "bank_account_declined",
455 BankAccountExists => "bank_account_exists",
456 BankAccountRestricted => "bank_account_restricted",
457 BankAccountUnusable => "bank_account_unusable",
458 BankAccountUnverified => "bank_account_unverified",
459 BankAccountVerificationFailed => "bank_account_verification_failed",
460 BillingInvalidMandate => "billing_invalid_mandate",
461 BitcoinUpgradeRequired => "bitcoin_upgrade_required",
462 CaptureChargeAuthorizationExpired => "capture_charge_authorization_expired",
463 CaptureUnauthorizedPayment => "capture_unauthorized_payment",
464 CardDeclineRateLimitExceeded => "card_decline_rate_limit_exceeded",
465 CardDeclined => "card_declined",
466 CardholderPhoneNumberRequired => "cardholder_phone_number_required",
467 ChargeAlreadyCaptured => "charge_already_captured",
468 ChargeAlreadyRefunded => "charge_already_refunded",
469 ChargeDisputed => "charge_disputed",
470 ChargeExceedsSourceLimit => "charge_exceeds_source_limit",
471 ChargeExceedsTransactionLimit => "charge_exceeds_transaction_limit",
472 ChargeExpiredForCapture => "charge_expired_for_capture",
473 ChargeInvalidParameter => "charge_invalid_parameter",
474 ChargeNotRefundable => "charge_not_refundable",
475 ClearingCodeUnsupported => "clearing_code_unsupported",
476 CountryCodeInvalid => "country_code_invalid",
477 CountryUnsupported => "country_unsupported",
478 CouponExpired => "coupon_expired",
479 CustomerMaxPaymentMethods => "customer_max_payment_methods",
480 CustomerMaxSubscriptions => "customer_max_subscriptions",
481 CustomerSessionExpired => "customer_session_expired",
482 CustomerTaxLocationInvalid => "customer_tax_location_invalid",
483 DebitNotAuthorized => "debit_not_authorized",
484 EmailInvalid => "email_invalid",
485 ExpiredCard => "expired_card",
486 FinancialConnectionsAccountInactive => "financial_connections_account_inactive",
487 FinancialConnectionsAccountPendingAccountNumbers => {
488 "financial_connections_account_pending_account_numbers"
489 }
490 FinancialConnectionsAccountUnavailableAccountNumbers => {
491 "financial_connections_account_unavailable_account_numbers"
492 }
493 FinancialConnectionsNoSuccessfulTransactionRefresh => {
494 "financial_connections_no_successful_transaction_refresh"
495 }
496 ForwardingApiInactive => "forwarding_api_inactive",
497 ForwardingApiInvalidParameter => "forwarding_api_invalid_parameter",
498 ForwardingApiRetryableUpstreamError => "forwarding_api_retryable_upstream_error",
499 ForwardingApiUpstreamConnectionError => "forwarding_api_upstream_connection_error",
500 ForwardingApiUpstreamConnectionTimeout => "forwarding_api_upstream_connection_timeout",
501 ForwardingApiUpstreamError => "forwarding_api_upstream_error",
502 IdempotencyKeyInUse => "idempotency_key_in_use",
503 IncorrectAddress => "incorrect_address",
504 IncorrectCvc => "incorrect_cvc",
505 IncorrectNumber => "incorrect_number",
506 IncorrectZip => "incorrect_zip",
507 IndiaRecurringPaymentMandateCanceled => "india_recurring_payment_mandate_canceled",
508 InstantPayoutsConfigDisabled => "instant_payouts_config_disabled",
509 InstantPayoutsCurrencyDisabled => "instant_payouts_currency_disabled",
510 InstantPayoutsLimitExceeded => "instant_payouts_limit_exceeded",
511 InstantPayoutsUnsupported => "instant_payouts_unsupported",
512 InsufficientFunds => "insufficient_funds",
513 IntentInvalidState => "intent_invalid_state",
514 IntentVerificationMethodMissing => "intent_verification_method_missing",
515 InvalidCardType => "invalid_card_type",
516 InvalidCharacters => "invalid_characters",
517 InvalidChargeAmount => "invalid_charge_amount",
518 InvalidCvc => "invalid_cvc",
519 InvalidExpiryMonth => "invalid_expiry_month",
520 InvalidExpiryYear => "invalid_expiry_year",
521 InvalidMandateReferencePrefixFormat => "invalid_mandate_reference_prefix_format",
522 InvalidNumber => "invalid_number",
523 InvalidSourceUsage => "invalid_source_usage",
524 InvalidTaxLocation => "invalid_tax_location",
525 InvoiceNoCustomerLineItems => "invoice_no_customer_line_items",
526 InvoiceNoPaymentMethodTypes => "invoice_no_payment_method_types",
527 InvoiceNoSubscriptionLineItems => "invoice_no_subscription_line_items",
528 InvoiceNotEditable => "invoice_not_editable",
529 InvoiceOnBehalfOfNotEditable => "invoice_on_behalf_of_not_editable",
530 InvoicePaymentIntentRequiresAction => "invoice_payment_intent_requires_action",
531 InvoiceUpcomingNone => "invoice_upcoming_none",
532 LivemodeMismatch => "livemode_mismatch",
533 LockTimeout => "lock_timeout",
534 Missing => "missing",
535 NoAccount => "no_account",
536 NotAllowedOnStandardAccount => "not_allowed_on_standard_account",
537 OutOfInventory => "out_of_inventory",
538 OwnershipDeclarationNotAllowed => "ownership_declaration_not_allowed",
539 ParameterInvalidEmpty => "parameter_invalid_empty",
540 ParameterInvalidInteger => "parameter_invalid_integer",
541 ParameterInvalidStringBlank => "parameter_invalid_string_blank",
542 ParameterInvalidStringEmpty => "parameter_invalid_string_empty",
543 ParameterMissing => "parameter_missing",
544 ParameterUnknown => "parameter_unknown",
545 ParametersExclusive => "parameters_exclusive",
546 PaymentIntentActionRequired => "payment_intent_action_required",
547 PaymentIntentAuthenticationFailure => "payment_intent_authentication_failure",
548 PaymentIntentIncompatiblePaymentMethod => "payment_intent_incompatible_payment_method",
549 PaymentIntentInvalidParameter => "payment_intent_invalid_parameter",
550 PaymentIntentKonbiniRejectedConfirmationNumber => {
551 "payment_intent_konbini_rejected_confirmation_number"
552 }
553 PaymentIntentMandateInvalid => "payment_intent_mandate_invalid",
554 PaymentIntentPaymentAttemptExpired => "payment_intent_payment_attempt_expired",
555 PaymentIntentPaymentAttemptFailed => "payment_intent_payment_attempt_failed",
556 PaymentIntentUnexpectedState => "payment_intent_unexpected_state",
557 PaymentMethodBankAccountAlreadyVerified => {
558 "payment_method_bank_account_already_verified"
559 }
560 PaymentMethodBankAccountBlocked => "payment_method_bank_account_blocked",
561 PaymentMethodBillingDetailsAddressMissing => {
562 "payment_method_billing_details_address_missing"
563 }
564 PaymentMethodConfigurationFailures => "payment_method_configuration_failures",
565 PaymentMethodCurrencyMismatch => "payment_method_currency_mismatch",
566 PaymentMethodCustomerDecline => "payment_method_customer_decline",
567 PaymentMethodInvalidParameter => "payment_method_invalid_parameter",
568 PaymentMethodInvalidParameterTestmode => "payment_method_invalid_parameter_testmode",
569 PaymentMethodMicrodepositFailed => "payment_method_microdeposit_failed",
570 PaymentMethodMicrodepositVerificationAmountsInvalid => {
571 "payment_method_microdeposit_verification_amounts_invalid"
572 }
573 PaymentMethodMicrodepositVerificationAmountsMismatch => {
574 "payment_method_microdeposit_verification_amounts_mismatch"
575 }
576 PaymentMethodMicrodepositVerificationAttemptsExceeded => {
577 "payment_method_microdeposit_verification_attempts_exceeded"
578 }
579 PaymentMethodMicrodepositVerificationDescriptorCodeMismatch => {
580 "payment_method_microdeposit_verification_descriptor_code_mismatch"
581 }
582 PaymentMethodMicrodepositVerificationTimeout => {
583 "payment_method_microdeposit_verification_timeout"
584 }
585 PaymentMethodNotAvailable => "payment_method_not_available",
586 PaymentMethodProviderDecline => "payment_method_provider_decline",
587 PaymentMethodProviderTimeout => "payment_method_provider_timeout",
588 PaymentMethodUnactivated => "payment_method_unactivated",
589 PaymentMethodUnexpectedState => "payment_method_unexpected_state",
590 PaymentMethodUnsupportedType => "payment_method_unsupported_type",
591 PayoutReconciliationNotReady => "payout_reconciliation_not_ready",
592 PayoutsLimitExceeded => "payouts_limit_exceeded",
593 PayoutsNotAllowed => "payouts_not_allowed",
594 PlatformAccountRequired => "platform_account_required",
595 PlatformApiKeyExpired => "platform_api_key_expired",
596 PostalCodeInvalid => "postal_code_invalid",
597 ProcessingError => "processing_error",
598 ProductInactive => "product_inactive",
599 ProgressiveOnboardingLimitExceeded => "progressive_onboarding_limit_exceeded",
600 RateLimit => "rate_limit",
601 ReferToCustomer => "refer_to_customer",
602 RefundDisputedPayment => "refund_disputed_payment",
603 ResourceAlreadyExists => "resource_already_exists",
604 ResourceMissing => "resource_missing",
605 ReturnIntentAlreadyProcessed => "return_intent_already_processed",
606 RoutingNumberInvalid => "routing_number_invalid",
607 SecretKeyRequired => "secret_key_required",
608 SepaUnsupportedAccount => "sepa_unsupported_account",
609 SetupAttemptFailed => "setup_attempt_failed",
610 SetupIntentAuthenticationFailure => "setup_intent_authentication_failure",
611 SetupIntentInvalidParameter => "setup_intent_invalid_parameter",
612 SetupIntentMandateInvalid => "setup_intent_mandate_invalid",
613 SetupIntentMobileWalletUnsupported => "setup_intent_mobile_wallet_unsupported",
614 SetupIntentSetupAttemptExpired => "setup_intent_setup_attempt_expired",
615 SetupIntentUnexpectedState => "setup_intent_unexpected_state",
616 ShippingAddressInvalid => "shipping_address_invalid",
617 ShippingCalculationFailed => "shipping_calculation_failed",
618 SkuInactive => "sku_inactive",
619 StateUnsupported => "state_unsupported",
620 StatusTransitionInvalid => "status_transition_invalid",
621 StripeTaxInactive => "stripe_tax_inactive",
622 TaxIdInvalid => "tax_id_invalid",
623 TaxIdProhibited => "tax_id_prohibited",
624 TaxesCalculationFailed => "taxes_calculation_failed",
625 TerminalLocationCountryUnsupported => "terminal_location_country_unsupported",
626 TerminalReaderBusy => "terminal_reader_busy",
627 TerminalReaderHardwareFault => "terminal_reader_hardware_fault",
628 TerminalReaderInvalidLocationForActivation => {
629 "terminal_reader_invalid_location_for_activation"
630 }
631 TerminalReaderInvalidLocationForPayment => {
632 "terminal_reader_invalid_location_for_payment"
633 }
634 TerminalReaderOffline => "terminal_reader_offline",
635 TerminalReaderTimeout => "terminal_reader_timeout",
636 TestmodeChargesOnly => "testmode_charges_only",
637 TlsVersionUnsupported => "tls_version_unsupported",
638 TokenAlreadyUsed => "token_already_used",
639 TokenCardNetworkInvalid => "token_card_network_invalid",
640 TokenInUse => "token_in_use",
641 TransferSourceBalanceParametersMismatch => {
642 "transfer_source_balance_parameters_mismatch"
643 }
644 TransfersNotAllowed => "transfers_not_allowed",
645 UrlInvalid => "url_invalid",
646 Unknown(v) => v,
647 }
648 }
649}
650
651impl std::str::FromStr for ApiErrorsCode {
652 type Err = std::convert::Infallible;
653 fn from_str(s: &str) -> Result<Self, Self::Err> {
654 use ApiErrorsCode::*;
655 match s {
656 "account_closed" => Ok(AccountClosed),
657 "account_country_invalid_address" => Ok(AccountCountryInvalidAddress),
658 "account_error_country_change_requires_additional_steps" => {
659 Ok(AccountErrorCountryChangeRequiresAdditionalSteps)
660 }
661 "account_information_mismatch" => Ok(AccountInformationMismatch),
662 "account_invalid" => Ok(AccountInvalid),
663 "account_number_invalid" => Ok(AccountNumberInvalid),
664 "acss_debit_session_incomplete" => Ok(AcssDebitSessionIncomplete),
665 "alipay_upgrade_required" => Ok(AlipayUpgradeRequired),
666 "amount_too_large" => Ok(AmountTooLarge),
667 "amount_too_small" => Ok(AmountTooSmall),
668 "api_key_expired" => Ok(ApiKeyExpired),
669 "application_fees_not_allowed" => Ok(ApplicationFeesNotAllowed),
670 "authentication_required" => Ok(AuthenticationRequired),
671 "balance_insufficient" => Ok(BalanceInsufficient),
672 "balance_invalid_parameter" => Ok(BalanceInvalidParameter),
673 "bank_account_bad_routing_numbers" => Ok(BankAccountBadRoutingNumbers),
674 "bank_account_declined" => Ok(BankAccountDeclined),
675 "bank_account_exists" => Ok(BankAccountExists),
676 "bank_account_restricted" => Ok(BankAccountRestricted),
677 "bank_account_unusable" => Ok(BankAccountUnusable),
678 "bank_account_unverified" => Ok(BankAccountUnverified),
679 "bank_account_verification_failed" => Ok(BankAccountVerificationFailed),
680 "billing_invalid_mandate" => Ok(BillingInvalidMandate),
681 "bitcoin_upgrade_required" => Ok(BitcoinUpgradeRequired),
682 "capture_charge_authorization_expired" => Ok(CaptureChargeAuthorizationExpired),
683 "capture_unauthorized_payment" => Ok(CaptureUnauthorizedPayment),
684 "card_decline_rate_limit_exceeded" => Ok(CardDeclineRateLimitExceeded),
685 "card_declined" => Ok(CardDeclined),
686 "cardholder_phone_number_required" => Ok(CardholderPhoneNumberRequired),
687 "charge_already_captured" => Ok(ChargeAlreadyCaptured),
688 "charge_already_refunded" => Ok(ChargeAlreadyRefunded),
689 "charge_disputed" => Ok(ChargeDisputed),
690 "charge_exceeds_source_limit" => Ok(ChargeExceedsSourceLimit),
691 "charge_exceeds_transaction_limit" => Ok(ChargeExceedsTransactionLimit),
692 "charge_expired_for_capture" => Ok(ChargeExpiredForCapture),
693 "charge_invalid_parameter" => Ok(ChargeInvalidParameter),
694 "charge_not_refundable" => Ok(ChargeNotRefundable),
695 "clearing_code_unsupported" => Ok(ClearingCodeUnsupported),
696 "country_code_invalid" => Ok(CountryCodeInvalid),
697 "country_unsupported" => Ok(CountryUnsupported),
698 "coupon_expired" => Ok(CouponExpired),
699 "customer_max_payment_methods" => Ok(CustomerMaxPaymentMethods),
700 "customer_max_subscriptions" => Ok(CustomerMaxSubscriptions),
701 "customer_session_expired" => Ok(CustomerSessionExpired),
702 "customer_tax_location_invalid" => Ok(CustomerTaxLocationInvalid),
703 "debit_not_authorized" => Ok(DebitNotAuthorized),
704 "email_invalid" => Ok(EmailInvalid),
705 "expired_card" => Ok(ExpiredCard),
706 "financial_connections_account_inactive" => Ok(FinancialConnectionsAccountInactive),
707 "financial_connections_account_pending_account_numbers" => {
708 Ok(FinancialConnectionsAccountPendingAccountNumbers)
709 }
710 "financial_connections_account_unavailable_account_numbers" => {
711 Ok(FinancialConnectionsAccountUnavailableAccountNumbers)
712 }
713 "financial_connections_no_successful_transaction_refresh" => {
714 Ok(FinancialConnectionsNoSuccessfulTransactionRefresh)
715 }
716 "forwarding_api_inactive" => Ok(ForwardingApiInactive),
717 "forwarding_api_invalid_parameter" => Ok(ForwardingApiInvalidParameter),
718 "forwarding_api_retryable_upstream_error" => Ok(ForwardingApiRetryableUpstreamError),
719 "forwarding_api_upstream_connection_error" => Ok(ForwardingApiUpstreamConnectionError),
720 "forwarding_api_upstream_connection_timeout" => {
721 Ok(ForwardingApiUpstreamConnectionTimeout)
722 }
723 "forwarding_api_upstream_error" => Ok(ForwardingApiUpstreamError),
724 "idempotency_key_in_use" => Ok(IdempotencyKeyInUse),
725 "incorrect_address" => Ok(IncorrectAddress),
726 "incorrect_cvc" => Ok(IncorrectCvc),
727 "incorrect_number" => Ok(IncorrectNumber),
728 "incorrect_zip" => Ok(IncorrectZip),
729 "india_recurring_payment_mandate_canceled" => Ok(IndiaRecurringPaymentMandateCanceled),
730 "instant_payouts_config_disabled" => Ok(InstantPayoutsConfigDisabled),
731 "instant_payouts_currency_disabled" => Ok(InstantPayoutsCurrencyDisabled),
732 "instant_payouts_limit_exceeded" => Ok(InstantPayoutsLimitExceeded),
733 "instant_payouts_unsupported" => Ok(InstantPayoutsUnsupported),
734 "insufficient_funds" => Ok(InsufficientFunds),
735 "intent_invalid_state" => Ok(IntentInvalidState),
736 "intent_verification_method_missing" => Ok(IntentVerificationMethodMissing),
737 "invalid_card_type" => Ok(InvalidCardType),
738 "invalid_characters" => Ok(InvalidCharacters),
739 "invalid_charge_amount" => Ok(InvalidChargeAmount),
740 "invalid_cvc" => Ok(InvalidCvc),
741 "invalid_expiry_month" => Ok(InvalidExpiryMonth),
742 "invalid_expiry_year" => Ok(InvalidExpiryYear),
743 "invalid_mandate_reference_prefix_format" => Ok(InvalidMandateReferencePrefixFormat),
744 "invalid_number" => Ok(InvalidNumber),
745 "invalid_source_usage" => Ok(InvalidSourceUsage),
746 "invalid_tax_location" => Ok(InvalidTaxLocation),
747 "invoice_no_customer_line_items" => Ok(InvoiceNoCustomerLineItems),
748 "invoice_no_payment_method_types" => Ok(InvoiceNoPaymentMethodTypes),
749 "invoice_no_subscription_line_items" => Ok(InvoiceNoSubscriptionLineItems),
750 "invoice_not_editable" => Ok(InvoiceNotEditable),
751 "invoice_on_behalf_of_not_editable" => Ok(InvoiceOnBehalfOfNotEditable),
752 "invoice_payment_intent_requires_action" => Ok(InvoicePaymentIntentRequiresAction),
753 "invoice_upcoming_none" => Ok(InvoiceUpcomingNone),
754 "livemode_mismatch" => Ok(LivemodeMismatch),
755 "lock_timeout" => Ok(LockTimeout),
756 "missing" => Ok(Missing),
757 "no_account" => Ok(NoAccount),
758 "not_allowed_on_standard_account" => Ok(NotAllowedOnStandardAccount),
759 "out_of_inventory" => Ok(OutOfInventory),
760 "ownership_declaration_not_allowed" => Ok(OwnershipDeclarationNotAllowed),
761 "parameter_invalid_empty" => Ok(ParameterInvalidEmpty),
762 "parameter_invalid_integer" => Ok(ParameterInvalidInteger),
763 "parameter_invalid_string_blank" => Ok(ParameterInvalidStringBlank),
764 "parameter_invalid_string_empty" => Ok(ParameterInvalidStringEmpty),
765 "parameter_missing" => Ok(ParameterMissing),
766 "parameter_unknown" => Ok(ParameterUnknown),
767 "parameters_exclusive" => Ok(ParametersExclusive),
768 "payment_intent_action_required" => Ok(PaymentIntentActionRequired),
769 "payment_intent_authentication_failure" => Ok(PaymentIntentAuthenticationFailure),
770 "payment_intent_incompatible_payment_method" => {
771 Ok(PaymentIntentIncompatiblePaymentMethod)
772 }
773 "payment_intent_invalid_parameter" => Ok(PaymentIntentInvalidParameter),
774 "payment_intent_konbini_rejected_confirmation_number" => {
775 Ok(PaymentIntentKonbiniRejectedConfirmationNumber)
776 }
777 "payment_intent_mandate_invalid" => Ok(PaymentIntentMandateInvalid),
778 "payment_intent_payment_attempt_expired" => Ok(PaymentIntentPaymentAttemptExpired),
779 "payment_intent_payment_attempt_failed" => Ok(PaymentIntentPaymentAttemptFailed),
780 "payment_intent_unexpected_state" => Ok(PaymentIntentUnexpectedState),
781 "payment_method_bank_account_already_verified" => {
782 Ok(PaymentMethodBankAccountAlreadyVerified)
783 }
784 "payment_method_bank_account_blocked" => Ok(PaymentMethodBankAccountBlocked),
785 "payment_method_billing_details_address_missing" => {
786 Ok(PaymentMethodBillingDetailsAddressMissing)
787 }
788 "payment_method_configuration_failures" => Ok(PaymentMethodConfigurationFailures),
789 "payment_method_currency_mismatch" => Ok(PaymentMethodCurrencyMismatch),
790 "payment_method_customer_decline" => Ok(PaymentMethodCustomerDecline),
791 "payment_method_invalid_parameter" => Ok(PaymentMethodInvalidParameter),
792 "payment_method_invalid_parameter_testmode" => {
793 Ok(PaymentMethodInvalidParameterTestmode)
794 }
795 "payment_method_microdeposit_failed" => Ok(PaymentMethodMicrodepositFailed),
796 "payment_method_microdeposit_verification_amounts_invalid" => {
797 Ok(PaymentMethodMicrodepositVerificationAmountsInvalid)
798 }
799 "payment_method_microdeposit_verification_amounts_mismatch" => {
800 Ok(PaymentMethodMicrodepositVerificationAmountsMismatch)
801 }
802 "payment_method_microdeposit_verification_attempts_exceeded" => {
803 Ok(PaymentMethodMicrodepositVerificationAttemptsExceeded)
804 }
805 "payment_method_microdeposit_verification_descriptor_code_mismatch" => {
806 Ok(PaymentMethodMicrodepositVerificationDescriptorCodeMismatch)
807 }
808 "payment_method_microdeposit_verification_timeout" => {
809 Ok(PaymentMethodMicrodepositVerificationTimeout)
810 }
811 "payment_method_not_available" => Ok(PaymentMethodNotAvailable),
812 "payment_method_provider_decline" => Ok(PaymentMethodProviderDecline),
813 "payment_method_provider_timeout" => Ok(PaymentMethodProviderTimeout),
814 "payment_method_unactivated" => Ok(PaymentMethodUnactivated),
815 "payment_method_unexpected_state" => Ok(PaymentMethodUnexpectedState),
816 "payment_method_unsupported_type" => Ok(PaymentMethodUnsupportedType),
817 "payout_reconciliation_not_ready" => Ok(PayoutReconciliationNotReady),
818 "payouts_limit_exceeded" => Ok(PayoutsLimitExceeded),
819 "payouts_not_allowed" => Ok(PayoutsNotAllowed),
820 "platform_account_required" => Ok(PlatformAccountRequired),
821 "platform_api_key_expired" => Ok(PlatformApiKeyExpired),
822 "postal_code_invalid" => Ok(PostalCodeInvalid),
823 "processing_error" => Ok(ProcessingError),
824 "product_inactive" => Ok(ProductInactive),
825 "progressive_onboarding_limit_exceeded" => Ok(ProgressiveOnboardingLimitExceeded),
826 "rate_limit" => Ok(RateLimit),
827 "refer_to_customer" => Ok(ReferToCustomer),
828 "refund_disputed_payment" => Ok(RefundDisputedPayment),
829 "resource_already_exists" => Ok(ResourceAlreadyExists),
830 "resource_missing" => Ok(ResourceMissing),
831 "return_intent_already_processed" => Ok(ReturnIntentAlreadyProcessed),
832 "routing_number_invalid" => Ok(RoutingNumberInvalid),
833 "secret_key_required" => Ok(SecretKeyRequired),
834 "sepa_unsupported_account" => Ok(SepaUnsupportedAccount),
835 "setup_attempt_failed" => Ok(SetupAttemptFailed),
836 "setup_intent_authentication_failure" => Ok(SetupIntentAuthenticationFailure),
837 "setup_intent_invalid_parameter" => Ok(SetupIntentInvalidParameter),
838 "setup_intent_mandate_invalid" => Ok(SetupIntentMandateInvalid),
839 "setup_intent_mobile_wallet_unsupported" => Ok(SetupIntentMobileWalletUnsupported),
840 "setup_intent_setup_attempt_expired" => Ok(SetupIntentSetupAttemptExpired),
841 "setup_intent_unexpected_state" => Ok(SetupIntentUnexpectedState),
842 "shipping_address_invalid" => Ok(ShippingAddressInvalid),
843 "shipping_calculation_failed" => Ok(ShippingCalculationFailed),
844 "sku_inactive" => Ok(SkuInactive),
845 "state_unsupported" => Ok(StateUnsupported),
846 "status_transition_invalid" => Ok(StatusTransitionInvalid),
847 "stripe_tax_inactive" => Ok(StripeTaxInactive),
848 "tax_id_invalid" => Ok(TaxIdInvalid),
849 "tax_id_prohibited" => Ok(TaxIdProhibited),
850 "taxes_calculation_failed" => Ok(TaxesCalculationFailed),
851 "terminal_location_country_unsupported" => Ok(TerminalLocationCountryUnsupported),
852 "terminal_reader_busy" => Ok(TerminalReaderBusy),
853 "terminal_reader_hardware_fault" => Ok(TerminalReaderHardwareFault),
854 "terminal_reader_invalid_location_for_activation" => {
855 Ok(TerminalReaderInvalidLocationForActivation)
856 }
857 "terminal_reader_invalid_location_for_payment" => {
858 Ok(TerminalReaderInvalidLocationForPayment)
859 }
860 "terminal_reader_offline" => Ok(TerminalReaderOffline),
861 "terminal_reader_timeout" => Ok(TerminalReaderTimeout),
862 "testmode_charges_only" => Ok(TestmodeChargesOnly),
863 "tls_version_unsupported" => Ok(TlsVersionUnsupported),
864 "token_already_used" => Ok(TokenAlreadyUsed),
865 "token_card_network_invalid" => Ok(TokenCardNetworkInvalid),
866 "token_in_use" => Ok(TokenInUse),
867 "transfer_source_balance_parameters_mismatch" => {
868 Ok(TransferSourceBalanceParametersMismatch)
869 }
870 "transfers_not_allowed" => Ok(TransfersNotAllowed),
871 "url_invalid" => Ok(UrlInvalid),
872 v => Ok(Unknown(v.to_owned())),
873 }
874 }
875}
876impl std::fmt::Display for ApiErrorsCode {
877 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
878 f.write_str(self.as_str())
879 }
880}
881
882impl std::fmt::Debug for ApiErrorsCode {
883 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
884 f.write_str(self.as_str())
885 }
886}
887#[cfg(feature = "serialize")]
888impl serde::Serialize for ApiErrorsCode {
889 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
890 where
891 S: serde::Serializer,
892 {
893 serializer.serialize_str(self.as_str())
894 }
895}
896impl miniserde::Deserialize for ApiErrorsCode {
897 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
898 crate::Place::new(out)
899 }
900}
901
902impl miniserde::de::Visitor for crate::Place<ApiErrorsCode> {
903 fn string(&mut self, s: &str) -> miniserde::Result<()> {
904 use std::str::FromStr;
905 self.out = Some(ApiErrorsCode::from_str(s).unwrap());
906 Ok(())
907 }
908}
909
910stripe_types::impl_from_val_with_from_str!(ApiErrorsCode);
911#[cfg(feature = "deserialize")]
912impl<'de> serde::Deserialize<'de> for ApiErrorsCode {
913 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
914 use std::str::FromStr;
915 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
916 Ok(Self::from_str(&s).unwrap())
917 }
918}
919#[derive(Copy, Clone, Eq, PartialEq)]
922pub enum ApiErrorsType {
923 ApiError,
924 CardError,
925 IdempotencyError,
926 InvalidRequestError,
927}
928impl ApiErrorsType {
929 pub fn as_str(self) -> &'static str {
930 use ApiErrorsType::*;
931 match self {
932 ApiError => "api_error",
933 CardError => "card_error",
934 IdempotencyError => "idempotency_error",
935 InvalidRequestError => "invalid_request_error",
936 }
937 }
938}
939
940impl std::str::FromStr for ApiErrorsType {
941 type Err = stripe_types::StripeParseError;
942 fn from_str(s: &str) -> Result<Self, Self::Err> {
943 use ApiErrorsType::*;
944 match s {
945 "api_error" => Ok(ApiError),
946 "card_error" => Ok(CardError),
947 "idempotency_error" => Ok(IdempotencyError),
948 "invalid_request_error" => Ok(InvalidRequestError),
949 _ => Err(stripe_types::StripeParseError),
950 }
951 }
952}
953impl std::fmt::Display for ApiErrorsType {
954 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
955 f.write_str(self.as_str())
956 }
957}
958
959impl std::fmt::Debug for ApiErrorsType {
960 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
961 f.write_str(self.as_str())
962 }
963}
964#[cfg(feature = "serialize")]
965impl serde::Serialize for ApiErrorsType {
966 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
967 where
968 S: serde::Serializer,
969 {
970 serializer.serialize_str(self.as_str())
971 }
972}
973impl miniserde::Deserialize for ApiErrorsType {
974 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
975 crate::Place::new(out)
976 }
977}
978
979impl miniserde::de::Visitor for crate::Place<ApiErrorsType> {
980 fn string(&mut self, s: &str) -> miniserde::Result<()> {
981 use std::str::FromStr;
982 self.out = Some(ApiErrorsType::from_str(s).map_err(|_| miniserde::Error)?);
983 Ok(())
984 }
985}
986
987stripe_types::impl_from_val_with_from_str!(ApiErrorsType);
988#[cfg(feature = "deserialize")]
989impl<'de> serde::Deserialize<'de> for ApiErrorsType {
990 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
991 use std::str::FromStr;
992 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
993 Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for ApiErrorsType"))
994 }
995}