diff --git a/Authorize.NET/Environment.cs b/Authorize.NET/Environment.cs index fb2c503..9eacd4a 100644 --- a/Authorize.NET/Environment.cs +++ b/Authorize.NET/Environment.cs @@ -19,130 +19,134 @@ namespace AuthorizeNet public class Environment { public static readonly Environment SANDBOX = new Environment("https://test.authorize.net", "https://apitest.authorize.net", "https://test.authorize.net"); public static readonly Environment PRODUCTION = new Environment("https://secure2.authorize.net","https://api2.authorize.net","https://cardpresent.authorize.net"); - public static readonly Environment LOCAL_VM = new Environment(null, null, null); - public static readonly Environment HOSTED_VM = new Environment(null, null, null); + public static readonly Environment LOCAL_VM = new Environment(null, null, null); + public static readonly Environment HOSTED_VM = new Environment(null, null, null); public static Environment CUSTOM = new Environment(null, null, null); - private String _baseUrl; - private String _xmlBaseUrl; - private String _cardPresentUrl; - - private Environment(String baseUrl, String xmlBaseUrl, String cardPresentUrl) { - _baseUrl = baseUrl; - _xmlBaseUrl = xmlBaseUrl; - _cardPresentUrl = cardPresentUrl; - } - - /** - * @return the baseUrl - */ - public String getBaseUrl() { - return _baseUrl; - } - - /** - * @return the xmlBaseUrl - */ - public String getXmlBaseUrl() { - return _xmlBaseUrl; - } - - /** - * @return the cardPresentUrl - */ - public String getCardPresentUrl() { - return _cardPresentUrl; - } - - /** - * If a custom environment needs to be supported, this convenience create - * method can be used to pass in a custom baseUrl. - * - * @param baseUrl - * @param xmlBaseUrl - * @return Environment object - */ - public static Environment createEnvironment(String baseUrl, String xmlBaseUrl) { - - return createEnvironment( baseUrl, xmlBaseUrl, null); - } - - /** - * If a custom environment needs to be supported, this convenience create - * method can be used to pass in a custom baseUrl. - * - * @param baseUrl - * @param xmlBaseUrl - * @param cardPresentUrl - * - * @return Environment object - */ - public static Environment createEnvironment(String baseUrl, String xmlBaseUrl, String cardPresentUrl) { - var environment = Environment.CUSTOM; - environment._baseUrl = baseUrl; - environment._xmlBaseUrl = xmlBaseUrl; - environment._cardPresentUrl = cardPresentUrl; - - return environment; - } - - /** - * Reads a integer value from property file and/or the environment - * Values in property file supersede the values set in environment - * @param propertyName name of the integer property to read - * @return int property value - */ - public static int getIntProperty( String propertyName) - { - var stringValue = GetProperty(propertyName); + private String _baseUrl; + private String _xmlBaseUrl; + private String _cardPresentUrl; + + private Environment(String baseUrl, String xmlBaseUrl, String cardPresentUrl) { + _baseUrl = baseUrl; + _xmlBaseUrl = xmlBaseUrl; + _cardPresentUrl = cardPresentUrl; + } + + /** + * @return the baseUrl + */ + public String getBaseUrl() { + return _baseUrl; + } + + /** + * @return the xmlBaseUrl + */ + public String getXmlBaseUrl() { + return _xmlBaseUrl; + } + + /** + * @return the cardPresentUrl + */ + public String getCardPresentUrl() { + return _cardPresentUrl; + } + + /** + * If a custom environment needs to be supported, this convenience create + * method can be used to pass in a custom baseUrl. + * + * @param baseUrl + * @param xmlBaseUrl + * @return Environment object + */ + public static Environment createEnvironment(String baseUrl, String xmlBaseUrl) { + + return createEnvironment( baseUrl, xmlBaseUrl, null); + } + + /** + * If a custom environment needs to be supported, this convenience create + * method can be used to pass in a custom baseUrl. + * + * @param baseUrl + * @param xmlBaseUrl + * @param cardPresentUrl + * + * @return Environment object + */ + public static Environment createEnvironment(String baseUrl, String xmlBaseUrl, String cardPresentUrl) { + var environment = Environment.CUSTOM; + environment._baseUrl = baseUrl; + environment._xmlBaseUrl = xmlBaseUrl; + environment._cardPresentUrl = cardPresentUrl; + + return environment; + } + + /** + * Reads a integer value from property file and/or the environment + * Values in property file supersede the values set in environment + * @param propertyName name of the integer property to read + * @return int property value + */ + public static int getIntProperty( String propertyName) + { + var stringValue = GetProperty(propertyName); var value = (AuthorizeNet.Util.StringUtils.ParseInt(stringValue)); - - return value; - } - - /** - * Reads a boolean value from property file and/or the environment - * Values in property file supersede the values set in environment - * @param propertyName name of the boolean property to read - * @return boolean property value - */ - public static bool getBooleanProperty( String propertyName) - { - var value = false; - var stringValue = GetProperty(propertyName); - if ( null != stringValue) - { - Boolean.TryParse(stringValue.Trim(), out value); - } - - return value; - } - - /// - /// Reads the value from property file and/or the environment - /// Values in property file supersede the values set in environmen - /// + + return value; + } + + /** + * Reads a boolean value from property file and/or the environment + * Values in property file supersede the values set in environment + * @param propertyName name of the boolean property to read + * @return boolean property value + */ + public static bool getBooleanProperty( String propertyName) + { + var value = false; + var stringValue = GetProperty(propertyName); + if ( null != stringValue) + { + Boolean.TryParse(stringValue.Trim(), out value); + } + + return value; + } + + private static object mutex = new object(); + + /// + /// Reads the value from property file and/or the environment + /// Values in property file supersede the values set in environmen + /// /// propertyName name of the property to read /// String property value - public static String GetProperty(String propertyName) { - String stringValue = null; + public static String GetProperty(String propertyName) { + String stringValue = null; + String propValue = null; - String propValue = null; - if ( ConfigurationManager.AppSettings.AllKeys.Contains(propertyName)) - { - propValue = ConfigurationManager.AppSettings[propertyName]; - } + lock(mutex) { + if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings.Get(propertyName))) + { + propValue = ConfigurationManager.AppSettings.Get(propertyName); + } + } var envValue = System.Environment.GetEnvironmentVariable(propertyName); - if ( null != propValue && propValue.Trim().Length > 0 ) - { - stringValue = propValue; - } - else if ( null != envValue && envValue.Trim().Length > 0 ) - { - stringValue = envValue; - } - return stringValue; - } + if ( null != propValue && propValue.Trim().Length > 0 ) + { + stringValue = propValue; + } + else if ( null != envValue && envValue.Trim().Length > 0 ) + { + stringValue = envValue; + } + return stringValue; + } } } \ No newline at end of file diff --git a/Authorize.NET/Properties/AssemblyInfo.cs b/Authorize.NET/Properties/AssemblyInfo.cs index 26ebac3..3c712e0 100644 --- a/Authorize.NET/Properties/AssemblyInfo.cs +++ b/Authorize.NET/Properties/AssemblyInfo.cs @@ -30,7 +30,7 @@ // Revision // // See AssemblyFileVersion.cs for Product and Assembly Version -//[assembly: AssemblyVersion("2.0.1.0")] -[assembly: AssemblyFileVersion("2.0.2.0")] -[assembly: AssemblyVersion("2.0.2.0")] +//[assembly: AssemblyVersion("2.0.2.0")] +[assembly: AssemblyFileVersion("2.0.3.0")] +[assembly: AssemblyVersion("2.0.3.0")] diff --git a/Authorize.NET/Util/Constants.cs b/Authorize.NET/Util/Constants.cs index 91e1141..cc21308 100644 --- a/Authorize.NET/Util/Constants.cs +++ b/Authorize.NET/Util/Constants.cs @@ -26,7 +26,7 @@ public static class Constants { public const int HttpConnectionDefaultTimeout = 30000; public const int HttpReadWriteDefaultTimeout = 30000; - public const string SDKVersion = "2.0.2"; + public const string SDKVersion = "2.0.3"; } #pragma warning restore 1591 diff --git a/AuthorizeNet.nuspec b/AuthorizeNet.nuspec index 52de83e..62b206a 100644 --- a/AuthorizeNet.nuspec +++ b/AuthorizeNet.nuspec @@ -2,7 +2,7 @@ AuthorizeNet - 2.0.2 + 2.0.3 AuthorizeNet Authorize.Net AuthorizeNet