diff --git a/ShopifySharp/Entities/AppliedDiscount.cs b/ShopifySharp/Entities/AppliedDiscount.cs index 533c6906..e9236bb3 100644 --- a/ShopifySharp/Entities/AppliedDiscount.cs +++ b/ShopifySharp/Entities/AppliedDiscount.cs @@ -36,4 +36,4 @@ public class AppliedDiscount [JsonProperty("amount")] public decimal? Amount { get; set; } } -} \ No newline at end of file +} diff --git a/ShopifySharp/Entities/CheckoutLineItem.cs b/ShopifySharp/Entities/CheckoutLineItem.cs index 759a0440..e384d454 100644 --- a/ShopifySharp/Entities/CheckoutLineItem.cs +++ b/ShopifySharp/Entities/CheckoutLineItem.cs @@ -1,4 +1,6 @@ using Newtonsoft.Json; +using System.Collections.Generic; +using ShopifySharp.Converters; namespace ShopifySharp; @@ -35,6 +37,12 @@ public class CheckoutLineItem [JsonProperty("grams")] public long? Grams { get; set; } + /// + /// The line price of the item, based on price multiplied by quantity. + /// + [JsonProperty("line_price")] + public decimal? LinePrice { get; set; } + /// /// The price of the item before discounts have been applied. /// @@ -149,6 +157,12 @@ public class CheckoutLineItem [JsonProperty("total_discount_set")] public PriceSet TotalDiscountSet { get; set; } + /// + /// A list of the discounts applied to the line item. + /// + [JsonProperty("applied_discounts")] + public ICollection AppliedDiscounts { get; set; } + /// /// An ordered list of amounts allocated by discount applications. Each discount allocation is associated to a particular discount application. /// diff --git a/ShopifySharp/Entities/CheckoutLineItemAppliedDiscount.cs b/ShopifySharp/Entities/CheckoutLineItemAppliedDiscount.cs new file mode 100644 index 00000000..caa11df9 --- /dev/null +++ b/ShopifySharp/Entities/CheckoutLineItemAppliedDiscount.cs @@ -0,0 +1,45 @@ +#nullable enable +using Newtonsoft.Json; + +namespace ShopifySharp; + +public class CheckoutLineItemAppliedDiscount +{ + /// The amount that is deducted from payment_due in presentment currency. + [JsonProperty("amount")] + public decimal? Amount { get; set; } + + /// Title of the discount. + [JsonProperty("title")] + public string? Title { get; set; } + + /// Reason for the discount. + [JsonProperty("description")] + public string? Description { get; set; } + + /// Whether this discount code can be applied to the checkout. + [JsonProperty("applicable")] + public bool? Applicable { get; set; } + + /// Describes how the discount was applied to the checkout. Possible values: + /// + /// automatic: The discount was applied automatically. + /// discount_code: The merchant or customer entered a discount code. + /// manual: The discount was applied manually by the merchant or an app. + /// script: The discount was applied by a Shopify Script. + /// + [JsonProperty("application_type")] + public string? ApplicationType { get; set; } + + /// The reason why the discount is not applicable, if the discount cannot be applied to the checkout. + [JsonProperty("non_applicable_reason")] + public string? NonApplicableReason { get; set; } + + /// The value that was used to calculate the final applied discount amount. + [JsonProperty("value")] + public string? Value { get; set; } + + /// The type of value that was used to calculate the final applied discount amount. Valid values: `fixed_amount` and `percentage`. + [JsonProperty("value_type")] + public string? ValueType { get; set; } +}