mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
payment intent/method support for incomplete status
This commit is contained in:
@ -443,7 +443,7 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("premium")]
|
||||
public async Task<ProfileResponseModel> PostPremium(PremiumRequestModel model)
|
||||
public async Task<PaymentResponseModel> PostPremium(PremiumRequestModel model)
|
||||
{
|
||||
var user = await _userService.GetUserByPrincipalAsync(User);
|
||||
if(user == null)
|
||||
@ -463,9 +463,15 @@ namespace Bit.Api.Controllers
|
||||
throw new BadRequestException("Invalid license.");
|
||||
}
|
||||
|
||||
await _userService.SignUpPremiumAsync(user, model.PaymentToken, model.PaymentMethodType.Value,
|
||||
model.AdditionalStorageGb.GetValueOrDefault(0), license);
|
||||
return new ProfileResponseModel(user, null, await _userService.TwoFactorIsEnabledAsync(user));
|
||||
var result = await _userService.SignUpPremiumAsync(user, model.PaymentToken,
|
||||
model.PaymentMethodType.Value, model.AdditionalStorageGb.GetValueOrDefault(0), license);
|
||||
var profile = new ProfileResponseModel(user, null, await _userService.TwoFactorIsEnabledAsync(user));
|
||||
return new PaymentResponseModel
|
||||
{
|
||||
UserProfile = profile,
|
||||
PaymentIntentClientSecret = result.Item2,
|
||||
Success = result.Item1
|
||||
};
|
||||
}
|
||||
|
||||
[HttpGet("billing")]
|
||||
|
@ -215,7 +215,7 @@ namespace Bit.Api.Controllers
|
||||
|
||||
[HttpPost("{id}/upgrade")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task PostUpgrade(string id, [FromBody]OrganizationUpgradeRequestModel model)
|
||||
public async Task<PaymentResponseModel> PostUpgrade(string id, [FromBody]OrganizationUpgradeRequestModel model)
|
||||
{
|
||||
var orgIdGuid = new Guid(id);
|
||||
if(!_currentContext.OrganizationOwner(orgIdGuid))
|
||||
@ -223,7 +223,12 @@ namespace Bit.Api.Controllers
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
await _organizationService.UpgradePlanAsync(orgIdGuid, model.ToOrganizationUpgrade());
|
||||
var result = await _organizationService.UpgradePlanAsync(orgIdGuid, model.ToOrganizationUpgrade());
|
||||
return new PaymentResponseModel
|
||||
{
|
||||
Success = result.Item1,
|
||||
PaymentIntentClientSecret = result.Item2
|
||||
};
|
||||
}
|
||||
|
||||
[HttpPost("{id}/seat")]
|
||||
|
Reference in New Issue
Block a user