Skip to content

Commit

Permalink
Resolve Billing and Secrets Manager Code (bitwarden#4645)
Browse files Browse the repository at this point in the history
* Resolve Billing Warnings

* Resolve SM Warnings
  • Loading branch information
justindbaur authored Aug 17, 2024
1 parent abb223a commit faa9afb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public ProjectRepository(IServiceScopeFactory serviceScopeFactory, IMapper mappe
: base(serviceScopeFactory, mapper, db => db.Project)
{ }

public override async Task<Core.SecretsManager.Entities.Project> GetByIdAsync(Guid id)
public override async Task<Core.SecretsManager.Entities.Project?> GetByIdAsync(Guid id)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public SecretRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper
: base(serviceScopeFactory, mapper, db => db.Secret)
{ }

public override async Task<Core.SecretsManager.Entities.Secret> GetByIdAsync(Guid id)
public override async Task<Core.SecretsManager.Entities.Secret?> GetByIdAsync(Guid id)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ from ap in grouping.DefaultIfEmpty()
where ap.GrantedSecret.DeletedDate == null &&
ap.GrantedSecretId != null
select new ServiceAccountSecretsAccess(sa,
new List<Guid> { ap.GrantedSecretId.Value });
new List<Guid> { ap.GrantedSecretId!.Value });

private static List<ServiceAccountSecretsAccess> FilterDirectSecretAccessResults(
List<ServiceAccountSecretsAccess> projectSecretsAccessResults,
Expand Down
6 changes: 5 additions & 1 deletion src/Api/Billing/Public/Controllers/OrganizationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ public class OrganizationController : Controller
private readonly ICurrentContext _currentContext;
private readonly IOrganizationRepository _organizationRepository;
private readonly IUpdateSecretsManagerSubscriptionCommand _updateSecretsManagerSubscriptionCommand;
private readonly ILogger<OrganizationController> _logger;

public OrganizationController(
IOrganizationService organizationService,
ICurrentContext currentContext,
IOrganizationRepository organizationRepository,
IUpdateSecretsManagerSubscriptionCommand updateSecretsManagerSubscriptionCommand)
IUpdateSecretsManagerSubscriptionCommand updateSecretsManagerSubscriptionCommand,
ILogger<OrganizationController> logger)
{
_organizationService = organizationService;
_currentContext = currentContext;
_organizationRepository = organizationRepository;
_updateSecretsManagerSubscriptionCommand = updateSecretsManagerSubscriptionCommand;
_logger = logger;
}

/// <summary>
Expand Down Expand Up @@ -58,6 +61,7 @@ public async Task<IActionResult> PostSubscriptionAsync([FromBody] OrganizationSu
}
catch (Exception ex)
{
_logger.LogError(ex, "Unhandled error while updating the subscription");
return StatusCode(500, new { Message = "An error occurred while updating the subscription." });
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Billing/Services/IProviderBillingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface IProviderBillingService
/// <see cref="PlanType"/>.
/// </summary>
/// <param name="provider">The <see cref="Provider"/> that manages the client <paramref name="organization"/>.</param>
/// <param name="organization">The client <see cref="Organization"/> whose <see cref="seats"/> you want to update.</param>
/// <param name="organization">The client <see cref="Organization"/> whose <paramref name="seats"/> you want to update.</param>
/// <param name="seats">The number of seats to assign to the client organization.</param>
Task AssignSeatsToClientOrganization(
Provider provider,
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Billing/Services/ISubscriberService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Task<Subscription> GetSubscriptionOrThrow(
SubscriptionGetOptions subscriptionGetOptions = null);

/// <summary>
/// Retrieves the <see cref="subscriber"/>'s tax information using their Stripe <see cref="Stripe.Customer"/>'s <see cref="Stripe.Customer.Address"/>.
/// Retrieves the <paramref name="subscriber"/>'s tax information using their Stripe <see cref="Stripe.Customer"/>'s <see cref="Stripe.Customer.Address"/>.
/// </summary>
/// <param name="subscriber">The subscriber to retrieve the tax information for.</param>
/// <returns>A <see cref="TaxInformation"/> representing the <paramref name="subscriber"/>'s tax information.</returns>
Expand Down

0 comments on commit faa9afb

Please sign in to comment.