mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
inject stripepaymentservice
This commit is contained in:
@ -28,6 +28,7 @@ namespace Bit.Api.Controllers
|
||||
private readonly ICipherService _cipherService;
|
||||
private readonly IOrganizationUserRepository _organizationUserRepository;
|
||||
private readonly ILicensingService _licenseService;
|
||||
private readonly IPaymentService _paymentService;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
public AccountsController(
|
||||
@ -38,6 +39,7 @@ namespace Bit.Api.Controllers
|
||||
ICipherService cipherService,
|
||||
IOrganizationUserRepository organizationUserRepository,
|
||||
ILicensingService licenseService,
|
||||
IPaymentService paymentService,
|
||||
GlobalSettings globalSettings)
|
||||
{
|
||||
_userService = userService;
|
||||
@ -47,6 +49,7 @@ namespace Bit.Api.Controllers
|
||||
_cipherService = cipherService;
|
||||
_organizationUserRepository = organizationUserRepository;
|
||||
_licenseService = licenseService;
|
||||
_paymentService = paymentService;
|
||||
_globalSettings = globalSettings;
|
||||
}
|
||||
|
||||
@ -476,8 +479,7 @@ namespace Bit.Api.Controllers
|
||||
|
||||
if(!_globalSettings.SelfHosted && user.Gateway != null)
|
||||
{
|
||||
var paymentService = user.GetPaymentService(_globalSettings);
|
||||
var billingInfo = await paymentService.GetBillingAsync(user);
|
||||
var billingInfo = await _paymentService.GetBillingAsync(user);
|
||||
var license = await _userService.GenerateLicenseAsync(user, billingInfo);
|
||||
return new BillingResponseModel(user, billingInfo, license);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace Bit.Api.Controllers
|
||||
private readonly IOrganizationUserRepository _organizationUserRepository;
|
||||
private readonly IOrganizationService _organizationService;
|
||||
private readonly IUserService _userService;
|
||||
private readonly IPaymentService _paymentService;
|
||||
private readonly CurrentContext _currentContext;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
|
||||
@ -32,6 +33,7 @@ namespace Bit.Api.Controllers
|
||||
IOrganizationUserRepository organizationUserRepository,
|
||||
IOrganizationService organizationService,
|
||||
IUserService userService,
|
||||
IPaymentService paymentService,
|
||||
CurrentContext currentContext,
|
||||
GlobalSettings globalSettings)
|
||||
{
|
||||
@ -39,6 +41,7 @@ namespace Bit.Api.Controllers
|
||||
_organizationUserRepository = organizationUserRepository;
|
||||
_organizationService = organizationService;
|
||||
_userService = userService;
|
||||
_paymentService = paymentService;
|
||||
_currentContext = currentContext;
|
||||
_globalSettings = globalSettings;
|
||||
}
|
||||
@ -78,8 +81,7 @@ namespace Bit.Api.Controllers
|
||||
|
||||
if(!_globalSettings.SelfHosted && organization.Gateway != null)
|
||||
{
|
||||
var paymentService = new StripePaymentService(_globalSettings);
|
||||
var billingInfo = await paymentService.GetBillingAsync(organization);
|
||||
var billingInfo = await _paymentService.GetBillingAsync(organization);
|
||||
if(billingInfo == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
|
Reference in New Issue
Block a user