diff --git a/MaxMind.MinFraud.UnitTest/MaxMind.MinFraud.UnitTest.csproj b/MaxMind.MinFraud.UnitTest/MaxMind.MinFraud.UnitTest.csproj index 3dc64aad..7c68164b 100644 --- a/MaxMind.MinFraud.UnitTest/MaxMind.MinFraud.UnitTest.csproj +++ b/MaxMind.MinFraud.UnitTest/MaxMind.MinFraud.UnitTest.csproj @@ -38,15 +38,27 @@ 4 - - ..\packages\MaxMind.Db.1.1.0\lib\net40\MaxMind.Db.dll + + ..\packages\MaxMind.Db.1.2.0-beta1\lib\net40\MaxMind.Db.dll True - - ..\packages\MaxMind.GeoIP2.2.3.1\lib\net40\MaxMind.GeoIP2.dll + + ..\packages\MaxMind.GeoIP2.2.4.0-beta1\lib\net40\MaxMind.GeoIP2.dll True + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + True + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll @@ -56,15 +68,12 @@ ..\packages\NUnit.2.6.4\lib\nunit.framework.dll True - - ..\packages\RestSharp.105.1.0\lib\net452\RestSharp.dll - True - ..\packages\RichardSzalay.MockHttp.1.2.1\lib\net45\RichardSzalay.MockHttp.dll True + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll diff --git a/MaxMind.MinFraud.UnitTest/packages.config b/MaxMind.MinFraud.UnitTest/packages.config index ec5ab3fd..4ec8b222 100644 --- a/MaxMind.MinFraud.UnitTest/packages.config +++ b/MaxMind.MinFraud.UnitTest/packages.config @@ -1,12 +1,12 @@  - - + + + - \ No newline at end of file diff --git a/MaxMind.MinFraud/Exception/InvalidRequestException.cs b/MaxMind.MinFraud/Exception/InvalidRequestException.cs index 9bf5185b..6203555a 100644 --- a/MaxMind.MinFraud/Exception/InvalidRequestException.cs +++ b/MaxMind.MinFraud/Exception/InvalidRequestException.cs @@ -97,6 +97,10 @@ protected InvalidRequestException(SerializationInfo info, StreamingContext conte [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { + if (info == null) + { + throw new ArgumentNullException(nameof(info)); + } info.AddValue("Code", Code); info.AddValue("Uri", this.Uri); base.GetObjectData(info, context); diff --git a/MaxMind.MinFraud/GlobalSuppressions.cs b/MaxMind.MinFraud/GlobalSuppressions.cs new file mode 100644 index 00000000..99b5e420 Binary files /dev/null and b/MaxMind.MinFraud/GlobalSuppressions.cs differ diff --git a/MaxMind.MinFraud/MaxMind.MinFraud.csproj b/MaxMind.MinFraud/MaxMind.MinFraud.csproj index 437a021b..43207f00 100644 --- a/MaxMind.MinFraud/MaxMind.MinFraud.csproj +++ b/MaxMind.MinFraud/MaxMind.MinFraud.csproj @@ -23,6 +23,7 @@ prompt 4 true + MaxMind.MinFraud.ruleset pdbonly @@ -33,27 +34,42 @@ 4 bin\Release\MaxMind.MinFraud.xml true - ExtendedCorrectnessRules.ruleset + MaxMind.MinFraud.ruleset + + + true + + + ..\MaxMind.snk - - ..\packages\MaxMind.Db.1.1.0\lib\net40\MaxMind.Db.dll + + ..\packages\MaxMind.Db.1.2.0-beta1\lib\net40\MaxMind.Db.dll True - - ..\packages\MaxMind.GeoIP2.2.3.1\lib\net40\MaxMind.GeoIP2.dll + + ..\packages\MaxMind.GeoIP2.2.4.0-beta1\lib\net40\MaxMind.GeoIP2.dll True - - ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll True - - ..\packages\RestSharp.105.1.0\lib\net452\RestSharp.dll + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + + + ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll True + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll True @@ -77,6 +93,7 @@ + @@ -107,6 +124,7 @@ + diff --git a/MaxMind.MinFraud/MaxMind.MinFraud.ruleset b/MaxMind.MinFraud/MaxMind.MinFraud.ruleset new file mode 100644 index 00000000..11519a70 --- /dev/null +++ b/MaxMind.MinFraud/MaxMind.MinFraud.ruleset @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/MaxMind.MinFraud/Properties/AssemblyInfo.cs b/MaxMind.MinFraud/Properties/AssemblyInfo.cs index b14b831d..5e4f34a0 100644 --- a/MaxMind.MinFraud/Properties/AssemblyInfo.cs +++ b/MaxMind.MinFraud/Properties/AssemblyInfo.cs @@ -1,7 +1,8 @@ -using System.Reflection; +using System; +using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. @@ -14,8 +15,8 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -23,18 +24,19 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7208d9c8-f862-4675-80e5-77a2f8901b96")] +[assembly: CLSCompliant(true)] // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.1")] -[assembly: AssemblyInformationalVersion("0.1.1-beta1")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("0.2.0-beta1")] \ No newline at end of file diff --git a/MaxMind.MinFraud/Request/Transaction.cs b/MaxMind.MinFraud/Request/Transaction.cs index 4f7dddfa..0ff690b9 100644 --- a/MaxMind.MinFraud/Request/Transaction.cs +++ b/MaxMind.MinFraud/Request/Transaction.cs @@ -33,7 +33,7 @@ public Transaction( Order order = null, Payment payment = null, Shipping shipping = null, - List shoppingCart = default(List) + IList shoppingCart = default(List) ) { this.Device = device; @@ -106,7 +106,7 @@ public Transaction( /// List of shopping items in the transaction. /// [JsonProperty("shopping_cart")] - public List ShoppingCart { get; } + public IList ShoppingCart { get; } /// /// Returns a string that represents the current object. diff --git a/MaxMind.MinFraud/Response/Score.cs b/MaxMind.MinFraud/Response/Score.cs index cef05f87..5695bb08 100644 --- a/MaxMind.MinFraud/Response/Score.cs +++ b/MaxMind.MinFraud/Response/Score.cs @@ -18,7 +18,7 @@ public class Score /// account. /// [JsonProperty("credits_remaining")] - public ulong? CreditsRemaining { get; internal set; } + public long? CreditsRemaining { get; internal set; } /// /// This is a UUID that identifies the minFraud request. Please use diff --git a/MaxMind.MinFraud/Response/Warning.cs b/MaxMind.MinFraud/Response/Warning.cs index 1c3954f6..a3da0416 100644 --- a/MaxMind.MinFraud/Response/Warning.cs +++ b/MaxMind.MinFraud/Response/Warning.cs @@ -1,5 +1,6 @@ using Newtonsoft.Json; using System.Collections.Generic; +using System.Collections.ObjectModel; namespace MaxMind.MinFraud.Response { @@ -36,7 +37,7 @@ public sealed class Warning /// number for an array. /// [JsonIgnore] - public List Input => new List(_input); + public ReadOnlyCollection Input => new ReadOnlyCollection(_input); /// /// Returns a string that represents the current object. diff --git a/MaxMind.MinFraud/Util/IPAddressConverter.cs b/MaxMind.MinFraud/Util/IPAddressConverter.cs index 5a36d663..994e60ef 100644 --- a/MaxMind.MinFraud/Util/IPAddressConverter.cs +++ b/MaxMind.MinFraud/Util/IPAddressConverter.cs @@ -1,7 +1,11 @@ -using System; -using System.Net; +#region + using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using System; +using System.Net; + +#endregion namespace MaxMind.MinFraud.Util { @@ -10,12 +14,16 @@ internal class IPAddressConverter : JsonConverter { public override bool CanConvert(Type objectType) { - return (objectType == typeof (IPAddress)); + return (objectType == typeof(IPAddress)); } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { - var ip = (IPAddress) value; + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + var ip = (IPAddress)value; writer.WriteValue(ip.ToString()); } diff --git a/MaxMind.MinFraud/WebServiceClient.cs b/MaxMind.MinFraud/WebServiceClient.cs index 3d778093..0911b968 100644 --- a/MaxMind.MinFraud/WebServiceClient.cs +++ b/MaxMind.MinFraud/WebServiceClient.cs @@ -44,13 +44,13 @@ public sealed class WebServiceClient : IDisposable public WebServiceClient( int userId, string licenseKey, - List locales = null, + IEnumerable locales = null, string host = "minfraud.maxmind.com", TimeSpan? timeout = null, HttpMessageHandler httpMessageHandler = null ) { - _locales = locales ?? new List { "en" }; + _locales = locales == null ? new List { "en" } : new List(locales); _httpClient = new HttpClient(httpMessageHandler ?? new HttpClientHandler()) { BaseAddress = new UriBuilder("https", host, -1, BasePath).Uri, diff --git a/MaxMind.MinFraud/packages.config b/MaxMind.MinFraud/packages.config index fc16101a..bd30172e 100644 --- a/MaxMind.MinFraud/packages.config +++ b/MaxMind.MinFraud/packages.config @@ -1,10 +1,10 @@  - - + + + - \ No newline at end of file diff --git a/MaxMind.snk b/MaxMind.snk new file mode 100644 index 00000000..8744a96d Binary files /dev/null and b/MaxMind.snk differ diff --git a/README.md b/README.md index 7a176e30..f6e74033 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ marked as async: var score = await client.ScoreAsync(transaction); ``` -Or a minFRaud Insights request by calling `InsightsAsynce` method: +Or a minFraud Insights request by calling `InsightsAsynce` method: ```csharp var score = await client.ScoreAsync(transaction); diff --git a/releasenotes.md b/releasenotes.md index cf44816a..45632c43 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,11 +1,18 @@ Release Notes ============= -0.2.0 (2015-XX-XX) ------------------- +0.2.0-beta1 (2015-09-10) +------------------------ * Add `is_gift` and `has_gift_message` order inputs. * Upgrade to the latest GeoIP2 release. +* `Score.CreditsRemaining` was change from a `ulong?` to `long?` in order to + be more CLS compliant. +* GeoIP2 dependency was updated to a version that does not depend on + RestSharp. +* Some parameters and properties were changed from using concrete classes to + interfaces. +* The library now has a strong name. 0.1.1-beta1 (2015-06-30) ------------------------