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
[AC-2576] Replace Billing commands and queries with services #4070
base: main
Are you sure you want to change the base?
Conversation
…rvice, move to commercial
New Issues
Fixed Issues
|
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!
|
||
organizationRepository.GetOwnerEmailAddressesById(organization.Id).Returns(organizationOwnerEmails); | ||
organizationRepository.GetOwnerEmailAddressesById(organization.Id).Returns([ | ||
"a@b.com", |
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.
Nit: I prefer to use the domain example.com
that is reserved for testing purposes
734e77c
@jlf0dev @r-tome @cturnbull-bitwarden Hey everyone, sorry had to fix something up in the If I could get another look, would greatly appreciate it. |
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.
Auth looks good 👍
e5c477e
5d77b73
Type of change
Objective
I wrote this PR due to ongoing conversations in the #code channel regarding how Bitwarden handles "CQRS" and the issue of having commands invoke other commands. Since Billing as a business function is more of an intermediary layer that processes side effects of other user actions, we've decided to refactor the business logic we've been writing to be service-oriented rather than formatted as commands or queries.
(Sorry for the insane commit chain. I've outlined the changes by team below)
This resulted in the movement of the following logic:
AssignSeatsToClientOrganizationCommand
->Commercial.ProviderBillingService
CancelSubscriptionCommand
->SubscriberService
CreateCustomerCommand
->Commercial.ProviderBillingService
RemovePaymentMethodCommand
->SubscriberService
ScaleSeatsCommand
->Commercial.ProviderBillingService
StartSubscriptionCommand
->Commercial.ProviderBillingService
ProviderBillingQueries
->Commercial.ProviderBillingService
OrganizationBillingQueries
->OrganizationBillingService
SubscriberQueries
->SubscriberService
@bitwarden/team-admin-console-dev:
As far as changes to your domain go, the big one is in
RemoveOrganizationFromProviderCommand
. SinceRemovePaymentMethod
is no longer a command, we can now invoke it from its service within this command. That update is in this PR and I've added tests for it.The updates to your API Controllers are just wiring up the new services with the same logic instead of the commands and queries. The only actual change to billing business logic represented in AC code is in the API
ProvidersController
. You'll seeStartSubscriptionCommand
has been split into 2 methods:CreateCustomer
andStartSubscription
. They do the same thing as before, but I wanted method control to be more granular.@bitwarden/team-auth-dev:
I think you only have one file changed in here and it's just replacing the previous command invocation for cancelling a subscription with the new service method; should be pretty straight forward.
@bitwarden/team-billing-dev:
If needed, we can sync as a team on the changes. Jet let me know.