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

customer_tax_location_invalid missing field for last_finalization_error.code #465

Open
robiot opened this issue Jan 1, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@robiot
Copy link

robiot commented Jan 1, 2024

Describe the bug

The customer_tax_location_invalid is not added as a valid value for last_finalization_error.code. It should be an easy fix.

To Reproduce

.

Expected behavior

.

Code snippets

No response

OS

Windows

Rust version

any

Library version

0.26.0

API version

2023-08-16

Additional context

No response

@robiot robiot added the bug Something isn't working label Jan 1, 2024
@augustoccesar
Copy link
Contributor

How did you reach this bug? It does seem like the invoice.last_finalization_error already have the customer_tax_location_invalid

pub last_finalization_error: Option<Box<ApiErrors>>,

CustomerTaxLocationInvalid,

@robiot
Copy link
Author

robiot commented Jan 16, 2024

@augustoccesar Thats weird, it was reched when a stripe webhook was called. I got it working by using another hook meanwhile.

@robiot
Copy link
Author

robiot commented Jan 24, 2024

Now for stripe checkout session creation:

(StripeError(JSONSerialize(Error { path: Path { segments: [Map { key: "error" }, Map { key: "code" }] }, original: Error("unknown variant `customer_tax_location_invalid`, expected one of `account_already_exists`, `account_country_invalid_address`, `account_invalid`, `account_number_invalid`, `alipay_upgrade_required`, `amount_too_large`, `amount_too_small`, `api_key_expired`, `balance_insufficient`, `bank_account_exists`, `bank_account_unusable`, `bank_account_unverified`, `bank_account_verification_failed`, `bitcoin_upgrade_required`, `card_declined`, `charge_already_captured`, `charge_already_refunded`, `charge_disputed`, `charge_expired_for_capture`, `country_unsupported`, `coupon_expired`, `customer_max_subscriptions`, `email_invalid`, `expired_card`, `idempotency_key_in_use`, `incorrect_address`, `incorrect_cvc`, `incorrect_number`, `incorrect_zip`, `instant_payouts_unsupported`, `invalid_card_type`, `invalid_charge_amount`, `invalid_cvc`, `invalid_expiry_month`, `invalid_expiry_year`, `invalid_number`, `invalid_source_usage`, `invoice_no_customer_line_items`, `invoice_no_subscription_line_items`, `invoice_not_editable`, `invoice_upcoming_none`, `livemode_mismatch`, `missing`, `order_creation_failed`, `order_required_settings`, `order_status_invalid`, `order_upstream_timeout`, `out_of_inventory`, `parameter_invalid_empty`, `parameter_invalid_integer`, `parameter_invalid_string_blank`, `parameter_invalid_string_empty`, `parameter_missing`, `parameter_unknown`, `payment_method_unactivated`, `payment_intent_unexpected_state`, `payouts_not_allowed`, `platform_api_key_expired`, `postal_code_invalid`, `processing_error`, `product_inactive`, `rate_limit`, `resource_already_exists`, `resource_missing`, `routing_number_invalid`, `secret_key_required`, `sepa_unsupported_account`, `shipping_calculation_failed`, `sku_inactive`, `state_unsupported`, `tax_id_invalid`, `taxes_calculation_failed`, `testmode_charges_only`, `tls_version_unsupported`, `token_already_used`, `token_in_use`, `transfers_not_allowed`, `upstream_order_creation_failed`, `url_invalid`", line: 3, column: 43) })))

Maybe the option is just added to invoice, but not to session creation? @augustoccesar

@robiot
Copy link
Author

robiot commented Jan 24, 2024

WARN - Failed to parse webhook: BadParse(Error("unknown variant `self`, expected `account` or `self_`", line: 213, column: 3)

Seems like there is a whole lot of parse errors. I'm wondering if im doing something wrong or if the crate is out of date?

@robiot
Copy link
Author

robiot commented Jan 24, 2024

The webhook api version is 2022-11-15 (latest doens't work either). I cannot downgrade any further.

Readme states that the latest version supported is 2020?

@augustoccesar
Copy link
Contributor

augustoccesar commented Jan 29, 2024

Now for stripe checkout session creation:

(StripeError(JSONSerialize(Error { path: Path { segments: [Map { key: "error" }, Map { key: "code" }] }, original: Error("unknown variant `customer_tax_location_invalid`, expected one of `account_already_exists`, `account_country_invalid_address`, `account_invalid`, `account_number_invalid`, `alipay_upgrade_required`, `amount_too_large`, `amount_too_small`, `api_key_expired`, `balance_insufficient`, `bank_account_exists`, `bank_account_unusable`, `bank_account_unverified`, `bank_account_verification_failed`, `bitcoin_upgrade_required`, `card_declined`, `charge_already_captured`, `charge_already_refunded`, `charge_disputed`, `charge_expired_for_capture`, `country_unsupported`, `coupon_expired`, `customer_max_subscriptions`, `email_invalid`, `expired_card`, `idempotency_key_in_use`, `incorrect_address`, `incorrect_cvc`, `incorrect_number`, `incorrect_zip`, `instant_payouts_unsupported`, `invalid_card_type`, `invalid_charge_amount`, `invalid_cvc`, `invalid_expiry_month`, `invalid_expiry_year`, `invalid_number`, `invalid_source_usage`, `invoice_no_customer_line_items`, `invoice_no_subscription_line_items`, `invoice_not_editable`, `invoice_upcoming_none`, `livemode_mismatch`, `missing`, `order_creation_failed`, `order_required_settings`, `order_status_invalid`, `order_upstream_timeout`, `out_of_inventory`, `parameter_invalid_empty`, `parameter_invalid_integer`, `parameter_invalid_string_blank`, `parameter_invalid_string_empty`, `parameter_missing`, `parameter_unknown`, `payment_method_unactivated`, `payment_intent_unexpected_state`, `payouts_not_allowed`, `platform_api_key_expired`, `postal_code_invalid`, `processing_error`, `product_inactive`, `rate_limit`, `resource_already_exists`, `resource_missing`, `routing_number_invalid`, `secret_key_required`, `sepa_unsupported_account`, `shipping_calculation_failed`, `sku_inactive`, `state_unsupported`, `tax_id_invalid`, `taxes_calculation_failed`, `testmode_charges_only`, `tls_version_unsupported`, `token_already_used`, `token_in_use`, `transfers_not_allowed`, `upstream_order_creation_failed`, `url_invalid`", line: 3, column: 43) })))

Maybe the option is just added to invoice, but not to session creation? @augustoccesar

Hmmm, looking into it it seems like the error enum that I shared above is the one that is up to date with the API specs, but is not the one used to parse responses.
The one used to parse error responses is this other re-exported one that seems to need to be manually updated.

One reason for it to not be using the generated one could be, like you mentioned, because of the version support. But I'm not quite sure. So maybe @arlyon can answer this one.

I did a diff on them and there are quite a lot of them that only exist on ApiErrorsCode and some of them that only exist on the ErrorCode. So I'm not sure what would be the ideal way to solve this. Maybe a merge between them?

Side note: It seems like errors related to Order, for example, are listed on the errors page (like order-creation-failed) and exist on ErrorCode but is not part of the generated ApiErrorsCode. Probably because got removed from the API.
Probably because it got discontinued in November 16, 2022 (it seems like it was a Beta feature)

@augustoccesar
Copy link
Contributor

augustoccesar commented Jan 29, 2024

WARN - Failed to parse webhook: BadParse(Error("unknown variant `self`, expected `account` or `self_`", line: 213, column: 3)

Seems like there is a whole lot of parse errors. I'm wondering if im doing something wrong or if the crate is out of date?

This one I believe is related the issue #489 and to the PR #490 and , so it will probably get fixed when/if it gets merged.

@arlyon
Copy link
Owner

arlyon commented Feb 2, 2024

The readme is out of date. The lastest version of async-stripe should always track the lastest api version of stripe itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants