arlyon / async-stripe

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

feat: export checkout_session_ext #615

Closed augustoccesar closed 2 months ago

augustoccesar commented 2 months ago

Description

Currently, the checkout_session_ext is not being exported, which makes the RetrieveCheckoutSessionLineItems not being able to be used.

With this change, the following should now be possible:

use std::str::FromStr;

use stripe::{CheckoutSession, CheckoutSessionId, Client, RetrieveCheckoutSessionLineItems};

#[tokio::main]
async fn main() {
    let secret_key = std::env::var("STRIPE_SECRET_KEY").expect("Missing STRIPE_SECRET_KEY in env");
    let client = Client::new(secret_key);

    let _line_items = CheckoutSession::retrieve_line_items(
        &client,
        &CheckoutSessionId::from_str("").unwrap(),
        &RetrieveCheckoutSessionLineItems::default(),
    )
    .await
    .unwrap();
}

Closes #614

Summary

Checklist

augustoccesar commented 2 months ago

@arlyon with the new Rust version, Clippy started to error on:

Error:    --> src/client/stripe.rs:182:44
    |
182 |         req.insert_header("authorization", &format!("***", self.secret_key));
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("***", self.secret_key)`

That is why of the change on the stripe.rs. Is it fine to keep on this PR or prefer the Clippy fix on a different one?

arlyon commented 2 months ago

I can see CI is failing also. I am going to update MSRV and fix any outstanding lints and comment here when you can rebase :)

arlyon commented 2 months ago

https://github.com/arlyon/async-stripe/pull/617 should be ready soonish

arlyon commented 2 months ago

Ok! Please rebase when you have the chance

augustoccesar commented 2 months ago

Ok! Please rebase when you have the chance

Done! ✅

arlyon commented 2 months ago

New release coming soon, TY :tada:

arlyon commented 2 months ago

:tada: This PR is included in version 0.40.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: