mirror of
https://github.com/bitwarden/server.git
synced 2025-05-12 15:12:16 -05:00
[PM-18064] Resolve billing warnings (#5797)
* Resolve Billing warnings * Remove exclusions * Format
This commit is contained in:
parent
ead5bbdd2a
commit
0075a15485
@ -4,8 +4,6 @@
|
||||
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
|
||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||
<ANCMPreConfiguredForIIS>true</ANCMPreConfiguredForIIS>
|
||||
<!-- Temp exclusions until warnings are fixed -->
|
||||
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS8604</WarningsNotAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
@ -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);
|
||||
|
@ -59,7 +59,7 @@ public interface IProviderBillingService
|
||||
int seatAdjustment);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the provided <paramref name="seatAdjustment"/> will result in a purchase for the <paramref name="provider"/>'s <see cref="planType"/>.
|
||||
/// Determines whether the provided <paramref name="seatAdjustment"/> will result in a purchase for the <paramref name="provider"/>'s <see cref="PlanType"/>.
|
||||
/// Seat adjustments that result in purchases include:
|
||||
/// <list type="bullet">
|
||||
/// <item>The <paramref name="provider"/> going from below the seat minimum to above the seat minimum for the provided <paramref name="planType"/></item>
|
||||
|
@ -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<PaymentHistoryService> logger) : IPaymentHistoryService
|
||||
ITransactionRepository transactionRepository) : IPaymentHistoryService
|
||||
{
|
||||
public async Task<IEnumerable<BillingHistoryInfo.BillingInvoice>> GetInvoiceHistoryAsync(
|
||||
ISubscriber subscriber,
|
||||
|
@ -3,8 +3,6 @@
|
||||
<PropertyGroup>
|
||||
<GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
|
||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||
<!-- Temp exclusions until warnings are fixed -->
|
||||
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS1574;CS9113</WarningsNotAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
@ -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<IStripeAdapter>();
|
||||
stripeAdapter.InvoiceListAsync(Arg.Any<StripeInvoiceListOptions>()).Returns(invoices);
|
||||
var transactionRepository = Substitute.For<ITransactionRepository>();
|
||||
var logger = Substitute.For<ILogger<PaymentHistoryService>>();
|
||||
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<IStripeAdapter>(),
|
||||
Substitute.For<ITransactionRepository>(),
|
||||
Substitute.For<ILogger<PaymentHistoryService>>());
|
||||
Substitute.For<ITransactionRepository>());
|
||||
|
||||
// Act
|
||||
var result = await paymentHistoryService.GetInvoiceHistoryAsync(null);
|
||||
@ -59,8 +56,7 @@ public class PaymentHistoryServiceTests
|
||||
var transactionRepository = Substitute.For<ITransactionRepository>();
|
||||
transactionRepository.GetManyByOrganizationIdAsync(subscriber.Id, Arg.Any<int>(), Arg.Any<DateTime?>()).Returns(transactions);
|
||||
var stripeAdapter = Substitute.For<IStripeAdapter>();
|
||||
var logger = Substitute.For<ILogger<PaymentHistoryService>>();
|
||||
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<IStripeAdapter>(),
|
||||
Substitute.For<ITransactionRepository>(),
|
||||
Substitute.For<ILogger<PaymentHistoryService>>());
|
||||
Substitute.For<ITransactionRepository>());
|
||||
|
||||
// Act
|
||||
var result = await paymentHistoryService.GetTransactionHistoryAsync(null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user