From 0075a15485daf3845c4dab42b7e3729850b131ad Mon Sep 17 00:00:00 2001
From: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Date: Fri, 9 May 2025 13:43:50 -0400
Subject: [PATCH] [PM-18064] Resolve billing warnings (#5797)
* Resolve Billing warnings
* Remove exclusions
* Format
---
src/Api/Api.csproj | 2 --
.../Controllers/OrganizationBillingController.cs | 2 ++
.../Billing/Services/IProviderBillingService.cs | 2 +-
.../Implementations/PaymentHistoryService.cs | 4 +---
src/Core/Core.csproj | 2 --
.../Billing/Services/PaymentHistoryServiceTests.cs | 13 ++++---------
6 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/src/Api/Api.csproj b/src/Api/Api.csproj
index 6505fdab5b..c490e90150 100644
--- a/src/Api/Api.csproj
+++ b/src/Api/Api.csproj
@@ -4,8 +4,6 @@
false
bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
true
-
- $(WarningsNotAsErrors);CS8604
diff --git a/src/Api/Billing/Controllers/OrganizationBillingController.cs b/src/Api/Billing/Controllers/OrganizationBillingController.cs
index 2f0a4ef48b..b82c627ee0 100644
--- a/src/Api/Billing/Controllers/OrganizationBillingController.cs
+++ b/src/Api/Billing/Controllers/OrganizationBillingController.cs
@@ -1,4 +1,5 @@
#nullable enable
+using System.Diagnostics;
using Bit.Api.AdminConsole.Models.Request.Organizations;
using Bit.Api.Billing.Models.Requests;
using Bit.Api.Billing.Models.Responses;
@@ -292,6 +293,7 @@ public class OrganizationBillingController(
sale.SubscriptionSetup.SkipTrial = true;
await organizationBillingService.Finalize(sale);
var org = await organizationRepository.GetByIdAsync(organizationId);
+ Debug.Assert(org is not null, "This organization has already been found via this same ID, this should be fine.");
if (organizationSignup.PaymentMethodType != null)
{
var paymentSource = new TokenizedPaymentSource(organizationSignup.PaymentMethodType.Value, organizationSignup.PaymentToken);
diff --git a/src/Core/Billing/Services/IProviderBillingService.cs b/src/Core/Billing/Services/IProviderBillingService.cs
index 6ed8910dd8..0171a7e1c3 100644
--- a/src/Core/Billing/Services/IProviderBillingService.cs
+++ b/src/Core/Billing/Services/IProviderBillingService.cs
@@ -59,7 +59,7 @@ public interface IProviderBillingService
int seatAdjustment);
///
- /// Determines whether the provided will result in a purchase for the 's .
+ /// Determines whether the provided will result in a purchase for the 's .
/// Seat adjustments that result in purchases include:
///
/// - The going from below the seat minimum to above the seat minimum for the provided
diff --git a/src/Core/Billing/Services/Implementations/PaymentHistoryService.cs b/src/Core/Billing/Services/Implementations/PaymentHistoryService.cs
index 6e984f946e..5a8cf16f5a 100644
--- a/src/Core/Billing/Services/Implementations/PaymentHistoryService.cs
+++ b/src/Core/Billing/Services/Implementations/PaymentHistoryService.cs
@@ -5,14 +5,12 @@ using Bit.Core.Entities;
using Bit.Core.Models.BitStripe;
using Bit.Core.Repositories;
using Bit.Core.Services;
-using Microsoft.Extensions.Logging;
namespace Bit.Core.Billing.Services.Implementations;
public class PaymentHistoryService(
IStripeAdapter stripeAdapter,
- ITransactionRepository transactionRepository,
- ILogger logger) : IPaymentHistoryService
+ ITransactionRepository transactionRepository) : IPaymentHistoryService
{
public async Task> GetInvoiceHistoryAsync(
ISubscriber subscriber,
diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj
index 4411a3de9b..898f0550b0 100644
--- a/src/Core/Core.csproj
+++ b/src/Core/Core.csproj
@@ -3,8 +3,6 @@
false
bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
-
- $(WarningsNotAsErrors);CS1574;CS9113
diff --git a/test/Core.Test/Billing/Services/PaymentHistoryServiceTests.cs b/test/Core.Test/Billing/Services/PaymentHistoryServiceTests.cs
index c9278e4488..06a408c5a8 100644
--- a/test/Core.Test/Billing/Services/PaymentHistoryServiceTests.cs
+++ b/test/Core.Test/Billing/Services/PaymentHistoryServiceTests.cs
@@ -4,7 +4,6 @@ using Bit.Core.Entities;
using Bit.Core.Models.BitStripe;
using Bit.Core.Repositories;
using Bit.Core.Services;
-using Microsoft.Extensions.Logging;
using NSubstitute;
using Stripe;
using Xunit;
@@ -22,8 +21,7 @@ public class PaymentHistoryServiceTests
var stripeAdapter = Substitute.For();
stripeAdapter.InvoiceListAsync(Arg.Any()).Returns(invoices);
var transactionRepository = Substitute.For();
- var logger = Substitute.For>();
- var paymentHistoryService = new PaymentHistoryService(stripeAdapter, transactionRepository, logger);
+ var paymentHistoryService = new PaymentHistoryService(stripeAdapter, transactionRepository);
// Act
var result = await paymentHistoryService.GetInvoiceHistoryAsync(subscriber);
@@ -40,8 +38,7 @@ public class PaymentHistoryServiceTests
// Arrange
var paymentHistoryService = new PaymentHistoryService(
Substitute.For(),
- Substitute.For(),
- Substitute.For>());
+ Substitute.For());
// Act
var result = await paymentHistoryService.GetInvoiceHistoryAsync(null);
@@ -59,8 +56,7 @@ public class PaymentHistoryServiceTests
var transactionRepository = Substitute.For();
transactionRepository.GetManyByOrganizationIdAsync(subscriber.Id, Arg.Any(), Arg.Any()).Returns(transactions);
var stripeAdapter = Substitute.For();
- var logger = Substitute.For>();
- var paymentHistoryService = new PaymentHistoryService(stripeAdapter, transactionRepository, logger);
+ var paymentHistoryService = new PaymentHistoryService(stripeAdapter, transactionRepository);
// Act
var result = await paymentHistoryService.GetTransactionHistoryAsync(subscriber);
@@ -77,8 +73,7 @@ public class PaymentHistoryServiceTests
// Arrange
var paymentHistoryService = new PaymentHistoryService(
Substitute.For(),
- Substitute.For(),
- Substitute.For>());
+ Substitute.For());
// Act
var result = await paymentHistoryService.GetTransactionHistoryAsync(null);