mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
adjust storage with payment intent/method handling
This commit is contained in:
@ -529,7 +529,7 @@ namespace Bit.Api.Controllers
|
||||
|
||||
[HttpPost("storage")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task PostStorage([FromBody]StorageRequestModel model)
|
||||
public async Task<PaymentResponseModel> PostStorage([FromBody]StorageRequestModel model)
|
||||
{
|
||||
var user = await _userService.GetUserByPrincipalAsync(User);
|
||||
if(user == null)
|
||||
@ -537,7 +537,12 @@ namespace Bit.Api.Controllers
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
await _userService.AdjustStorageAsync(user, model.StorageGbAdjustment.Value);
|
||||
var result = await _userService.AdjustStorageAsync(user, model.StorageGbAdjustment.Value);
|
||||
return new PaymentResponseModel
|
||||
{
|
||||
Success = true,
|
||||
PaymentIntentClientSecret = result
|
||||
};
|
||||
}
|
||||
|
||||
[HttpPost("license")]
|
||||
|
@ -246,7 +246,7 @@ namespace Bit.Api.Controllers
|
||||
|
||||
[HttpPost("{id}/storage")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task PostStorage(string id, [FromBody]StorageRequestModel model)
|
||||
public async Task<PaymentResponseModel> PostStorage(string id, [FromBody]StorageRequestModel model)
|
||||
{
|
||||
var orgIdGuid = new Guid(id);
|
||||
if(!_currentContext.OrganizationOwner(orgIdGuid))
|
||||
@ -254,7 +254,12 @@ namespace Bit.Api.Controllers
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
await _organizationService.AdjustStorageAsync(orgIdGuid, model.StorageGbAdjustment.Value);
|
||||
var result = await _organizationService.AdjustStorageAsync(orgIdGuid, model.StorageGbAdjustment.Value);
|
||||
return new PaymentResponseModel
|
||||
{
|
||||
Success = true,
|
||||
PaymentIntentClientSecret = result
|
||||
};
|
||||
}
|
||||
|
||||
[HttpPost("{id}/verify-bank")]
|
||||
|
Reference in New Issue
Block a user