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

PaymentResponseModel for storage and seat adjustments

This commit is contained in:
Kyle Spearrin
2019-08-12 10:03:50 -04:00
parent 74bbeae776
commit 157cafa551
3 changed files with 12 additions and 4 deletions

View File

@ -15,7 +15,7 @@ namespace Bit.Core.Services
Task ReinstateSubscriptionAsync(Guid organizationId);
Task<Tuple<bool, string>> UpgradePlanAsync(Guid organizationId, OrganizationUpgrade upgrade);
Task<string> AdjustStorageAsync(Guid organizationId, short storageAdjustmentGb);
Task AdjustSeatsAsync(Guid organizationId, int seatAdjustment);
Task<string> AdjustSeatsAsync(Guid organizationId, int seatAdjustment);
Task VerifyBankAsync(Guid organizationId, int amount1, int amount2);
Task<Tuple<Organization, OrganizationUser>> SignUpAsync(OrganizationSignup organizationSignup);
Task<Tuple<Organization, OrganizationUser>> SignUpAsync(OrganizationLicense license, User owner,

View File

@ -255,7 +255,7 @@ namespace Bit.Core.Services
return secret;
}
public async Task AdjustSeatsAsync(Guid organizationId, int seatAdjustment)
public async Task<string> AdjustSeatsAsync(Guid organizationId, int seatAdjustment)
{
var organization = await GetOrgById(organizationId);
if(organization == null)
@ -372,17 +372,20 @@ namespace Bit.Core.Services
subUpdateAction = (prorate) => subscriptionItemService.DeleteAsync(seatItem.Id);
}
string paymentIntentClientSecret = null;
var invoicedNow = false;
if(additionalSeats > 0)
{
var result = await (_paymentService as StripePaymentService).PreviewUpcomingInvoiceAndPayAsync(
organization, plan.StripeSeatPlanId, subItemOptions, 500);
invoicedNow = result.Item1;
paymentIntentClientSecret = result.Item2;
}
await subUpdateAction(!invoicedNow);
organization.Seats = (short?)newSeatTotal;
await ReplaceAndUpdateCache(organization);
return paymentIntentClientSecret;
}
public async Task VerifyBankAsync(Guid organizationId, int amount1, int amount2)