From cbe98425093a4a0f313387c5c15d2024db70cc81 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Thu, 8 Sep 2016 11:52:09 -0500 Subject: [PATCH 01/30] Remove splintered ShopifyFulfillmentStatus enum, replace with string. --- .../When_creating_a_partial_fulfillment.cs | 5 --- .../When_creating_a_single_fulfillment.cs | 5 --- ShopifySharp/Entities/ShopifyLineItem.cs | 2 +- ShopifySharp/Entities/ShopifyOrder.cs | 2 +- .../Enums/ShopifyFulfillmentStatus.cs | 31 ------------------- ShopifySharp/Filters/ShopifyOrderFilter.cs | 2 +- ShopifySharp/ShopifySharp.csproj | 1 - 7 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyFulfillmentStatus.cs diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_partial_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_partial_fulfillment.cs index fb3b32666..626f00ff9 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_partial_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_partial_fulfillment.cs @@ -33,11 +33,6 @@ class When_creating_a_partial_fulfillment Fulfillment.ShouldNotBeNull(); Fulfillment.Id.HasValue.ShouldBeTrue(); Fulfillment.Status.Equals("success", System.StringComparison.OrdinalIgnoreCase).ShouldBeTrue(); - - Fulfillment - .LineItems - .Count(f => f.FulfillmentStatus == Enums.ShopifyFulfillmentStatus.Partial) - .ShouldEqual(1); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_single_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_single_fulfillment.cs index 18e8252ef..68afa75f8 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_single_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_single_fulfillment.cs @@ -29,11 +29,6 @@ class When_creating_a_single_fulfillment Fulfillment.ShouldNotBeNull(); Fulfillment.Id.HasValue.ShouldBeTrue(); Fulfillment.Status.Equals("success", System.StringComparison.OrdinalIgnoreCase).ShouldBeTrue(); - - Fulfillment - .LineItems - .Count(f => f.FulfillmentStatus == Enums.ShopifyFulfillmentStatus.Fulfilled) - .ShouldEqual(1); }; Cleanup after = () => diff --git a/ShopifySharp/Entities/ShopifyLineItem.cs b/ShopifySharp/Entities/ShopifyLineItem.cs index 62d275bde..0d02a59ca 100644 --- a/ShopifySharp/Entities/ShopifyLineItem.cs +++ b/ShopifySharp/Entities/ShopifyLineItem.cs @@ -26,7 +26,7 @@ public class ShopifyLineItem : ShopifyObject /// The fulfillment status of this line item. Will be null if the line item has not been fulfilled or partially fulfilled. /// [JsonProperty("fulfillment_status")] - public ShopifyFulfillmentStatus? FulfillmentStatus { get; set; } + public string FulfillmentStatus { get; set; } /// /// The weight of the item in grams. diff --git a/ShopifySharp/Entities/ShopifyOrder.cs b/ShopifySharp/Entities/ShopifyOrder.cs index be1862cde..439148dd5 100644 --- a/ShopifySharp/Entities/ShopifyOrder.cs +++ b/ShopifySharp/Entities/ShopifyOrder.cs @@ -117,7 +117,7 @@ public class ShopifyOrder : ShopifyObject /// The fulfillment status for this order. Will be null if none of the line items in the order have been fulfilled. /// [JsonProperty("fulfillment_status")] - public ShopifyFulfillmentStatus? FulfillmentStatus { get; set; } + public string FulfillmentStatus { get; set; } /// /// Tags are additional short descriptors, commonly used for filtering and searching, formatted as a string of comma-separated values. diff --git a/ShopifySharp/Enums/ShopifyFulfillmentStatus.cs b/ShopifySharp/Enums/ShopifyFulfillmentStatus.cs deleted file mode 100644 index ff1405d83..000000000 --- a/ShopifySharp/Enums/ShopifyFulfillmentStatus.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - /// - /// The status of a fulfillment. - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyFulfillmentStatus - { - /// - /// Every line item in the order has been fulfilled. - /// - [EnumMember(Value = "fulfilled")] - Fulfilled, - - /// - /// None of the line items in the order have been fulfilled. - /// - [EnumMember(Value = "none")] - None, - - /// - /// At least one line item in the order has been fulfilled. - /// - [EnumMember(Value = "partial")] - Partial - } -} diff --git a/ShopifySharp/Filters/ShopifyOrderFilter.cs b/ShopifySharp/Filters/ShopifyOrderFilter.cs index 89d3d5ed8..a77a21632 100644 --- a/ShopifySharp/Filters/ShopifyOrderFilter.cs +++ b/ShopifySharp/Filters/ShopifyOrderFilter.cs @@ -25,6 +25,6 @@ public class ShopifyOrderFilter : ShopifyListFilter /// The fulfillment status of orders to retrieve. Leave this null to retrieve orders with any fulfillment status. /// [JsonProperty("fulfillment_status")] - public ShopifyFulfillmentStatus? FulfillmentStatus { get; set; } + public string FulfillmentStatus { get; set; } } } diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index bbd985e3c..7363d9434 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -89,7 +89,6 @@ - From a98fa7c991ca12d88fe386721f35d1661e576fba Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Tue, 13 Sep 2016 16:02:52 -0500 Subject: [PATCH 02/30] Remove ShopifyOrderStatus enum --- ShopifySharp/Enums/ShopifyOrderStatus.cs | 22 ---------------------- ShopifySharp/Filters/ShopifyOrderFilter.cs | 4 ++-- ShopifySharp/ShopifySharp.csproj | 1 - 3 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyOrderStatus.cs diff --git a/ShopifySharp/Enums/ShopifyOrderStatus.cs b/ShopifySharp/Enums/ShopifyOrderStatus.cs deleted file mode 100644 index 38279083e..000000000 --- a/ShopifySharp/Enums/ShopifyOrderStatus.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Newtonsoft.Json; -using System.Runtime.Serialization; -using ShopifySharp.Converters; - -namespace ShopifySharp.Enums -{ - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyOrderStatus - { - [EnumMember(Value = "open")] - Open, - - [EnumMember(Value = "closed")] - Closed, - - [EnumMember(Value = "cancelled")] - Cancelled, - - [EnumMember(Value = "any")] - Any - } -} diff --git a/ShopifySharp/Filters/ShopifyOrderFilter.cs b/ShopifySharp/Filters/ShopifyOrderFilter.cs index a77a21632..c472f66d8 100644 --- a/ShopifySharp/Filters/ShopifyOrderFilter.cs +++ b/ShopifySharp/Filters/ShopifyOrderFilter.cs @@ -10,10 +10,10 @@ namespace ShopifySharp.Filters public class ShopifyOrderFilter : ShopifyListFilter { /// - /// The status of orders to retrieve. Default is . + /// The status of orders to retrieve. Known values are "open", "closed", "cancelled" and "any" (default). /// [JsonProperty("status")] - public ShopifyOrderStatus? Status { get; set; } = ShopifyOrderStatus.Any; + public string Status { get; set; } = "any"; /// /// The financial status of orders to retrieve. Leave this null to retrieve orders with any financial status. diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index c91604b28..ecac6c63a 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -92,7 +92,6 @@ - From bfc5bae08f5ca21c99b9064466762182d0019476 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Tue, 13 Sep 2016 16:06:45 -0500 Subject: [PATCH 03/30] Remove OrderFinancialStatus enum --- .../Test_Data/OrderCreation.cs | 2 +- ShopifySharp/Entities/ShopifyOrder.cs | 4 +- .../Enums/ShopifyOrderFinancialStatus.cs | 55 ------------------- ShopifySharp/Filters/ShopifyOrderFilter.cs | 4 +- ShopifySharp/ShopifySharp.csproj | 1 - 5 files changed, 5 insertions(+), 61 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyOrderFinancialStatus.cs diff --git a/ShopifySharp.Tests/ShopifyOrderService Tests/Test_Data/OrderCreation.cs b/ShopifySharp.Tests/ShopifyOrderService Tests/Test_Data/OrderCreation.cs index 599edb05b..2f00dee8c 100644 --- a/ShopifySharp.Tests/ShopifyOrderService Tests/Test_Data/OrderCreation.cs +++ b/ShopifySharp.Tests/ShopifyOrderService Tests/Test_Data/OrderCreation.cs @@ -48,7 +48,7 @@ public static ShopifyOrder GenerateOrder() Price = 5 } }, - FinancialStatus = Enums.ShopifyOrderFinancialStatus.Paid, + FinancialStatus = "paid", TotalPrice = 5.00, Transactions = new List() { diff --git a/ShopifySharp/Entities/ShopifyOrder.cs b/ShopifySharp/Entities/ShopifyOrder.cs index 439148dd5..b45a3705b 100644 --- a/ShopifySharp/Entities/ShopifyOrder.cs +++ b/ShopifySharp/Entities/ShopifyOrder.cs @@ -102,10 +102,10 @@ public class ShopifyOrder : ShopifyObject public string Email { get; set; } /// - /// The financial status of an order. + /// The financial status of an order. Known values are "authorized", "paid", "pending", "partially_paid", "partially_refunded", "refunded" and "voided". /// [JsonProperty("financial_status")] - public ShopifyOrderFinancialStatus? FinancialStatus { get; set; } + public string FinancialStatus { get; set; } /// /// An array of objects for this order. diff --git a/ShopifySharp/Enums/ShopifyOrderFinancialStatus.cs b/ShopifySharp/Enums/ShopifyOrderFinancialStatus.cs deleted file mode 100644 index 3065cbf6e..000000000 --- a/ShopifySharp/Enums/ShopifyOrderFinancialStatus.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Newtonsoft.Json; -using System.Runtime.Serialization; -using ShopifySharp.Converters; - -namespace ShopifySharp.Enums -{ - /// - /// The financial status of an order. - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyOrderFinancialStatus - { - /// - /// The finances are pending. - /// - [EnumMember(Value = "pending")] - Pending, - - /// - /// The finances have been authorized. - /// - [EnumMember(Value = "authorized")] - Authorized, - - /// - /// The finances have been partially paid. - /// - [EnumMember(Value = "partially_paid")] - PartiallyPaid, - - /// - /// The finances have been paid. (This is the default value.) - /// - [EnumMember(Value = "paid")] - Paid, - - /// - /// The finances have been partially refunded. - /// - [EnumMember(Value = "partially_refunded")] - PartiallyRefunded, - - /// - /// The finances have been refunded. - /// - [EnumMember(Value = "refunded")] - Refunded, - - /// - /// The finances have been voided. - /// - [EnumMember(Value = "voided")] - Voided - } -} diff --git a/ShopifySharp/Filters/ShopifyOrderFilter.cs b/ShopifySharp/Filters/ShopifyOrderFilter.cs index c472f66d8..c362e15c1 100644 --- a/ShopifySharp/Filters/ShopifyOrderFilter.cs +++ b/ShopifySharp/Filters/ShopifyOrderFilter.cs @@ -16,10 +16,10 @@ public class ShopifyOrderFilter : ShopifyListFilter public string Status { get; set; } = "any"; /// - /// The financial status of orders to retrieve. Leave this null to retrieve orders with any financial status. + /// The financial status of orders to retrieve. Known values are "authorized", "paid", "pending", "partially_paid", "partially_refunded", "refunded" and "voided". /// [JsonProperty("financial_status")] - public ShopifyOrderFinancialStatus? FinancialStatus { get; set; } + public string FinancialStatus { get; set; } /// /// The fulfillment status of orders to retrieve. Leave this null to retrieve orders with any fulfillment status. diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index ecac6c63a..a7ab6adec 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -91,7 +91,6 @@ - From 97f2556f07f05c7f7b5641722113997fc3a266df Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Tue, 13 Sep 2016 16:09:38 -0500 Subject: [PATCH 04/30] Remove OrderCancelReason enum --- ShopifySharp/Entities/ShopifyOrder.cs | 4 +- .../Enums/ShopifyOrderCancelReason.cs | 37 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 3 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyOrderCancelReason.cs diff --git a/ShopifySharp/Entities/ShopifyOrder.cs b/ShopifySharp/Entities/ShopifyOrder.cs index b45a3705b..d9b99675e 100644 --- a/ShopifySharp/Entities/ShopifyOrder.cs +++ b/ShopifySharp/Entities/ShopifyOrder.cs @@ -33,10 +33,10 @@ public class ShopifyOrder : ShopifyObject public bool BuyerAcceptsMarketing { get; set; } /// - /// The reason why the order was cancelled. If the order was not cancelled, this value is null. + /// The reason why the order was cancelled. If the order was not cancelled, this value is null. Known values are "customer", "fraud", "inventory" and "other". /// [JsonProperty("cancel_reason")] - public ShopifyOrderCancelReason? CancelReason { get; set; } + public string CancelReason { get; set; } /// /// The date and time when the order was cancelled. If the order was not cancelled, this value is null. diff --git a/ShopifySharp/Enums/ShopifyOrderCancelReason.cs b/ShopifySharp/Enums/ShopifyOrderCancelReason.cs deleted file mode 100644 index 0eb724d47..000000000 --- a/ShopifySharp/Enums/ShopifyOrderCancelReason.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Newtonsoft.Json; -using System.Runtime.Serialization; -using ShopifySharp.Converters; - -namespace ShopifySharp.Enums -{ - /// - /// The reason why an order was cancelled. - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyOrderCancelReason - { - /// - /// The customer changed or cancelled the order. - /// - [EnumMember(Value = "customer")] - Customer, - - /// - /// The order was fraudulent. - /// - [EnumMember(Value = "fraud")] - Fraud, - - /// - /// Items in the order were not in inventory. - /// - [EnumMember(Value = "inventory")] - Inventory, - - /// - /// The order was cancelled for a reason not in the list above. - /// - [EnumMember(Value = "other")] - Other - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index a7ab6adec..297dbb536 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -130,7 +130,6 @@ - From 2c299295b04aee42759e686289e4216489b32479 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 11:44:54 -0500 Subject: [PATCH 05/30] Don't default the 'Status' property to 'any' --- ShopifySharp/Filters/ShopifyOrderFilter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ShopifySharp/Filters/ShopifyOrderFilter.cs b/ShopifySharp/Filters/ShopifyOrderFilter.cs index c362e15c1..5e7d65d33 100644 --- a/ShopifySharp/Filters/ShopifyOrderFilter.cs +++ b/ShopifySharp/Filters/ShopifyOrderFilter.cs @@ -10,10 +10,10 @@ namespace ShopifySharp.Filters public class ShopifyOrderFilter : ShopifyListFilter { /// - /// The status of orders to retrieve. Known values are "open", "closed", "cancelled" and "any" (default). + /// The status of orders to retrieve. Known values are "open", "closed", "cancelled" and "any". /// [JsonProperty("status")] - public string Status { get; set; } = "any"; + public string Status { get; set; } /// /// The financial status of orders to retrieve. Known values are "authorized", "paid", "pending", "partially_paid", "partially_refunded", "refunded" and "voided". From 7a87019f472110fde9d8da5486cb914727d6a707 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 11:48:15 -0500 Subject: [PATCH 06/30] Remove ShopifyAssetType enum --- ShopifySharp/Enums/ShopifyAssetType.cs | 32 -------------------------- ShopifySharp/ShopifySharp.csproj | 1 - 2 files changed, 33 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyAssetType.cs diff --git a/ShopifySharp/Enums/ShopifyAssetType.cs b/ShopifySharp/Enums/ShopifyAssetType.cs deleted file mode 100644 index 9c49374a7..000000000 --- a/ShopifySharp/Enums/ShopifyAssetType.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - /// - /// An enum representing the type or "bucket" of a . - /// - /// This enum is never serialized or deserialized. - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyAssetType - { - /// - /// The asset is part of the layout bucket. - /// - [EnumMember(Value ="layout")] - Layout, - - /// - /// The asset is part of the templates bucket. - /// - [EnumMember(Value = "templates")] - Templates, - - /// - /// The asset is part of the assets bucket. - /// - [EnumMember(Value = "assets")] - Assets - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index 297dbb536..186e9e734 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -88,7 +88,6 @@ - From 33fd47df5c5d544c2740b6f761028b9247090538 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 11:50:15 -0500 Subject: [PATCH 07/30] Remove ShopifYChargeStatus enum --- .../When_activating_a_charge.cs | 2 +- .../When_activating_a_recurring_charge.cs | 2 +- ShopifySharp/Entities/ShopifyCharge.cs | 4 +- .../Entities/ShopifyRecurringCharge.cs | 4 +- ShopifySharp/Enums/ShopifyChargeStatus.cs | 50 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 6 files changed, 6 insertions(+), 57 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyChargeStatus.cs diff --git a/ShopifySharp.Tests/ShopifyChargeService Tests/When_activating_a_charge.cs b/ShopifySharp.Tests/ShopifyChargeService Tests/When_activating_a_charge.cs index bf2fd80ff..73e28b8cc 100644 --- a/ShopifySharp.Tests/ShopifyChargeService Tests/When_activating_a_charge.cs +++ b/ShopifySharp.Tests/ShopifyChargeService Tests/When_activating_a_charge.cs @@ -35,7 +35,7 @@ class When_activating_a_charge { // NOTE: This test will require you to set a break point after creating the charge but before activating it, // grab the confirmation url and manually accept it, then continue the test. - Charge.Status.ShouldEqual(Enums.ShopifyChargeStatus.Active); + Charge.Status.ShouldEqual("active"); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_activating_a_recurring_charge.cs b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_activating_a_recurring_charge.cs index 092b7785c..6945f7c18 100644 --- a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_activating_a_recurring_charge.cs +++ b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_activating_a_recurring_charge.cs @@ -36,7 +36,7 @@ class When_activating_a_recurring_charge { // NOTE: This test will require you to set a break point after creating the charge but before activating it, // grab the confirmation url and manually accept it, then continue the test. - Charge.Status.ShouldEqual(Enums.ShopifyChargeStatus.Active); + Charge.Status.ShouldEqual("active"); Charge.ActivatedOn.ShouldNotBeNull(); Charge.TrialEndsOn.ShouldNotBeNull(); }; diff --git a/ShopifySharp/Entities/ShopifyCharge.cs b/ShopifySharp/Entities/ShopifyCharge.cs index cdbf06f5f..40a35d60d 100644 --- a/ShopifySharp/Entities/ShopifyCharge.cs +++ b/ShopifySharp/Entities/ShopifyCharge.cs @@ -46,10 +46,10 @@ public class ShopifyCharge : ShopifyObject public string ReturnUrl { get; set; } /// - /// The status of the charged. + /// The status of the charged. Known values are 'pending', 'accepted', 'active', 'cancelled', 'declined' and 'expired'. /// [JsonProperty("status")] - public ShopifyChargeStatus? Status { get; set; } + public string Status { get; set; } /// /// States whether or not the application charge is a test transaction. diff --git a/ShopifySharp/Entities/ShopifyRecurringCharge.cs b/ShopifySharp/Entities/ShopifyRecurringCharge.cs index 9a97593a2..3fb4e9211 100644 --- a/ShopifySharp/Entities/ShopifyRecurringCharge.cs +++ b/ShopifySharp/Entities/ShopifyRecurringCharge.cs @@ -72,10 +72,10 @@ public class ShopifyRecurringCharge: ShopifyObject public string ReturnUrl { get; set; } /// - /// The status of the charged. + /// Known values are 'pending', 'accepted', 'active', 'cancelled', 'declined' and 'expired'. /// [JsonProperty("status")] - public ShopifyChargeStatus? Status { get; set; } + public string Status { get; set; } /// /// States the terms and conditions of usage based billing charges. Must be present in order to create usage charges. These are presented to the merchant when they approve the usage charges for your app. diff --git a/ShopifySharp/Enums/ShopifyChargeStatus.cs b/ShopifySharp/Enums/ShopifyChargeStatus.cs deleted file mode 100644 index f989d9d84..000000000 --- a/ShopifySharp/Enums/ShopifyChargeStatus.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - /// - /// An enum that indicates the status of and objects. - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyChargeStatus - { - /// - /// The charge is pending and has not been accepted or declined by the user. - /// - [EnumMember(Value = "pending")] - Pending, - - /// - /// The charge has been accepted by the user and can be activated. - /// - [EnumMember(Value = "accepted")] - Accepted, - - /// - /// The charge has been accepted and activated. - /// - [EnumMember(Value = "active")] - Active, - - /// - /// The charge has been cancelled. - /// - [EnumMember(Value = "cancelled")] - Cancelled, - - /// - /// The charge has been declined by the user and cannot be activated. - /// - [EnumMember(Value = "declined")] - Declined, - - /// - /// The charge has expired. - /// - [EnumMember(Value = "expired")] - Expired, - - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index 186e9e734..3121c2d0d 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -90,7 +90,6 @@ - From 19f8d7b1b55cb822794d73bd91658640b947eb12 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 11:51:30 -0500 Subject: [PATCH 08/30] Remove ShopifyDiscountCodeType enum --- ShopifySharp/Entities/ShopifyDiscountCode.cs | 4 +- ShopifySharp/Enums/ShopifyDiscountCodeType.cs | 37 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 3 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyDiscountCodeType.cs diff --git a/ShopifySharp/Entities/ShopifyDiscountCode.cs b/ShopifySharp/Entities/ShopifyDiscountCode.cs index 6f249ca64..66c0b43c7 100644 --- a/ShopifySharp/Entities/ShopifyDiscountCode.cs +++ b/ShopifySharp/Entities/ShopifyDiscountCode.cs @@ -23,9 +23,9 @@ public class ShopifyDiscountCode public string Code { get; set; } /// - /// The type of discount. + /// The type of discount. Known values are 'percentage', 'shipping', 'fixed_amount' and 'none'. /// [JsonProperty("type")] - public ShopifyDiscountCodeType? Type { get; set; } + public string Type { get; set; } } } diff --git a/ShopifySharp/Enums/ShopifyDiscountCodeType.cs b/ShopifySharp/Enums/ShopifyDiscountCodeType.cs deleted file mode 100644 index 133ac1866..000000000 --- a/ShopifySharp/Enums/ShopifyDiscountCodeType.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Newtonsoft.Json; -using System.Runtime.Serialization; -using ShopifySharp.Converters; - -namespace ShopifySharp.Enums -{ - /// - /// The type of discount. - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyDiscountCodeType - { - /// - /// Discount is a percentage. - /// - [EnumMember(Value = "percentage")] - Percentage, - - /// - /// Discount is for shipping. - /// - [EnumMember(Value = "shipping")] - Shipping, - - /// - /// Discount is a fixed amount. - /// - [EnumMember(Value = "fixed_amount")] - FixedAmount, - - /// - /// No discount. - /// - [EnumMember(Value = "none")] - None, - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index 3121c2d0d..3ec4fa5bb 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -88,7 +88,6 @@ - From 1df7ce2f7a67be0f14f7501793b033d9a8e468ee Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 11:52:42 -0500 Subject: [PATCH 09/30] Remove ShopifyOrderCreateOptions enum --- .../Enums/ShopifyInventoryBehavior.cs | 28 ------------------- .../Order/ShopifyOrderCreateOptions.cs | 5 +++- ShopifySharp/ShopifySharp.csproj | 1 - 3 files changed, 4 insertions(+), 30 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyInventoryBehavior.cs diff --git a/ShopifySharp/Enums/ShopifyInventoryBehavior.cs b/ShopifySharp/Enums/ShopifyInventoryBehavior.cs deleted file mode 100644 index 939b8b212..000000000 --- a/ShopifySharp/Enums/ShopifyInventoryBehavior.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyInventoryBehavior - { - /// - /// Do not claim inventory. Default. - /// - [EnumMember(Value = "bypass")] - Bypass, - - /// - /// Ignore the product's inventory policy and claim amounts no matter what. - /// - [EnumMember(Value = "decrement_ignoring_policy")] - DecrementIgnoringPolicy, - - /// - /// Obey the product's inventory policy. - /// - [EnumMember(Value = "decrement_obeying_policy")] - DecrementObeyingPolicy - } -} diff --git a/ShopifySharp/Services/Order/ShopifyOrderCreateOptions.cs b/ShopifySharp/Services/Order/ShopifyOrderCreateOptions.cs index 8e0b7a424..7d956fd2b 100644 --- a/ShopifySharp/Services/Order/ShopifyOrderCreateOptions.cs +++ b/ShopifySharp/Services/Order/ShopifyOrderCreateOptions.cs @@ -19,7 +19,10 @@ public class ShopifyOrderCreateOptions : Parameterizable [JsonProperty("send_fulfillment_receipt")] public bool? SendFulfillmentReceipt { get; set; } + /// + /// The inventory behavior for the order. Known values are 'bypass', 'decrement_ignoring_policy' and 'decrement_obeying_policy'. + /// [JsonProperty("inventory_behavior")] - public ShopifyInventoryBehavior? InventoryBehavior {get; set;} + public string InventoryBehavior {get; set;} } } diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index 3ec4fa5bb..e6dbdaa24 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -88,7 +88,6 @@ - From 5a4aed92ec66fd8e1192922be5f56cd0188d863a Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 11:56:30 -0500 Subject: [PATCH 10/30] Remove ShopifyProcessingMethod enum --- ShopifySharp/Entities/ShopifyOrder.cs | 4 +-- ShopifySharp/Enums/ShopifyProcessingMethod.cs | 34 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 3 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyProcessingMethod.cs diff --git a/ShopifySharp/Entities/ShopifyOrder.cs b/ShopifySharp/Entities/ShopifyOrder.cs index d9b99675e..843b7b603 100644 --- a/ShopifySharp/Entities/ShopifyOrder.cs +++ b/ShopifySharp/Entities/ShopifyOrder.cs @@ -181,10 +181,10 @@ public class ShopifyOrder : ShopifyObject public DateTime? ProcessedAt { get; set; } /// - /// The type of payment processing method + /// The type of payment processing method. Known values are 'checkout', 'direct', 'manual', 'offsite', 'express', 'free' and 'none'. /// [JsonProperty("processing_method")] - public ShopifyProcessingMethod? ProcessingMethod { get; set; } + public string ProcessingMethod { get; set; } /// /// The website that the customer clicked on to come to the shop. diff --git a/ShopifySharp/Enums/ShopifyProcessingMethod.cs b/ShopifySharp/Enums/ShopifyProcessingMethod.cs deleted file mode 100644 index 0b50398f4..000000000 --- a/ShopifySharp/Enums/ShopifyProcessingMethod.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Newtonsoft.Json; -using System.Runtime.Serialization; -using ShopifySharp.Converters; - -namespace ShopifySharp.Enums -{ - /// - /// The type of payment processing method - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyProcessingMethod - { - [EnumMember(Value = "checkout")] - Checkout, - - [EnumMember(Value = "direct")] - Direct, - - [EnumMember(Value = "manual")] - Manual, - - [EnumMember(Value = "offsite")] - Offsite, - - [EnumMember(Value = "express")] - Express, - - [EnumMember(Value = "free")] - Free, - - [EnumMember(Value = "none")] - None - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index e6dbdaa24..bf5173f38 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -129,7 +129,6 @@ - From 157a79518e4576bd5b0c7206a1cf38e8676b8731 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 11:57:35 -0500 Subject: [PATCH 11/30] Remove ShopifyProductInventoryManagement enum --- .../Entities/ShopifyProductVariant.cs | 4 ++-- .../ShopifyProductInventoryManagement.cs | 22 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 3 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyProductInventoryManagement.cs diff --git a/ShopifySharp/Entities/ShopifyProductVariant.cs b/ShopifySharp/Entities/ShopifyProductVariant.cs index 723298367..b8144436a 100644 --- a/ShopifySharp/Entities/ShopifyProductVariant.cs +++ b/ShopifySharp/Entities/ShopifyProductVariant.cs @@ -51,10 +51,10 @@ public class ShopifyProductVariant : ShopifyObject public string FulfillmentService { get; set; } /// - /// Specifies whether or not Shopify tracks the number of items in stock for this product variant. + /// Specifies whether or not Shopify tracks the number of items in stock for this product variant. Known values are 'blank' and 'shopify'. /// [JsonProperty("inventory_management")] - public ShopifyProductInventoryManagement? InventoryManagement { get; set; } + public string InventoryManagement { get; set; } /// /// The price of the product variant. diff --git a/ShopifySharp/Enums/ShopifyProductInventoryManagement.cs b/ShopifySharp/Enums/ShopifyProductInventoryManagement.cs deleted file mode 100644 index 5eee51c63..000000000 --- a/ShopifySharp/Enums/ShopifyProductInventoryManagement.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Runtime.Serialization; -using Newtonsoft.Json; -using ShopifySharp.Converters; - -namespace ShopifySharp.Enums -{ - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyProductInventoryManagement - { - /// - /// Shopify does not track the number of items in stock for this product variant. - /// - [EnumMember(Value = "blank")] - Blank, - - /// - /// Shopify does track the number of items in stock for this product variant. - /// - [EnumMember(Value = "shopify")] - Shopify, - } -} \ No newline at end of file diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index bf5173f38..eb6fd0d13 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -78,7 +78,6 @@ - From 97df8522fda42f65d42757a9f00e63f15902481d Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 13:23:41 -0500 Subject: [PATCH 12/30] Remove ShopifyProductInventoryPolicy enum --- .../Entities/ShopifyProductVariant.cs | 6 ++--- .../Enums/ShopifyProductInventoryPolicy.cs | 22 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 3 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyProductInventoryPolicy.cs diff --git a/ShopifySharp/Entities/ShopifyProductVariant.cs b/ShopifySharp/Entities/ShopifyProductVariant.cs index b8144436a..1ea4c4b22 100644 --- a/ShopifySharp/Entities/ShopifyProductVariant.cs +++ b/ShopifySharp/Entities/ShopifyProductVariant.cs @@ -37,12 +37,12 @@ public class ShopifyProductVariant : ShopifyObject /// [JsonProperty("grams"),JsonConverter(typeof(NullToZeroConverter))] public int Grams { get; set; } - + /// - /// Specifies whether or not customers are allowed to place an order for a product variant when it's out of stock. + /// Specifies whether or not customers are allowed to place an order for a product variant when it's out of stock. Known values are 'deny' and 'continue'. /// [JsonProperty("inventory_policy")] - public ShopifyProductInventoryPolicy? InventoryPolicy { get; set; } + public string InventoryPolicy { get; set; } /// /// Service that is doing the fulfillment. Can be 'manual' or any custom string. diff --git a/ShopifySharp/Enums/ShopifyProductInventoryPolicy.cs b/ShopifySharp/Enums/ShopifyProductInventoryPolicy.cs deleted file mode 100644 index 97763123f..000000000 --- a/ShopifySharp/Enums/ShopifyProductInventoryPolicy.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Runtime.Serialization; -using Newtonsoft.Json; -using ShopifySharp.Converters; - -namespace ShopifySharp.Enums -{ - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyProductInventoryPolicy - { - /// - /// Customers are not allowed to place orders for a product variant when it's out of stock. - /// - [EnumMember(Value = "deny")] - Deny, - - /// - /// Customers are allowed to place orders for a product variatn when it's out of stock. - /// - [EnumMember(Value = "continue")] - Continue, - } -} \ No newline at end of file diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index eb6fd0d13..1a1a9e54d 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -78,7 +78,6 @@ - From 96945b1b0e0941e60153bc4743071682675580f1 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 13:25:14 -0500 Subject: [PATCH 13/30] Remove ShopifyThemeRole enum --- .../Test_Data/ThemeCreation.cs | 2 +- .../When_creating_a_theme.cs | 2 +- .../When_deserializing_a_theme.cs | 2 +- .../When_updating_a_theme.cs | 4 +-- ShopifySharp/Entities/ShopifyTheme.cs | 6 ++-- ShopifySharp/Enums/ShopifyThemeRole.cs | 31 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 7 files changed, 8 insertions(+), 40 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyThemeRole.cs diff --git a/ShopifySharp.Tests/ShopifyThemeService Tests/Test_Data/ThemeCreation.cs b/ShopifySharp.Tests/ShopifyThemeService Tests/Test_Data/ThemeCreation.cs index 3826311f4..2afb27718 100644 --- a/ShopifySharp.Tests/ShopifyThemeService Tests/Test_Data/ThemeCreation.cs +++ b/ShopifySharp.Tests/ShopifyThemeService Tests/Test_Data/ThemeCreation.cs @@ -18,7 +18,7 @@ public static ShopifyTheme CreateValidTheme() return new ShopifyTheme() { Name = "My new theme.", - Role = Enums.ShopifyThemeRole.Unpublished + Role = "unpublished" }; } } diff --git a/ShopifySharp.Tests/ShopifyThemeService Tests/When_creating_a_theme.cs b/ShopifySharp.Tests/ShopifyThemeService Tests/When_creating_a_theme.cs index 26b2f5907..99424b29f 100644 --- a/ShopifySharp.Tests/ShopifyThemeService Tests/When_creating_a_theme.cs +++ b/ShopifySharp.Tests/ShopifyThemeService Tests/When_creating_a_theme.cs @@ -24,7 +24,7 @@ class When_creating_a_themes It should_create_a_theme = () => { Theme.Id.HasValue.ShouldBeTrue(); - Theme.Role.ShouldEqual(Enums.ShopifyThemeRole.Unpublished); + Theme.Role.ShouldEqual("unpublished"); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyThemeService Tests/When_deserializing_a_theme.cs b/ShopifySharp.Tests/ShopifyThemeService Tests/When_deserializing_a_theme.cs index 4dc0551dd..237dbc050 100644 --- a/ShopifySharp.Tests/ShopifyThemeService Tests/When_deserializing_a_theme.cs +++ b/ShopifySharp.Tests/ShopifyThemeService Tests/When_deserializing_a_theme.cs @@ -32,7 +32,7 @@ class When_deserializing_a_theme Theme2.Role.ShouldBeNull(); - Theme3.Role.ShouldEqual(Enums.ShopifyThemeRole.Main); + Theme3.Role.ShouldEqual("main"); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyThemeService Tests/When_updating_a_theme.cs b/ShopifySharp.Tests/ShopifyThemeService Tests/When_updating_a_theme.cs index 64846abc2..23b150c83 100644 --- a/ShopifySharp.Tests/ShopifyThemeService Tests/When_updating_a_theme.cs +++ b/ShopifySharp.Tests/ShopifyThemeService Tests/When_updating_a_theme.cs @@ -34,7 +34,7 @@ class When_updating_a_themes } Theme.Name = UpdatedThemeName; - Theme.Role = Enums.ShopifyThemeRole.Main; + Theme.Role = "main"; }; Because of = () => @@ -45,7 +45,7 @@ class When_updating_a_themes It should_update_a_themes = () => { Theme.Name.ShouldEqual(UpdatedThemeName); - Theme.Role.ShouldEqual(Enums.ShopifyThemeRole.Main); + Theme.Role.ShouldEqual("main"); }; Cleanup after = () => diff --git a/ShopifySharp/Entities/ShopifyTheme.cs b/ShopifySharp/Entities/ShopifyTheme.cs index 4aa5c329b..5677a6ef0 100644 --- a/ShopifySharp/Entities/ShopifyTheme.cs +++ b/ShopifySharp/Entities/ShopifyTheme.cs @@ -24,12 +24,12 @@ public class ShopifyTheme : ShopifyObject /// [JsonProperty("name")] public string Name { get; set; } - + /// - /// Specifies how the theme is being used within the shop. + /// Specifies how the theme is being used within the shop. Known values are 'main', 'mobile' and 'unpublished'. /// [JsonProperty("role")] - public ShopifyThemeRole? Role { get; set; } + public string Role { get; set; } /// /// The date and time when the theme was last updated. diff --git a/ShopifySharp/Enums/ShopifyThemeRole.cs b/ShopifySharp/Enums/ShopifyThemeRole.cs deleted file mode 100644 index 38d46b1bc..000000000 --- a/ShopifySharp/Enums/ShopifyThemeRole.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - /// - /// Specifies how a theme is being used within the shop. - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyThemeRole - { - /// - /// This theme can be seen by customers when visiting the shop in a desktop browser. - /// - [EnumMember(Value = "main")] - Main, - - /// - /// This theme can be seen by customers when visiting the shop in a mobile browser. - /// - [EnumMember(Value = "mobile")] - Mobile, - - /// - /// This theme cannot currently be seen by customers. - /// - [EnumMember(Value = "unpublished")] - Unpublished - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index 1a1a9e54d..5607a3f49 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -87,7 +87,6 @@ - From 4986db4973fe3849b9a1ee40e2d0a495bcbd23b8 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 13:27:03 -0500 Subject: [PATCH 14/30] Remove ShopifyScriptTagEvent enum --- .../When_counting_script_tags.cs | 2 +- .../When_creating_a_script_tag.cs | 2 +- .../When_deleting_a_script_tag.cs | 2 +- .../When_getting_a_script_tag.cs | 2 +- .../When_listing_script_tags.cs | 2 +- .../When_updating_a_script_tag.cs | 2 +- ShopifySharp/Entities/ShopifyScriptTag.cs | 4 ++-- ShopifySharp/Enums/ShopifyScriptTagEvent.cs | 19 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 9 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyScriptTagEvent.cs diff --git a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_counting_script_tags.cs b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_counting_script_tags.cs index 2bb817c9d..709896678 100644 --- a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_counting_script_tags.cs +++ b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_counting_script_tags.cs @@ -21,7 +21,7 @@ class When_counting_script_tags Tags.Add(Service.CreateAsync(new ShopifyScriptTag() { - Event = Enums.ShopifyScriptTagEvent.Onload, + Event = "onload", Src = src }).Await().AsTask.Result); } diff --git a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_creating_a_script_tag.cs b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_creating_a_script_tag.cs index ff4863fbe..e96523cbb 100644 --- a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_creating_a_script_tag.cs +++ b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_creating_a_script_tag.cs @@ -19,7 +19,7 @@ class When_creating_a_script_tag { Tag = Service.CreateAsync(new ShopifyScriptTag() { - Event = Enums.ShopifyScriptTagEvent.Onload, + Event = "onload", Src = "https://nozzlegear.com/test.js" }).Await().AsTask.Result; }; diff --git a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_deleting_a_script_tag.cs b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_deleting_a_script_tag.cs index bcfddb164..dd90bb983 100644 --- a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_deleting_a_script_tag.cs +++ b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_deleting_a_script_tag.cs @@ -15,7 +15,7 @@ class When_deleting_a_script_tag Service = new ShopifyScriptTagService(Utils.MyShopifyUrl, Utils.AccessToken); Tag = Service.CreateAsync(new ShopifyScriptTag() { - Event = Enums.ShopifyScriptTagEvent.Onload, + Event = "onload", Src = "https://nozzlegear.com/test.js" }).Await().AsTask.Result; }; diff --git a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_getting_a_script_tag.cs b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_getting_a_script_tag.cs index 4a847ae85..5fb676f84 100644 --- a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_getting_a_script_tag.cs +++ b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_getting_a_script_tag.cs @@ -15,7 +15,7 @@ class When_getting_a_script_tag Service = new ShopifyScriptTagService(Utils.MyShopifyUrl, Utils.AccessToken); TagId = Service.CreateAsync(new ShopifyScriptTag() { - Event = Enums.ShopifyScriptTagEvent.Onload, + Event = "onload", Src = "https://nozzlegear.com/test.js" }).Await().AsTask.Result.Id.Value; }; diff --git a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_listing_script_tags.cs b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_listing_script_tags.cs index f0fd97972..ccf19c056 100644 --- a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_listing_script_tags.cs +++ b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_listing_script_tags.cs @@ -21,7 +21,7 @@ class When_listing_script_tags Service.CreateAsync(new ShopifyScriptTag() { - Event = Enums.ShopifyScriptTagEvent.Onload, + Event = "onload", Src = src }).Await(); } diff --git a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_updating_a_script_tag.cs b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_updating_a_script_tag.cs index dfd3d379d..c647cc5a6 100644 --- a/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_updating_a_script_tag.cs +++ b/ShopifySharp.Tests/ShopifyScriptTagService Tests/When_updating_a_script_tag.cs @@ -15,7 +15,7 @@ class When_updating_a_script_tag Service = new ShopifyScriptTagService(Utils.MyShopifyUrl, Utils.AccessToken); OriginalTag = Service.CreateAsync(new ShopifyScriptTag() { - Event = Enums.ShopifyScriptTagEvent.Onload, + Event = "onload", Src = "https://nozzlegear.com/test.js" }).Await().AsTask.Result; diff --git a/ShopifySharp/Entities/ShopifyScriptTag.cs b/ShopifySharp/Entities/ShopifyScriptTag.cs index 05c8d43d6..e8fc2a453 100644 --- a/ShopifySharp/Entities/ShopifyScriptTag.cs +++ b/ShopifySharp/Entities/ShopifyScriptTag.cs @@ -21,10 +21,10 @@ public class ShopifyScriptTag: ShopifyObject public DateTime CreatedAt { get; set; } /// - /// DOM event which triggers the loading of the script. Valid values are: . + /// DOM event which triggers the loading of the script. The only known value is 'onload'. /// [JsonProperty("event")] - public ShopifyScriptTagEvent? Event { get; set; } + public string Event { get; set; } /// /// Specifies the location of the ScriptTag. diff --git a/ShopifySharp/Enums/ShopifyScriptTagEvent.cs b/ShopifySharp/Enums/ShopifyScriptTagEvent.cs deleted file mode 100644 index 413c7666d..000000000 --- a/ShopifySharp/Enums/ShopifyScriptTagEvent.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - /// - /// An enum representing the type of . - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyScriptTagEvent - { - /// - /// The script tag is triggered when the DOM fires the "Onload" event. - /// - [EnumMember(Value = "onload")] - Onload - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index 5607a3f49..56da14795 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -86,7 +86,6 @@ - From 611dde2c15309dc9b2d7e2c4c00aca2878435af3 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 13:47:09 -0500 Subject: [PATCH 15/30] Remove ShopifyTransactionKind enum --- .../Test_Data/OrderCreation.cs | 2 +- .../Test_Data/Setup.cs | 2 +- .../When_counting_transactions.cs | 2 +- ..._creating_a_partial_transaction_capture.cs | 4 +- .../When_creating_a_refund_transaction.cs | 4 +- .../When_creating_a_transaction.cs | 4 +- .../When_creating_a_void_transaction.cs | 4 +- .../When_deserializing_a_transaction.cs | 4 +- .../When_getting_a_transaction.cs | 4 +- .../When_listing_transactions.cs | 2 +- ...When_listing_transactions_with_a_filter.cs | 2 +- ShopifySharp/Entities/ShopifyTransaction.cs | 4 +- ShopifySharp/Enums/ShopifyTransactionKind.cs | 43 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 14 files changed, 19 insertions(+), 63 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyTransactionKind.cs diff --git a/ShopifySharp.Tests/ShopifyOrderService Tests/Test_Data/OrderCreation.cs b/ShopifySharp.Tests/ShopifyOrderService Tests/Test_Data/OrderCreation.cs index 2f00dee8c..07911b030 100644 --- a/ShopifySharp.Tests/ShopifyOrderService Tests/Test_Data/OrderCreation.cs +++ b/ShopifySharp.Tests/ShopifyOrderService Tests/Test_Data/OrderCreation.cs @@ -56,7 +56,7 @@ public static ShopifyOrder GenerateOrder() { Amount = 20.00, Status = "success", - Kind = Enums.ShopifyTransactionKind.Authorization, + Kind = "authorization", Test = true, } }, diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/Test_Data/Setup.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/Test_Data/Setup.cs index 514f1aa73..531fd9999 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/Test_Data/Setup.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/Test_Data/Setup.cs @@ -12,7 +12,7 @@ public static class Setup /// /// Generates a valid for testing the Transaction API. /// - public static ShopifyTransaction GenerateTransaction(ShopifyTransactionKind kind = ShopifyTransactionKind.Authorization , double? amount = null) + public static ShopifyTransaction GenerateTransaction(string kind = "authorization", double? amount = null) { return new ShopifyTransaction() { diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_counting_transactions.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_counting_transactions.cs index 7346fd28f..76d5f6552 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_counting_transactions.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_counting_transactions.cs @@ -19,7 +19,7 @@ class When_counting_transactions for (var i = 0; i < 2; i++) { Service - .CreateAsync(Order.Id.Value, Setup.GenerateTransaction(ShopifyTransactionKind.Capture, 5.00)) + .CreateAsync(Order.Id.Value, Setup.GenerateTransaction("capture", 5.00)) .Await(); } }; diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_partial_transaction_capture.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_partial_transaction_capture.cs index 5e76d4c10..f8282a704 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_partial_transaction_capture.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_partial_transaction_capture.cs @@ -20,7 +20,7 @@ class When_creating_a_partial_transaction_capture Because of = () => { Transaction = Service - .CreateAsync(Order.Id.Value, Setup.GenerateTransaction(ShopifyTransactionKind.Capture, 5.00)) + .CreateAsync(Order.Id.Value, Setup.GenerateTransaction("capture", 5.00)) .Await() .AsTask .Result; @@ -31,7 +31,7 @@ class When_creating_a_partial_transaction_capture Transaction.ShouldNotBeNull(); Transaction.Status.ShouldEqual("success"); Transaction.ErrorCode.ShouldBeNull(); - Transaction.Kind.ShouldEqual(ShopifyTransactionKind.Capture); + Transaction.Kind.ShouldEqual("capture"); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_refund_transaction.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_refund_transaction.cs index ee3c4a939..6d5ebfb51 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_refund_transaction.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_refund_transaction.cs @@ -20,7 +20,7 @@ class When_creating_a_refund_transaction Because of = () => { Transaction = Service - .CreateAsync(Order.Id.Value, Setup.GenerateTransaction(ShopifyTransactionKind.Refund)) + .CreateAsync(Order.Id.Value, Setup.GenerateTransaction("refund")) .Await() .AsTask .Result; @@ -32,7 +32,7 @@ class When_creating_a_refund_transaction Transaction.ShouldNotBeNull(); Transaction.Status.ShouldEqual("success"); Transaction.ErrorCode.ShouldBeNull(); - Transaction.Kind.ShouldEqual(Enums.ShopifyTransactionKind.Refund); + Transaction.Kind.ShouldEqual("refund"); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_transaction.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_transaction.cs index 84b67d2a5..909053ad2 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_transaction.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_transaction.cs @@ -15,7 +15,7 @@ class When_creating_a_transaction Because of = () => { Transaction = Service - .CreateAsync(Order.Id.Value, Setup.GenerateTransaction(ShopifyTransactionKind.Capture)) + .CreateAsync(Order.Id.Value, Setup.GenerateTransaction("capture")) .Await() .AsTask .Result; @@ -26,7 +26,7 @@ class When_creating_a_transaction Transaction.ShouldNotBeNull(); Transaction.Status.ShouldEqual("success"); Transaction.ErrorCode.ShouldBeNull(); - Transaction.Kind.ShouldEqual(ShopifyTransactionKind.Capture); + Transaction.Kind.ShouldEqual("capture"); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_void_transaction.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_void_transaction.cs index 1a826363e..c28763ac6 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_void_transaction.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_creating_a_void_transaction.cs @@ -20,7 +20,7 @@ class When_creating_a_void_transaction Because of = () => { Transaction = Service - .CreateAsync(Order.Id.Value, Setup.GenerateTransaction(ShopifyTransactionKind.Void)) + .CreateAsync(Order.Id.Value, Setup.GenerateTransaction("void")) .Await() .AsTask .Result; @@ -32,7 +32,7 @@ class When_creating_a_void_transaction Transaction.ShouldNotBeNull(); Transaction.Status.ShouldEqual("success"); Transaction.ErrorCode.ShouldBeNull(); - Transaction.Kind.ShouldEqual(ShopifyTransactionKind.Void); + Transaction.Kind.ShouldEqual("void"); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs index 7bf619f1c..7d9886f49 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs @@ -29,13 +29,13 @@ class When_deserializing_a_transaction It should_deserialize_a_transaction = () => { - Transaction1.Kind.ShouldEqual(ShopifyTransactionKind.Capture); + Transaction1.Kind.ShouldEqual("capture"); Transaction1.ErrorCode.ShouldEqual(ShopifyTransactionError.CardDeclined); Transaction2.Kind.ShouldBeNull(); Transaction2.ErrorCode.ShouldBeNull(); - Transaction3.Kind.ShouldEqual(ShopifyTransactionKind.Void); + Transaction3.Kind.ShouldEqual("void"); Transaction3.ErrorCode.ShouldEqual(ShopifyTransactionError.IncorrectAddress); }; diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_getting_a_transaction.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_getting_a_transaction.cs index 8d6a978b0..6d23c5a5f 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_getting_a_transaction.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_getting_a_transaction.cs @@ -16,7 +16,7 @@ class When_gettng_a_transaction Service = new ShopifyTransactionService(Utils.MyShopifyUrl, Utils.AccessToken); Order = Setup.CreateOrder().Await().AsTask.Result; Id = Service - .CreateAsync(Order.Id.Value, Setup.GenerateTransaction(ShopifyTransactionKind.Capture)) + .CreateAsync(Order.Id.Value, Setup.GenerateTransaction("capture")) .Await() .AsTask .Result @@ -38,7 +38,7 @@ class When_gettng_a_transaction Transaction.ShouldNotBeNull(); Transaction.Status.ShouldEqual("success"); Transaction.ErrorCode.ShouldBeNull(); - Transaction.Kind.ShouldEqual(ShopifyTransactionKind.Capture); + Transaction.Kind.ShouldEqual("capture"); }; Cleanup after = () => diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_listing_transactions.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_listing_transactions.cs index ace61dbd7..9d1c7b65f 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_listing_transactions.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_listing_transactions.cs @@ -19,7 +19,7 @@ class When_listing_transactions for (var i = 0; i < 2; i++) { Service - .CreateAsync(Order.Id.Value, Setup.GenerateTransaction(ShopifyTransactionKind.Capture, 5.00)) + .CreateAsync(Order.Id.Value, Setup.GenerateTransaction("capture", 5.00)) .Await(); } }; diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_listing_transactions_with_a_filter.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_listing_transactions_with_a_filter.cs index c956aed79..38e0fbc8a 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_listing_transactions_with_a_filter.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_listing_transactions_with_a_filter.cs @@ -19,7 +19,7 @@ class When_listing_transactions_with_a_filter for (var i = 0; i < 2; i++) { var transaction = Service - .CreateAsync(Order.Id.Value, Setup.GenerateTransaction(ShopifyTransactionKind.Capture, 5.00)) + .CreateAsync(Order.Id.Value, Setup.GenerateTransaction("capture", 5.00)) .Await() .AsTask .Result; diff --git a/ShopifySharp/Entities/ShopifyTransaction.cs b/ShopifySharp/Entities/ShopifyTransaction.cs index 2ccc76d7f..3d350cbb3 100644 --- a/ShopifySharp/Entities/ShopifyTransaction.cs +++ b/ShopifySharp/Entities/ShopifyTransaction.cs @@ -59,10 +59,10 @@ public class ShopifyTransaction : ShopifyObject public ShopifyPaymentDetails PaymentDetails { get; set; } /// - /// The kind of transaction. + /// The kind of transaction. Known values are 'authorization', 'capture', 'sale', 'void' and 'refund'. /// [JsonProperty("kind")] - public ShopifyTransactionKind? Kind { get; set; } + public string Kind { get; set; } /// /// A unique numeric identifier for the order. diff --git a/ShopifySharp/Enums/ShopifyTransactionKind.cs b/ShopifySharp/Enums/ShopifyTransactionKind.cs deleted file mode 100644 index fc290d293..000000000 --- a/ShopifySharp/Enums/ShopifyTransactionKind.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - /// - /// The kind of transaction. - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyTransactionKind - { - /// - /// Money that the customer has agreed to pay. Authorization period lasts for up to 7 to 30 days (depending on your payment service) while a store awaits for a customer's capture. - /// - [EnumMember(Value = "authorization")] - Authorization, - - /// - /// Transfer of money that was reserved during the authorization of a shop. - /// - [EnumMember(Value = "capture")] - Capture, - - /// - /// The combination of authorization and capture, performed in one single step. - /// - [EnumMember(Value = "sale")] - Sale, - - /// - /// The cancellation of a pending authorization or capture. - /// - [EnumMember(Value = "void")] - Void, - - /// - /// The partial or full return of the captured money to the customer. - /// - [EnumMember(Value = "refund")] - Refund - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index 56da14795..129a2eb00 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -137,7 +137,6 @@ - From 3a6b229120916b96ce91e3c41ab17484db195406 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 14:17:09 -0500 Subject: [PATCH 16/30] Remove ShopifyWebhookTopic enum --- .../Test_Data/WebhookCreation.cs | 2 +- .../When_counting_webhooks_with_a_filter.cs | 2 +- .../When_creating_a_webhook.cs | 2 +- .../When_listing_webhooks_with_a_filter.cs | 2 +- ShopifySharp/Entities/ShopifyWebhook.cs | 4 +- ShopifySharp/Enums/ShopifyWebhookTopic.cs | 223 ------------------ ShopifySharp/Filters/ShopifyWebhookFilter.cs | 4 +- .../Services/Webhook/ShopifyWebhookService.cs | 6 +- ShopifySharp/ShopifySharp.csproj | 1 - 9 files changed, 11 insertions(+), 235 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyWebhookTopic.cs diff --git a/ShopifySharp.Tests/ShopifyWebhookService Tests/Test_Data/WebhookCreation.cs b/ShopifySharp.Tests/ShopifyWebhookService Tests/Test_Data/WebhookCreation.cs index 6a287f1f0..f76ca9266 100644 --- a/ShopifySharp.Tests/ShopifyWebhookService Tests/Test_Data/WebhookCreation.cs +++ b/ShopifySharp.Tests/ShopifyWebhookService Tests/Test_Data/WebhookCreation.cs @@ -9,7 +9,7 @@ namespace ShopifySharp.Tests.Test_Data { public static class WebhookCreation { - public static ShopifyWebhook CreateValidWebhook(string path = null, ShopifyWebhookTopic topic = ShopifyWebhookTopic.OrderCreated) + public static ShopifyWebhook CreateValidWebhook(string path = null, string topic = "orders/create") { if (string.IsNullOrEmpty(path)) { diff --git a/ShopifySharp.Tests/ShopifyWebhookService Tests/When_counting_webhooks_with_a_filter.cs b/ShopifySharp.Tests/ShopifyWebhookService Tests/When_counting_webhooks_with_a_filter.cs index 4a1544eb9..99c732a45 100644 --- a/ShopifySharp.Tests/ShopifyWebhookService Tests/When_counting_webhooks_with_a_filter.cs +++ b/ShopifySharp.Tests/ShopifyWebhookService Tests/When_counting_webhooks_with_a_filter.cs @@ -51,7 +51,7 @@ public class When_counting_webhooks_with_a_filter static ShopifyWebhookService Service; static int? AllCount; static int? FilteredCount; - static ShopifyWebhookTopic FilterTopic = ShopifyWebhookTopic.ShopUpdated; + static string FilterTopic = "shop/update"; static List Webhooks = new List(); } } diff --git a/ShopifySharp.Tests/ShopifyWebhookService Tests/When_creating_a_webhook.cs b/ShopifySharp.Tests/ShopifyWebhookService Tests/When_creating_a_webhook.cs index fff8a448b..259a78364 100644 --- a/ShopifySharp.Tests/ShopifyWebhookService Tests/When_creating_a_webhook.cs +++ b/ShopifySharp.Tests/ShopifyWebhookService Tests/When_creating_a_webhook.cs @@ -15,7 +15,7 @@ class When_creating_a_webhook Establish context = () => { Service = new ShopifyWebhookService(Utils.MyShopifyUrl, Utils.AccessToken); - ExampleWebhook = WebhookCreation.CreateValidWebhook(topic: ShopifyWebhookTopic.ThemePublished); + ExampleWebhook = WebhookCreation.CreateValidWebhook(topic: "themes/publish"); }; Because of = () => diff --git a/ShopifySharp.Tests/ShopifyWebhookService Tests/When_listing_webhooks_with_a_filter.cs b/ShopifySharp.Tests/ShopifyWebhookService Tests/When_listing_webhooks_with_a_filter.cs index e340d9a76..45d41ba2e 100644 --- a/ShopifySharp.Tests/ShopifyWebhookService Tests/When_listing_webhooks_with_a_filter.cs +++ b/ShopifySharp.Tests/ShopifyWebhookService Tests/When_listing_webhooks_with_a_filter.cs @@ -56,7 +56,7 @@ public class When_listing_webhooks_with_a_filter static ShopifyWebhookService Service; static IEnumerable Result; - static ShopifyWebhookTopic FilterTopic = ShopifyWebhookTopic.ShopUpdated; + static string FilterTopic = "shop/update"; static List CreatedWebhooks = new List(); static ShopifyWebhookFilter Options; } diff --git a/ShopifySharp/Entities/ShopifyWebhook.cs b/ShopifySharp/Entities/ShopifyWebhook.cs index 39d486d00..e597e65f0 100644 --- a/ShopifySharp/Entities/ShopifyWebhook.cs +++ b/ShopifySharp/Entities/ShopifyWebhook.cs @@ -44,10 +44,10 @@ public class ShopifyWebhook : ShopifyObject public IEnumerable MetafieldNamespaces { get; set; } /// - /// The event that will trigger the webhook. + /// The event that will trigger the webhook, e.g. 'orders/create' or 'app/uninstalled'. A full list of webhook topics can be found at https://help.shopify.com/api/reference/webhook. /// [JsonProperty("topic")] - public ShopifyWebhookTopic? Topic { get; set; } + public string Topic { get; set; } /// /// The date and time when the webhook was updated. diff --git a/ShopifySharp/Enums/ShopifyWebhookTopic.cs b/ShopifySharp/Enums/ShopifyWebhookTopic.cs deleted file mode 100644 index 42e773220..000000000 --- a/ShopifySharp/Enums/ShopifyWebhookTopic.cs +++ /dev/null @@ -1,223 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - /// - /// A topic for a - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyWebhookTopic - { - /// - /// When an order has been created. - /// - [EnumMember(Value = "orders/create")] - OrderCreated, - - /// - /// When an order has been deleted. - /// - [EnumMember(Value = "orders/delete")] - OrderDeleted, - - /// - /// When an order has been updated. - /// - [EnumMember(Value ="orders/updated")] - OrderUpdated, - - /// - /// When an order has been paid. - /// - [EnumMember(Value = "orders/paid")] - OrderPaid, - - /// - /// When an order has been cancelled. - /// - [EnumMember(Value = "orders/cancelled")] - OrderCancelled, - - /// - /// When an order has been fulfilled. - /// - [EnumMember(Value = "orders/fulfilled")] - OrderFulfilled, - - /// - /// When an order has been partially fulfilled. - /// - [EnumMember(Value = "orders/partially_fulfilled")] - OrderPartiallyFulfilled, - - /// - /// When a transaction has been created. - /// - [EnumMember(Value = "order_transactions/create")] - OrderTransactionCreated, - - /// - /// When a cart has been created. - /// - [EnumMember(Value = "carts/create")] - CartCreated, - - /// - /// When a cart has been updated. - /// - [EnumMember(Value = "carts/update")] - CartUpdated, - - /// - /// When a checkout has been created. - /// - [EnumMember(Value = "checkouts/create")] - CheckoutCreated, - - /// - /// When a checkout has been updated. - /// - [EnumMember(Value = "checkouts/update")] - CheckoutUpdated, - - /// - /// When a checkout has been deleted. - /// - [EnumMember(Value = "checkouts/delete")] - CheckoutDeleted, - - /// - /// When a refund has been created. - /// - [EnumMember(Value = "refunds/create")] - RefundCreated, - - /// - /// When a product has been created. - /// - [EnumMember(Value = "products/create")] - ProductCreated, - - /// - /// When a product has been updated. - /// - [EnumMember(Value = "products/update")] - ProductUpdated, - - /// - /// When a product has been deleted. - /// - [EnumMember(Value = "products/delete")] - ProductDeleted, - - /// - /// When a collection has been created. - /// - [EnumMember(Value = "collections/create")] - CollectionCreated, - - /// - /// When a collection has been updated. - /// - [EnumMember(Value = "collections/update")] - CollectionUpdated, - - /// - /// When a collection has been deleted. - /// - [EnumMember(Value = "collections/delete")] - CollectionDeleted, - - /// - /// When a customer group has been created. - /// - [EnumMember(Value = "customer_groups/create")] - CustomerGroupCreated, - - /// - /// When a customer group has been updated. - /// - [EnumMember(Value = "customer_groups/update")] - CustomerGroupUpdated, - - /// - /// When a customer group has been deleted. - /// - [EnumMember(Value = "customer_groups/delete")] - CustomerGroupDeleted, - - /// - /// When a customer has been created. - /// - [EnumMember(Value = "customers/create")] - CustomerCreated, - - /// - /// When a customer has been enabled. - /// - [EnumMember(Value = "customers/enable")] - CustomerEnabled, - - /// - /// When a customer has been disabled. - /// - [EnumMember(Value = "customers/disable")] - CustomerDisabled, - - /// - /// When a customer has been updated. - /// - [EnumMember(Value = "customers/update")] - CustomerUpdated, - - /// - /// When a customer has been deleted. - /// - [EnumMember(Value = "customers/delete")] - CustomerDeleted, - - /// - /// When a fulfillment has been created. - /// - [EnumMember(Value = "fulfillments/create")] - FulfillmentCreated, - - /// - /// When a fulfillment has been updated. - /// - [EnumMember(Value = "fulfillments/update")] - FulfillmentUpdated, - - /// - /// When a shop has been updated. - /// - [EnumMember(Value = "shop/update")] - ShopUpdated, - - /// - /// When a dispute has been created. - /// - [EnumMember(Value = "disputes/create")] - DisputeCreated, - - /// - /// When a dispute has been updated. - /// - [EnumMember(Value = "disputes/update")] - DisputeUpdated, - - /// - /// When an app has been uninstalled. - /// - [EnumMember(Value = "app/uninstalled")] - AppUninstalled, - - /// - /// When a Shopify store's published theme has been changed. - /// - [EnumMember(Value = "themes/publish")] - ThemePublished - } -} diff --git a/ShopifySharp/Filters/ShopifyWebhookFilter.cs b/ShopifySharp/Filters/ShopifyWebhookFilter.cs index 81ddb885c..5579d4822 100644 --- a/ShopifySharp/Filters/ShopifyWebhookFilter.cs +++ b/ShopifySharp/Filters/ShopifyWebhookFilter.cs @@ -15,9 +15,9 @@ public class ShopifyWebhookFilter : ShopifyListFilter public string Address { get; set; } /// - /// An optional filter for the topic property. When used, the method will only return webhooks with the given topic. + /// An optional filter for the topic property. When used, the method will only return webhooks with the given topic. A full list of topics can be found at https://help.shopify.com/api/reference/webhook. /// [JsonProperty("topic")] - public ShopifyWebhookTopic? Topic { get; set; } + public string Topic { get; set; } } } diff --git a/ShopifySharp/Services/Webhook/ShopifyWebhookService.cs b/ShopifySharp/Services/Webhook/ShopifyWebhookService.cs index 586162a4e..32b8e477d 100644 --- a/ShopifySharp/Services/Webhook/ShopifyWebhookService.cs +++ b/ShopifySharp/Services/Webhook/ShopifyWebhookService.cs @@ -32,15 +32,15 @@ public ShopifyWebhookService(string myShopifyUrl, string shopAccessToken) : base /// Gets a count of all of the shop's webhooks. /// /// An optional filter for the address property. When used, this method will only count webhooks with the given address. - /// An optional filter for the topic property. When used, this method will only count webhooks with the given topic. + /// An optional filter for the topic property. When used, this method will only count webhooks with the given topic. A full list of topics can be found at https://help.shopify.com/api/reference/webhook. /// The count of all webhooks for the shop. - public async Task CountAsync(string address = null, ShopifyWebhookTopic? topic = null) + public async Task CountAsync(string address = null, string topic = null) { IRestRequest req = RequestEngine.CreateRequest("webhooks/count.json", Method.GET); //Add optional parameters to request if (string.IsNullOrEmpty(address) == false) req.AddParameter("address", address); - if (topic != null && topic.HasValue) req.AddParameter("topic", topic.ToSerializedString()); + if (!string.IsNullOrEmpty(topic)) req.AddParameter("topic", topic); JToken responseObject = await RequestEngine.ExecuteRequestAsync(_RestClient, req); diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index 129a2eb00..cc8977ddf 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -86,7 +86,6 @@ - From b2b435d0137e0c2e3796d13dfe4b24c3906843e3 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 14:45:38 -0500 Subject: [PATCH 17/30] Remove ShopifyTransactionError enum --- .../When_deserializing_a_transaction.cs | 4 +- ShopifySharp/Entities/ShopifyTransaction.cs | 4 +- ShopifySharp/Enums/ShopifyTransactionError.cs | 49 ------------------- ShopifySharp/ShopifySharp.csproj | 1 - 4 files changed, 4 insertions(+), 54 deletions(-) delete mode 100644 ShopifySharp/Enums/ShopifyTransactionError.cs diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs index 7d9886f49..2339f92e7 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs @@ -30,13 +30,13 @@ class When_deserializing_a_transaction It should_deserialize_a_transaction = () => { Transaction1.Kind.ShouldEqual("capture"); - Transaction1.ErrorCode.ShouldEqual(ShopifyTransactionError.CardDeclined); + Transaction1.ErrorCode.ShouldEqual("card_declined"); Transaction2.Kind.ShouldBeNull(); Transaction2.ErrorCode.ShouldBeNull(); Transaction3.Kind.ShouldEqual("void"); - Transaction3.ErrorCode.ShouldEqual(ShopifyTransactionError.IncorrectAddress); + Transaction3.ErrorCode.ShouldEqual("incorrect_address"); }; Cleanup after = () => diff --git a/ShopifySharp/Entities/ShopifyTransaction.cs b/ShopifySharp/Entities/ShopifyTransaction.cs index 3d350cbb3..8d08260f2 100644 --- a/ShopifySharp/Entities/ShopifyTransaction.cs +++ b/ShopifySharp/Entities/ShopifyTransaction.cs @@ -77,10 +77,10 @@ public class ShopifyTransaction : ShopifyObject public object Receipt { get; set; } /// - /// A standardized error code, independent of the payment provider. Value can be null. + /// A standardized error code, e.g. 'incorrect_number', independent of the payment provider. Value can be null. A full list of known values can be found at https://help.shopify.com/api/reference/transaction. /// [JsonProperty("error_code")] - public ShopifyTransactionError? ErrorCode { get; set; } + public string ErrorCode { get; set; } /// /// The status of the transaction. Valid values are: pending, failure, success or error. diff --git a/ShopifySharp/Enums/ShopifyTransactionError.cs b/ShopifySharp/Enums/ShopifyTransactionError.cs deleted file mode 100644 index f7352f70a..000000000 --- a/ShopifySharp/Enums/ShopifyTransactionError.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Newtonsoft.Json; -using ShopifySharp.Converters; -using System.Runtime.Serialization; - -namespace ShopifySharp.Enums -{ - /// - /// A standardized error code, independent of the payment provider. - /// - [JsonConverter(typeof(NullableEnumConverter))] - public enum ShopifyTransactionError - { - [EnumMember(Value = "incorrect_number")] - IncorrectNumber, - - [EnumMember(Value = "invalid_number")] - InvalidNumber, - - [EnumMember(Value = "invalid_expiry_date")] - InvalidExpiryDate, - - [EnumMember(Value = "invalid_cvc")] - InvalidCvc, - - [EnumMember(Value = "expired_card")] - ExpiredCard, - - [EnumMember(Value = "incorrect_cvc")] - IncorrectCvc, - - [EnumMember(Value = "incorrect_zip")] - IncorrectZip, - - [EnumMember(Value = "incorrect_address")] - IncorrectAddress, - - [EnumMember(Value = "card_declined")] - CardDeclined, - - [EnumMember(Value = "processing_error")] - ProcesingError, - - [EnumMember(Value = "call_issuer")] - CallIssuer, - - [EnumMember(Value = "pick_up_card")] - PickUpCard - } -} diff --git a/ShopifySharp/ShopifySharp.csproj b/ShopifySharp/ShopifySharp.csproj index cc8977ddf..c041b263c 100644 --- a/ShopifySharp/ShopifySharp.csproj +++ b/ShopifySharp/ShopifySharp.csproj @@ -135,7 +135,6 @@ - From 903110e054d0ac57b618889b8b1e181db65af607 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 16:09:44 -0500 Subject: [PATCH 18/30] Let .BuildAuthorizationUrl accept a list of enum permissions or string permissions --- .../ShopifyAuthorizationService.cs | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ShopifySharp/Services/Authorization/ShopifyAuthorizationService.cs b/ShopifySharp/Services/Authorization/ShopifyAuthorizationService.cs index c0cb180f8..0ec318877 100644 --- a/ShopifySharp/Services/Authorization/ShopifyAuthorizationService.cs +++ b/ShopifySharp/Services/Authorization/ShopifyAuthorizationService.cs @@ -193,15 +193,29 @@ public static async Task IsValidMyShopifyUrl(string url) /// An optional, random string value provided by your application which is unique for each authorization request. During the OAuth callback phase, your application should check that this value matches the one you provided to this method. /// The authorization url. public static Uri BuildAuthorizationUrl(IEnumerable scopes, string myShopifyUrl, string shopifyApiKey, string redirectUrl = null, string state = null) + { + return BuildAuthorizationUrl(scopes.Select(s => s.ToSerializedString()), myShopifyUrl, shopifyApiKey, redirectUrl, state); + } + + /// + /// Builds an authorization URL for Shopify OAuth integration. + /// + /// An array of Shopify permission strings, e.g. 'read_orders' or 'write_script_tags'. These are the permissions that your app needs to run. + /// The shop's *.myshopify.com URL. + /// Your app's public API key. + /// An optional URL to redirect the user to after integration. Overrides the Shopify app's default redirect URL. + /// An optional, random string value provided by your application which is unique for each authorization request. During the OAuth callback phase, your application should check that this value matches the one you provided to this method. + /// The authorization url. + public static Uri BuildAuthorizationUrl(IEnumerable scopes, string myShopifyUrl, string shopifyApiKey, string redirectUrl = null, string state = null) { //Prepare a uri builder for the shop URL - UriBuilder builder = new UriBuilder(RequestEngine.BuildShopUri(myShopifyUrl)); + var builder = new UriBuilder(RequestEngine.BuildShopUri(myShopifyUrl)); //Build the querystring - List> qs = new List>() + var qs = new List>() { new KeyValuePair("client_id", shopifyApiKey), - new KeyValuePair("scope", string.Join(",", scopes.Select(s => s.ToSerializedString()))), + new KeyValuePair("scope", string.Join(",", scopes)), }; if (string.IsNullOrEmpty(redirectUrl) == false) From 36cc85bd020227547fa7c274c43f64756b33c473 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Mon, 19 Sep 2016 16:25:19 -0500 Subject: [PATCH 19/30] Bump to 3.0.0 --- ShopifySharp/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ShopifySharp/Properties/AssemblyInfo.cs b/ShopifySharp/Properties/AssemblyInfo.cs index 46b2a4e89..1439f7b09 100644 --- a/ShopifySharp/Properties/AssemblyInfo.cs +++ b/ShopifySharp/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 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("2.4.0.0")] -[assembly: AssemblyFileVersion("2.4.0.0")] +[assembly: AssemblyVersion("3.0.0.0")] +[assembly: AssemblyFileVersion("3.0.0.0")] From 4991a565f0af4a366601648dd8b17f8b04cc9198 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 10:03:46 -0500 Subject: [PATCH 20/30] Do not send notification emails during tests. --- .../When_cancelling_a_fulfillment.cs | 2 +- .../When_completing_a_fulfillment.cs | 2 +- .../When_counting_fulfillments.cs | 2 +- .../When_counting_fulfillments_with_a_filter.cs | 2 +- .../When_creating_a_fulfillment.cs | 2 +- ...hen_creating_a_fulfillment_with_multiple_tracking_numbers.cs | 2 +- .../When_creating_a_partial_fulfillment.cs | 2 +- .../When_creating_a_single_fulfillment.cs | 2 +- .../When_getting_a_fulfillment.cs | 2 +- .../When_listing_fulfillments.cs | 2 +- .../When_listing_fulfillments_with_a_filter.cs | 2 +- .../When_updating_a_fulfillment.cs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_cancelling_a_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_cancelling_a_fulfillment.cs index 4693ced07..bf192e6b4 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_cancelling_a_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_cancelling_a_fulfillment.cs @@ -15,7 +15,7 @@ class When_cancelling_a_fulfillment var fulfillment = FulfillmentCreation.GenerateFulfillment(); Id = Service - .CreateAsync(Order.Id.Value, fulfillment, true) + .CreateAsync(Order.Id.Value, fulfillment, false) .Await() .AsTask .Result diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_completing_a_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_completing_a_fulfillment.cs index e200d7516..4302b426e 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_completing_a_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_completing_a_fulfillment.cs @@ -15,7 +15,7 @@ class When_completing_a_fulfillment var fulfillment = FulfillmentCreation.GenerateFulfillment(); Id = Service - .CreateAsync(Order.Id.Value, fulfillment, true) + .CreateAsync(Order.Id.Value, fulfillment, false) .Await() .AsTask .Result diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_counting_fulfillments.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_counting_fulfillments.cs index 919cf677c..1e4288953 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_counting_fulfillments.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_counting_fulfillments.cs @@ -17,7 +17,7 @@ class When_counting_fulfillments var items = Order.LineItems.Skip(i).Take(1); var fulfillment = FulfillmentCreation.GenerateFulfillment(items: items); - Service.CreateAsync(Order.Id.Value, fulfillment, true).Await(); + Service.CreateAsync(Order.Id.Value, fulfillment, false).Await(); } }; diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_counting_fulfillments_with_a_filter.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_counting_fulfillments_with_a_filter.cs index 6cde337db..9993c5b4f 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_counting_fulfillments_with_a_filter.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_counting_fulfillments_with_a_filter.cs @@ -20,7 +20,7 @@ class When_counting_fulfillments_with_a_filter var items = Order.LineItems.Skip(i).Take(1); var fulfillment = FulfillmentCreation.GenerateFulfillment(items: items); - Created.Add(Service.CreateAsync(Order.Id.Value, fulfillment, true).Await().AsTask.Result); + Created.Add(Service.CreateAsync(Order.Id.Value, fulfillment, false).Await().AsTask.Result); //Wait 1 second so created fulfillments have differing times. Thread.Sleep(1000); diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_fulfillment.cs index 30fed4534..40fb19a2e 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_fulfillment.cs @@ -15,7 +15,7 @@ class When_creating_a_fulfillment Because of = () => { Fulfillment = Service - .CreateAsync(Order.Id.Value, FulfillmentCreation.GenerateFulfillment(), true) + .CreateAsync(Order.Id.Value, FulfillmentCreation.GenerateFulfillment(), false) .Await() .AsTask .Result; diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_fulfillment_with_multiple_tracking_numbers.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_fulfillment_with_multiple_tracking_numbers.cs index f58e167d6..b4f1f5175 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_fulfillment_with_multiple_tracking_numbers.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_fulfillment_with_multiple_tracking_numbers.cs @@ -18,7 +18,7 @@ class When_creating_a_fulfillment_with_multiple_tracking_numbers var fulfillment = FulfillmentCreation.GenerateFulfillment(true); Fulfillment = Service - .CreateAsync(Order.Id.Value, fulfillment, true) + .CreateAsync(Order.Id.Value, fulfillment, false) .Await() .AsTask .Result; diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_partial_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_partial_fulfillment.cs index 626f00ff9..cb66d469d 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_partial_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_partial_fulfillment.cs @@ -22,7 +22,7 @@ class When_creating_a_partial_fulfillment var fulfillment = FulfillmentCreation.GenerateFulfillment(false, Order.LineItems.Take(1)); Fulfillment = Service - .CreateAsync(Order.Id.Value, fulfillment, true) + .CreateAsync(Order.Id.Value, fulfillment, false) .Await() .AsTask .Result; diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_single_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_single_fulfillment.cs index 68afa75f8..80413b704 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_single_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_creating_a_single_fulfillment.cs @@ -18,7 +18,7 @@ class When_creating_a_single_fulfillment var fulfillment = FulfillmentCreation.GenerateFulfillment(false, Order.LineItems.Take(1)); Fulfillment = Service - .CreateAsync(Order.Id.Value, fulfillment, true) + .CreateAsync(Order.Id.Value, fulfillment, false) .Await() .AsTask .Result; diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_getting_a_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_getting_a_fulfillment.cs index f85a94f74..56a56a67b 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_getting_a_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_getting_a_fulfillment.cs @@ -15,7 +15,7 @@ class When_getting_a_fulfillment var fulfillment = FulfillmentCreation.GenerateFulfillment(); Id = Service - .CreateAsync(Order.Id.Value, fulfillment, true) + .CreateAsync(Order.Id.Value, fulfillment, false) .Await() .AsTask .Result diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_listing_fulfillments.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_listing_fulfillments.cs index f381646ee..f2f789be3 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_listing_fulfillments.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_listing_fulfillments.cs @@ -20,7 +20,7 @@ class When_listing_fulfillments var items = Order.LineItems.Skip(i).Take(1); var fulfillment = FulfillmentCreation.GenerateFulfillment(items: items); - Service.CreateAsync(Order.Id.Value, fulfillment, true).Await(); + Service.CreateAsync(Order.Id.Value, fulfillment, false).Await(); } }; diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_listing_fulfillments_with_a_filter.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_listing_fulfillments_with_a_filter.cs index f3ce75fb7..6fff7e584 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_listing_fulfillments_with_a_filter.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_listing_fulfillments_with_a_filter.cs @@ -20,7 +20,7 @@ class When_listing_fulfillments_with_a_filter var items = Order.LineItems.Skip(i).Take(1); var fulfillment = FulfillmentCreation.GenerateFulfillment(items: items); - Created.Add(Service.CreateAsync(Order.Id.Value, fulfillment, true).Await().AsTask.Result); + Created.Add(Service.CreateAsync(Order.Id.Value, fulfillment, false).Await().AsTask.Result); } }; diff --git a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_updating_a_fulfillment.cs b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_updating_a_fulfillment.cs index 3f6f6d27e..d3be8f513 100644 --- a/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_updating_a_fulfillment.cs +++ b/ShopifySharp.Tests/ShopifyFulfillmentService Tests/When_updating_a_fulfillment.cs @@ -15,7 +15,7 @@ class When_updating_a_fulfillment var fulfillment = FulfillmentCreation.GenerateFulfillment(); Created = Service - .CreateAsync(Order.Id.Value, fulfillment, true) + .CreateAsync(Order.Id.Value, fulfillment, false) .Await() .AsTask .Result; From 39a805e169fa8b47ec57629e9cb54831e94fc9e4 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 11:04:43 -0500 Subject: [PATCH 21/30] Ignore charge tests --- .../ShopifyChargeService Tests/When_activating_a_charge.cs | 1 + .../ShopifyChargeService Tests/When_creating_a_charge.cs | 1 + .../ShopifyChargeService Tests/When_listing_charges.cs | 1 + .../ShopifyChargeService Tests/When_retrieving_a_charge.cs | 1 + .../When_publishing_a_custom_collection.cs | 1 - 5 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ShopifySharp.Tests/ShopifyChargeService Tests/When_activating_a_charge.cs b/ShopifySharp.Tests/ShopifyChargeService Tests/When_activating_a_charge.cs index 73e28b8cc..49623ac5b 100644 --- a/ShopifySharp.Tests/ShopifyChargeService Tests/When_activating_a_charge.cs +++ b/ShopifySharp.Tests/ShopifyChargeService Tests/When_activating_a_charge.cs @@ -31,6 +31,7 @@ class When_activating_a_charge Charge = Service.GetAsync(Charge.Id.Value).Await().AsTask.Result; }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_activate_a_charge = () => { // NOTE: This test will require you to set a break point after creating the charge but before activating it, diff --git a/ShopifySharp.Tests/ShopifyChargeService Tests/When_creating_a_charge.cs b/ShopifySharp.Tests/ShopifyChargeService Tests/When_creating_a_charge.cs index 8a524cbc5..074e0c8c9 100644 --- a/ShopifySharp.Tests/ShopifyChargeService Tests/When_creating_a_charge.cs +++ b/ShopifySharp.Tests/ShopifyChargeService Tests/When_creating_a_charge.cs @@ -29,6 +29,7 @@ class When_creating_a_charge Charge = Service.CreateAsync(Charge).Await().AsTask.Result; }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_create_a_charge = () => { Charge.ConfirmationUrl.ShouldNotBeNull(); diff --git a/ShopifySharp.Tests/ShopifyChargeService Tests/When_listing_charges.cs b/ShopifySharp.Tests/ShopifyChargeService Tests/When_listing_charges.cs index c3d37da4e..2480d6c99 100644 --- a/ShopifySharp.Tests/ShopifyChargeService Tests/When_listing_charges.cs +++ b/ShopifySharp.Tests/ShopifyChargeService Tests/When_listing_charges.cs @@ -29,6 +29,7 @@ class When_listing_charges Charges = Service.ListAsync().Await().AsTask.Result; }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_retrieve_a_list_of_charges = () => { Charges.ShouldNotBeNull(); diff --git a/ShopifySharp.Tests/ShopifyChargeService Tests/When_retrieving_a_charge.cs b/ShopifySharp.Tests/ShopifyChargeService Tests/When_retrieving_a_charge.cs index 3c8feb18b..5e0f3f763 100644 --- a/ShopifySharp.Tests/ShopifyChargeService Tests/When_retrieving_a_charge.cs +++ b/ShopifySharp.Tests/ShopifyChargeService Tests/When_retrieving_a_charge.cs @@ -29,6 +29,7 @@ class When_retrieving_a_charge Charge = Service.GetAsync(ChargeId).Await().AsTask.Result; }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_retrieve_a_charge = () => { Charge.ShouldNotBeNull(); diff --git a/ShopifySharp.Tests/ShopifyCustomCollectionService Tests/When_publishing_a_custom_collection.cs b/ShopifySharp.Tests/ShopifyCustomCollectionService Tests/When_publishing_a_custom_collection.cs index b79ffe626..ba5734d29 100644 --- a/ShopifySharp.Tests/ShopifyCustomCollectionService Tests/When_publishing_a_custom_collection.cs +++ b/ShopifySharp.Tests/ShopifyCustomCollectionService Tests/When_publishing_a_custom_collection.cs @@ -22,7 +22,6 @@ public class When_publishing_a_custom_collection It should_publish_a_custom_collection = () => { Collection.ShouldNotBeNull(); - Collection.PublishedAt.ShouldNotBeNull(); }; Cleanup after = () => From dbab9e63fde114eb68057a8b4373bf8e12a61806 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 11:08:25 -0500 Subject: [PATCH 22/30] Do not require the nullable .Path to not be null --- .../ShopifyEventService Tests/When_getting_an_event.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/ShopifySharp.Tests/ShopifyEventService Tests/When_getting_an_event.cs b/ShopifySharp.Tests/ShopifyEventService Tests/When_getting_an_event.cs index d724d5898..4d51714ea 100644 --- a/ShopifySharp.Tests/ShopifyEventService Tests/When_getting_an_event.cs +++ b/ShopifySharp.Tests/ShopifyEventService Tests/When_getting_an_event.cs @@ -30,7 +30,6 @@ class When_getting_an_event Event.Author.ShouldNotBeNull(); Event.CreatedAt.HasValue.ShouldBeTrue(); Event.Message.ShouldNotBeNull(); - Event.Path.ShouldNotBeNull(); Event.SubjectId.ShouldBeGreaterThan(0); Event.SubjectType.ShouldNotBeNull(); Event.Verb.ShouldNotBeNull(); From 6e5a198e1b482cf438caa4c5c893b268e7c7f9c8 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 11:11:33 -0500 Subject: [PATCH 23/30] Ignore recurring charge tests --- .../When_activating_a_recurring_charge.cs | 1 + .../When_creating_a_recurring_charge.cs | 1 + .../When_deleting_a_recurring_charge.cs | 1 + .../When_listing_recurring_charges.cs | 1 + .../When_retrieving_a_recurring_charge.cs | 1 + 5 files changed, 5 insertions(+) diff --git a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_activating_a_recurring_charge.cs b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_activating_a_recurring_charge.cs index 6945f7c18..e43b8ef3c 100644 --- a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_activating_a_recurring_charge.cs +++ b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_activating_a_recurring_charge.cs @@ -32,6 +32,7 @@ class When_activating_a_recurring_charge Charge = Service.GetAsync(Charge.Id.Value).Await().AsTask.Result; }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_activate_a_recurring_charge = () => { // NOTE: This test will require you to set a break point after creating the charge but before activating it, diff --git a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_creating_a_recurring_charge.cs b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_creating_a_recurring_charge.cs index 78509683f..c46b6811a 100644 --- a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_creating_a_recurring_charge.cs +++ b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_creating_a_recurring_charge.cs @@ -30,6 +30,7 @@ class When_creating_a_recurring_charge Charge = Service.CreateAsync(Charge).Await().AsTask.Result; }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_create_a_recurring_charge = () => { Charge.ConfirmationUrl.ShouldNotBeNull(); diff --git a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_deleting_a_recurring_charge.cs b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_deleting_a_recurring_charge.cs index 4c6699f5d..d976b6e8a 100644 --- a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_deleting_a_recurring_charge.cs +++ b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_deleting_a_recurring_charge.cs @@ -37,6 +37,7 @@ class When_deleting_a_recurring_charge } }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_delete_a_recurring_charge = () => { // A charge cannot be deleted unless it has been activated. This test will fail unless you manually diff --git a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_listing_recurring_charges.cs b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_listing_recurring_charges.cs index aa6a0b1f8..8b344c68a 100644 --- a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_listing_recurring_charges.cs +++ b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_listing_recurring_charges.cs @@ -29,6 +29,7 @@ class When_listing_recurring_charges Charges = Service.ListAsync().Await().AsTask.Result; }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_retrieve_a_list_of_recurring_charges = () => { Charges.ShouldNotBeNull(); diff --git a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_retrieving_a_recurring_charge.cs b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_retrieving_a_recurring_charge.cs index 476569b55..a4195433a 100644 --- a/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_retrieving_a_recurring_charge.cs +++ b/ShopifySharp.Tests/ShopifyRecurringChargeService Tests/When_retrieving_a_recurring_charge.cs @@ -29,6 +29,7 @@ class When_retrieving_a_recurring_charge Charge = Service.GetAsync(ChargeId).Await().AsTask.Result; }; + [Ignore("Charge tests cannot be run automatically; they require manual confirmation.")] It should_retrieve_a_recurring_charge = () => { Charge.ShouldNotBeNull(); From e2c19af4d05b6710845e74991c5ad4a8f3b349f2 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 11:17:39 -0500 Subject: [PATCH 24/30] Check that role is null *or* empty --- .../When_deserializing_a_theme.cs | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/ShopifySharp.Tests/ShopifyThemeService Tests/When_deserializing_a_theme.cs b/ShopifySharp.Tests/ShopifyThemeService Tests/When_deserializing_a_theme.cs index 237dbc050..2190ae7da 100644 --- a/ShopifySharp.Tests/ShopifyThemeService Tests/When_deserializing_a_theme.cs +++ b/ShopifySharp.Tests/ShopifyThemeService Tests/When_deserializing_a_theme.cs @@ -19,20 +19,16 @@ class When_deserializing_a_theme Because of = () => { - Theme1 = JsonConvert.DeserializeObject(Theme1Json); + Theme1 = JsonConvert.DeserializeObject(Theme1Json); Theme2 = JsonConvert.DeserializeObject(Theme2Json); - - Theme3 = JsonConvert.DeserializeObject(Theme3Json); }; It should_deserialize_a_theme = () => { - Theme1.Role.ShouldBeNull(); - - Theme2.Role.ShouldBeNull(); - - Theme3.Role.ShouldEqual("main"); + string.IsNullOrEmpty(Theme1.Role).ShouldBeTrue(); + + Theme2.Role.ShouldEqual("main"); }; Cleanup after = () => @@ -40,16 +36,12 @@ class When_deserializing_a_theme }; - static string Theme1Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}"; + static string Theme1Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}"; - static string Theme2Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"unknown_value\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}"; + static string Theme2Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"main\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}"; - static string Theme3Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"main\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}"; - - static ShopifyTheme Theme1 { get; set; } + static ShopifyTheme Theme1 { get; set; } static ShopifyTheme Theme2 { get; set; } - - static ShopifyTheme Theme3 { get; set; } } } From a2af4842ad85133c96911d88c9bfe377bd27f671 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 11:19:01 -0500 Subject: [PATCH 25/30] Do not check for 'uknown_value' deserialization. --- .../When_deserializing_a_transaction.cs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs index 2339f92e7..ea4a0b2b6 100644 --- a/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs +++ b/ShopifySharp.Tests/ShopifyTransactionService Tests/When_deserializing_a_transaction.cs @@ -21,22 +21,17 @@ class When_deserializing_a_transaction Because of = () => { Transaction1 = JsonConvert.DeserializeObject(TransactionJson); - + Transaction2 = JsonConvert.DeserializeObject(Transaction2Json); - - Transaction3 = JsonConvert.DeserializeObject(Transaction3Json); }; It should_deserialize_a_transaction = () => { Transaction1.Kind.ShouldEqual("capture"); Transaction1.ErrorCode.ShouldEqual("card_declined"); - - Transaction2.Kind.ShouldBeNull(); - Transaction2.ErrorCode.ShouldBeNull(); - - Transaction3.Kind.ShouldEqual("void"); - Transaction3.ErrorCode.ShouldEqual("incorrect_address"); + + Transaction2.Kind.ShouldEqual("void"); + Transaction2.ErrorCode.ShouldEqual("incorrect_address"); }; Cleanup after = () => @@ -46,14 +41,10 @@ class When_deserializing_a_transaction static string TransactionJson { get; } = "{\"id\": 1068278477,\"order_id\": 450789469,\"amount\": \"409.94\",\"kind\": \"capture\",\"gateway\": \"bogus\",\"status\": \"success\",\"message\": \"Bogus Gateway: Forced success\",\"created_at\": \"2015-12-08T11:40:41-05:00\",\"test\": true,\"authorization\": null,\"currency\": \"USD\",\"location_id\": null,\"user_id\": null,\"parent_id\": 389404469,\"device_id\": null,\"receipt\": {},\"error_code\":\"card_declined\",\"source_name\": \"755357713\"}"; - static string Transaction2Json { get; } = "{\"id\": 1068278477,\"order_id\": 450789469,\"amount\": \"409.94\",\"kind\": \"unknown_value\",\"gateway\": \"bogus\",\"status\": \"success\",\"message\": \"Bogus Gateway: Forced success\",\"created_at\": \"2015-12-08T11:40:41-05:00\",\"test\": true,\"authorization\": null,\"currency\": \"USD\",\"location_id\": null,\"user_id\": null,\"parent_id\": 389404469,\"device_id\": null,\"receipt\": {},\"error_code\": \"unknown_value\",\"source_name\": \"755357713\"}"; - - static string Transaction3Json { get; } = "{\"id\": 1068278477,\"order_id\": 450789469,\"amount\": \"409.94\",\"kind\": \"void\",\"gateway\": \"bogus\",\"status\": \"success\",\"message\": \"Bogus Gateway: Forced success\",\"created_at\": \"2015-12-08T11:40:41-05:00\",\"test\": true,\"authorization\": null,\"currency\": \"USD\",\"location_id\": null,\"user_id\": null,\"parent_id\": 389404469,\"device_id\": null,\"receipt\": {},\"error_code\": \"incorrect_address\",\"source_name\": \"755357713\"}"; + static string Transaction2Json { get; } = "{\"id\": 1068278477,\"order_id\": 450789469,\"amount\": \"409.94\",\"kind\": \"void\",\"gateway\": \"bogus\",\"status\": \"success\",\"message\": \"Bogus Gateway: Forced success\",\"created_at\": \"2015-12-08T11:40:41-05:00\",\"test\": true,\"authorization\": null,\"currency\": \"USD\",\"location_id\": null,\"user_id\": null,\"parent_id\": 389404469,\"device_id\": null,\"receipt\": {},\"error_code\": \"incorrect_address\",\"source_name\": \"755357713\"}"; static ShopifyTransaction Transaction1 { get; set; } static ShopifyTransaction Transaction2 { get; set; } - - static ShopifyTransaction Transaction3 { get; set; } } } From e18337dfa77fe454534d9415283143c866800f89 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 11:57:47 -0500 Subject: [PATCH 26/30] Update README --- readme.md | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/readme.md b/readme.md index ce9757f3e..182ccc32b 100644 --- a/readme.md +++ b/readme.md @@ -39,16 +39,9 @@ console in Visual Studio to install it: Install-Package ShopifySharp ``` -# Version 2.0.0 +# Version 3.0.0 -Version 2.0.0 is a major update to ShopifySharp, it contains some breaking changes. We strongly recommend updating to 2.0.0+ **before** June 1st, 2016. Shopify will completely deprecate the method for verifying authentic requests used in `ShopifyAuthorizationService.IsAuthenticRequest` on June 1st, 2016. After that date, this method will always return false in v1 builds. - -**Breaking changes**: - -- `ShopifyException.Error.Errors` is now a `Dictionary>` on the ShopifyException itself. To maintain some back compat, `ShopifyException.JsonError` is the raw JSON-serialized error returned by Shopify. It's functionally identical to the old ex.Error.Errors, which was also the raw JSON string. -- Any enums that previously had a `.Unknown` default value are now nullable and have had those values removed. Instead of checking if `Enum == Enum.Unknown`, you should instead check if `Enum == null` or `Enum != Enum.Value`. -- `ShopifyRecurringChargeStatus` has been merged into `ShopifyChargeStatus`. -- All `*FilterOptions` and `*ListOptions` (used in many Service.ListAsync and Service.CountAsync calls) have been renamed to `*Filter` and moved into the `ShopifySharp.Filters` namespace. +Version 3.0.0 is a major update to ShopifySharp, it contains breaking changes by [removing almost all enums](#why_dont_you_use_enums) from the library. We recommend updating to 3.0.0+ if you're using any of the enums from 2.x in production. These enums are brittle, and [Shopify can change them without warning, thereby breaking your app](https://github.com/nozzlegear/ShopifySharp/issues/64). ### A work-in-progress @@ -1654,17 +1647,19 @@ var subjectType = "Order"; var orderEvents = await service.ListAsync(orderId, subjectType); ``` -# A note on enums +# "Why don't you use enums?" I'm a big fan of using enums to make things easier for C# devs, because it removes a lot of the headache that comes with trying to remember all the valid string options for certain properties. With enums, we get those options hardcoded by default. We can easily scroll up and down the list of known values and select the one we need, without having to worry about typos. -Many Shopify objects have string properties that only accept a predetermined list of values, and hese properties are perfect for matching to C# enums. Unfortunately, Shopify has a habit of only documenting the most used values and leaving the developer to guess the rest. +Many Shopify objects have string properties that only accept a predetermined list of values, and these properties are perfect for matching to C# enums. Unfortunately, Shopify has a habit of only documenting the most used values and leaving the developer to guess the rest. On top of that, they sometimes change those enums completely, [such as this case where they changed the enums used for filtering orders without announcing it](https://github.com/nozzlegear/ShopifySharp/issues/64). + +That's a problem when it comes to strongly-typed languages like C#. If you receive an enum property that doesn't have a value matching the enum, you're going to get a big fat exception thrown in your face. This is especially problematic when these undocumented enum values are sent to you automatically in webhooks. -That's a problem when it comes to strongly-typed languages like C#. If you receive an enum property that doesn't have a value matching the enum, you're going to get a big fat exception thrown in your face. This is especially problematic when these undocumented enum values are sent to you automatically in webhooks. +On top of that, if there's an enum value that you need to send but isn't in ShopifySharp, you'll need to wait until a new version of the lib is released before you can use it. -To maintain the benefits of enums while also preventing exceptions from undocumented values, all enums in ShopifySharp are nullable and implement a `NullableEnumConverter` JSON converter. If an unknown value is received, the enum will just be converted to null rather than throw an exception. +Enums would be much better suited to ShopifySharp if Shopify themselves used API versioning, but sadly that isn't the case. After struggling with undocumented values and unannounced changes that break apps through two major releases of ShopifySharp, I've made the decision to pull the plug on almost all enums in the lib. -I strongly encourage you to file an issue if you receive or need to use an undocumented enum; or even better: create a pull request. +What were previously enums in ShopifySharp 1.x and 2.x are now string properties. This change will prevent breaking your app when an enum value changes, and will allow you to quickly update your app when a new enum value is released without waiting on an update to ShopifySharp first. # Tests From e20fdc40f4428a2c95a962b3487758e43f555dee Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 13:58:18 -0500 Subject: [PATCH 27/30] Update nuget package --- ShopifySharp/ShopifySharp.nuspec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ShopifySharp/ShopifySharp.nuspec b/ShopifySharp/ShopifySharp.nuspec index 0fa1e3d2e..184d4389a 100644 --- a/ShopifySharp/ShopifySharp.nuspec +++ b/ShopifySharp/ShopifySharp.nuspec @@ -11,6 +11,10 @@ false ShopifySharp is a .NET library that enables you to authenticate and make API calls to Shopify. + 3.0.0 + ===== + - Breaking release: all enums have been removed and replaced with strings to avoid unannounced changes from Shopify breaking your apps. + 2.4.0 ===== - New ShopifyEventService: List, get and count Shopify events. From 9ab237f54feb70c04ff8ff5ca734049a7352c10f Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 15:12:28 -0500 Subject: [PATCH 28/30] Remove enums from docs --- readme.md | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index 182ccc32b..993fc5792 100644 --- a/readme.md +++ b/readme.md @@ -174,12 +174,19 @@ string usersMyShopifyUrl = "https://example.myshopify.com"; string redirectUrl = "https://example.com/my/redirect/url"; //An array of the Shopify access scopes your application needs to run. -IEnumerable scopes = new List() +var scopes = new List() { ShopifyAuthorizationScope.ReadCustomers, ShopifyAuthorizationScope.WriteCustomers }; +//Or, use an array of string permissions +var scopes = new List() +{ + "read_customers", + "write_customers" +} + //All ShopifyAuthorizationService methods are static. string authUrl = ShopifyAuthorizationService.BuildAuthorizationUrl(scopes, usersMyShopifyUrl, shopifyApiKey); ``` @@ -434,8 +441,6 @@ var service = new ShopifyUsageChargeService(myShopifyUrl, shopAccessToken); var usageCharges = await service.ListAsync(recurringChargeId); ``` -### Creating a usage charge - ## Shops ### Retrieving shop information @@ -588,7 +593,7 @@ var order = new ShopifyOrder() Title = "Test Line Item Title" } }, - FinancialStatus = Enums.ShopifyOrderFinancialStatus.Paid, + FinancialStatus = "paid", TotalPrice = 5.00, Email = Guid.NewGuid().ToString() + "@example.com", Note = "Test note about the customer.", @@ -765,7 +770,7 @@ ShopifyWebhook hook = new ShopifyWebhook() Fields = new List() { "field1", "field2" }, Format = "json", MetafieldNamespaces = new List() { "metafield1", "metafield2" }, - Topic = topic, + Topic = "app/uninstalled", }; hook = await service.CreateAsync(hook); @@ -821,7 +826,7 @@ dynamically change the functionality of their shop without manually editing thei var service = new ShopifyScriptTagService(myShopifyUrl, shopAccessToken); var tag = new ShopifyScriptTag() { - Event = ShopifyScriptTagEvent.Onload, + Event = "onload", Src = "https://example.com/my-javascript-file.js" } @@ -964,7 +969,7 @@ var service = new ShopifyThemeService(myShopifyUrl, shopAccessToken); var theme = new ShopifyTheme() { Name = "My new theme.", - Role = ShopifyThemeRole.Unpublished + Role = "unpublished" } theme = await service.CreateAsync(theme); @@ -982,7 +987,7 @@ var theme = await service.GetAsync(themeId); ### Updating a theme -Remember, you can't update a theme if its `Processing` flag is set to `true`. Shopify will automatically set it to `false` once it's done processing. Additionally, you cannot set a theme's role from `ShopifyThemeRole.Main` to `ShopifyThemeRole.Unpublished`. Instead, you need to set a different theme's role to `ShopifyThemeRole.Main`. +Remember, you can't update a theme if its `Processing` flag is set to `true`. Shopify will automatically set it to `false` once it's done processing. Additionally, you cannot set a theme's role from `"main"` to `"unpublished"`. Instead, you need to set a different theme's role to `"main"`. ```c# var service = new ShopifyThemeService(myShopifyUrl, shopAccessToken); @@ -1267,7 +1272,7 @@ By omitting an `Amount` value, this transaction will capture the full amount. var service = new ShopifyTransactionService(myShopifyUrl, shopAccessToken); var transaction = new ShopifyTransaction() { - Kind = ShopifyTransactionKind.Capture + Kind = "capture" }; await service.CreateAsync(orderId, transaction); @@ -1283,7 +1288,7 @@ This method will capture a specified amount on a previously authorized order. var service = new ShopifyTransactionService(myShopifyUrl, shopAccessToken); var transaction = new ShopifyTransaction() { - Kind = ShopifyTransactionKind.Capture, + Kind = "capture", Amount = 5.00 }; @@ -1302,7 +1307,7 @@ This method will create a refund on a previously authorized order. Like the last var service = new ShopifyTransactionService(myShopifyUrl, shopAccessToken); var transaction = new ShopifyTransaction() { - Kind = ShopifyTransactionKind.Refund, + Kind = "refund", Amount = 5.00 }; @@ -1319,7 +1324,7 @@ That in mind, I'm including this example for posterity. var service = new ShopifyTransactionService(myShopifyUrl, shopAccessToken); var transaction = new ShopifyTransaction() { - Kind = ShopifyTransactionKind.Void + Kind = "void" }; //Throws an error. From 917cbe5eed451b4adebdf9eb0700982d3506c951 Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 15:15:15 -0500 Subject: [PATCH 29/30] Document 'open' as a known value for .Status --- ShopifySharp/Entities/ShopifyFulfillment.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ShopifySharp/Entities/ShopifyFulfillment.cs b/ShopifySharp/Entities/ShopifyFulfillment.cs index cdeb40096..350bd2644 100644 --- a/ShopifySharp/Entities/ShopifyFulfillment.cs +++ b/ShopifySharp/Entities/ShopifyFulfillment.cs @@ -34,14 +34,9 @@ public class ShopifyFulfillment : ShopifyObject public object Receipt { get; set; } /// - /// The status of the fulfillment. Valid values are 'pending', 'success', 'cancelled', + /// The status of the fulfillment. Valid values are 'pending', 'open', 'success', 'cancelled', /// 'error' and 'failure'. /// - /// - /// This class and property were created before the - /// . It should be converted to an - /// enum in v2.0. - /// [JsonProperty("status")] public string Status { get; set; } From 8df13df6d74f930972ec4b1d21b632c86a649b7a Mon Sep 17 00:00:00 2001 From: Joshua Harms Date: Wed, 21 Sep 2016 15:18:22 -0500 Subject: [PATCH 30/30] Document known enum values --- ShopifySharp/Entities/ShopifyLineItem.cs | 2 +- ShopifySharp/Entities/ShopifyOrder.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ShopifySharp/Entities/ShopifyLineItem.cs b/ShopifySharp/Entities/ShopifyLineItem.cs index 0d02a59ca..4a1ef07e7 100644 --- a/ShopifySharp/Entities/ShopifyLineItem.cs +++ b/ShopifySharp/Entities/ShopifyLineItem.cs @@ -23,7 +23,7 @@ public class ShopifyLineItem : ShopifyObject public string FulfillmentService { get; set; } /// - /// The fulfillment status of this line item. Will be null if the line item has not been fulfilled or partially fulfilled. + /// The fulfillment status of this line item. Known values are 'fulfilled', 'null' and 'partial'. /// [JsonProperty("fulfillment_status")] public string FulfillmentStatus { get; set; } diff --git a/ShopifySharp/Entities/ShopifyOrder.cs b/ShopifySharp/Entities/ShopifyOrder.cs index 843b7b603..03b1bca01 100644 --- a/ShopifySharp/Entities/ShopifyOrder.cs +++ b/ShopifySharp/Entities/ShopifyOrder.cs @@ -114,7 +114,7 @@ public class ShopifyOrder : ShopifyObject public IEnumerable Fulfillments { get; set; } /// - /// The fulfillment status for this order. Will be null if none of the line items in the order have been fulfilled. + /// The fulfillment status for this order. Known values are 'fulfilled', 'null' and 'partial'. /// [JsonProperty("fulfillment_status")] public string FulfillmentStatus { get; set; }