Skip to content

Commit 0075a15

Browse files
authored
[PM-18064] Resolve billing warnings (#5797)
* Resolve Billing warnings * Remove exclusions * Format
1 parent ead5bbd commit 0075a15

File tree

6 files changed

+8
-17
lines changed

6 files changed

+8
-17
lines changed

src/Api/Api.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
55
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
66
<ANCMPreConfiguredForIIS>true</ANCMPreConfiguredForIIS>
7-
<!-- Temp exclusions until warnings are fixed -->
8-
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS8604</WarningsNotAsErrors>
97
</PropertyGroup>
108

119
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

src/Api/Billing/Controllers/OrganizationBillingController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#nullable enable
2+
using System.Diagnostics;
23
using Bit.Api.AdminConsole.Models.Request.Organizations;
34
using Bit.Api.Billing.Models.Requests;
45
using Bit.Api.Billing.Models.Responses;
@@ -292,6 +293,7 @@ public async Task<IResult> RestartSubscriptionAsync([FromRoute] Guid organizatio
292293
sale.SubscriptionSetup.SkipTrial = true;
293294
await organizationBillingService.Finalize(sale);
294295
var org = await organizationRepository.GetByIdAsync(organizationId);
296+
Debug.Assert(org is not null, "This organization has already been found via this same ID, this should be fine.");
295297
if (organizationSignup.PaymentMethodType != null)
296298
{
297299
var paymentSource = new TokenizedPaymentSource(organizationSignup.PaymentMethodType.Value, organizationSignup.PaymentToken);

src/Core/Billing/Services/IProviderBillingService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Task ScaleSeats(
5959
int seatAdjustment);
6060

6161
/// <summary>
62-
/// Determines whether the provided <paramref name="seatAdjustment"/> will result in a purchase for the <paramref name="provider"/>'s <see cref="planType"/>.
62+
/// Determines whether the provided <paramref name="seatAdjustment"/> will result in a purchase for the <paramref name="provider"/>'s <see cref="PlanType"/>.
6363
/// Seat adjustments that result in purchases include:
6464
/// <list type="bullet">
6565
/// <item>The <paramref name="provider"/> going from below the seat minimum to above the seat minimum for the provided <paramref name="planType"/></item>

src/Core/Billing/Services/Implementations/PaymentHistoryService.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
using Bit.Core.Models.BitStripe;
66
using Bit.Core.Repositories;
77
using Bit.Core.Services;
8-
using Microsoft.Extensions.Logging;
98

109
namespace Bit.Core.Billing.Services.Implementations;
1110

1211
public class PaymentHistoryService(
1312
IStripeAdapter stripeAdapter,
14-
ITransactionRepository transactionRepository,
15-
ILogger<PaymentHistoryService> logger) : IPaymentHistoryService
13+
ITransactionRepository transactionRepository) : IPaymentHistoryService
1614
{
1715
public async Task<IEnumerable<BillingHistoryInfo.BillingInvoice>> GetInvoiceHistoryAsync(
1816
ISubscriber subscriber,

src/Core/Core.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
<PropertyGroup>
44
<GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
55
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
6-
<!-- Temp exclusions until warnings are fixed -->
7-
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS1574;CS9113</WarningsNotAsErrors>
86
</PropertyGroup>
97

108
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

test/Core.Test/Billing/Services/PaymentHistoryServiceTests.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Bit.Core.Models.BitStripe;
55
using Bit.Core.Repositories;
66
using Bit.Core.Services;
7-
using Microsoft.Extensions.Logging;
87
using NSubstitute;
98
using Stripe;
109
using Xunit;
@@ -22,8 +21,7 @@ public async Task GetInvoiceHistoryAsync_Succeeds()
2221
var stripeAdapter = Substitute.For<IStripeAdapter>();
2322
stripeAdapter.InvoiceListAsync(Arg.Any<StripeInvoiceListOptions>()).Returns(invoices);
2423
var transactionRepository = Substitute.For<ITransactionRepository>();
25-
var logger = Substitute.For<ILogger<PaymentHistoryService>>();
26-
var paymentHistoryService = new PaymentHistoryService(stripeAdapter, transactionRepository, logger);
24+
var paymentHistoryService = new PaymentHistoryService(stripeAdapter, transactionRepository);
2725

2826
// Act
2927
var result = await paymentHistoryService.GetInvoiceHistoryAsync(subscriber);
@@ -40,8 +38,7 @@ public async Task GetInvoiceHistoryAsync_SubscriberNull_ReturnsNull()
4038
// Arrange
4139
var paymentHistoryService = new PaymentHistoryService(
4240
Substitute.For<IStripeAdapter>(),
43-
Substitute.For<ITransactionRepository>(),
44-
Substitute.For<ILogger<PaymentHistoryService>>());
41+
Substitute.For<ITransactionRepository>());
4542

4643
// Act
4744
var result = await paymentHistoryService.GetInvoiceHistoryAsync(null);
@@ -59,8 +56,7 @@ public async Task GetTransactionHistoryAsync_Succeeds()
5956
var transactionRepository = Substitute.For<ITransactionRepository>();
6057
transactionRepository.GetManyByOrganizationIdAsync(subscriber.Id, Arg.Any<int>(), Arg.Any<DateTime?>()).Returns(transactions);
6158
var stripeAdapter = Substitute.For<IStripeAdapter>();
62-
var logger = Substitute.For<ILogger<PaymentHistoryService>>();
63-
var paymentHistoryService = new PaymentHistoryService(stripeAdapter, transactionRepository, logger);
59+
var paymentHistoryService = new PaymentHistoryService(stripeAdapter, transactionRepository);
6460

6561
// Act
6662
var result = await paymentHistoryService.GetTransactionHistoryAsync(subscriber);
@@ -77,8 +73,7 @@ public async Task GetTransactionHistoryAsync_SubscriberNull_ReturnsNull()
7773
// Arrange
7874
var paymentHistoryService = new PaymentHistoryService(
7975
Substitute.For<IStripeAdapter>(),
80-
Substitute.For<ITransactionRepository>(),
81-
Substitute.For<ILogger<PaymentHistoryService>>());
76+
Substitute.For<ITransactionRepository>());
8277

8378
// Act
8479
var result = await paymentHistoryService.GetTransactionHistoryAsync(null);

0 commit comments

Comments
 (0)