Ejemplo n.º 1
0
        private CardControlDTO ReturnCardInformation(CardControl cardControl)
        {
            var lastFourDigitsArray   = _operationsService.GetLastFourDigitsFromCard(cardControl.Cardnumber);
            var returnCardinformation = new CardControlDTO
            {
                Id = cardControl.Id,
                RegistrationDate = cardControl.RegistrationDate,
                Token            = _tokenService.GenerateToken(lastFourDigitsArray, cardControl.CVV)
            };

            return(returnCardinformation);
        }
Ejemplo n.º 2
0
        public Task <bool> ValidateToken(TokenControlContext _context, TokenRequest tokenRequest)
        {
            var cardSavedInDataBase = _dataBaseSearchService.GetCardByIds(_context, tokenRequest);

            if (cardSavedInDataBase == null || !ValidateThirtyMinutesRule(cardSavedInDataBase))
            {
                return(Task.FromResult(false));
            }
            var  lastFourDigitsArray = _operationsService.GetLastFourDigitsFromCard(cardSavedInDataBase.Cardnumber);
            bool result = tokenRequest.Token == GenerateToken(lastFourDigitsArray, tokenRequest.CVV);

            return(Task.FromResult(result));
        }