public async Task <PaymentResponse> SendPayment(PaymentRequest paymentRequest)
        {
            //TODO: validate paymentRequest against business rules
            var bankPaymentRequest = _bankPaymentMapper.MapRequest(paymentRequest);

            var bankPaymentResponse = await _bankApiClient.Process(bankPaymentRequest);

            var paymentResponse = _bankPaymentMapper.MapResponse(bankPaymentResponse);

            _applicationLogger.LogInformation($"Finished processing payment request: {bankPaymentResponse.PaymentReference}");
            return(paymentResponse);
        }
Ejemplo n.º 2
0
 public string Get()
 {
     _logger.LogInformation($"The payment database connection string : { _configuration.GetConnectionString("PaymentConnection") }", ("Process", "Payment"), ("Data", "123"));
     _logger.LogCritical($"The Elastic Search Endpoint : { _configuration["ElasticConfiguration:Uri"] }");
     _logger.LogCritical($"The Logstash Endpoint : { _configuration["LogstashConfiguration:Uri"] }");
     _logger.LogWarning($"The Current Environment : { Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") }");
     return("Payment Service Up ad running");
 }
 public string Get()
 {
     _logger.LogException("PAYMENT_FAILURE", new Exception("Payment failed on purpose for logging test"), ("Process", "Payment"), ("Data", "456"));
     _logger.LogInformation("PAYMENT_DB", $"The payment database connection string : { _configuration.GetConnectionString("PaymentConnection") }", ("Process", "Payment"), ("Data", "123"));
     _logger.LogCritical("PAYMENT_ES", $"The Elastic Search Endpoint : { _configuration["ElasticConfiguration:Uri"] }");
     _logger.LogCritical("PAYMENT_LS", $"The Logstash Endpoint : { _configuration["LogstashConfiguration:Uri"] }");
     _logger.LogWarning("PAYMENT_ENV", $"The Current Environment : { Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") }");
     return("Payment Service Up ad running");
 }
Ejemplo n.º 4
0
        public async Task <ClientModel> Create(ClientModel clientModel)
        {
            await ValidateClientIfExist(clientModel);

            var mappedEntity = ObjectMapper.Mapper.Map <Client>(clientModel);

            if (mappedEntity == null)
            {
                throw new ApplicationException($"Entity could not be mapped.");
            }

            var newEntity = await _clientRepository.AddAsync(mappedEntity);

            _logger.LogInformation($"Entity successfully added.");

            var newMappedEntity = ObjectMapper.Mapper.Map <ClientModel>(newEntity);

            return(newMappedEntity);
        }
Ejemplo n.º 5
0
        public async Task <RemmittanceModel> Create(RemmittanceModel remmittanceModel)
        {
            await ValidateIfExist(remmittanceModel);

            try
            {
                var mappedEntity = ObjectMapper.Mapper.Map <Remittance>(remmittanceModel);
                if (mappedEntity == null)
                {
                    throw new ApplicationException($"Entity could not be mapped.");
                }

                var newEntity = await _remmittanceRepository.Create(mappedEntity);

                _logger.LogInformation($"Entity successfully added.");

                var newMappedEntity = ObjectMapper.Mapper.Map <RemmittanceModel>(newEntity);
                return(newMappedEntity);
            }
            catch (Exception)
            {
                return(null);
            }
        }