mirror of
https://github.com/bitwarden/server.git
synced 2024-12-01 13:43:23 +01:00
06910175e2
* Replace SubscriberQueries with SubscriberService * Replace OrganizationBillingQueries with OrganizationBillingService * Replace ProviderBillingQueries with ProviderBillingService, move to Commercial * Replace AssignSeatsToClientOrganizationCommand with ProviderBillingService, move to commercial * Replace ScaleSeatsCommand with ProviderBillingService and move to Commercial * Replace CancelSubscriptionCommand with SubscriberService * Replace CreateCustomerCommand with ProviderBillingService and move to Commercial * Replace StartSubscriptionCommand with ProviderBillingService and moved to Commercial * Replaced RemovePaymentMethodCommand with SubscriberService * Formatting * Used dotnet format this time * Changing ProviderBillingService to scoped * Found circular dependency' * One more time with feeling * Formatting * Fix error in remove org from provider * Missed test fix in conflit * [AC-1937] Server: Implement endpoint to retrieve provider payment information (#4107) * Move the gettax and paymentmethod from stripepayment class Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Add the method to retrieve the tax and payment details Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Add unit tests for the paymentInformation method Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Add the endpoint to retrieve paymentinformation Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Add unit tests to the SubscriberService Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Remove the getTaxInfoAsync update reference Signed-off-by: Cy Okeke <cokeke@bitwarden.com> --------- Signed-off-by: Cy Okeke <cokeke@bitwarden.com> --------- Signed-off-by: Cy Okeke <cokeke@bitwarden.com> Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com>
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using Bit.Api.Billing.Controllers;
|
|
using Bit.Api.Billing.Models.Responses;
|
|
using Bit.Core.Billing.Models;
|
|
using Bit.Core.Billing.Services;
|
|
using Bit.Test.Common.AutoFixture;
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|
using Microsoft.AspNetCore.Http.HttpResults;
|
|
using NSubstitute;
|
|
using Xunit;
|
|
|
|
namespace Bit.Api.Test.Billing.Controllers;
|
|
|
|
[ControllerCustomize(typeof(OrganizationBillingController))]
|
|
[SutProviderCustomize]
|
|
public class OrganizationBillingControllerTests
|
|
{
|
|
[Theory, BitAutoData]
|
|
public async Task GetMetadataAsync_MetadataNull_NotFound(
|
|
Guid organizationId,
|
|
SutProvider<OrganizationBillingController> sutProvider)
|
|
{
|
|
var result = await sutProvider.Sut.GetMetadataAsync(organizationId);
|
|
|
|
Assert.IsType<NotFound>(result);
|
|
}
|
|
|
|
[Theory, BitAutoData]
|
|
public async Task GetMetadataAsync_OK(
|
|
Guid organizationId,
|
|
SutProvider<OrganizationBillingController> sutProvider)
|
|
{
|
|
sutProvider.GetDependency<IOrganizationBillingService>().GetMetadata(organizationId)
|
|
.Returns(new OrganizationMetadataDTO(true));
|
|
|
|
var result = await sutProvider.Sut.GetMetadataAsync(organizationId);
|
|
|
|
Assert.IsType<Ok<OrganizationMetadataResponse>>(result);
|
|
|
|
var organizationMetadataResponse = ((Ok<OrganizationMetadataResponse>)result).Value;
|
|
|
|
Assert.True(organizationMetadataResponse.IsOnSecretsManagerStandalone);
|
|
}
|
|
}
|