Exemple #1
0
        /// <summary>
        /// Create a new instance to generate a transaction to Punto Pagos
        /// </summary>
        /// <returns></returns>
        public Transaction CreateTransaction()
        {
            if (_logger == null)
            {
                _logger = Log4NetLoggerProxy.GetLogger("PuntoPagos-sdk");
                _logger.Info("Logger for log4net Start");
            }

            if (string.IsNullOrEmpty(_configuration.ClientKey) || string.IsNullOrEmpty(_configuration.ClientSecret))
            {
                if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["PuntoPago-Secret"]))
                {
                    throw new ArgumentNullException("PuntoPago-Secret", "The PuntoPago-Secret in AppSettings can not be null or empty");
                }

                if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["PuntoPago-Key"]))
                {
                    throw new ArgumentNullException("PuntoPago-Key", "The PuntoPago-Key in AppSettings can not be null or empty");
                }

                if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["PuntoPago-Environment"]))
                {
                    throw new ArgumentNullException("PuntoPago-Environment", "The PuntoPago-Environment in AppSettings can not be null or empty ");
                }

                _configuration.ClientSecret = ConfigurationManager.AppSettings["PuntoPago-Secret"];
                _configuration.ClientKey    = ConfigurationManager.AppSettings["PuntoPago-Key"];
                _configuration.Environment  = ConfigurationManager.AppSettings["PuntoPago-Environment"];

                _logger.Debug("End configurate ClientSecret, ClientKey and Environment from AppSettings");
            }
            else
            {
                _logger.Debug("End configurate ClientSecret, ClientKey and Environment from Code");
            }

            return(new Transaction(_configuration, PuntoPagoFactory.CreateAuthorization(_configuration, _logger),
                                   PuntoPagoFactory.CreateExecutorWeb(_logger), _logger));
        }
Exemple #2
0
 /// <summary>
 /// The method returns a logger for RegisterApp.
 /// </summary>
 /// <returns>ILog</returns>
 public static ILog GetRegisterAppLogger()
 {
     return(Log4NetLoggerProxy.GetLogger("RegisterAppLogger"));
 }
Exemple #3
0
 /// <summary>
 /// The method returns a logger for Interface layer.
 /// </summary>
 /// <returns>ILog</returns>
 public static ILog GetInterfaceLayerLogger()
 {
     return(Log4NetLoggerProxy.GetLogger("InterfaceLayerLogger"));
 }
Exemple #4
0
 /// <summary>
 /// The method returns a logger for External Service.
 /// </summary>
 /// <returns>ILog</returns>
 public static ILog GetExternalServiceLogger()
 {
     return(Log4NetLoggerProxy.GetLogger("ExternalServiceLoggerd"));
 }
Exemple #5
0
 /// <summary>
 /// The method returns a logger for Application layer.
 /// </summary>
 /// <returns>ILog</returns>
 public static ILog GetApplicationLayerLogger()
 {
     return(Log4NetLoggerProxy.GetLogger("ApplicationLayerLogger"));
 }