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

refactor for addtnl. payment service (braintree)

This commit is contained in:
Kyle Spearrin
2017-07-28 12:09:12 -04:00
parent 2dc9c196c4
commit 082b53e133
14 changed files with 928 additions and 351 deletions

View File

@ -11,6 +11,7 @@ using Bit.Core.Enums;
using System.Linq;
using Bit.Core.Repositories;
using Bit.Core.Utilities;
using Bit.Core;
namespace Bit.Api.Controllers
{
@ -22,17 +23,20 @@ namespace Bit.Api.Controllers
private readonly ICipherService _cipherService;
private readonly IOrganizationUserRepository _organizationUserRepository;
private readonly UserManager<User> _userManager;
private readonly GlobalSettings _globalSettings;
public AccountsController(
IUserService userService,
ICipherService cipherService,
IOrganizationUserRepository organizationUserRepository,
UserManager<User> userManager)
UserManager<User> userManager,
GlobalSettings globalSettings)
{
_userService = userService;
_cipherService = cipherService;
_organizationUserRepository = organizationUserRepository;
_userManager = userManager;
_globalSettings = globalSettings;
}
[HttpPost("register")]
@ -363,7 +367,8 @@ namespace Bit.Api.Controllers
throw new UnauthorizedAccessException();
}
var billingInfo = await BillingHelpers.GetBillingAsync(user);
var paymentService = user.GetPaymentService(_globalSettings);
var billingInfo = await paymentService.GetBillingAsync(user);
if(billingInfo == null)
{
throw new NotFoundException();