* Remove flag from CreateProviderCommand
* Remove flag from OrganizationsController
* Consolidate provider extensions
* Remove flag from ProvidersController
* Remove flag from CreateMsp.cshtml
* Remove flag from Provider Edit.cshtml
Also ensured the editable Gateway fields show for Multi-organization enterprises
* Remove flag from OrganizationsController
* Remove flag from billing-owned provider controllers
* Remove flag from OrganizationService
* Remove flag from RemoveOrganizationFromProviderCommand
* Remove flag from ProviderService
* Remove flag
* Run dotnet format
* Fix failing tests
* resolves issue #4043 default values for itemsPerPage and startIndex
* UsersController#Get now uses a queryParamModel
Co-authored-by: Ahmad Mustafa Jebran <jebran.mustafa@gmail.com>
Co-authored-by: Luris Solis <solisluris@gmail.com>
* Test now passes, default 50 is represented
---------
Co-authored-by: Jared McCannon <jmccannon@bitwarden.com>
* Add HasConfirmedOwnersExceptQuery class, interface and unit tests
* Register IHasConfirmedOwnersExceptQuery for dependency injection
* Replace OrganizationService.HasConfirmedOwnersExceptAsync with HasConfirmedOwnersExceptQuery
* Refactor DeleteManagedOrganizationUserAccountCommand to use IHasConfirmedOwnersExceptQuery
* Fix unit tests
* Extract IOrganizationService.RemoveUserAsync into IRemoveOrganizationUserCommand; Update unit tests
* Extract IOrganizationService.RemoveUsersAsync into IRemoveOrganizationUserCommand; Update unit tests
* Refactor RemoveUserAsync(Guid organizationId, Guid userId) to use ValidateDeleteUser
* Refactor RemoveOrganizationUserCommandTests to use more descriptive method names
* Refactor controller actions to accept Guid directly instead of parsing strings
* Add unit tests for removing OrganizationUser by UserId
* Refactor remove OrganizationUser by UserId method
* Add summary to IHasConfirmedOwnersExceptQuery
* PM-11123: Device Type mapping
* PM-11123: Moving ClientType out of NotificationCenter, naming clash with Identity ClientType
* PM-11123: Rename ClientType in ICurrentContext to match the type
* Refactor: Update metadata in OrganizationSignup and OrganizationUpgrade
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.
* Introduce OrganizationSale
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.
* Use OrganizationSale in OrganizationBillingService
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.
* Add functionality for free organization upgrade
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 Logic) Re-order OrganizationBillingService methods alphabetically
* (No Logic) Run dotnet format
* Refactor: Rename some methods and models for consistency
This commit contains no logic changes at all. It's entirely comprised of renames of existing models and methods to bring our codebase more in line with our app's functionality and terminology.
* Add feature flag: AC-2476-deprecate-stripe-sources-api
* Standardize error responses from applicable billing controllers
During my work on CB, I found that just using the built-in TypedResults errors results in the client choking on the response because it's looking for the ErrroResponseModel. The new BaseBillingController provides Error utilities to return TypedResults wrapping that model so the client can process it.
* Add feature flagged payment method endoints to OrganizationBillingController
* Run dotnet format
* Fix error handling in provider setup process
This update ensures that when 'enable-consolidated-billing' is on, any exception thrown during the Stripe customer or subscription setup process for the provider will block the remainder of the setup process so the provider does not enter an invalid state
* Refactor the way BillingException is thrown
Made it simpler to just use the exception constructor and also ensured it was added to the exception handling middleware so it could provide a simple response to the client
* Handle all Stripe exceptions in exception handling middleware
* Fixed error response output for billing's provider controllers
* Cleaned up billing owned provider controllers
Changes were made based on feature updates by product and stuff that's no longer needed. No need to expose sensitive endpoints when they're not being used.
* Reafctored get invoices
Removed unnecssarily bloated method from SubscriberService
* Updated error handling for generating the client invoice report
* Moved get provider subscription to controller
This is only used once and the service layer doesn't seem like the correct choice anymore when thinking about error handling with retrieval
* Handled bad request for update tax information
* Split out Stripe configuration from unauthorization
* Run dotnet format
* Addison's feedback
* Remove Organization.FlexibleCollections from code
* Drop Organization.FlexibleCollections column in EF databases
(MSSQL column to be retained for 1 additional deployment to support rollback in cloud)
* Adding API endpoint to send out Access Request for SM to Admins, adding email template
* Fixing email template HTML, adding tests
* fixing tests
* fixing lint
* Moving files to proper locations
* fixing build error relating to not removing some old code
* Updating namespaces and removing unused using statements
* Dependency injection fix
* Fixing tests and moving them to proper files
* lint
* format fixes
* dotnet format fix
* small fixes
* removing using directive's that aren't needed
* Update bitwarden_license/test/Commercial.Core.Test/SecretsManager/Commands/PasswordManager/RequestSMAccessCommandTests.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/MailTemplates/Handlebars/SecretsManagerAccessRequest.text.hbs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update bitwarden_license/src/Commercial.Core/SecretsManager/Commands/PasswordManager/RequestSMAccessCommand.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Changes requested by Thomas
* Lint fixes
* Suggested changes from Maceij
* Current state of tests
* Fixing tests and getting the core.csproj file from main
* Reverting csproj file change
* Removing usings directory
* dotnet format
* Fixing test
* Update bitwarden_license/test/Commercial.Core.Test/SecretsManager/Commands/Requests/RequestSMAccessCommandTests.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update test/Api.Test/SecretsManager/Controllers/RequestSMAccessControllerTests.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Thomas requested changes
* Fixing 500 error when user name is null
* Prettier error message if user sends over an whitespace string
* Fixing word wrapping issue in email contents
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* chore: remove fc refs in CreateGroup and UpdateGroup commands, refs AC-2646
* chore: remove fc refs and update interface to represent usage/get rid of double enumeration warnings, refs AC-2646
* chore: remove org/provider service fc callers, refs AC-2646
* chore: remove collection service fc callers, refs AC-2646
* chore: remove cipher service import ciphers fc callers, refs AC-2646
* fix: UpdateOrganizationUserCommandTests collections to list, refs AC-2646
* fix: update CreateGroupCommandTests, refs AC-2646
* fix: adjust UpdateGroupCommandTests, refs AC-2646
* fix: adjust UpdateOrganizationUserCommandTests for FC always true, refs AC-2646
* fix: update CollectionServiceTests, refs AC-2646
* fix: remove unnecessary test with fc disabled, refs AC-2646
* fix: update tests to account for AccessAll removal and Manager removal, refs AC-2646
* chore: remove dependence on FC flag for tests, refs AC-2646
* Add AccessToSecretsAsync to the repository
* Add BulkSecretAuthorizationHandler
* Update controller to use the new authz handler
* Add integration test coverage
* Optionally Run `docker-compose`
* Use Traversal Projects Over Solution Files
* Cleanup VSCode Tasks
* Bind DataProtection Keys to Host
- Makes it so the container can be rebuilt without corrupting data
* Update .vscode/tasks.json
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
---------
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
* Enable `nullable` for `ApiKey`
* Switch to Using `required`
* Make Scope Be Valid JSON
* Update test/Api.IntegrationTest/SecretsManager/Controllers/ServiceAccountsControllerTests.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Move Nullable Directive
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Expanded Teams and Enterprise plan with provider seat data
* Updated provider setup process with new plan information
* Updated provider subscription retrieval and update with new plan information
* Updated client invoice report with new plan information
* Fixed tests
* Fix broken test
* Add BaseProviderController, update some endpoints to ServiceUser permissions
* Prevent service user from scaling provider seats above seat minimum
* Expand invoice response to include DueDate
* Renamed ProductType to ProductTierType
* Renamed Product properties to ProductTier
* Moved ProductTierType to Bit.Core.Billing.Enums namespace from Bit.Core.Enums
* Moved PlanType enum to Bit.Core.Billing.Enums
* Moved StaticStore to Bit.Core.Billing.Models.StaticStore namespace
* Added ProductType enum
* dotnet format
* Add authz handling for secret access policy reads
* Add the ability to fetch secret access polices from the repository
* refactor response models
* Add new endpoint
* Refactored GET provider subscription
Refactoring this endpoint and its associated tests in preparation for the addition of more endpoints that share similar patterns
* Replaced StripePaymentService call in AccountsController, OrganizationsController
This was made in error during a previous PR. Since this is not related to Consolidated Billing, we want to try not to include it in these changes.
* Removing GetPaymentInformation call from ProviderBillingService
This method is a good call for the SubscriberService as we'll want to extend the functionality to all subscriber types
* Refactored GetTaxInformation to use Billing owned DTO
* Add UpdateTaxInformation to SubscriberService
* Added GetTaxInformation and UpdateTaxInformation endpoints to ProviderBillingController
* Added controller to manage creation of Stripe SetupIntents
With the deprecation of the Sources API, we need to move the bank account creation process to using SetupIntents. This controller brings both the creation of "card" and "us_bank_account" SetupIntents
under billing management.
* Added UpdatePaymentMethod method to SubscriberService
This method utilizes the SetupIntents created by the StripeController from the previous commit when a customer adds a card or us_bank_account payment method (Stripe). We need to cache the most recent SetupIntent for the subscriber so that we know which PaymentMethod is their most recent even when it hasn't been confirmed yet.
* Refactored GetPaymentMethod to use billing owned DTO and check setup intents
* Added GetPaymentMethod and UpdatePaymentMethod endpoints to ProviderBillingController
* Re-added GetPaymentInformation endpoint to consolidate API calls on the payment method page
* Added VerifyBankAccount endpoint to ProviderBillingController in order to finalize bank account payment methods
* Updated BitPayInvoiceRequestModel to support providers
* run dotnet format
* Conner's feedback
* Run dotnet format'
* Replace SubscriberQueries with SubscriberService
* Replace OrganizationBillingQueries with OrganizationBillingService
* Replace ProviderBillingQueries with ProviderBillingService, move to Commercial
* Replace AssignSeatsToClientOrganizationCommand with ProviderBillingService, move to commercial
* Replace ScaleSeatsCommand with ProviderBillingService and move to Commercial
* Replace CancelSubscriptionCommand with SubscriberService
* Replace CreateCustomerCommand with ProviderBillingService and move to Commercial
* Replace StartSubscriptionCommand with ProviderBillingService and moved to Commercial
* Replaced RemovePaymentMethodCommand with SubscriberService
* Formatting
* Used dotnet format this time
* Changing ProviderBillingService to scoped
* Found circular dependency'
* One more time with feeling
* Formatting
* Fix error in remove org from provider
* Missed test fix in conflit
* [AC-1937] Server: Implement endpoint to retrieve provider payment information (#4107)
* Move the gettax and paymentmethod from stripepayment class
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Add the method to retrieve the tax and payment details
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Add unit tests for the paymentInformation method
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Add the endpoint to retrieve paymentinformation
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Add unit tests to the SubscriberService
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Remove the getTaxInfoAsync update reference
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
---------
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
---------
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com>
* Prevent calls to Stripe when unlinking client org has no Stripe objects
* Thomas' feedback
* Check for stripe when org unlinked from org page
---------
Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com>
* Add new models
* Update repositories
* Add new authz handler
* Add new query
* Add new command
* Add authz, command, and query to DI
* Add new endpoint to controller
* Add query unit tests
* Add api unit tests
* Add api integration tests
* Add the ability to get multi projects access
* Add access policy helper + tests
* Add new data/request models
* Add access policy operations to repo
* Add authz handler for new operations
* Add new controller endpoints
* add updating service account revision
* add new classes
* initial commit
* revert the changes on this files
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* revert unnecessary changes
* Add a model
* add the delete token endpoint
* add a unit test for delete provider
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* add the delete provider method
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* resolve the failing test
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* resolve the delete request redirect issue
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* changes to correct the json issue
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* resolve errors
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* resolve pr comment
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* move ProviderDeleteTokenable to the adminConsole
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Add feature flag
* resolve pr comments
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* add some unit test
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* resolve the failing test
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* resolve test
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* add the remove feature flag
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* [AC-2378] Added `ProviderId` to PayPal transaction model (#3995)
* Added ProviderId to PayPal transaction model
* Fixed issue with parsing provider id
* [AC-1923] Add endpoint to create client organization (#3977)
* Add new endpoint for creating client organizations in consolidated billing
* Create empty org and then assign seats for code re-use
* Fixes made from debugging client side
* few more small fixes
* Vincent's feedback
* Bumped version to 2024.4.1 (#3997)
* [AC-1923] Add endpoint to create client organization (#3977)
* Add new endpoint for creating client organizations in consolidated billing
* Create empty org and then assign seats for code re-use
* Fixes made from debugging client side
* few more small fixes
* Vincent's feedback
* [AC-1923] Add endpoint to create client organization (#3977)
* Add new endpoint for creating client organizations in consolidated billing
* Create empty org and then assign seats for code re-use
* Fixes made from debugging client side
* few more small fixes
* Vincent's feedback
* add changes after merge conflict
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
---------
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
Co-authored-by: Alex Morask <144709477+amorask-bitwarden@users.noreply.github.com>
Co-authored-by: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com>
* Add new endpoint for creating client organizations in consolidated billing
* Create empty org and then assign seats for code re-use
* Fixes made from debugging client side
* few more small fixes
* Vincent's feedback