diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index 1a87892..c50ad9f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ obj *.nupkg **/test-results/* *Resharper* -test +test +release/ diff --git a/LICENSE b/LICENSE index a9e9e31..12c7189 100644 --- a/LICENSE +++ b/LICENSE @@ -1,20 +1,20 @@ -Copyright (c) 2012 SyntaxTree. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Copyright (c) 2012 SyntaxTree. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 3b94ba6..577a019 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,55 @@ -## SyntaxTree.FastSpring.Api - -SyntaxTree.FastSpring.Api is a C# library to query the [FastSpring](http://www.fastspring/) REST API. - -It works on .NET 3.5, .NET 4.0 and .NET 4.5. - -## API - -```csharp -namespace SyntaxTree.FastSpring.Api -{ - public sealed class CompanyStore - { - public CompanyStore(StoreCredential credential) {} - - public Order Order(string reference) {} - } - - public sealed class StoreCredential - { - public string Company { get; set; } - public string Username { get; set; } - public string Password { get; set; } - - public StoreCredential(string company, string username, string password) {} - } -} -``` - -Usage sample: - -```csharp -using SyntaxTree.FastSpring.Api; - -public class Program -{ - public static void Main() - { - var store = new CompanyStore( - new StoreCredential( - company: "Microsoft", - username: "api-user", - password: "xxx")); - - var order = store.Order(reference: "SYNXXXXXX-XXXX-XXXXX"); - - Console.WriteLine(order.Customer.FirstName); - } -} -``` - -We currently only support the order and coupon API, not the subscription one. - -All calls made to the FastSpring server are currently made synchronous and blocking. -Wrap your calls into a Task if you want them to to be asynchronous. +## SyntaxTree.FastSpring.Api + +SyntaxTree.FastSpring.Api is a C# library to query the [FastSpring](http://www.fastspring/) REST API. + +It works on .NET 3.5, .NET 4.0 and .NET 4.5. + +## API + +```csharp +namespace SyntaxTree.FastSpring.Api +{ + public sealed class CompanyStore + { + public CompanyStore(StoreCredential credential) {} + + public Order Order(string reference) {} + } + + public sealed class StoreCredential + { + public string Company { get; set; } + public string Username { get; set; } + public string Password { get; set; } + + public StoreCredential(string company, string username, string password) {} + } +} +``` + +Usage sample: + +```csharp +using SyntaxTree.FastSpring.Api; + +public class Program +{ + public static void Main() + { + var store = new CompanyStore( + new StoreCredential( + company: "Microsoft", + username: "api-user", + password: "xxx")); + + var order = store.Order(reference: "SYNXXXXXX-XXXX-XXXXX"); + + Console.WriteLine(order.Customer.FirstName); + } +} +``` + +We currently only support the order and coupon API, not the subscription one. + +All calls made to the FastSpring server are currently made synchronous and blocking. +Wrap your calls into a Task if you want them to to be asynchronous. diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..9602f46 --- /dev/null +++ b/build.bat @@ -0,0 +1,25 @@ +@echo Off +set config=%1 +if "%config%" == "" ( + set config=Release +) + +set version= +if not "%PackageVersion%" == "" ( + set version=-Version %PackageVersion% +) + +REM Package restore +REM tools\nuget.exe restore src\SyntaxTree.FastSpring.Api.sln -OutputDirectory %cd%\src\packages -NonInteractive + +REM Build +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild src\SyntaxTree.FastSpring.Api.sln /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false + +REM Package +mkdir release +mkdir release\nuget +tools\nuget.exe pack "src\SyntaxTree.FastSpring.Api\SyntaxTree.FastSpring.Api.csproj" -symbols -o release\nuget -p Configuration=%config% %version% + +REM Plain assemblies +mkdir release\assemblies +copy src\SyntaxTree.FastSpring.Api\bin\%config%\SyntaxTree.FastSpring*.dll release\assemblies diff --git a/msbuild.log b/msbuild.log new file mode 100644 index 0000000..974fd46 --- /dev/null +++ b/msbuild.log @@ -0,0 +1,17 @@ +Build started 2/12/2014 13:40:53. + 1>Project "D:\Projects\Git\SyntaxTree.FastSpring.Api\src\SyntaxTree.FastSpring.Api.sln" on node 1 (default targets). + 1>ValidateSolutionConfiguration: + Building solution configuration "Release|Any CPU". + 1>Project "D:\Projects\Git\SyntaxTree.FastSpring.Api\src\SyntaxTree.FastSpring.Api.sln" (1) is building "D:\Projects\Git\SyntaxTree.FastSpring.Api\src\SyntaxTree.FastSpring.Api\SyntaxTree.FastSpring.Api.csproj" (2) on node 1 (default targets). + 2>CoreCompile: + Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files. + CopyFilesToOutputDirectory: + SyntaxTree.FastSpring.Api -> D:\Projects\Git\SyntaxTree.FastSpring.Api\src\SyntaxTree.FastSpring.Api\bin\Release\SyntaxTree.FastSpring.Api.dll + 2>Done Building Project "D:\Projects\Git\SyntaxTree.FastSpring.Api\src\SyntaxTree.FastSpring.Api\SyntaxTree.FastSpring.Api.csproj" (default targets). + 1>Done Building Project "D:\Projects\Git\SyntaxTree.FastSpring.Api\src\SyntaxTree.FastSpring.Api.sln" (default targets). + +Build succeeded. + 0 Warning(s) + 0 Error(s) + +Time Elapsed 00:00:00.60 diff --git a/SyntaxTree.FastSpring.Api.sln b/src/SyntaxTree.FastSpring.Api.sln old mode 100755 new mode 100644 similarity index 87% rename from SyntaxTree.FastSpring.Api.sln rename to src/SyntaxTree.FastSpring.Api.sln index fb7d296..ab45ede --- a/SyntaxTree.FastSpring.Api.sln +++ b/src/SyntaxTree.FastSpring.Api.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyntaxTree.FastSpring.Api", "SyntaxTree.FastSpring.Api.csproj", "{14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyntaxTree.FastSpring.Api", "SyntaxTree.FastSpring.Api\SyntaxTree.FastSpring.Api.csproj", "{14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Address.cs b/src/SyntaxTree.FastSpring.Api/Address.cs old mode 100755 new mode 100644 similarity index 95% rename from Address.cs rename to src/SyntaxTree.FastSpring.Api/Address.cs index 1ff1067..d253334 --- a/Address.cs +++ b/src/SyntaxTree.FastSpring.Api/Address.cs @@ -1,28 +1,28 @@ -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - public sealed class Address - { - [XmlElement("addressLine1")] - public string FirstLine { get; set; } - - [XmlElement("addressLine2")] - public string SecondLine { get; set; } - - [XmlElement("city")] - public string City { get; set; } - - [XmlElement("region")] - public string Region { get; set; } - - [XmlElement("regionCustom")] - public string RegionCustom { get; set; } - - [XmlElement("postalCode")] - public string PostalCode { get; set; } - - [XmlElement("country")] - public string Country { get; set; } - } +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + public sealed class Address + { + [XmlElement("addressLine1")] + public string FirstLine { get; set; } + + [XmlElement("addressLine2")] + public string SecondLine { get; set; } + + [XmlElement("city")] + public string City { get; set; } + + [XmlElement("region")] + public string Region { get; set; } + + [XmlElement("regionCustom")] + public string RegionCustom { get; set; } + + [XmlElement("postalCode")] + public string PostalCode { get; set; } + + [XmlElement("country")] + public string Country { get; set; } + } } \ No newline at end of file diff --git a/CompanyStore.cs b/src/SyntaxTree.FastSpring.Api/CompanyStore.cs old mode 100755 new mode 100644 similarity index 96% rename from CompanyStore.cs rename to src/SyntaxTree.FastSpring.Api/CompanyStore.cs index 6aaa991..77cbe4f --- a/CompanyStore.cs +++ b/src/SyntaxTree.FastSpring.Api/CompanyStore.cs @@ -1,84 +1,84 @@ -using System; -using System.Net; -using System.Text; -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - public sealed class CompanyStore - { - private readonly StoreCredential _credential; - - public CompanyStore(StoreCredential credential) - { - if (credential == null) - throw new ArgumentNullException("credential"); - - _credential = credential; - } - - private static T ParseResponse(WebResponse response) - { - if (response == null) - throw new InvalidOperationException("No response."); - - var responseStream = response.GetResponseStream(); - if (responseStream == null) - throw new InvalidOperationException("Unable to acquire response stream."); - - return (T) new XmlSerializer(typeof (T)).Deserialize(responseStream); - } - - public Coupon GenerateCoupon(string prefix) - { - if (prefix == null) - throw new ArgumentNullException("prefix"); - if (prefix.Length == 0) - throw new ArgumentException("Prefix is empty.", "prefix"); - - var request = Request("POST", string.Concat("/coupon/", prefix, "/generate")); - return ParseResponse(request.GetResponse()); - } - - public Order Order(string reference) - { - if (reference == null) - throw new ArgumentNullException("reference"); - if (reference.Length == 0) - throw new ArgumentException("Reference is empty.", "reference"); - - var request = Request("GET", "/order/" + reference); - return ParseResponse(request.GetResponse()); - } - - public OrderSearchResult Orders(string query) - { - if (query == null) - throw new ArgumentNullException("query"); - if (query.Length == 0) - throw new ArgumentException("Query is empty.", "query"); - - var request = Request("GET", "/orders/search?query=" + Uri.EscapeDataString(query)); - return ParseResponse(request.GetResponse()); - } - - private WebRequest Request(string method, string uri) - { - var request = WebRequest.Create(StoreUri(uri)); - request.ContentType = "application/xml"; - request.Method = method; - request.Headers["Authorization"] = AuthorizationHeader(); - return request; - } - - private string AuthorizationHeader() - { - return "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(_credential.Username + ":" + _credential.Password)); - } - - private string StoreUri(string uri) - { - return "https://api.fastspring.com/company/" + _credential.Company + uri; - } - } -} +using System; +using System.Net; +using System.Text; +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + public sealed class CompanyStore + { + private readonly StoreCredential _credential; + + public CompanyStore(StoreCredential credential) + { + if (credential == null) + throw new ArgumentNullException("credential"); + + _credential = credential; + } + + private static T ParseResponse(WebResponse response) + { + if (response == null) + throw new InvalidOperationException("No response."); + + var responseStream = response.GetResponseStream(); + if (responseStream == null) + throw new InvalidOperationException("Unable to acquire response stream."); + + return (T) new XmlSerializer(typeof (T)).Deserialize(responseStream); + } + + public Coupon GenerateCoupon(string prefix) + { + if (prefix == null) + throw new ArgumentNullException("prefix"); + if (prefix.Length == 0) + throw new ArgumentException("Prefix is empty.", "prefix"); + + var request = Request("POST", string.Concat("/coupon/", prefix, "/generate")); + return ParseResponse(request.GetResponse()); + } + + public Order Order(string reference) + { + if (reference == null) + throw new ArgumentNullException("reference"); + if (reference.Length == 0) + throw new ArgumentException("Reference is empty.", "reference"); + + var request = Request("GET", "/order/" + reference); + return ParseResponse(request.GetResponse()); + } + + public OrderSearchResult Orders(string query) + { + if (query == null) + throw new ArgumentNullException("query"); + if (query.Length == 0) + throw new ArgumentException("Query is empty.", "query"); + + var request = Request("GET", "/orders/search?query=" + Uri.EscapeDataString(query)); + return ParseResponse(request.GetResponse()); + } + + private WebRequest Request(string method, string uri) + { + var request = WebRequest.Create(StoreUri(uri)); + request.ContentType = "application/xml"; + request.Method = method; + request.Headers["Authorization"] = AuthorizationHeader(); + return request; + } + + private string AuthorizationHeader() + { + return "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(_credential.Username + ":" + _credential.Password)); + } + + private string StoreUri(string uri) + { + return "https://api.fastspring.com/company/" + _credential.Company + uri; + } + } +} diff --git a/Contact.cs b/src/SyntaxTree.FastSpring.Api/Contact.cs old mode 100755 new mode 100644 similarity index 95% rename from Contact.cs rename to src/SyntaxTree.FastSpring.Api/Contact.cs index f505779..b801294 --- a/Contact.cs +++ b/src/SyntaxTree.FastSpring.Api/Contact.cs @@ -1,22 +1,22 @@ -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - public sealed class Contact - { - [XmlElement("firstName")] - public string FirstName { get; set; } - - [XmlElement("lastName")] - public string LastName { get; set; } - - [XmlElement("company")] - public string Company { get; set; } - - [XmlElement("email")] - public string Email { get; set; } - - [XmlElement("phoneNumber")] - public string PhoneNumber { get; set; } - } +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + public sealed class Contact + { + [XmlElement("firstName")] + public string FirstName { get; set; } + + [XmlElement("lastName")] + public string LastName { get; set; } + + [XmlElement("company")] + public string Company { get; set; } + + [XmlElement("email")] + public string Email { get; set; } + + [XmlElement("phoneNumber")] + public string PhoneNumber { get; set; } + } } \ No newline at end of file diff --git a/Coupon.cs b/src/SyntaxTree.FastSpring.Api/Coupon.cs similarity index 100% rename from Coupon.cs rename to src/SyntaxTree.FastSpring.Api/Coupon.cs diff --git a/Order.cs b/src/SyntaxTree.FastSpring.Api/Order.cs old mode 100755 new mode 100644 similarity index 95% rename from Order.cs rename to src/SyntaxTree.FastSpring.Api/Order.cs index fff655a..5798afd --- a/Order.cs +++ b/src/SyntaxTree.FastSpring.Api/Order.cs @@ -1,53 +1,53 @@ -using System; -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - [XmlRoot(ElementName = "order", IsNullable = false, Namespace = "")] - public sealed class Order : ShortOrder - { - [XmlElement("due")] - public DateTime Due { get; set; } - - [XmlElement("currency")] - public string Currency { get; set; } - - [XmlElement("referrer")] - public string Referrer { get; set; } - - [XmlElement("originIp")] - public string OriginIP{ get; set; } - - [XmlElement("total")] - public double Total { get; set; } - - [XmlElement("tax")] - public double Tax { get; set; } - - [XmlElement("shipping")] - public double Shipping { get; set; } - - [XmlElement("sourceName")] - public string SourceName { get; set; } - - [XmlElement("sourceKey")] - public string SourceKey { get; set; } - - [XmlElement("sourceCampaign")] - public string SourceCampaign { get; set; } - - [XmlElement("purchaser")] - public Contact Purchaser { get; set; } - - [XmlElement("address")] - public Address Address { get; set; } - - [XmlArray("orderItems")] - [XmlArrayItem("orderItem")] - public OrderItem[] Items { get; set; } - - [XmlArray("payments")] - [XmlArrayItem("payment")] - public Payment[] Payments { get; set; } - } +using System; +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + [XmlRoot(ElementName = "order", IsNullable = false, Namespace = "")] + public sealed class Order : ShortOrder + { + [XmlElement("due")] + public DateTime Due { get; set; } + + [XmlElement("currency")] + public string Currency { get; set; } + + [XmlElement("referrer")] + public string Referrer { get; set; } + + [XmlElement("originIp")] + public string OriginIP{ get; set; } + + [XmlElement("total")] + public double Total { get; set; } + + [XmlElement("tax")] + public double Tax { get; set; } + + [XmlElement("shipping")] + public double Shipping { get; set; } + + [XmlElement("sourceName")] + public string SourceName { get; set; } + + [XmlElement("sourceKey")] + public string SourceKey { get; set; } + + [XmlElement("sourceCampaign")] + public string SourceCampaign { get; set; } + + [XmlElement("purchaser")] + public Contact Purchaser { get; set; } + + [XmlElement("address")] + public Address Address { get; set; } + + [XmlArray("orderItems")] + [XmlArrayItem("orderItem")] + public OrderItem[] Items { get; set; } + + [XmlArray("payments")] + [XmlArrayItem("payment")] + public Payment[] Payments { get; set; } + } } \ No newline at end of file diff --git a/OrderItem.cs b/src/SyntaxTree.FastSpring.Api/OrderItem.cs old mode 100755 new mode 100644 similarity index 95% rename from OrderItem.cs rename to src/SyntaxTree.FastSpring.Api/OrderItem.cs index 33e13e6..2364331 --- a/OrderItem.cs +++ b/src/SyntaxTree.FastSpring.Api/OrderItem.cs @@ -1,19 +1,19 @@ -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - public sealed class OrderItem - { - [XmlElement("productDisplay")] - public string ProductDisplay { get; set; } - - [XmlElement("productName")] - public string ProductName { get; set; } - - [XmlElement("quantity")] - public int Quantity { get; set; } - - [XmlElement("subscriptionReference")] - public string SubscriptionReference { get; set; } - } +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + public sealed class OrderItem + { + [XmlElement("productDisplay")] + public string ProductDisplay { get; set; } + + [XmlElement("productName")] + public string ProductName { get; set; } + + [XmlElement("quantity")] + public int Quantity { get; set; } + + [XmlElement("subscriptionReference")] + public string SubscriptionReference { get; set; } + } } \ No newline at end of file diff --git a/OrderSearchResult.cs b/src/SyntaxTree.FastSpring.Api/OrderSearchResult.cs similarity index 100% rename from OrderSearchResult.cs rename to src/SyntaxTree.FastSpring.Api/OrderSearchResult.cs diff --git a/Payment.cs b/src/SyntaxTree.FastSpring.Api/Payment.cs old mode 100755 new mode 100644 similarity index 95% rename from Payment.cs rename to src/SyntaxTree.FastSpring.Api/Payment.cs index 9bf8d10..12b1c13 --- a/Payment.cs +++ b/src/SyntaxTree.FastSpring.Api/Payment.cs @@ -1,26 +1,26 @@ -using System; -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - public sealed class Payment - { - [XmlElement("status")] - public Status Status { get; set; } - - [XmlElement("statusChanged")] - public DateTime StatusChanged { get; set; } - - [XmlElement("methodType")] - public PaymentMethod Method { get; set; } - - [XmlElement("declinedReason")] - public PaymentDeclinationReason DeclinationReason { get; set; } - - [XmlElement("currency")] - public string Currency { get; set; } - - [XmlElement("total")] - public double Total { get; set; } - } +using System; +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + public sealed class Payment + { + [XmlElement("status")] + public Status Status { get; set; } + + [XmlElement("statusChanged")] + public DateTime StatusChanged { get; set; } + + [XmlElement("methodType")] + public PaymentMethod Method { get; set; } + + [XmlElement("declinedReason")] + public PaymentDeclinationReason DeclinationReason { get; set; } + + [XmlElement("currency")] + public string Currency { get; set; } + + [XmlElement("total")] + public double Total { get; set; } + } } \ No newline at end of file diff --git a/PaymentDeclinationReason.cs b/src/SyntaxTree.FastSpring.Api/PaymentDeclinationReason.cs old mode 100755 new mode 100644 similarity index 93% rename from PaymentDeclinationReason.cs rename to src/SyntaxTree.FastSpring.Api/PaymentDeclinationReason.cs index 2f84df4..6024e63 --- a/PaymentDeclinationReason.cs +++ b/src/SyntaxTree.FastSpring.Api/PaymentDeclinationReason.cs @@ -1,43 +1,43 @@ -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - public enum PaymentDeclinationReason - { - [XmlEnum("")] - None, - - [XmlEnum("internal-error")] - InternalError, - - [XmlEnum("unsupported-country")] - UnsupportedCountry, - - [XmlEnum("expired-card")] - ExpiredCard, - - [XmlEnum("declined")] - Declined, - - [XmlEnum("risk")] - Risk, - - [XmlEnum("processor-risk")] - ProcessorRisk, - - [XmlEnum("connection")] - Connection, - - [XmlEnum("unknown")] - Unknown, - - [XmlEnum("cc-address-verification")] - CcAddressVerification, - - [XmlEnum("cc-cvv")] - CcCvv, - - [XmlEnum("voice-auth")] - VoiceAuth, - } +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + public enum PaymentDeclinationReason + { + [XmlEnum("")] + None, + + [XmlEnum("internal-error")] + InternalError, + + [XmlEnum("unsupported-country")] + UnsupportedCountry, + + [XmlEnum("expired-card")] + ExpiredCard, + + [XmlEnum("declined")] + Declined, + + [XmlEnum("risk")] + Risk, + + [XmlEnum("processor-risk")] + ProcessorRisk, + + [XmlEnum("connection")] + Connection, + + [XmlEnum("unknown")] + Unknown, + + [XmlEnum("cc-address-verification")] + CcAddressVerification, + + [XmlEnum("cc-cvv")] + CcCvv, + + [XmlEnum("voice-auth")] + VoiceAuth, + } } \ No newline at end of file diff --git a/PaymentMethod.cs b/src/SyntaxTree.FastSpring.Api/PaymentMethod.cs old mode 100755 new mode 100644 similarity index 92% rename from PaymentMethod.cs rename to src/SyntaxTree.FastSpring.Api/PaymentMethod.cs index ca14aaf..de59b6f --- a/PaymentMethod.cs +++ b/src/SyntaxTree.FastSpring.Api/PaymentMethod.cs @@ -1,28 +1,28 @@ -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - public enum PaymentMethod - { - [XmlEnum("paypal")] - Paypal, - - [XmlEnum("creditcard")] - CreditCard, - - [XmlEnum("test")] - Test, - - [XmlEnum("bank")] - Bank, - - [XmlEnum("check")] - Check, - - [XmlEnum("purchase-order")] - PurchaseOrder, - - [XmlEnum("free")] - Free, - } +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + public enum PaymentMethod + { + [XmlEnum("paypal")] + Paypal, + + [XmlEnum("creditcard")] + CreditCard, + + [XmlEnum("test")] + Test, + + [XmlEnum("bank")] + Bank, + + [XmlEnum("check")] + Check, + + [XmlEnum("purchase-order")] + PurchaseOrder, + + [XmlEnum("free")] + Free, + } } \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/src/SyntaxTree.FastSpring.Api/Properties/AssemblyInfo.cs old mode 100755 new mode 100644 similarity index 89% rename from Properties/AssemblyInfo.cs rename to src/SyntaxTree.FastSpring.Api/Properties/AssemblyInfo.cs index 85cf210..5811fa7 --- a/Properties/AssemblyInfo.cs +++ b/src/SyntaxTree.FastSpring.Api/Properties/AssemblyInfo.cs @@ -1,36 +1,36 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 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. -[assembly: AssemblyTitle("SyntaxTree.FastSpring.Api")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SyntaxTree.FastSpring.Api")] -[assembly: AssemblyCopyright("Copyright © SyntaxTree 2012")] -[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 -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d50dbcd1-b437-47d8-a494-74043d75f6a4")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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. +[assembly: AssemblyTitle("SyntaxTree.FastSpring.Api")] +[assembly: AssemblyDescription("FastSpring payments API client for .NET")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("SyntaxTree")] +[assembly: AssemblyProduct("SyntaxTree.FastSpring.Api")] +[assembly: AssemblyCopyright("Copyright © SyntaxTree 2012")] +[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 +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d50dbcd1-b437-47d8-a494-74043d75f6a4")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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("1.0.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ReturnStatus.cs b/src/SyntaxTree.FastSpring.Api/ReturnStatus.cs similarity index 100% rename from ReturnStatus.cs rename to src/SyntaxTree.FastSpring.Api/ReturnStatus.cs diff --git a/ShortOrder.cs b/src/SyntaxTree.FastSpring.Api/ShortOrder.cs similarity index 100% rename from ShortOrder.cs rename to src/SyntaxTree.FastSpring.Api/ShortOrder.cs diff --git a/Status.cs b/src/SyntaxTree.FastSpring.Api/Status.cs old mode 100755 new mode 100644 similarity index 92% rename from Status.cs rename to src/SyntaxTree.FastSpring.Api/Status.cs index 06f5cdb..c9f7689 --- a/Status.cs +++ b/src/SyntaxTree.FastSpring.Api/Status.cs @@ -1,40 +1,40 @@ -using System.Xml.Serialization; - -namespace SyntaxTree.FastSpring.Api -{ - public enum Status - { - [XmlEnum("open")] - Open, - - [XmlEnum("request")] - Request, - - [XmlEnum("requested")] - Requested, - - [XmlEnum("acceptance")] - Acceptance, - - [XmlEnum("accepted")] - Accepted, - - [XmlEnum("fulfillment")] - Fulfillment, - - [XmlEnum("fulfilled")] - Fulfilled, - - [XmlEnum("completion")] - Completion, - - [XmlEnum("completed")] - Completed, - - [XmlEnum("canceled")] - Canceled, - - [XmlEnum("failed")] - Failed, - } +using System.Xml.Serialization; + +namespace SyntaxTree.FastSpring.Api +{ + public enum Status + { + [XmlEnum("open")] + Open, + + [XmlEnum("request")] + Request, + + [XmlEnum("requested")] + Requested, + + [XmlEnum("acceptance")] + Acceptance, + + [XmlEnum("accepted")] + Accepted, + + [XmlEnum("fulfillment")] + Fulfillment, + + [XmlEnum("fulfilled")] + Fulfilled, + + [XmlEnum("completion")] + Completion, + + [XmlEnum("completed")] + Completed, + + [XmlEnum("canceled")] + Canceled, + + [XmlEnum("failed")] + Failed, + } } \ No newline at end of file diff --git a/StoreCredential.cs b/src/SyntaxTree.FastSpring.Api/StoreCredential.cs old mode 100755 new mode 100644 similarity index 96% rename from StoreCredential.cs rename to src/SyntaxTree.FastSpring.Api/StoreCredential.cs index aefaadd..8250a97 --- a/StoreCredential.cs +++ b/src/SyntaxTree.FastSpring.Api/StoreCredential.cs @@ -1,32 +1,32 @@ -using System; - -namespace SyntaxTree.FastSpring.Api -{ - public sealed class StoreCredential - { - public string Company { get; private set; } - public string Username { get; private set; } - public string Password { get; private set; } - - public StoreCredential(string company, string username, string password) - { - if (company == null) - throw new ArgumentNullException("company"); - if (username == null) - throw new ArgumentNullException("username"); - if (password == null) - throw new ArgumentNullException("password"); - - if (company.Length == 0) - throw new ArgumentException("Company name is empty.", "company"); - if (username.Length == 0) - throw new ArgumentException("Username is empty.", "username"); - if (password.Length == 0) - throw new ArgumentException("Password is empty", "password"); - - Company = company; - Username = username; - Password = password; - } - } +using System; + +namespace SyntaxTree.FastSpring.Api +{ + public sealed class StoreCredential + { + public string Company { get; private set; } + public string Username { get; private set; } + public string Password { get; private set; } + + public StoreCredential(string company, string username, string password) + { + if (company == null) + throw new ArgumentNullException("company"); + if (username == null) + throw new ArgumentNullException("username"); + if (password == null) + throw new ArgumentNullException("password"); + + if (company.Length == 0) + throw new ArgumentException("Company name is empty.", "company"); + if (username.Length == 0) + throw new ArgumentException("Username is empty.", "username"); + if (password.Length == 0) + throw new ArgumentException("Password is empty", "password"); + + Company = company; + Username = username; + Password = password; + } + } } \ No newline at end of file diff --git a/SyntaxTree.FastSpring.Api.csproj b/src/SyntaxTree.FastSpring.Api/SyntaxTree.FastSpring.Api.csproj old mode 100755 new mode 100644 similarity index 96% rename from SyntaxTree.FastSpring.Api.csproj rename to src/SyntaxTree.FastSpring.Api/SyntaxTree.FastSpring.Api.csproj index bafcfe9..f0df367 --- a/SyntaxTree.FastSpring.Api.csproj +++ b/src/SyntaxTree.FastSpring.Api/SyntaxTree.FastSpring.Api.csproj @@ -1,62 +1,65 @@ - - - - - Debug - AnyCPU - {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4} - Library - Properties - SyntaxTree.FastSpring.Api - SyntaxTree.FastSpring.Api - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {14DE6DBD-DDE0-4041-A1E9-570D40E03BE4} + Library + Properties + SyntaxTree.FastSpring.Api + SyntaxTree.FastSpring.Api + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/SyntaxTree.FastSpring.Api/SyntaxTree.FastSpring.Api.nuspec b/src/SyntaxTree.FastSpring.Api/SyntaxTree.FastSpring.Api.nuspec new file mode 100644 index 0000000..924029c --- /dev/null +++ b/src/SyntaxTree.FastSpring.Api/SyntaxTree.FastSpring.Api.nuspec @@ -0,0 +1,16 @@ + + + + $id$ + $version$ + $title$ + $author$ + $author$ + https://raw.githubusercontent.com/syntaxtree/SyntaxTree.FastSpring.Api/master/LICENSE + https://github.com/syntaxtree/SyntaxTree.FastSpring.Api/ + false + FastSpring payments API client for .NET + Copyright © SyntaxTree 2012 + fastspring syntaxtree myget payments credit card paypal subscriptions + + \ No newline at end of file diff --git a/tools/nuget.exe b/tools/nuget.exe new file mode 100644 index 0000000..8dd7e45 Binary files /dev/null and b/tools/nuget.exe differ