Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miss error invalid_bank_account_iban\invalid_owner_name #144

Open
i18n-now opened this issue Jan 15, 2024 · 4 comments
Open

miss error invalid_bank_account_iban\invalid_owner_name #144

i18n-now opened this issue Jan 15, 2024 · 4 comments

Comments

@i18n-now
Copy link

i18n-now commented Jan 15, 2024

https://stripe.com/docs/sources/sepa-debit

Source creation for SEPA Direct Debit payments may return any of the following errors:
invalid_owner_name
invalid_bank_account_iban
processing_error
payment_method_not_available

seems loss invalid_owner_name\invalid_bank_account_iban

will cause error in rust arlyon/async-stripe#479

Describe the bug

crash

To Reproduce

parse

fn main() {
    let json = r#"id":"seti_1OYkYPBS6OLyeF2QCeCxPRQP","object":"setup_intent","application":null,"automatic_payment_methods":{"allow_redirects":"always","enabled":true},"cancellation_reason":null,"client_secret":"seti_1OYkYPBS6OLyeF2QCeCxPRQP_secret_PNVZGM5M8qfpA0i53eDlw0fyf2F339n","created":1705303553,"customer":"cus_PNShbMnVo5L9gd","description":null,"flow_directions":null,"last_setup_error":{"code":"invalid_owner_name","message":"The name provided in billing_details must have between 3 and 100 characters.","payment_method":{"id":"pm_1OYkYQBS6OLyeF2QuMGbBv15","object":"payment_method","bancontact":{},"billing_details":{"address":{"city":null,"country":null,"line1":null,"line2":null,"postal_code":null,"state":null},"email":"[email protected]","name":"22","phone":null},"created":1705303554,"customer":null,"livemode":false,"metadata":{},"type":"bancontact"},"type":"invalid_request_error"},"latest_attempt":"setatt_1OYkYQBS6OLyeF2QzU7iIAGD","livemode":false,"mandate":null,"metadata":{},"next_action":null,"on_behalf_of":null,"payment_method":null,"payment_method_configuration_details":{"id":"pmc_1OREowBS6OLyeF2Qf9TEW9H4","parent":null},"payment_method_options":{"card":{"mandate_options":null,"network":null,"request_three_d_secure":"automatic"}},"payment_method_types":["card","bancontact","ideal","sepa_debit","sofort","link"],"single_use_mandate":null,"status":"requires_payment_method","usage":"off_session"}"#;
    let setup_intent: stripe::SetupIntent = serde_json::from_str(json).unwrap();
}

Expected behavior

crash on this setup indent

Code snippets


thread 'main' panicked at src/main.rs:3:72:
called `Result::unwrap()` on an `Err` value: Error("unknown variant `invalid_owner_name`, expected one of `account_closed`, `account_country_invalid_address`, `account_error_country_change_requires_additional_steps`, `account_information_mismatch`, `account_invalid`, `account_number_invalid`, `acss_debit_session_incomplete`, `alipay_upgrade_required`, `amount_too_large`, `amount_too_small`, `api_key_expired`, `application_fees_not_allowed`, `authentication_required`, `balance_insufficient`, `balance_invalid_parameter`, `bank_account_bad_routing_numbers`, `bank_account_declined`, `bank_account_exists`, `bank_account_restricted`, `bank_account_unusable`, `bank_account_unverified`, `bank_account_verification_failed`, `billing_invalid_mandate`, `bitcoin_upgrade_required`, `capture_charge_authorization_expired`, `capture_unauthorized_payment`, `card_decline_rate_limit_exceeded`, `card_declined`, `cardholder_phone_number_required`, `charge_already_captured`, `charge_already_refunded`, `charge_disputed`, `charge_exceeds_source_limit`, `charge_expired_for_capture`, `charge_invalid_parameter`, `charge_not_refundable`, `clearing_code_unsupported`, `country_code_invalid`, `country_unsupported`, `coupon_expired`, `customer_max_payment_methods`, `customer_max_subscriptions`, `customer_tax_location_invalid`, `debit_not_authorized`, `email_invalid`, `expired_card`, `financial_connections_account_inactive`, `financial_connections_no_successful_transaction_refresh`, `idempotency_key_in_use`, `incorrect_address`, `incorrect_cvc`, `incorrect_number`, `incorrect_zip`, `instant_payouts_config_disabled`, `instant_payouts_currency_disabled`, `instant_payouts_limit_exceeded`, `instant_payouts_unsupported`, `insufficient_funds`, `intent_invalid_state`, `intent_verification_method_missing`, `invalid_card_type`, `invalid_characters`, `invalid_charge_amount`, `invalid_cvc`, `invalid_expiry_month`, `invalid_expiry_year`, `invalid_number`, `invalid_source_usage`, `invalid_tax_location`, `invoice_no_customer_line_items`, `invoice_no_payment_method_types`, `invoice_no_subscription_line_items`, `invoice_not_editable`, `invoice_on_behalf_of_not_editable`, `invoice_payment_intent_requires_action`, `invoice_upcoming_none`, `livemode_mismatch`, `lock_timeout`, `missing`, `no_account`, `not_allowed_on_standard_account`, `out_of_inventory`, `ownership_declaration_not_allowed`, `parameter_invalid_empty`, `parameter_invalid_integer`, `parameter_invalid_string_blank`, `parameter_invalid_string_empty`, `parameter_missing`, `parameter_unknown`, `parameters_exclusive`, `payment_intent_action_required`, `payment_intent_authentication_failure`, `payment_intent_incompatible_payment_method`, `payment_intent_invalid_parameter`, `payment_intent_konbini_rejected_confirmation_number`, `payment_intent_mandate_invalid`, `payment_intent_payment_attempt_expired`, `payment_intent_payment_attempt_failed`, `payment_intent_unexpected_state`, `payment_method_bank_account_already_verified`, `payment_method_bank_account_blocked`, `payment_method_billing_details_address_missing`, `payment_method_configuration_failures`, `payment_method_currency_mismatch`, `payment_method_customer_decline`, `payment_method_invalid_parameter`, `payment_method_invalid_parameter_testmode`, `payment_method_microdeposit_failed`, `payment_method_microdeposit_verification_amounts_invalid`, `payment_method_microdeposit_verification_amounts_mismatch`, `payment_method_microdeposit_verification_attempts_exceeded`, `payment_method_microdeposit_verification_descriptor_code_mismatch`, `payment_method_microdeposit_verification_timeout`, `payment_method_not_available`, `payment_method_provider_decline`, `payment_method_provider_timeout`, `payment_method_unactivated`, `payment_method_unexpected_state`, `payment_method_unsupported_type`, `payout_reconciliation_not_ready`, `payouts_limit_exceeded`, `payouts_not_allowed`, `platform_account_required`, `platform_api_key_expired`, `postal_code_invalid`, `processing_error`, `product_inactive`, `progressive_onboarding_limit_exceeded`, `rate_limit`, `refer_to_customer`, `refund_disputed_payment`, `resource_already_exists`, `resource_missing`, `return_intent_already_processed`, `routing_number_invalid`, `secret_key_required`, `sepa_unsupported_account`, `setup_attempt_failed`, `setup_intent_authentication_failure`, `setup_intent_invalid_parameter`, `setup_intent_mandate_invalid`, `setup_intent_setup_attempt_expired`, `setup_intent_unexpected_state`, `shipping_calculation_failed`, `sku_inactive`, `state_unsupported`, `status_transition_invalid`, `stripe_tax_inactive`, `tax_id_invalid`, `taxes_calculation_failed`, `terminal_location_country_unsupported`, `terminal_reader_busy`, `terminal_reader_hardware_fault`, `terminal_reader_offline`, `terminal_reader_timeout`, `testmode_charges_only`, `tls_version_unsupported`, `token_already_used`, `token_card_network_invalid`, `token_in_use`, `transfer_source_balance_parameters_mismatch`, `transfers_not_allowed`, `url_invalid`", line: 1, column: 409)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

OS

mac

Rust version

cargo 1.77.0-nightly (3e428a38a 2024-01-09)

Library version

v0.29.0

API version

latest

@anniel-stripe
Copy link
Contributor

Hi @i18n-now , thanks for the issue! The error codes you mentioned are only used by the Sources API, which is deprecated. As mentioned on the page you linked, Stripe recommends using the Payment Intents and PaymentMethods APIs to integrate with SEPA Direct Debit - you can follow the instructions at https://stripe.com/docs/payments/sepa-debit/accept-a-payment. Would that alternative work for you?

@i18n-now
Copy link
Author

i18n-now commented Jan 16, 2024

@anniel-stripe

I'm using the PaymentMethods API with setup_intent

As shown in the screenshot below, select Euro payment, set setup Indent , enter only one letter here and submit.
, there will be a return a setup_intent with last_setup_error containing errors invalid_owner_name

you can get seti_1OYkYPBS6OLyeF2QCeCxPRQP in test mode for example

image

{"id":"seti_1OYkYPBS6OLyeF2QCeCxPRQP","object":"setup_intent","application":null,"automatic_payment_methods":{"allow_redirects":"always","enabled":true},"cancellation_reason":null,"client_secret":"seti_1OYkYPBS6OLyeF2QCeCxPRQP_secret_PNVZGM5M8qfpA0i53eDlw0fyf2F339n","created":1705303553,"customer":"cus_PNShbMnVo5L9gd","description":null,"flow_directions":null,"last_setup_error":{"code":"invalid_owner_name","message":"The name provided in billing_details must have between 3 and 100 characters.","payment_method":{"id":"pm_1OYkYQBS6OLyeF2QuMGbBv15","object":"payment_method","bancontact":{},"billing_details":{"address":{"city":null,"country":null,"line1":null,"line2":null,"postal_code":null,"state":null},"email":"[email protected]","name":"22","phone":null},"created":1705303554,"customer":null,"livemode":false,"metadata":{},"type":"bancontact"},"type":"invalid_request_error"},"latest_attempt":"setatt_1OYkYQBS6OLyeF2QzU7iIAGD","livemode":false,"mandate":null,"metadata":{},"next_action":null,"on_behalf_of":null,"payment_method":null,"payment_method_configuration_details":{"id":"pmc_1OREowBS6OLyeF2Qf9TEW9H4","parent":null},"payment_method_options":{"card":{"mandate_options":null,"network":null,"request_three_d_secure":"automatic"}},"payment_method_types":["card","bancontact","ideal","sepa_debit","sofort","link"],"single_use_mandate":null,"status":"requires_payment_method","usage":"off_session"}"

@anniel-stripe
Copy link
Contributor

Apologies for my confusion @i18n-now , I double checked with the team behind SEPA Direct Debit and it seems these errors are shared between the deprecated Sources API and the PaymentIntents and PaymentMethods APIs. You're right that these are missing from the spec, I'll look into getting these added.

@i18n-now
Copy link
Author

Looking forward to adding it soon, because missing these errors will cause the rust program to crash. (The rust program is the code generated based on this configuration)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants