/// <summary>
 /// Add new address to the specific blockchain type black list
 /// </summary>
 /// <param name="blackListModel"></param>
 /// <returns></returns>
 /// <exception cref="Exception">Is thrown on wrong usage of service.</exception>
 public async Task AddToBlackListAsync(AddBlackListModel blackListModel)
 {
     await ExecuteActionAsync(async() =>
     {
         await _service.CreateBlackListAsync(blackListModel);
     });
 }
예제 #2
0
        public async Task CheckBlackListPositiveRestFlow_AllOperationsWorkAsExpected()
        {
            var    blockchainCashoutPreconditionsCheckClient = GenerateBlockchainWalletsClient();
            string blockedAddress = "GA4FSFQNHZ5A7VVRDC3UKLUVHX7BAZGRZ432XOAFVQJMYULPKKPPE7PY";
            var    newBlackList   = new AddBlackListModel()
            {
                BlockchainType  = _stellarBlockchainType,
                BlockedAddress  = blockedAddress,
                IsCaseSensitive = false
            };

            await blockchainCashoutPreconditionsCheckClient.AddToBlackListAsync(newBlackList);

            var blackList = await blockchainCashoutPreconditionsCheckClient.GetBlackListAsync(_stellarBlockchainType, blockedAddress);

            var allEtcBlackLists = await blockchainCashoutPreconditionsCheckClient.GetAllBlackListsAsync(_stellarBlockchainType, 500, null);

            await blockchainCashoutPreconditionsCheckClient.DeleteBlackListAsync(_stellarBlockchainType, blockedAddress);

            var blackListAfterDeletion = await blockchainCashoutPreconditionsCheckClient.GetBlackListAsync(_stellarBlockchainType, blockedAddress);

            var allEtcBlackListsAfterDeletion = await blockchainCashoutPreconditionsCheckClient.GetAllBlackListsAsync(_stellarBlockchainType, 500, null);

            Assert.True(blackList != null);
            Assert.True(allEtcBlackLists.List.FirstOrDefault(x => x.BlockedAddress == blockedAddress) != null);
            Assert.True(blackListAfterDeletion == null);
            Assert.True(allEtcBlackListsAfterDeletion.List.FirstOrDefault(x => x.BlockedAddress == blockedAddress) == null);
        }
        public async Task <IActionResult> UpdateBlockedAddressAsync([FromBody] AddBlackListModel request)
        {
            string blockedAddress = Trim(request.BlockedAddress);

            BlackListModel model = new BlackListModel(request.BlockchainType, blockedAddress, request.IsCaseSensitive);

            await _blackListService.SaveAsync(model);

            return(Ok());
        }
예제 #4
0
        public async Task AddToBlackListAsync_NotValidParameters_ExcetionThrow()
        {
            var    blockchainCashoutPreconditionsCheckClient = GenerateBlockchainWalletsClient();
            string blockedAddress = "";
            var    newBlackList   = new AddBlackListModel()
            {
                BlockchainType  = _etcBlockchainType,
                BlockedAddress  = blockedAddress,
                IsCaseSensitive = false
            };

            await Assert.ThrowsAsync <BlockchainCashoutPreconditionsCheck.Client.Exceptions.ErrorResponseException>(async() =>
            {
                await blockchainCashoutPreconditionsCheckClient.AddToBlackListAsync(newBlackList);
            });
        }