# OrderItem

An object representing a row in an Order.

info

Order items are not created with this API class; they are always created by Order.addArticle.

# Properties

Property Type Decription
uid integer The unique identifier of the order item.
order integer The order number associated with the order item.
costs Costs The cost details of the order item.
revenueShare RevenueShare Revenue-share details of the order item, if any. See below.
discountInfo DiscountInfo The discount details of the order item, if any.
article integer The unique identifier of an article.
articleNumber string An optional identifier of the article modifiable by an adminstrator. May contain letters, hyphens, numbers and other characters.
articleName string An optional identifier of the article modifiable by an adminstrator. May contain letters, hyphens, numbers and other characters.
choices object The ArticleChoices that were made when ordering the article, e.g. {"1324567": "789456123", "quantity": 2}.
download string The download URL of the order item, if any.

# Costs

These are the properties for the costs object:

Property Type Description
total number The total amount of the order item influenced by, e.g., the quantity added to cart.
unit number The unit cost of the order item.

In turn, the above objects have the following properties:

Property Type Decription
currency string The currency of the order item.
exVat number The amount excluding value-added tax.
incVat number The amount including value-added tax.
vat number Value-added tax of the order item.
vatRate number Value-added tax rate of the order item as a decimal number, e.g. 0.12 for 12%.

# DiscountInfo

These are the properties for the 'discountInfo' object:

Property Type Decription
discount integer The unique identifier of the discount.
exVat number The discount amount excluding value-added tax.
incVat number The discount amount including value-added tax.
name string Name of the discount, e.g. "Students and teachers".
rate number The discount rate of the order item as a decimal number, e.g. 0.2 for 20%.
vat number Value-added tax of the discount.
vatRate number Value-added tax rate of the discount as a decimal number, e.g. 0.12 for 12%.

# RevenueShare

These are the properties for the 'revenueShare' object:

Property Type Decription
suborder integer The unique identifier of the suborder, if any.
supplier integer The unique identifier of the supplier, if any.
exVat number The revenue-share amount excluding value-added tax.
incVat number The revenue-share amount including value-added tax.
vat number Value-added tax of the revenue share.
vatRate number Value-added tax rate of the revenue share as a decimal number, e.g. 0.12 for 12%.

# Methods

# delete

Deletes an order item.

# Parameters

The unique identifier of the order item.

# Errors

Code Message Description
1006 Forbidden The request is forbidden. This may be because you don't have the required permissions.

# Returns

If the request is successful, then an empty response (null) is returned.

# Example

OrderItem.delete(123456)

# get

# Parameters

Parameter Type Description
uid integer The unique identifier of an order item.
query mixed Which info to return. See Query language.

# Example

OrderItem.get(999999)

# getSchema

Fetches the JSON Schema which can be used for client-side validation.

# Parameters

Parameter Description
uid The unique identifier of an order item.

# set

Updates an order item. At present, the only property that can be set is choices/quantity.

# Parameters

Parameter Description
uid The unique identifier of an article or null to create a new order item.
patch An object containing the properties and values to set for the order item.
query A query specifying what to return after a successful set (optional).

# Returns

If the request is successful, then either the unique identifier of the order item is returned or what had been specified in the query.

# Errors

Code Message Description
-32003 Bad call The request is formally correct but the operation can still not be performed.
1006 Forbidden The request is forbidden. This may be because you don't have the required permissions.
9001 Validation error The parameters contents failed JSON-Schema validation. The data is an array of objects with the properies message (readable text) and pointer (a JSON Poiter to the property where the validation failed).

# Example

The request below sets quantity to 3 for the order item 999999 and returns the choices and unique identifiers of the order item as well as the unique identifier of the order.

OrderItem.set(999999, {
  "choices": {
    "quantity": 3
  }
}, [
  "choices",
  "order",
  "uid"
])