private void LogMerchantDetails() { try { // Using Request Target provided in the sample code/merchantconfig _logger.Trace("Using Request Target:'{0}'", _merchantConfig.RequestTarget); // logging Authentication type _logger.Trace("Authentication Type -> {0}", _merchantConfig.AuthenticationType); // logging Request Type _logger.Trace("Request Type -> {0}", _merchantConfig.RequestType); // Logging all the Properties of MerchantConfig and their respective Values _logger.Trace("MERCHCFG > {0}", MerchantConfig.LogAllproperties(_merchantConfig)); } catch (Exception e) { ExceptionUtility.Exception(e.Message, e.StackTrace); } }
public static string LogAllproperties(MerchantConfig obj) { var hiddenProperties = Constants.HideMerchantConfigProps.Split(','); var merchCfgLogString = " "; var merchantConfigProperties = typeof(MerchantConfig).GetProperties(); foreach (var property in merchantConfigProperties) { // If HiddenProperties Array does not contain any value of the current property being iterated // It simply means if the current property is not a hidden property, only then log it if (!hiddenProperties.Any(property.Name.Contains)) { merchCfgLogString += property.Name; merchCfgLogString += " "; merchCfgLogString += property.GetValue(obj); merchCfgLogString += ", "; } } return(merchCfgLogString); }
public Authorize(MerchantConfig merchantConfig) { _merchantConfig = merchantConfig; Enumerations.ValidateRequestType(_merchantConfig.RequestType); Enumerations.SetRequestType(_merchantConfig); }