125 lines
5.6 KiB
C#
125 lines
5.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using gehGassi.Klarna.Checkout;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace gehGassi.Klarna.OrderManagement
|
|
{
|
|
public class OrderLine
|
|
{
|
|
/// <summary>
|
|
/// Article number, SKU or similar.
|
|
/// </summary>
|
|
/// <value>Article number, SKU or similar.</value>
|
|
[StringLength(255, MinimumLength = 0)]
|
|
[JsonProperty("reference")]
|
|
public string Reference { get; set; }
|
|
|
|
/// <summary>
|
|
/// Order line type. Matches: physical|discount|shipping_fee|sales_tax|store_credit|gift_card|digital|surcharge|return_fee
|
|
/// </summary>
|
|
/// <value>Order line type. Matches: physical|discount|shipping_fee|sales_tax|store_credit|gift_card|digital|surcharge|return_fee</value>
|
|
[RegularExpression("/physical|discount|shipping_fee|sales_tax|store_credit|gift_card|digital|surcharge|return_fee/")]
|
|
[JsonProperty("type")]
|
|
public string Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// Item quantity. Non-negative.
|
|
/// </summary>
|
|
/// <value>Item quantity. Non-negative.</value>
|
|
[Required]
|
|
[JsonProperty("quantity")]
|
|
public long? Quantity { get; set; }
|
|
|
|
/// <summary>
|
|
/// Unit used to describe the quantity. Maximum 10 characters.
|
|
/// </summary>
|
|
/// <value>Unit used to describe the quantity. Maximum 10 characters.</value>
|
|
[StringLength(10, MinimumLength = 0)]
|
|
[JsonProperty("quantity_unit")]
|
|
public string QuantityUnit { get; set; }
|
|
|
|
/// <summary>
|
|
/// Descriptive item name. Maximum 255 characters.
|
|
/// </summary>
|
|
/// <value>Descriptive item name. Maximum 255 characters.</value>
|
|
[Required]
|
|
[StringLength(255, MinimumLength = 0)]
|
|
[JsonProperty("name")]
|
|
public string Name { get; set; }
|
|
|
|
/// <summary>
|
|
/// Total amount including tax and discounts (`quantity * unit_price - total_discount_amount`).
|
|
/// </summary>
|
|
/// <value>Total amount including tax and discounts (`quantity * unit_price - total_discount_amount`).</value>
|
|
[Required]
|
|
[JsonProperty("total_amount")]
|
|
public long? TotalAmount { get; set; }
|
|
|
|
/// <summary>
|
|
/// Unit price including tax without applying discounts in minor units.
|
|
/// </summary>
|
|
/// <value>Unit price including tax without applying discounts in minor units.</value>
|
|
[Required]
|
|
[JsonProperty("unit_price")]
|
|
public long? UnitPrice { get; set; }
|
|
|
|
/// <summary>
|
|
/// The discount amount in minor units. Includes tax. Example: 1200 = $12. Max value: 100000000
|
|
/// </summary>
|
|
/// <value>The discount amount in minor units. Includes tax. Example: 1200 = $12. Max value: 100000000</value>
|
|
[Range(0, 100000000)]
|
|
[JsonProperty("total_discount_amount")]
|
|
public long? TotalDiscountAmount { get; set; }
|
|
|
|
/// <summary>
|
|
/// The tax rate in percent with two implicit decimals. Non-negative. Example: 2500 = 25%.
|
|
/// </summary>
|
|
/// <value>The tax rate in percent with two implicit decimals. Non-negative. Example: 2500 = 25%.</value>
|
|
[JsonProperty("tax_rate")]
|
|
public int? TaxRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// The total tax amount in minor units. Negative if the order line type is discount. Example: 500 = $5.
|
|
/// </summary>
|
|
/// <value>The total tax amount in minor units. Negative if the order line type is discount. Example: 500 = $5.</value>
|
|
[JsonProperty("total_tax_amount")]
|
|
public long? TotalTaxAmount { get; set; }
|
|
|
|
/// <summary>
|
|
/// Data about the order line. Set at creation or update and returned when fetching the order through the API. Maximum 1024 characters.
|
|
/// </summary>
|
|
/// <value>Data about the order line. Set at creation or update and returned when fetching the order through the API. Maximum 1024 characters.</value>
|
|
[StringLength(1024, MinimumLength = 0)]
|
|
[JsonProperty("merchant_data")]
|
|
public string MerchantData { get; set; }
|
|
|
|
/// <summary>
|
|
/// URL to the product that can be used in communications between Klarna and the customer. Maximum 1024 characters.
|
|
/// </summary>
|
|
/// <value>URL to the product that can be used in communications between Klarna and the customer. Maximum 1024 characters.</value>
|
|
[StringLength(1024, MinimumLength = 0)]
|
|
[JsonProperty("product_url")]
|
|
public string ProductUrl { get; set; }
|
|
|
|
/// <summary>
|
|
/// URL to an image that can be embedded in communications between Klarna and the customer. Maximum 1024 characters.
|
|
/// </summary>
|
|
/// <value>URL to an image that can be embedded in communications between Klarna and the customer. Maximum 1024 characters.</value>
|
|
[StringLength(1024, MinimumLength = 0)]
|
|
[JsonProperty("image_url")]
|
|
public string ImageUrl { get; set; }
|
|
|
|
/// <summary>
|
|
/// Identifiers to better describe the product for improved risk assessment, support, presentation to consumers and promotional functionality.
|
|
/// </summary>
|
|
/// <value>Identifiers to better describe the product for improved risk assessment, support, presentation to consumers and promotional functionality.</value>
|
|
[JsonProperty("product_identifiers")]
|
|
public ProductIdentifiers ProductIdentifiers { get; set; }
|
|
}
|
|
}
|