1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

add billing info to admin edit page

This commit is contained in:
Kyle Spearrin
2019-02-25 10:39:04 -05:00
parent b229985256
commit 7ee8c0a240
9 changed files with 106 additions and 6 deletions

View File

@ -8,6 +8,7 @@ using System.Collections.Generic;
using Bit.Core.Models.Table;
using Bit.Core;
using Bit.Core.Utilities;
using Bit.Core.Services;
namespace Bit.Admin.Controllers
{
@ -16,15 +17,18 @@ namespace Bit.Admin.Controllers
{
private readonly IOrganizationRepository _organizationRepository;
private readonly IOrganizationUserRepository _organizationUserRepository;
private readonly IPaymentService _paymentService;
private readonly GlobalSettings _globalSettings;
public OrganizationsController(
IOrganizationRepository organizationRepository,
IOrganizationUserRepository organizationUserRepository,
IPaymentService paymentService,
GlobalSettings globalSettings)
{
_organizationRepository = organizationRepository;
_organizationUserRepository = organizationUserRepository;
_paymentService = paymentService;
_globalSettings = globalSettings;
}
@ -78,7 +82,8 @@ namespace Bit.Admin.Controllers
}
var users = await _organizationUserRepository.GetManyDetailsByOrganizationAsync(id);
return View(new OrganizationEditModel(organization, users, _globalSettings));
var billingInfo = await _paymentService.GetBillingAsync(organization);
return View(new OrganizationEditModel(organization, users, billingInfo, _globalSettings));
}
[HttpPost]

View File

@ -8,6 +8,7 @@ using System.Collections.Generic;
using Bit.Core.Models.Table;
using Bit.Core;
using Bit.Core.Utilities;
using Bit.Core.Services;
namespace Bit.Admin.Controllers
{
@ -16,15 +17,18 @@ namespace Bit.Admin.Controllers
{
private readonly IUserRepository _userRepository;
private readonly ICipherRepository _cipherRepository;
private readonly IPaymentService _paymentService;
private readonly GlobalSettings _globalSettings;
public UsersController(
IUserRepository userRepository,
ICipherRepository cipherRepository,
IPaymentService paymentService,
GlobalSettings globalSettings)
{
_userRepository = userRepository;
_cipherRepository = cipherRepository;
_paymentService = paymentService;
_globalSettings = globalSettings;
}
@ -74,7 +78,8 @@ namespace Bit.Admin.Controllers
}
var ciphers = await _cipherRepository.GetManyByUserIdAsync(id);
return View(new UserEditModel(user, ciphers, _globalSettings));
var billingInfo = await _paymentService.GetBillingAsync(user);
return View(new UserEditModel(user, ciphers, billingInfo, _globalSettings));
}
[HttpPost]