예제 #1
0
        public void ShouldReturnErrorWhenCreditCardNumberIsInvalid()
        {
            var command = new CreateCreditCardPaymentCommand();

            command.CardNumber = "12346546";
            command.ValidDate  = DateTime.Now.AddDays(1);

            command.Valdiate().IsValid.Should().Be(false);
        }
예제 #2
0
        public void ShouldReturnSuccessWhenCreditCardNumberIsValid()
        {
            // Para gerar o cartão foi usado https://ccardgenerator.com/generat-visa-card-numbers.php

            var command = new CreateCreditCardPaymentCommand();

            command.CardNumber = "4526923734292204";
            command.ValidDate  = DateTime.Now.AddDays(1);

            command.Valdiate().IsValid.Should().Be(true);
        }
        public async Task <IActionResult> Payment([FromBody] CreateCreditCardPaymentCommand payment)
        {
            var commandResult = await _mediator.Send(payment);

            return(TransactionResponse(commandResult));
        }