Exemple #1
0
        public async Task <ActionResult <CardControlDTO> > PostCardControl(CardControl cardControl)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            CardControlDTO returnCardinformation = await _cardControlsService.ProcessCustomerCard(_context, cardControl);

            return(CreatedAtAction(nameof(GetCardControl), new { id = cardControl.Id }, returnCardinformation));
        }
Exemple #2
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);
        }