using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace gehGassi.Klarna.Checkout { public class Order { /// /// The merchant name (max 255 characters). /// /// The merchant name (max 255 characters). [JsonProperty("name")] public string Name { get; private set; } /// /// The current status of the order. The status will be ‘incomplete’ until the customer has been successfully authorized. /// /// The current status of the order. The status will be ‘incomplete’ until the customer has been successfully authorized. [JsonProperty("status")] public string Status { get; set; } /// /// Used to define the language and region of the customer. RFC 1766 customer's locale. /// /// Used to define the language and region of the customer. RFC 1766 customer's locale. [Required] [RegularExpression("/^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$/")] [JsonProperty("locale")] public string Locale { get; set; } /// /// Gets or Sets Customer /// [JsonProperty("customer")] public Customer Customer { get; set; } /// /// Gets or Sets Options /// [JsonProperty("options")] public Options Options { get; set; } /// /// Gets or Sets Attachment /// [JsonProperty("attachment")] public Attachment Attachment { get; set; } /// /// Gets or Sets Gui /// [JsonProperty("gui")] public Gui Gui { get; set; } /// /// Indicates whether this purchase will create a token that can be used by the merchant to create recurring purchases. This must be enabled for the merchant to use. Default: false Depending on specified country, recurring could be used for the following payment methods: Pay Later, Direct Debit, Card. /// /// Indicates whether this purchase will create a token that can be used by the merchant to create recurring purchases. This must be enabled for the merchant to use. Default: false Depending on specified country, recurring could be used for the following payment methods: Pay Later, Direct Debit, Card. [JsonProperty("recurring")] public bool? Recurring { get; set; } /// /// Extra information added to the order. Example: [\"dangerous_goods\", \"bulky\"] /// /// Extra information added to the order. Example: [\"dangerous_goods\", \"bulky\"] [JsonProperty("tags")] public List Tags { get; set; } /// /// Unique order ID that will be used for the entire lifecycle of the order. (max 255 characters) /// /// Unique order ID that will be used for the entire lifecycle of the order. (max 255 characters) [JsonProperty("order_id")] public string OrderId { get; private set; } /// /// The purchase country of the merchant's store. The format to be used is ISO 3166 alpha-2. Eg: GB, SE, DE, US, etc. Note: purchase country and currency need to match the defined merchant configuration. For global configuration read this https://developers.klarna.com/documentation/klarna-checkout/kco-global/ /// /// The purchase country of the merchant's store. The format to be used is ISO 3166 alpha-2. Eg: GB, SE, DE, US, etc. Note: purchase country and currency need to match the defined merchant configuration. For global configuration read this https://developers.klarna.com/documentation/klarna-checkout/kco-global/ [Required] [RegularExpression("/^[A-Za-z]{2,2}$/")] [JsonProperty("purchase_country")] public string PurchaseCountry { get; set; } /// /// The purchase currency of the merchant's store. The format to be used is ISO 4217. Eg: USD, EUR, SEK, GBP, etc. Note: purchase country and currency need to match the defined merchant configuration. For global configuration read this https://developers.klarna.com/documentation/klarna-checkout/kco-global/ /// /// The purchase currency of the merchant's store. The format to be used is ISO 4217. Eg: USD, EUR, SEK, GBP, etc. Note: purchase country and currency need to match the defined merchant configuration. For global configuration read this https://developers.klarna.com/documentation/klarna-checkout/kco-global/ [Required] [RegularExpression("/^[A-Za-z]{3,3}$/")] [JsonProperty("purchase_currency")] public string PurchaseCurrency { get; set; } /// /// Gets or Sets BillingAddress /// [JsonProperty("billing_address")] public Address BillingAddress { get; set; } /// /// Gets or Sets ShippingAddress /// [JsonProperty("shipping_address")] public Address ShippingAddress { get; set; } /// /// Total amount of the order including tax and any available discounts. The value should be in non-negative minor units. Example: 25 Euros should be 2500. /// /// Total amount of the order including tax and any available discounts. The value should be in non-negative minor units. Example: 25 Euros should be 2500. [Required] [JsonProperty("order_amount")] public long? OrderAmount { get; set; } /// /// Total tax amount of the order. The value should be in non-negative minor units. Example: 25 Euros should be 2500. /// /// Total tax amount of the order. The value should be in non-negative minor units. Example: 25 Euros should be 2500. [Required] [JsonProperty("order_tax_amount")] public long? OrderTaxAmount { get; set; } /// /// An array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order. /// /// An array containing list of line items that are part of this order. Maximum of 1000 line items could be processed in a single order. [Required] [JsonProperty("order_lines")] public List OrderLines { get; set; } /// /// Gets or Sets MerchantUrls /// [JsonProperty("merchant_urls")] public MerchantUrls MerchantUrls { get; set; } /// /// The HTML snippet that is used to render the checkout in an iframe. /// /// The HTML snippet that is used to render the checkout in an iframe. [JsonProperty("html_snippet")] public string HtmlSnippet { get; private set; } /// /// Used for storing merchant's internal order number or other reference. If set, will be shown on the confirmation page as \"order number\" . The value is also available in the settlement files. (max 255 characters). Example: \"45aa52f387871e3a210645d4\" /// /// Used for storing merchant's internal order number or other reference. If set, will be shown on the confirmation page as \"order number\" . The value is also available in the settlement files. (max 255 characters). Example: \"45aa52f387871e3a210645d4\" [StringLength(255, MinimumLength = 0)] [JsonProperty("merchant_reference1")] public string MerchantReference1 { get; set; } /// /// Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters). Example: \"45aa52f387871e3a210645d4\" /// /// Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters). Example: \"45aa52f387871e3a210645d4\" [StringLength(255, MinimumLength = 0)] [JsonProperty("merchant_reference2")] public string MerchantReference2 { get; set; } /// /// ISO 8601 datetime. The date and time when the order has been created. The format will be as follows: \"yyyy-mm-ddThh:mm:ssZ\" /// /// ISO 8601 datetime. The date and time when the order has been created. The format will be as follows: \"yyyy-mm-ddThh:mm:ssZ\" [JsonProperty("started_at")] public DateTime? StartedAt { get; private set; } /// /// ISO 8601 datetime. The date and time when the order has been completed. The format will be as follows: \"yyyy-mm-ddThh:mm:ssZ\" /// /// ISO 8601 datetime. The date and time when the order has been completed. The format will be as follows: \"yyyy-mm-ddThh:mm:ssZ\" [JsonProperty("completed_at")] public DateTime? CompletedAt { get; private set; } /// /// ISO 8601 datetime. The date and time when the order was last modified. The format will be as follows: \"yyyy-mm-ddThh:mm:ssZ\" /// /// ISO 8601 datetime. The date and time when the order was last modified. The format will be as follows: \"yyyy-mm-ddThh:mm:ssZ\" [JsonProperty("last_modified_at")] public DateTime? LastModifiedAt { get; private set; } /// /// List of external payment methods that will be displayed as part of payment methods in the checkout. /// /// List of external payment methods that will be displayed as part of payment methods in the checkout. [JsonProperty("external_payment_methods")] public List ExternalPaymentMethods { get; set; } /// /// List of external checkouts that will be displayed as part of payment methods in the checkout. The image_url is required, and the image size has to be 276x48px /// /// List of external checkouts that will be displayed as part of payment methods in the checkout. The image_url is required, and the image size has to be 276x48px [JsonProperty("external_checkouts")] public List ExternalCheckouts { get; set; } /// /// List of allowed shipping countries for this order in ISO-3166 alpha-2 format. If specified, the customer will be able to change the shipping country in the checkout and you will be notified through ‘address_update’ callback or the ‘shipping_address_change’ javascript event. If not specified then the default value will be the purchase country. Example: look at billing_countries example. /// /// List of allowed shipping countries for this order in ISO-3166 alpha-2 format. If specified, the customer will be able to change the shipping country in the checkout and you will be notified through ‘address_update’ callback or the ‘shipping_address_change’ javascript event. If not specified then the default value will be the purchase country. Example: look at billing_countries example. [JsonProperty("shipping_countries")] public List ShippingCountries { get; set; } /// /// A list of shipping options available for this order. /// /// A list of shipping options available for this order. [JsonProperty("shipping_options")] public List ShippingOptions { get; set; } /// /// Pass through field to send any information about the order to be used later for reference while retrieving the order details (max 6000 characters). /// /// Pass through field to send any information about the order to be used later for reference while retrieving the order details (max 6000 characters). [StringLength(6000, MinimumLength = 0)] [JsonProperty("merchant_data")] public string MerchantData { get; set; } /// /// Gets or Sets MerchantRequested /// [JsonProperty("merchant_requested")] public MerchantRequested MerchantRequested { get; set; } /// /// Gets or Sets SelectedShippingOption /// [JsonProperty("selected_shipping_option")] public ShippingOption SelectedShippingOption { get; set; } /// /// Token to be used when creating recurring orders. /// /// Token to be used when creating recurring orders. [JsonProperty("recurring_token")] public string RecurringToken { get; private set; } /// /// Description to be added to the recurring order. /// /// Description to be added to the recurring order. [StringLength(255, MinimumLength = 0)] [JsonProperty("recurring_description")] public string RecurringDescription { get; private set; } /// /// List of allowed billing countries for this order. If specified, the customer will be able to change the billing country in the checkout and you will be notified through ‘country_change’ callback or the ‘billing_address_change’ javascript event. If not specified but shipping_countries is specified, will use same values as shipping_countries. If not specified and shipping_countries is not specified, then the default value will be the purchase country. Example: [\"AD\", \"AE\", \"AG\", \"AI\", \"AL\", \"AM\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CF\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GR\", \"GS\", \"GT\", \"GU\", \"GY\", \"HK\", \"HN\", \"HR\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KI\", \"KM\", \"KN\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SR\", \"ST\", \"SV\", \"SX\", \"SZ\", \"TC\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"XK\", \"YT\", \"ZA\", \"ZM\", \"ZW\"]\" /// /// List of allowed billing countries for this order. If specified, the customer will be able to change the billing country in the checkout and you will be notified through ‘country_change’ callback or the ‘billing_address_change’ javascript event. If not specified but shipping_countries is specified, will use same values as shipping_countries. If not specified and shipping_countries is not specified, then the default value will be the purchase country. Example: [\"AD\", \"AE\", \"AG\", \"AI\", \"AL\", \"AM\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CF\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GR\", \"GS\", \"GT\", \"GU\", \"GY\", \"HK\", \"HN\", \"HR\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KI\", \"KM\", \"KN\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SR\", \"ST\", \"SV\", \"SX\", \"SZ\", \"TC\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"XK\", \"YT\", \"ZA\", \"ZM\", \"ZW\"]\" [JsonProperty("billing_countries")] public List BillingCountries { get; set; } } }