-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[PM-11728] Upgrade free organizations without Stripe Sources API #4757
Merged
amorask-bitwarden
merged 6 commits into
main
from
billing/PM-11728/change-plan-dialog-setup-intents
Sep 11, 2024
Merged
[PM-11728] Upgrade free organizations without Stripe Sources API #4757
amorask-bitwarden
merged 6 commits into
main
from
billing/PM-11728/change-plan-dialog-setup-intents
Sep 11, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit moves the IsFromSecretsManagerTrial flag from the OrganizationUpgrade to the OrganizationSignup because it will only be passed in on organization creation. Additionally, it removes the nullable boolean 'provider' flag passed to OrganizationService.SignUpAsync and instead adds that boolean flag to the OrganizationSignup which seems more appropriate.
While I'm trying to ingrain a singular model that can be used to purchase or upgrade organizations, I disliked my previously implemented OrganizationSubscriptionPurchase for being a little too wordy and specific. This sale class aligns more closely with the work we need to complete against Stripe and also uses a private constructor so that it can only be created and utilized via an Organiztion and either OrganizationSignup or OrganizationUpgrade object.
This commit renames the OrganizationBillingService.PurchaseSubscription to Finalize and passes it the OrganizationSale object. It also updates the method so that, if the organization already has a customer, it retrieves that customer instead of automatically trying to create one which we'll need for upgraded free organizations.
This commit adds an UpdatePaymentMethod to the OrganizationBillingService that will check if a customer exists for the organization and if not, creates one with the updated payment source and tax information. Then, in the UpgradeOrganizationPlanCommand, we can use the OrganizationUpgrade to get an OrganizationSale and finalize it, which will create a subscription using the customer created as part of the payment method update that takes place right before it on the client-side. Additionally, it adds some tax ID backfill logic to SubscriberService.UpdateTaxInformation
No New Or Fixed Issues Found |
eliykat
approved these changes
Sep 11, 2024
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.
AC changes look good, I particularly like moving the provider parameter inside the Signup object.
cturnbull-bitwarden
approved these changes
Sep 11, 2024
amorask-bitwarden
deleted the
billing/PM-11728/change-plan-dialog-setup-intents
branch
September 11, 2024 13:04
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-11728
📔 Objective
This PR does some refactoring of the previously implemented
OrganizationSubscriptionPurchase
and methods in theOrganizationBillingService
to support the purchasing of subscriptions for organizations where customers already exist.Additionally, it adds support for upgrading free organizations using our new purchase process by:
A.) Adding an
OrganizationBillingService.UpdatePaymentMethod
method that will create a customer for an organization trying to update their payment method if one does not exist already (this is the flow used when organizations upgrade from free to paid)B.) Piping the free organization purchase through the same, improved purchase process we use when purchasing a new organization.
All other subscription update logic remains untouched.
Notes
The commit chain is ordered and each commit note contains a detailed description of the changes within that specific commit.
Related Clients PR: bitwarden/clients#10976
📸 Screenshots
Upgrading a free organization with SM to a teams organization using a credit card:
Screen.Recording.2024-09-10.at.2.09.59.PM.mov
Upgrading a teams organization with SM to an enterprise organization while changing the payment method to a bank account:
Screen.Recording.2024-09-10.at.2.18.21.PM.mov
Upgrading a free organization without SM to a families organization using PayPal:
Screen.Recording.2024-09-10.at.2.21.14.PM.mov
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes