Skip to content

Commit

Permalink
[AC-1803] Remove propagation from Bitwarden Portal billing email to S…
Browse files Browse the repository at this point in the history
…tripe account email (#3469)

* Revert changes on stripe billing email update

* Retain the email validation changes
  • Loading branch information
cyprain-okeke authored Nov 27, 2023
1 parent eab0838 commit 3ca8aef
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/Admin/Controllers/OrganizationsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using Bit.Core.Vault.Repositories;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Stripe;

namespace Bit.Admin.Controllers;

Expand Down Expand Up @@ -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,
Expand All @@ -74,8 +72,7 @@ public OrganizationsController(
ICurrentContext currentContext,
ISecretRepository secretRepository,
IProjectRepository projectRepository,
IServiceAccountRepository serviceAccountRepository,
IStripeSyncService stripeSyncService)
IServiceAccountRepository serviceAccountRepository)
{
_organizationService = organizationService;
_organizationRepository = organizationRepository;
Expand All @@ -99,7 +96,6 @@ public OrganizationsController(
_secretRepository = secretRepository;
_projectRepository = projectRepository;
_serviceAccountRepository = serviceAccountRepository;
_stripeSyncService = stripeSyncService;
}

[RequirePermission(Permission.Org_List_View)]
Expand Down Expand Up @@ -213,19 +209,6 @@ public async Task<IActionResult> Edit(Guid id, OrganizationEditModel model)
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)
Expand Down

0 comments on commit 3ca8aef

Please sign in to comment.