-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AC-2965] Use OrganizationBillingService to purchase org when FF is on (
#4737) * Add PurchaseSubscription to OrganizationBillingService and call from OrganizationService.SignUpAsync when FF is on * Run dotnet format * Missed billing service DI for SCIM which uses the OrganizationService
- Loading branch information
1 parent
8491c58
commit c0a4ba8
Showing
11 changed files
with
481 additions
and
39 deletions.
There are no files selected for viewing
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 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 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 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
27 changes: 27 additions & 0 deletions
27
src/Core/Billing/Models/OrganizationSubscriptionPurchase.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Bit.Core.Billing.Enums; | ||
|
||
namespace Bit.Core.Billing.Models; | ||
|
||
public record OrganizationSubscriptionPurchase( | ||
OrganizationSubscriptionPurchaseMetadata Metadata, | ||
OrganizationPasswordManagerSubscriptionPurchase PasswordManagerSubscription, | ||
TokenizedPaymentSource PaymentSource, | ||
PlanType PlanType, | ||
OrganizationSecretsManagerSubscriptionPurchase SecretsManagerSubscription, | ||
TaxInformation TaxInformation); | ||
|
||
public record OrganizationPasswordManagerSubscriptionPurchase( | ||
int Storage, | ||
bool PremiumAccess, | ||
int Seats); | ||
|
||
public record OrganizationSecretsManagerSubscriptionPurchase( | ||
int Seats, | ||
int ServiceAccounts); | ||
|
||
public record OrganizationSubscriptionPurchaseMetadata( | ||
bool FromProvider, | ||
bool FromSecretsManagerStandalone) | ||
{ | ||
public static OrganizationSubscriptionPurchaseMetadata Default => new(false, false); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
using Bit.Core.Billing.Models; | ||
using Bit.Core.AdminConsole.Entities; | ||
using Bit.Core.Billing.Models; | ||
|
||
namespace Bit.Core.Billing.Services; | ||
|
||
public interface IOrganizationBillingService | ||
{ | ||
/// <summary> | ||
/// Retrieve metadata about the organization represented bsy the provided <paramref name="organizationId"/>. | ||
/// </summary> | ||
/// <param name="organizationId">The ID of the organization to retrieve metadata for.</param> | ||
/// <returns>An <see cref="OrganizationMetadata"/> record.</returns> | ||
Task<OrganizationMetadata> GetMetadata(Guid organizationId); | ||
|
||
/// <summary> | ||
/// Purchase a subscription for the provided <paramref name="organization"/> using the provided <paramref name="organizationSubscriptionPurchase"/>. | ||
/// If successful, a Stripe <see cref="Stripe.Customer"/> and <see cref="Stripe.Subscription"/> will be created for the organization and the | ||
/// organization will be enabled. | ||
/// </summary> | ||
/// <param name="organization">The organization to purchase a subscription for.</param> | ||
/// <param name="organizationSubscriptionPurchase">The purchase information for the organization's subscription.</param> | ||
Task PurchaseSubscription(Organization organization, OrganizationSubscriptionPurchase organizationSubscriptionPurchase); | ||
} |
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
Oops, something went wrong.