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);
}