From 2504b97016709a1e64c5f8535956d83bc9c7bc44 Mon Sep 17 00:00:00 2001 From: Alexander Zinovev Date: Thu, 8 Aug 2019 16:53:02 +0200 Subject: [PATCH] Fix #53: Actualize the CheckoutOrder and OrderManagementOrder models. --- .../Klarna.Rest.Core/Model/CheckoutOrder.cs | 119 +++++++++++++----- .../Model/OrderManagementOrder.cs | 66 ++++++++-- 2 files changed, 148 insertions(+), 37 deletions(-) diff --git a/Klarna.Rest/Klarna.Rest.Core/Model/CheckoutOrder.cs b/Klarna.Rest/Klarna.Rest.Core/Model/CheckoutOrder.cs index ebd9df9..8145f02 100644 --- a/Klarna.Rest/Klarna.Rest.Core/Model/CheckoutOrder.cs +++ b/Klarna.Rest/Klarna.Rest.Core/Model/CheckoutOrder.cs @@ -3,186 +3,247 @@ namespace Klarna.Rest.Core.Model { + /// + /// + /// public class CheckoutOrder { /// /// The unique order ID (max 255 characters). /// - /// Read only + /// The unique order ID (max 255 characters). [JsonProperty(PropertyName = "order_id")] public string OrderId { get; set; } + /// /// The merchant name (max 255 characters). /// - /// Read only + /// The merchant name (max 255 characters). [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// /// ISO 3166 alpha-2 purchase country. /// - /// Required + /// ISO 3166 alpha-2 purchase country. [JsonProperty(PropertyName = "purchase_country")] public string PurchaseCountry { get; set; } + /// /// ISO 4217 purchase currency. /// - /// Required + /// ISO 4217 purchase currency. [JsonProperty(PropertyName = "purchase_currency")] public string PurchaseCurrency { get; set; } + /// /// RFC 1766 customer's locale. /// - /// Required + /// RFC 1766 customer's locale. [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } + /// /// The current status of the order. /// - /// Read only + /// The current status of the order. [JsonProperty(PropertyName = "status")] public string Status { get; set; } + /// /// Once the customer has provided any data in the checkout iframe, updates to this object will be ignored (without generating an error). /// + /// Once the customer has provided any data in the checkout iframe, updates to this object will be ignored (without generating an error). [JsonProperty(PropertyName = "billing_address")] public CheckoutAddressInfo BillingCheckoutAddress { get; set; } + /// - /// Unless the customer has explicitly chosen to enter a separate shipping address, this is a clone of BillingAddress. + /// Unless the customer has explicitly chosen to enter a separate shipping address, this is a clone of billing_address. /// - /// Read only + /// Unless the customer has explicitly chosen to enter a separate shipping address, this is a clone of billing_address. [JsonProperty(PropertyName = "shipping_address")] public CheckoutAddressInfo ShippingCheckoutAddress { get; set; } + /// /// Non-negative, minor units. Total amount of the order, including tax and any discounts. /// - /// Required + /// Non-negative, minor units. Total amount of the order, including tax and any discounts. [JsonProperty(PropertyName = "order_amount")] public int OrderAmount { get; set; } + /// /// Non-negative, minor units. The total tax amount of the order. /// - /// Required + /// Non-negative, minor units. The total tax amount of the order. [JsonProperty(PropertyName = "order_tax_amount")] public int OrderTaxAmount { get; set; } + /// /// The applicable order lines (max 1000) /// - /// Required + /// The applicable order lines (max 1000) [JsonProperty(PropertyName = "order_lines")] public ICollection OrderLines { get; set; } + /// /// Information about the liable customer of the order. /// + /// Information about the liable customer of the order. [JsonProperty(PropertyName = "customer")] public CheckoutCustomer CheckoutCustomer { get; set; } + /// - /// The MerchantUrls object. + /// The merchant_urls object. /// - /// Required + /// The merchant_urls object. [JsonProperty(PropertyName = "merchant_urls")] public CheckoutMerchantUrls MerchantUrls { get; set; } + /// /// The HTML snippet that is used to render the checkout in an iframe. /// - /// Read only + /// The HTML snippet that is used to render the checkout in an iframe. [JsonProperty(PropertyName = "html_snippet")] public string HtmlSnippet { get; set; } + /// - /// Used for storing merchant's internal order number or other reference. If set, will be shown on the confirmation page as "order number" (max 255 characters). + /// Used for storing merchant's internal order number or other reference. If set, will be shown on the confirmation page as \"order number\" (max 255 characters). /// + /// Used for storing merchant's internal order number or other reference. If set, will be shown on the confirmation page as \"order number\" (max 255 characters). [JsonProperty(PropertyName = "merchant_reference1")] public string MerchantReference1 { get; set; } + /// - /// Used for storing merchant's internal order number of other reference (max 255 characters). + /// Used for storing merchant's internal order number or other reference (max 255 characters). /// + /// Used for storing merchant's internal order number or other reference (max 255 characters). [JsonProperty(PropertyName = "merchant_reference2")] public string MerchantReference2 { get; set; } + /// /// ISO 8601 datetime. When the merchant created the order. /// - /// Read only + /// ISO 8601 datetime. When the merchant created the order. [JsonProperty(PropertyName = "started_at")] public string StartedAt { get; set; } + /// /// ISO 8601 datetime. When the customer completed the order. /// - /// Read only + /// ISO 8601 datetime. When the customer completed the order. [JsonProperty(PropertyName = "completed_at")] public string CompletedAt { get; set; } + /// /// ISO 8601 datetime. When the order was last modified. /// - /// Read only + /// ISO 8601 datetime. When the order was last modified. [JsonProperty(PropertyName = "last_modified_at")] public string LastModifiedAt { get; set; } + /// - /// Options for the purchase. + /// Options for this purchase. /// + /// Options for this purchase. [JsonProperty(PropertyName = "options")] public CheckoutOptions CheckoutOptions { get; set; } + /// /// Additional purchase information required for some industries. /// + /// Additional purchase information required for some industries. [JsonProperty(PropertyName = "attachment")] public Attachment Attachment { get; set; } + /// /// List of external payment methods. /// + /// List of external payment methods. [JsonProperty(PropertyName = "external_payment_methods")] public ICollection ExternalPaymentMethods { get; set; } + /// /// List of external checkouts. /// - [JsonProperty(PropertyName = "externa_checkouts")] + /// List of external checkouts. + [JsonProperty(PropertyName = "external_checkouts")] public ICollection ExternalCheckouts { get; set; } + /// - /// A list of countries (ISO 3166 alpha-2). Default is PurchaseCountry only. + /// A list of countries (ISO 3166 alpha-2). Default is purchase_country only. /// + /// A list of countries (ISO 3166 alpha-2). Default is purchase_country only. [JsonProperty(PropertyName = "shipping_countries")] public ICollection ShippingCountries { get; set; } + /// /// A list of shipping options available for this order. /// + /// A list of shipping options available for this order. [JsonProperty(PropertyName = "shipping_options")] public ICollection ShippingOptions { get; set; } + /// - /// Pass through field (max 1024 characters). + /// Pass through field (max 6000 characters). /// + /// Pass through field (max 6000 characters). [JsonProperty(PropertyName = "merchant_data")] public string MerchantData { get; set; } + /// /// The gui object. /// + /// The gui object. [JsonProperty(PropertyName = "gui")] public Gui Gui { get; set; } + /// - /// Stored merchant requested data. + /// Stores merchant requested data. /// - /// Read only + /// Stores merchant requested data. [JsonProperty(PropertyName = "merchant_requested")] public MerchantRequested MerchantRequested { get; set; } + /// /// Current shipping options selected by the customer. /// - /// Read only + /// Current shipping options selected by the customer. [JsonProperty(PropertyName = "selected_shipping_option")] public ShippingOption SelectedShippingOption { 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 /// + /// 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 [JsonProperty(PropertyName = "recurring")] public bool Recurring { get; set; } + /// /// Token to be used when creating recurring orders. /// - /// Read only + /// Token to be used when creating recurring orders. [JsonProperty(PropertyName = "recurring_token")] public string RecurringToken { get; set; } + /// - /// Description recurring subscriptions. + /// Description recurring subscription. /// - /// Read only + /// Description recurring subscription. [JsonProperty(PropertyName = "recurring_description")] public string RecurringDescription { get; set; } + + /// + /// A list of countries (ISO 3166 alpha-2) to specify allowed billing countries. + /// + /// A list of countries (ISO 3166 alpha-2) to specify allowed billing countries. + [JsonProperty(PropertyName = "billing_countries")] + public ICollection BillingCountries { get; set; } + + /// + /// The product's extra features + /// + /// The product's extra features + [JsonProperty(PropertyName = "tags")] + public ICollection Tags { get; set; } } } \ No newline at end of file diff --git a/Klarna.Rest/Klarna.Rest.Core/Model/OrderManagementOrder.cs b/Klarna.Rest/Klarna.Rest.Core/Model/OrderManagementOrder.cs index 7f28a7c..f40d10a 100644 --- a/Klarna.Rest/Klarna.Rest.Core/Model/OrderManagementOrder.cs +++ b/Klarna.Rest/Klarna.Rest.Core/Model/OrderManagementOrder.cs @@ -5,128 +5,178 @@ namespace Klarna.Rest.Core.Model { + /// + /// + /// public class OrderManagementOrder { /// - /// The unique order ID. No longer than 255 characters. + /// The unique order ID. Cannot be longer than 255 characters. /// + /// The unique order ID. Cannot be longer than 255 characters. [JsonProperty(PropertyName = "order_id")] public string OrderId { get; set; } + /// - /// the order status. + /// The order status. /// + /// The order status. [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "status")] public OrderManagementOrderStatus Status { get; set; } + /// - /// Fraud status for the order. + /// Fraud status for the order. Either ACCEPTED, PENDING or REJECTED. /// + /// Fraud status for the order. Either ACCEPTED, PENDING or REJECTED. [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "fraud_status")] public OrderManagementFraudStatus FraudStatus { get; set; } + /// /// The order amount in minor units. That is the smallest currency unit available such as cent or penny. /// + /// The order amount in minor units. That is the smallest currency unit available such as cent or penny. [JsonProperty(PropertyName = "order_amount")] public int OrderAmount { get; set; } + /// /// The original order amount. In minor units. /// + /// The original order amount. In minor units. [JsonProperty(PropertyName = "original_order_amount")] public int OriginalOrderAmount { get; set; } + /// /// The total amount of all captures. In minor units. /// + /// The total amount of all captures. In minor units. [JsonProperty(PropertyName = "captured_amount")] public int CapturedAmount { get; set; } + /// /// The total amount of refunded for this order. In minor units. /// + /// The total amount of refunded for this order. In minor units. [JsonProperty(PropertyName = "refunded_amount")] public int RefundedAmount { get; set; } + /// - /// he remaining authorized amount for this order. To increase the remaining_authorized_amount the order_amount needs to be increased. + /// The remaining authorized amount for this order. To increase the `remaining_authorized_amount` the `order_amount` needs to be increased. /// + /// The remaining authorized amount for this order. To increase the `remaining_authorized_amount` the `order_amount` needs to be increased. [JsonProperty(PropertyName = "remaining_authorized_amount")] public int RemainingAuthorizedAmount { get; set; } + /// /// The currency for this order. Specified in ISO 4217 format. /// + /// The currency for this order. Specified in ISO 4217 format. [JsonProperty(PropertyName = "purchase_currency")] public string PurchaseCurrency { get; set; } + /// /// The customers locale. Specified according to RFC 1766. /// + /// The customers locale. Specified according to RFC 1766. [JsonProperty(PropertyName = "locale")] public string Locale { get; set; } + /// /// An array of order_line objects. Each line represents one item in the cart. /// + /// An array of order_line objects. Each line represents one item in the cart. [JsonProperty(PropertyName = "order_lines")] public ICollection OrderLines { get; set; } + /// - /// Merchant reference 1. Can be used to store your internal reference to the order. + /// The order number that the merchant should assign to the order. This is how a customer would reference the purchase they made. If supplied, it is labeled as the Order Number within post purchase communications as well as the Klarna App. /// + /// The order number that the merchant should assign to the order. This is how a customer would reference the purchase they made. If supplied, it is labeled as the Order Number within post purchase communications as well as the Klarna App. [JsonProperty(PropertyName = "merchant_reference1")] public string MerchantReference1 { get; set; } + /// - /// Merchant reference 2. Can be used to store your internal reference to the order. + /// Can be used to store your internal reference to the order. This is generally an internal reference number that merchants use as alternate identifier that matches their internal ERP or Order Management system. /// + /// Can be used to store your internal reference to the order. This is generally an internal reference number that merchants use as alternate identifier that matches their internal ERP or Order Management system. [JsonProperty(PropertyName = "merchant_reference2")] public string MerchantReference2 { get; set; } + /// - /// Customer friendly reference id, used as order reference when communicating with the customer. + /// A Klarna generated reference that is shorter than the Klarna Order Id and is used as a customer friendly reference. It is most often used as a reference when Klarna is communicating with the customer with regard to payment statuses. /// + /// A Klarna generated reference that is shorter than the Klarna Order Id and is used as a customer friendly reference. It is most often used as a reference when Klarna is communicating with the customer with regard to payment statuses. [JsonProperty(PropertyName = "klarna_reference")] public string KlarnaReference { get; set; } + /// /// Information about the customer placing the order. /// + /// Information about the customer placing the order. [JsonProperty(PropertyName = "customer")] public OrderManagementCustomer Customer { get; set; } + /// /// Customer billing address. /// + /// Customer billing address. [JsonProperty(PropertyName = "billing_address")] public OrderManagementAddressInfo BillingAddress { get; set; } + /// - /// Customer shipping address + /// Customer shipping address. /// + /// Customer shipping address. [JsonProperty(PropertyName = "shipping_address")] public OrderManagementAddressInfo ShippingAddress { get; set; } + /// /// The time for the purchase. Formatted according to ISO 8601. /// + /// The time for the purchase. Formatted according to ISO 8601. [JsonProperty(PropertyName = "created_at")] public string CreatedAt { get; set; } + /// /// The purchase country. Formatted according to ISO 3166-1 alpha-2. /// + /// The purchase country. Formatted according to ISO 3166-1 alpha-2. [JsonProperty(PropertyName = "purchase_country")] public string PurchaseCountry { get; set; } + /// /// Order expiration time. The order can only be captured until this time. Formatted according to ISO 8601. /// + /// Order expiration time. The order can only be captured until this time. Formatted according to ISO 8601. [JsonProperty(PropertyName = "expires_at")] public string ExpiresAt { get; set; } + /// /// List of captures for this order. /// + /// List of captures for this order. [JsonProperty(PropertyName = "captures")] public ICollection Captures { get; set; } + /// /// List of refunds for this order. /// + /// List of refunds for this order. [JsonProperty(PropertyName = "refunds")] public ICollection Refunds { get; set; } + /// /// Text field for storing data about the order. Set at order creation. /// + /// Text field for storing data about the order. Set at order creation. [JsonProperty(PropertyName = "merchant_data")] public string MerchantData { get; set; } + /// /// Initial payment method for this order /// + /// Initial payment method for this order [JsonProperty(PropertyName = "initial_payment_method")] public OrderManagementInitialPaymentMethod InitialPaymentMethod { get; set; } }