Skip to content

Commit 5184d10

Browse files
Create customer for client organization that was converted to BU upon unlinking (#5706)
1 parent cb2860c commit 5184d10

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bitwarden_license/src/Commercial.Core/AdminConsole/Providers/RemoveOrganizationFromProviderCommand.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,14 @@ private async Task ResetOrganizationBillingAsync(
110110
IEnumerable<string> organizationOwnerEmails)
111111
{
112112
if (provider.IsBillable() &&
113-
organization.IsValidClient() &&
114-
!string.IsNullOrEmpty(organization.GatewayCustomerId))
113+
organization.IsValidClient())
115114
{
115+
// An organization converted to a business unit will not have a Customer since it was given to the business unit.
116+
if (string.IsNullOrEmpty(organization.GatewayCustomerId))
117+
{
118+
await _providerBillingService.CreateCustomerForClientOrganization(provider, organization);
119+
}
120+
116121
var customer = await _stripeAdapter.CustomerUpdateAsync(organization.GatewayCustomerId, new CustomerUpdateOptions
117122
{
118123
Description = string.Empty,

0 commit comments

Comments
 (0)