mirror of
https://github.com/bitwarden/server.git
synced 2024-12-30 18:17:36 +01:00
org update billing
This commit is contained in:
parent
ea6178594c
commit
2b97e4c847
@ -111,7 +111,7 @@ namespace Bit.Api.Controllers
|
|||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
await _organizationRepository.ReplaceAsync(model.ToOrganization(organization));
|
await _organizationService.UpdateAsync(model.ToOrganization(organization), true);
|
||||||
return new OrganizationResponseModel(organization);
|
return new OrganizationResponseModel(organization);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ namespace Bit.Core.Services
|
|||||||
Task UpgradePlanAsync(Guid organizationId, PlanType plan, int additionalSeats);
|
Task UpgradePlanAsync(Guid organizationId, PlanType plan, int additionalSeats);
|
||||||
Task AdjustSeatsAsync(Guid organizationId, int seatAdjustment);
|
Task AdjustSeatsAsync(Guid organizationId, int seatAdjustment);
|
||||||
Task<Tuple<Organization, OrganizationUser>> SignUpAsync(OrganizationSignup organizationSignup);
|
Task<Tuple<Organization, OrganizationUser>> SignUpAsync(OrganizationSignup organizationSignup);
|
||||||
|
Task UpdateAsync(Organization organization, bool updateBilling = false);
|
||||||
Task<OrganizationUser> InviteUserAsync(Guid organizationId, Guid invitingUserId, string email,
|
Task<OrganizationUser> InviteUserAsync(Guid organizationId, Guid invitingUserId, string email,
|
||||||
Enums.OrganizationUserType type, IEnumerable<SubvaultUser> subvaults);
|
Enums.OrganizationUserType type, IEnumerable<SubvaultUser> subvaults);
|
||||||
Task ResendInviteAsync(Guid organizationId, Guid invitingUserId, Guid organizationUserId);
|
Task ResendInviteAsync(Guid organizationId, Guid invitingUserId, Guid organizationUserId);
|
||||||
|
@ -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,
|
public async Task<OrganizationUser> InviteUserAsync(Guid organizationId, Guid invitingUserId, string email,
|
||||||
Enums.OrganizationUserType type, IEnumerable<SubvaultUser> subvaults)
|
Enums.OrganizationUserType type, IEnumerable<SubvaultUser> subvaults)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user