-
Notifications
You must be signed in to change notification settings - Fork 28
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: Address Glue Updates for modifying default payment method #621
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #621 +/- ##
=======================================
Coverage 91.48% 91.48%
=======================================
Files 615 615
Lines 16418 16424 +6
=======================================
+ Hits 15020 15026 +6
Misses 1398 1398
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found @@ Coverage Diff @@
## main #621 +/- ##
=======================================
Coverage 91.48% 91.48%
=======================================
Files 615 615
Lines 16418 16424 +6
=======================================
+ Hits 15020 15026 +6
Misses 1398 1398
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #621 +/- ##
===========================================
Coverage 95.92000 95.92000
===========================================
Files 793 793
Lines 17735 17741 +6
===========================================
+ Hits 17012 17018 +6
Misses 723 723
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -113,8 +113,18 @@ def update_billing_address(self, request, *args, **kwargs): | |||
if not billing_address: | |||
raise ValidationError(detail="No billing_address sent") | |||
owner = self.get_object() | |||
|
|||
formatted_address = { | |||
"line1": billing_address["line_1"], |
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.
Why are line1/2 camel? Shouldn't it be snake?
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.
ah yeah this is what I was mentioning on the applications channel; stripe considers line1 and line2 to be the correct key format instead of line_1 and line_2, which is different than our snakeify method. This seemed to be the most painless way to isolate that "rewrapping"
f"Stripe successfully updated billing address for owner {owner.ownerid} by user #{self.requesting_user.ownerid}" | ||
) | ||
|
||
try: |
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.
This logic makes sense, but I find it weird we were originally doing it w/ subscription an not customer_id; can you think why that was the case?
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.
This was on me and my lack of understanding of where the address / billing details lay among the stripe objects. After actually doing the testing locally and gaining more context on what exactly we are changing and where made me realize this update had nothing to do with the stripe subscription and everything to do with the customer.
Namely, you can have a default payment method even without having a subscription, since that's tied to the customer through payment methods ultimately.
Purpose/Motivation
This updates the existing update_billing_address function to actually update the stripe default payment method billing details, as well as the customer billing address.
Stemmed from doing some local testing with the new address component where i saw the default_payment_method billing details address wasn't being updated when we were updating the users address. Now we update both the customer as well as the payment method address with this set of changes.
Notes to Reviewer
Most of the review is UT updates, but for the stripe stuff we are doing three things:
Screen.Recording.2024-06-17.at.5.14.11.PM.mov
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.