1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 00:52:49 -05:00

combined tax updates with other operations

This commit is contained in:
Chad Scharf
2020-06-17 19:49:27 -04:00
parent f7e5f1f15e
commit b7a500eb63
10 changed files with 66 additions and 14 deletions

View File

@ -345,7 +345,7 @@ namespace Bit.Core.Services
}
public async Task<string> PurchasePremiumAsync(User user, PaymentMethodType paymentMethodType,
string paymentToken, short additionalStorageGb)
string paymentToken, short additionalStorageGb, string country, string postalCode)
{
if (paymentMethodType != PaymentMethodType.Credit && string.IsNullOrWhiteSpace(paymentToken))
{
@ -463,10 +463,28 @@ namespace Bit.Core.Services
InvoiceSettings = new CustomerInvoiceSettingsOptions
{
DefaultPaymentMethod = stipeCustomerPaymentMethodId
}
},
Address = new AddressOptions
{
Line1 = string.Empty,
Country = country,
PostalCode = postalCode,
},
});
createdStripeCustomer = true;
}
else if (customer != null)
{
await customerService.UpdateAsync(customer.Id, new CustomerUpdateOptions
{
Address = new AddressOptions
{
Line1 = string.Empty,
Country = country,
PostalCode = postalCode,
}
});
}
if (customer == null)
{