1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-11 12:53:50 -05:00

Consistency on TaxInfo use in service params

This commit is contained in:
Chad Scharf
2020-06-18 10:41:55 -04:00
parent 1b027cab59
commit 0f28ac45f9
5 changed files with 46 additions and 35 deletions

View File

@ -704,7 +704,7 @@ namespace Bit.Core.Services
public async Task<Tuple<bool, string>> SignUpPremiumAsync(User user, string paymentToken,
PaymentMethodType paymentMethodType, short additionalStorageGb, UserLicense license,
string country, string postalCode)
TaxInfo taxInfo)
{
if (user.Premium)
{
@ -743,7 +743,7 @@ namespace Bit.Core.Services
else
{
paymentIntentClientSecret = await _paymentService.PurchasePremiumAsync(user, paymentMethodType,
paymentToken, additionalStorageGb, country, postalCode);
paymentToken, additionalStorageGb, taxInfo);
}
user.Premium = true;
@ -845,14 +845,14 @@ namespace Bit.Core.Services
return secret;
}
public async Task ReplacePaymentMethodAsync(User user, string paymentToken, PaymentMethodType paymentMethodType)
public async Task ReplacePaymentMethodAsync(User user, string paymentToken, PaymentMethodType paymentMethodType, TaxInfo taxInfo)
{
if (paymentToken.StartsWith("btok_"))
{
throw new BadRequestException("Invalid token.");
}
var updated = await _paymentService.UpdatePaymentMethodAsync(user, paymentMethodType, paymentToken);
var updated = await _paymentService.UpdatePaymentMethodAsync(user, paymentMethodType, paymentToken, taxInfo: taxInfo);
if (updated)
{
await SaveUserAsync(user);