Skip to content

Commit

Permalink
Add missing checkout line item properties
Browse files Browse the repository at this point in the history
  • Loading branch information
nozzlegear committed Apr 1, 2024
1 parent 1216bbc commit bd2e7bc
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ShopifySharp/Entities/AppliedDiscount.cs
Expand Up @@ -36,4 +36,4 @@ public class AppliedDiscount
[JsonProperty("amount")]
public decimal? Amount { get; set; }
}
}
}
14 changes: 14 additions & 0 deletions ShopifySharp/Entities/CheckoutLineItem.cs
@@ -1,4 +1,6 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using ShopifySharp.Converters;

namespace ShopifySharp;

Expand Down Expand Up @@ -35,6 +37,12 @@ public class CheckoutLineItem
[JsonProperty("grams")]
public long? Grams { get; set; }

/// <summary>
/// The line price of the item, based on price multiplied by quantity.
/// </summary>
[JsonProperty("line_price")]
public decimal? LinePrice { get; set; }

/// <summary>
/// The price of the item before discounts have been applied.
/// </summary>
Expand Down Expand Up @@ -149,6 +157,12 @@ public class CheckoutLineItem
[JsonProperty("total_discount_set")]
public PriceSet TotalDiscountSet { get; set; }

/// <summary>
/// A list of the discounts applied to the line item.
/// </summary>
[JsonProperty("applied_discounts")]
public ICollection<CheckoutLineItemAppliedDiscount> AppliedDiscounts { get; set; }

/// <summary>
/// An ordered list of amounts allocated by discount applications. Each discount allocation is associated to a particular discount application.
/// </summary>
Expand Down
45 changes: 45 additions & 0 deletions 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:
/// <list>
/// <item>automatic: The discount was applied automatically.</item>
/// <item>discount_code: The merchant or customer entered a discount code.</item>
/// <item>manual: The discount was applied manually by the merchant or an app.</item>
/// <item>script: The discount was applied by a Shopify Script.</item>
/// </list>
[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; }
}

0 comments on commit bd2e7bc

Please sign in to comment.