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

feat: Add Update Billing Address service function #611

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

ajay-sentry
Copy link
Contributor

@ajay-sentry ajay-sentry commented Jun 10, 2024

Purpose/Motivation

Part of the Q2 billing epic, particularly around updates for edit billing details, this PR aims to add a new service function around updating a user's billing address.

This function is very similar to the email address function, the main difference being the data payload being pulled from the API request and the payload being passed into the stripe customer modify function.

Links to relevant tickets

Closes codecov/engineering-team#1863

Notes to Reviewer

For now, this endpoint isn't being used anywhere, but it will be used in the useUpdateBillingAddress gazebo hook added in this PR: codecov/gazebo#2940. That hook is currently hard coded to use sentry's company address.

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.

@codecov-notifications
Copy link

Codecov Report

Attention: Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files Patch % Lines
services/billing.py 91.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.50%. Comparing base (bccac24) to head (36b0a4c).

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main     #611   +/-   ##
=======================================
  Coverage   91.49%   91.50%           
=======================================
  Files         615      615           
  Lines       16379    16401   +22     
=======================================
+ Hits        14986    15007   +21     
- Misses       1393     1394    +1     
Flag Coverage Δ
unit 91.50% <95.45%> (+<0.01%) ⬆️
unit-latest-uploader 91.50% <95.45%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
api/internal/owner/views.py 99.04% <100.00%> (+0.10%) ⬆️
services/billing.py 92.30% <91.66%> (-0.03%) ⬇️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

Copy link

Codecov Report

Attention: Patch coverage is 95.45455% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 91.50%. Comparing base (bccac24) to head (36b0a4c).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #611   +/-   ##
=======================================
  Coverage   91.49%   91.50%           
=======================================
  Files         615      615           
  Lines       16379    16401   +22     
=======================================
+ Hits        14986    15007   +21     
- Misses       1393     1394    +1     
Flag Coverage Δ
unit 91.50% <95.45%> (+<0.01%) ⬆️
unit-latest-uploader 91.50% <95.45%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
api/internal/owner/views.py 99.04% <100.00%> (+0.10%) ⬆️
services/billing.py 92.30% <91.66%> (-0.03%) ⬇️

Impacted file tree graph

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.93%. Comparing base (bccac24) to head (36b0a4c).

✅ All tests successful. No failed tests found.

Files Patch % Lines
services/billing.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##               main       #611   +/-   ##
===========================================
  Coverage   95.93000   95.93000           
===========================================
  Files           793        793           
  Lines         17697      17719   +22     
===========================================
+ Hits          16977      16998   +21     
- Misses          720        721    +1     
Flag Coverage Δ
unit 91.50% <95.45%> (+<0.01%) ⬆️
unit-latest-uploader 91.50% <95.45%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if not billing_address:
raise ValidationError(detail="No billing_address sent")
owner = self.get_object()
billing = BillingService(requesting_user=request.current_owner)
Copy link
Contributor

Choose a reason for hiding this comment

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

will request.current_owner and self.get_object() ever be different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay so after some investigation, current_owner is an actual "owner" or "user," while the "owner" that is being updated in this case is actually an "organization" or "account" tied to the actual stripe subscription lol.

If you're confused, me too :) But this is something we'll probably be revisiting once the "Account" model is created

@ajay-sentry ajay-sentry added this pull request to the merge queue Jun 12, 2024
Merged via the queue into main with commit c5b388b Jun 12, 2024
20 of 22 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/1863-update-address-function branch June 12, 2024 16:24
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.

Create Billing Service function for Address Updates
2 participants