arlyon / async-stripe

Async (and blocking!) Rust bindings for the Stripe API
https://payments.rs
Apache License 2.0
464 stars 130 forks source link

fix: add idempotency_error #316

Closed MarcoIeni closed 1 year ago

MarcoIeni commented 1 year ago

When calling the UsageRecord::create function I get this error:

JSONSerialize(Error("unknown variant `idempotency_error`, expected one of `api_error`, `api_connection_error`, `authentication_error`, `card_error`, `invalid_request_error`, `rate_limit_error`, `validation_error`"))

I initialize the client with the strategy stripe::RequestStrategy::Idempotent.

I guess the fix is to add the idempotency_error to this enum.

arlyon commented 1 year ago

Ah! Nice catch. Please note if you are using the manual idempotency strategy that you will need to specify a new key between requests. I have a few PRs in the queue I need to sort out (blocked on me fixing tarpaulin) but it is my priority this week to clear out the queue (this included!).

Thanks for your contribution.

codecov[bot] commented 1 year ago

Codecov Report

Merging #316 (0e842f5) into master (204d56d) will increase coverage by 0.06%. The diff coverage is n/a.

@@            Coverage Diff            @@
##           master    #316      +/-   ##
=========================================
+ Coverage    5.57%   5.64%   +0.06%     
=========================================
  Files         148     148              
  Lines       14624   14634      +10     
=========================================
+ Hits          816     826      +10     
  Misses      13808   13808              
Impacted Files Coverage Δ
src/error.rs 0.00% <ø> (ø)
src/client/base/tokio.rs 93.83% <0.00%> (+0.35%) :arrow_up:
src/params.rs 68.21% <0.00%> (+0.42%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

arlyon commented 1 year ago

All merged! I am going to release a new version to crates.io shortly which will be the final release before we overhaul the codegen in 0.16. Thanks again!