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

possible suggestions, based on a fix to our app #555

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Connoropolous
Copy link

@Connoropolous Connoropolous commented May 23, 2024

Summary

@arlyon
I'm not opening this PR to suggest you merge these changes, as they might not work for everyone, and I don't know all that much about the library, but I will say that this source property appears to be deprecated, and that not having it there caused a bug in the case of my application, when a Charge with a source that came from a connected app (Gumroad) came through the pipes.
Feel free to close after checking it out?

Checklist

Copy link
Owner

@arlyon arlyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks for opening this. We have a pretty much complete rewrite happening on the next branch and one of the explicit goals is improving logging. I think we will formally adopt tracing and think quite seriously about the devex debugging serialization issues.

@Connoropolous
Copy link
Author

cool!
I just added another fix, after debugging, which was PriceId can include subscription_plan.

I'm curious, what was the big pull for building async-stripe? Who's using it?
Also curious, what kind of timeframe is next branch progressing on?

@seanpianka
Copy link
Contributor

cool! I just added another fix, after debugging, which was PriceId can include subscription_plan.

I'm curious, what was the big pull for building async-stripe? Who's using it? Also curious, what kind of timeframe is next branch progressing on?

async-stripe is a fork from the original project stripe-rs and is currently the only maintained Stripe client bindings for Rust, as Stripe does not officially support the language. All the same kinds of projects and organizations (in other language communities) which use Stripe are the kinds of users async-stripe sees!

@Connoropolous
Copy link
Author

cool.
With the state of the repo and the next dev branch, is there value in trying to get my schema patches merged?

@arlyon
Copy link
Owner

arlyon commented Jul 23, 2024

Hey, sorry been a busy few weeks between work and trying to move. Thank you for taking the time here. I am happy to merge these into the current live branch, will make some comments.

@@ -102,7 +102,40 @@ impl TokioClient {
Box::pin(async move {
let bytes = send_inner(&client, request, &strategy).await?;
let json_deserializer = &mut serde_json::Deserializer::from_slice(&bytes);
serde_path_to_error::deserialize(json_deserializer).map_err(StripeError::from)

match serde_path_to_error::deserialize(json_deserializer) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to, instead, integrate tracing into this crate properly. If you have the time to set this up, some TRACE level statements in the event of a failure would probably be well received.

@@ -208,7 +208,7 @@ macro_rules! def_id {
&& !s.starts_with($alt_prefix)
)* {
// N.B. For debugging
eprintln!("bad id is: {} (expected: {:?}) for {}", s, $prefix, stringify!($struct_name));
// eprintln!("bad id is: {} (expected: {:?}) for {}", s, $prefix, stringify!($struct_name));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, it's silly I have left this eprintln for so long. Let's do a trace / debug level log.

@@ -170,7 +170,7 @@ pub struct Charge {
///
/// It contains the Source, Card, or BankAccount object used for the charge.
/// For details about the payment method used for this charge, refer to `payment_method` or `payment_method_details` instead.
pub source: Option<PaymentSource>,
// pub source: Option<PaymentSource>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be commented out

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the source of truth that you would use to check this?
This was causing a failure till I commented it out

@@ -39,3 +39,69 @@ fn is_charge_expandable() {
}
});
}

/*
Use this test to fix deserialization
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! perhaps a binary for this would be useful, rather than a test :)

@Connoropolous
Copy link
Author

@arlyon
maybe we should just pick the one thing from here for now, the 'subscription_plan' thing and merge that, plus the 'application' options?

@arlyon
Copy link
Owner

arlyon commented Aug 6, 2024

That is OK with me, I don't mind splitting it up

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

Successfully merging this pull request may close these issues.

3 participants