|
|
|
|
@ -21,7 +21,6 @@ using Bit.Core.Utilities;
@@ -21,7 +21,6 @@ using Bit.Core.Utilities;
|
|
|
|
|
using Bit.Core.Vault.Repositories; |
|
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
using Stripe; |
|
|
|
|
|
|
|
|
|
namespace Bit.Admin.Controllers; |
|
|
|
|
|
|
|
|
|
@ -50,7 +49,6 @@ public class OrganizationsController : Controller
@@ -50,7 +49,6 @@ public class OrganizationsController : Controller
|
|
|
|
|
private readonly ISecretRepository _secretRepository; |
|
|
|
|
private readonly IProjectRepository _projectRepository; |
|
|
|
|
private readonly IServiceAccountRepository _serviceAccountRepository; |
|
|
|
|
private readonly IStripeSyncService _stripeSyncService; |
|
|
|
|
|
|
|
|
|
public OrganizationsController( |
|
|
|
|
IOrganizationService organizationService, |
|
|
|
|
@ -74,8 +72,7 @@ public class OrganizationsController : Controller
@@ -74,8 +72,7 @@ public class OrganizationsController : Controller
|
|
|
|
|
ICurrentContext currentContext, |
|
|
|
|
ISecretRepository secretRepository, |
|
|
|
|
IProjectRepository projectRepository, |
|
|
|
|
IServiceAccountRepository serviceAccountRepository, |
|
|
|
|
IStripeSyncService stripeSyncService) |
|
|
|
|
IServiceAccountRepository serviceAccountRepository) |
|
|
|
|
{ |
|
|
|
|
_organizationService = organizationService; |
|
|
|
|
_organizationRepository = organizationRepository; |
|
|
|
|
@ -99,7 +96,6 @@ public class OrganizationsController : Controller
@@ -99,7 +96,6 @@ public class OrganizationsController : Controller
|
|
|
|
|
_secretRepository = secretRepository; |
|
|
|
|
_projectRepository = projectRepository; |
|
|
|
|
_serviceAccountRepository = serviceAccountRepository; |
|
|
|
|
_stripeSyncService = stripeSyncService; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[RequirePermission(Permission.Org_List_View)] |
|
|
|
|
@ -213,19 +209,6 @@ public class OrganizationsController : Controller
@@ -213,19 +209,6 @@ public class OrganizationsController : Controller
|
|
|
|
|
throw new BadRequestException("Plan does not support Secrets Manager"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
if (!string.IsNullOrWhiteSpace(organization.GatewayCustomerId) && !string.IsNullOrWhiteSpace(organization.BillingEmail)) |
|
|
|
|
{ |
|
|
|
|
await _stripeSyncService.UpdateCustomerEmailAddress(organization.GatewayCustomerId, organization.BillingEmail); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (StripeException stripeException) |
|
|
|
|
{ |
|
|
|
|
_logger.LogError(stripeException, "Failed to update billing email address in Stripe for Organization with ID '{organizationId}'", organization.Id); |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await _organizationRepository.ReplaceAsync(organization); |
|
|
|
|
await _applicationCacheService.UpsertOrganizationAbilityAsync(organization); |
|
|
|
|
await _referenceEventService.RaiseEventAsync(new ReferenceEvent(ReferenceEventType.OrganizationEditedByAdmin, organization, _currentContext) |
|
|
|
|
|