mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
Replace StripePaymentService with PremiumUserBillingService in ReplacePaymentMethodAsync call (#5350)
This commit is contained in:
@ -9,6 +9,7 @@ using Bit.Core.AdminConsole.Services;
|
||||
using Bit.Core.Auth.Enums;
|
||||
using Bit.Core.Auth.Models;
|
||||
using Bit.Core.Auth.Models.Business.Tokenables;
|
||||
using Bit.Core.Billing.Models;
|
||||
using Bit.Core.Billing.Models.Sales;
|
||||
using Bit.Core.Billing.Services;
|
||||
using Bit.Core.Context;
|
||||
@ -1044,11 +1045,11 @@ public class UserService : UserManager<User>, IUserService, IDisposable
|
||||
throw new BadRequestException("Invalid token.");
|
||||
}
|
||||
|
||||
var updated = await _paymentService.UpdatePaymentMethodAsync(user, paymentMethodType, paymentToken, taxInfo: taxInfo);
|
||||
if (updated)
|
||||
{
|
||||
await SaveUserAsync(user);
|
||||
}
|
||||
var tokenizedPaymentSource = new TokenizedPaymentSource(paymentMethodType, paymentToken);
|
||||
var taxInformation = TaxInformation.From(taxInfo);
|
||||
|
||||
await _premiumUserBillingService.UpdatePaymentMethod(user, tokenizedPaymentSource, taxInformation);
|
||||
await SaveUserAsync(user);
|
||||
}
|
||||
|
||||
public async Task CancelPremiumAsync(User user, bool? endOfPeriod = null)
|
||||
|
Reference in New Issue
Block a user