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: adjust schedules logic for upgrades to occur immediately #265

Merged
merged 4 commits into from
Nov 27, 2023

Conversation

adrian-codecov
Copy link
Contributor

Purpose/Motivation

We're adjusting the logic that governs schedules to make changes effective immediate when the desired scheduled value is an upgrade from the original one, either seats or billing rate.

What does this PR do?

  • Adjust the billing file + tests to reflect ^

Notes to Reviewer

screen-capture.8.webm

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.

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fb9fe94) 95.54% compared to head (5ae05aa) 95.54%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #265   +/-   ##
=====================================
  Coverage   95.54   95.54           
=====================================
  Files        721     721           
  Lines      16048   16048           
=====================================
  Hits       15332   15332           
  Misses       716     716           
Flag Coverage Δ
unit 95.63% <100.00%> (ø)
unit-latest-uploader 95.63% <100.00%> (ø)

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.

@codecov-staging
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fb9fe94) 95.63% compared to head (5ae05aa) 95.63%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #265   +/-   ##
=======================================
  Coverage   95.63%   95.63%           
=======================================
  Files         607      607           
  Lines       15641    15641           
=======================================
  Hits        14958    14958           
  Misses        683      683           
Flag Coverage Δ
unit 95.63% <100.00%> (ø)
unit-latest-uploader 95.63% <100.00%> (ø)

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.

Copy link
Contributor

@JerrySentry JerrySentry left a comment

Choose a reason for hiding this comment

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

Pre-approved with one little thing

Comment on lines 238 to 241
new_plan = desired_plan["value"]
new_quantity = desired_plan["quantity"]

print("downgrade", new_plan, new_quantity)
Copy link
Contributor

Choose a reason for hiding this comment

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

debugging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tyty

)
log.info(
f"Stripe subscription modified successfully for owner {owner.ownerid} by user #{self.requesting_user.ownerid}"
)
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

under this else block can be simplified to:

if not subscription_schedule_id:
    subscription_schedule_id = stripe.SubscriptionSchedule.create(
        from_subscription=owner.stripe_subscription_id
    ).id

self._modify_subscription_schedule(
    owner, subscription, subscription_schedule_id, desired_plan
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, will make the changes!

@adrian-codecov adrian-codecov merged commit 2d9ccfa into main Nov 27, 2023
19 checks passed
@adrian-codecov adrian-codecov deleted the 716-adjust-ongoing-schedule-logic branch November 27, 2023 17:53
RulaKhaled pushed a commit that referenced this pull request Nov 28, 2023
* feat: adjust schedules logic for upgrades to occur immediately

* feat: adjust logic
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.

None yet

2 participants