mirror of
https://github.com/bitwarden/server.git
synced 2025-02-17 02:01:53 +01:00
[AC-2548] Remove automatic tax collection check from provider creation (#4042)
* Remove automatic tax collection check * Fix tests
This commit is contained in:
parent
2a535ac835
commit
bcfaf55412
@ -45,13 +45,6 @@ public class StartSubscriptionCommand(
|
|||||||
|
|
||||||
var customer = await GetOrCreateCustomerAsync(provider, taxInfo);
|
var customer = await GetOrCreateCustomerAsync(provider, taxInfo);
|
||||||
|
|
||||||
if (taxInfo.BillingAddressCountry == "US" && customer.Tax is not { AutomaticTax: StripeConstants.AutomaticTaxStatus.Supported })
|
|
||||||
{
|
|
||||||
logger.LogError("Cannot start Provider subscription - Provider's ({ProviderID}) Stripe customer ({CustomerID}) is in the US and does not support automatic tax", provider.Id, customer.Id);
|
|
||||||
|
|
||||||
throw ContactSupport();
|
|
||||||
}
|
|
||||||
|
|
||||||
var providerPlans = await providerPlanRepository.GetByProviderId(provider.Id);
|
var providerPlans = await providerPlanRepository.GetByProviderId(provider.Id);
|
||||||
|
|
||||||
if (providerPlans == null || providerPlans.Count == 0)
|
if (providerPlans == null || providerPlans.Count == 0)
|
||||||
|
@ -105,32 +105,6 @@ public class StartSubscriptionCommandTests
|
|||||||
await DidNotRetrieveProviderPlansAsync(sutProvider);
|
await DidNotRetrieveProviderPlansAsync(sutProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory, BitAutoData]
|
|
||||||
public async Task StartSubscription_CustomerDoesNotSupportAutomaticTax_ThrowsBillingException(
|
|
||||||
SutProvider<StartSubscriptionCommand> sutProvider,
|
|
||||||
Provider provider,
|
|
||||||
TaxInfo taxInfo)
|
|
||||||
{
|
|
||||||
provider.GatewayCustomerId = _customerId;
|
|
||||||
|
|
||||||
provider.GatewaySubscriptionId = null;
|
|
||||||
|
|
||||||
taxInfo.BillingAddressCountry = "US";
|
|
||||||
|
|
||||||
SetCustomerRetrieval(sutProvider, new Customer
|
|
||||||
{
|
|
||||||
Id = _customerId,
|
|
||||||
Tax = new CustomerTax
|
|
||||||
{
|
|
||||||
AutomaticTax = StripeConstants.AutomaticTaxStatus.NotCollecting
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await ThrowsContactSupportAsync(() => sutProvider.Sut.StartSubscription(provider, taxInfo));
|
|
||||||
|
|
||||||
await DidNotRetrieveProviderPlansAsync(sutProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory, BitAutoData]
|
[Theory, BitAutoData]
|
||||||
public async Task StartSubscription_NoProviderPlans_ThrowsBillingException(
|
public async Task StartSubscription_NoProviderPlans_ThrowsBillingException(
|
||||||
SutProvider<StartSubscriptionCommand> sutProvider,
|
SutProvider<StartSubscriptionCommand> sutProvider,
|
||||||
|
Loading…
Reference in New Issue
Block a user