Exemplo n.º 1
0
        public async Task <IActionResult> SetExpired([FromBody] BlockchainWalletExpiredRequest request)
        {
            bool isValid = await _blockchainAddressValidator.Execute(request.WalletAddress, request.Blockchain);

            if (!isValid)
            {
                return(BadRequest(ErrorResponse.Create("Wallet address is not valid")));
            }

            try
            {
                bool released = await _bcnWalletUsageService.ReleaseAsync(request.WalletAddress, request.Blockchain);

                if (released)
                {
                    return(Ok());
                }

                return(BadRequest(ErrorResponse.Create("Couldn't set wallet as expired")));
            }
            catch (Exception ex)
            {
                await _log.WriteErrorAsync(nameof(WalletsController), nameof(SetExpired), request.ToJson(), ex);

                throw;
            }
        }
        public async Task <IActionResult> SetExpired([FromBody] BlockchainWalletExpiredRequest request)
        {
            bool isValid;

            try
            {
                isValid = await _blockchainAddressValidator.Execute(request.WalletAddress, request.Blockchain);
            }
            catch (BlockchainTypeNotSupported)
            {
                isValid = true;
            }

            if (!isValid)
            {
                return(BadRequest(ErrorResponse.Create("Wallet address is not valid")));
            }

            bool released = await _bcnWalletUsageService.ReleaseAsync(request.WalletAddress, request.Blockchain);

            if (released)
            {
                return(Ok());
            }

            return(BadRequest(ErrorResponse.Create("Couldn't set wallet as expired")));
        }
Exemplo n.º 3
0
 public Task SetWalletExpiredAsync(BlockchainWalletExpiredRequest request)
 {
     return(_runner.RunWithDefaultErrorHandlingAsync(() => _payInternalApi.SetWalletExpiredAsync(request)));
 }