-
Notifications
You must be signed in to change notification settings - Fork 31
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
fix: use proper expiry time in getorder endpoint #2612
Conversation
a2d6740
to
419d218
Compare
419d218
to
8574d0b
Compare
9d40f5a
to
86686de
Compare
f2afdfe
to
77cba2f
Compare
@@ -0,0 +1,60 @@ | |||
package xstripe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Metadata: datastore.Metadata{ | ||
"stripeSubscriptionId": "wrong_sub_id", | ||
}, | ||
ID: uuid.Must(uuid.FromString("facade00-0000-4000-a000-000000000000")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, approved with some questions and minor nit
77cba2f
to
a5c749f
Compare
[puLL-Merge] - brave-intl/bat-go@2612 DescriptionThis PR refactors the Stripe integration in the SKUs service, improving code organization, testability, and error handling. It moves Stripe-related logic into a separate package, introduces a new ChangesChanges
Possible Issues
Security HotspotsNo significant security issues were introduced in this refactoring. However, care should be taken to ensure that sensitive information (like Stripe API keys) is properly handled and not exposed in logs or error messages. |
Summary
This PR fixes code that could update an order associated with Stripe purchases while getting the order. This could happen in a situation where:
That last path is important because it used to extend an order by the hardcoded one month. This is wrong for a few reasons, mainly because:
This PR also fixes a bug where a new session could be ignored to be checked for payment status.
This PR also refactors interactions with Stripe. The Stripe client code has been wrapped to enable testing. Some places interacting with Stripe have been updated and unified (such as session creation).
Additionally, this set of changes includes vast test coverage for the changed code (which was not covered before), as well as coverage for places which have not been possible to test before as well.
Type of Change
Tested Environments
Before Requesting Review
Manual Test Plan