示例#1
0
        public async Task <PaymentResponseModel> PostStorage(string id, [FromBody] StorageRequestModel model)
        {
            var orgIdGuid = new Guid(id);

            if (!await _currentContext.OrganizationOwner(orgIdGuid))
            {
                throw new NotFoundException();
            }

            var result = await _organizationService.AdjustStorageAsync(orgIdGuid, model.StorageGbAdjustment.Value);

            return(new PaymentResponseModel
            {
                Success = true,
                PaymentIntentClientSecret = result
            });
        }
        public async Task <PaymentResponseModel> PostStorage([FromBody] StorageRequestModel model)
        {
            var user = await _userService.GetUserByPrincipalAsync(User);

            if (user == null)
            {
                throw new UnauthorizedAccessException();
            }

            var result = await _userService.AdjustStorageAsync(user, model.StorageGbAdjustment.Value);

            return(new PaymentResponseModel
            {
                Success = true,
                PaymentIntentClientSecret = result
            });
        }