From faa9afbe5efe40b77a5bbb8c8a7c264ee1da9752 Mon Sep 17 00:00:00 2001 From: Justin Baur <19896123+justindbaur@users.noreply.github.com> Date: Sat, 17 Aug 2024 07:06:31 -0400 Subject: [PATCH] Resolve Billing and Secrets Manager Code (#4645) * Resolve Billing Warnings * Resolve SM Warnings --- .../SecretsManager/Repositories/ProjectRepository.cs | 2 +- .../SecretsManager/Repositories/SecretRepository.cs | 2 +- .../SecretsManager/Repositories/ServiceAccountRepository.cs | 2 +- .../Billing/Public/Controllers/OrganizationController.cs | 6 +++++- src/Core/Billing/Services/IProviderBillingService.cs | 2 +- src/Core/Billing/Services/ISubscriberService.cs | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs index 99d34e8cf..40ae58aa6 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs @@ -16,7 +16,7 @@ public class ProjectRepository : Repository db.Project) { } - public override async Task GetByIdAsync(Guid id) + public override async Task GetByIdAsync(Guid id) { using (var scope = ServiceScopeFactory.CreateScope()) { diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs index 8b23e4cfd..14087ddff 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs @@ -19,7 +19,7 @@ public class SecretRepository : Repository db.Secret) { } - public override async Task GetByIdAsync(Guid id) + public override async Task GetByIdAsync(Guid id) { using (var scope = ServiceScopeFactory.CreateScope()) { diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ServiceAccountRepository.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ServiceAccountRepository.cs index 20c457730..10822d87d 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ServiceAccountRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ServiceAccountRepository.cs @@ -263,7 +263,7 @@ public class ServiceAccountRepository : Repository { ap.GrantedSecretId.Value }); + new List { ap.GrantedSecretId!.Value }); private static List FilterDirectSecretAccessResults( List projectSecretsAccessResults, diff --git a/src/Api/Billing/Public/Controllers/OrganizationController.cs b/src/Api/Billing/Public/Controllers/OrganizationController.cs index 22d562764..c696f2af5 100644 --- a/src/Api/Billing/Public/Controllers/OrganizationController.cs +++ b/src/Api/Billing/Public/Controllers/OrganizationController.cs @@ -19,17 +19,20 @@ public class OrganizationController : Controller private readonly ICurrentContext _currentContext; private readonly IOrganizationRepository _organizationRepository; private readonly IUpdateSecretsManagerSubscriptionCommand _updateSecretsManagerSubscriptionCommand; + private readonly ILogger _logger; public OrganizationController( IOrganizationService organizationService, ICurrentContext currentContext, IOrganizationRepository organizationRepository, - IUpdateSecretsManagerSubscriptionCommand updateSecretsManagerSubscriptionCommand) + IUpdateSecretsManagerSubscriptionCommand updateSecretsManagerSubscriptionCommand, + ILogger logger) { _organizationService = organizationService; _currentContext = currentContext; _organizationRepository = organizationRepository; _updateSecretsManagerSubscriptionCommand = updateSecretsManagerSubscriptionCommand; + _logger = logger; } /// @@ -58,6 +61,7 @@ public class OrganizationController : Controller } catch (Exception ex) { + _logger.LogError(ex, "Unhandled error while updating the subscription"); return StatusCode(500, new { Message = "An error occurred while updating the subscription." }); } } diff --git a/src/Core/Billing/Services/IProviderBillingService.cs b/src/Core/Billing/Services/IProviderBillingService.cs index 1235fcd5f..2514ca785 100644 --- a/src/Core/Billing/Services/IProviderBillingService.cs +++ b/src/Core/Billing/Services/IProviderBillingService.cs @@ -17,7 +17,7 @@ public interface IProviderBillingService /// . /// /// The that manages the client . - /// The client whose you want to update. + /// The client whose you want to update. /// The number of seats to assign to the client organization. Task AssignSeatsToClientOrganization( Provider provider, diff --git a/src/Core/Billing/Services/ISubscriberService.cs b/src/Core/Billing/Services/ISubscriberService.cs index 5183d49be..a9df11cee 100644 --- a/src/Core/Billing/Services/ISubscriberService.cs +++ b/src/Core/Billing/Services/ISubscriberService.cs @@ -90,7 +90,7 @@ public interface ISubscriberService SubscriptionGetOptions subscriptionGetOptions = null); /// - /// Retrieves the 's tax information using their Stripe 's . + /// Retrieves the 's tax information using their Stripe 's . /// /// The subscriber to retrieve the tax information for. /// A representing the 's tax information.