Exemple #1
0
        async Task CallWebHook(CriarPaymentCommand request)
        {
            var result = await _webHook.CallPostMethod(new WebHookMethodRequestDto
            {
                PayId           = request.PayId,
                CreatedAt       = request.CreatedAt,
                Name            = request.Name,
                Bandeira        = request.Bandeira,
                NumeroCartao    = request.NumeroCartao,
                Vencimento      = request.Vencimento,
                CodigoSeguranca = request.CodigoSeguranca,
                Valor           = (decimal)request.Valor,
                Status          = request.Status
            });

            if (result.StatusCode != HttpStatusCode.OK)
            {
                request.AddNotification("", result.ContentResult);
                _response.AddNotifications(request.Notifications);
            }
        }
        //async Task CallWebHook(CriarPaymentCommand request)
        //{
        //    var result = await _webHook.CallPostMethod(new WebHookMethodRequestDto
        //    {
        //        PayId = request.PayId,
        //        CreatedAt = request.CreatedAt,
        //        Name = request.Name,
        //        Bandeira = request.Bandeira,
        //        NumeroCartao = request.NumeroCartao,
        //        Vencimento = request.Vencimento,
        //        CodigoSeguranca = request.CodigoSeguranca,
        //        Valor = (decimal)request.Valor,
        //        Status = request.Status
        //    });
        //    if (result.StatusCode != HttpStatusCode.OK)
        //    {
        //        request.AddNotification("", result.ContentResult);
        //        _response.AddNotifications(request.Notifications);
        //    }
        //}

        async Task CallKafkaProducer(CriarPaymentCommand request)
        {
            var result = await _kafkaProducer.RealizarPagamento(new MethodRequestDto
            {
                PayId           = request.PayId,
                CreatedAt       = request.CreatedAt,
                Name            = request.Name,
                Bandeira        = request.Bandeira,
                NumeroCartao    = request.NumeroCartao,
                Vencimento      = request.Vencimento,
                CodigoSeguranca = request.CodigoSeguranca,
                Valor           = (decimal)request.Valor,
                Status          = request.Status
            });

            if (result.Status == Confluent.Kafka.PersistenceStatus.NotPersisted)
            {
                request.AddNotification("", result.Message.Value);
                _response.AddNotifications(request.Notifications);
            }
        }
Exemple #3
0
        async Task SendPayToKafka(CriarPaymentCommand request)
        {
            var requestPaymentDto = new RequestPaymentDto
            {
                PayId           = request.PayId,
                CreatedAt       = request.CreatedAt,
                Name            = request.Name,
                Bandeira        = request.Bandeira,
                NumeroCartao    = request.NumeroCartao,
                Vencimento      = request.Vencimento,
                CodigoSeguranca = request.CodigoSeguranca,
                Valor           = (decimal)request.Valor,
                Status          = request.Status
            };
            var result = await _sendPayToKafka.SendPay(requestPaymentDto);

            if (result.Status == Confluent.Kafka.PersistenceStatus.NotPersisted)
            {
                request.AddNotification("", result.Message.Value);
                _response.AddNotifications(request.Notifications);
            }
        }