1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

org update billing

This commit is contained in:
Kyle Spearrin
2017-04-10 19:07:38 -04:00
parent ea6178594c
commit 2b97e4c847
3 changed files with 22 additions and 1 deletions

View File

@ -621,6 +621,26 @@ namespace Bit.Core.Services
}
}
public async Task UpdateAsync(Organization organization, bool updateBilling = false)
{
if(organization.Id == default(Guid))
{
throw new ApplicationException("Cannot create org this way. Call SignUpAsync.");
}
await _organizationRepository.ReplaceAsync(organization);
if(updateBilling && !string.IsNullOrWhiteSpace(organization.StripeCustomerId))
{
var customerService = new StripeCustomerService();
await customerService.UpdateAsync(organization.StripeCustomerId, new StripeCustomerUpdateOptions
{
Email = organization.BillingEmail,
Description = organization.BusinessName
});
}
}
public async Task<OrganizationUser> InviteUserAsync(Guid organizationId, Guid invitingUserId, string email,
Enums.OrganizationUserType type, IEnumerable<SubvaultUser> subvaults)
{