# CalculateOrder

**Description**

We use this method to calculate the order in real time against the business rules defined in the ERP system. Extra orderlines can be returned, for example service fees, shipping costs and/or administrative fees.

## SOAP API:

**Action**

<http://shoxl.com/ShoxlService/CalculateOrder>

{% hint style="info" %}
Please note: this is not a working url, but a combination of namespace and method. Do not expect the url to return a result.
{% endhint %}

**Style**

Document

### Input (Literal)

The input of this method is the document element tns:CalculateOrder having the structure defined by the following table.

<table data-header-hidden><thead><tr><th width="163">Element</th><th>Type</th><th width="150">Occurs</th><th>Description</th></tr></thead><tbody><tr><td>Element</td><td>Type</td><td>Occurs</td><td>Description</td></tr><tr><td>Sequence</td><td></td><td>1..1</td><td></td></tr><tr><td>request</td><td>tns:CalculateOrderRequest</td><td>0..1</td><td></td></tr></tbody></table>

#### *Complex Type: tns:CalculateOrderRequest*

**Description**

The CalculateOrderRequest contains all the information needed to calculate the

Order in the ERP system.

<table data-header-hidden><thead><tr><th>Component</th><th width="165">Type</th><th width="150">Occurs</th><th>Description</th></tr></thead><tbody><tr><td>Component</td><td>Type</td><td>Occurs</td><td>Description</td></tr><tr><td>Sequence</td><td></td><td>1..1</td><td></td></tr><tr><td>AccountNumber</td><td>s:string</td><td>1..1</td><td>This is the (project) account number of the customer.</td></tr><tr><td>ExternalOrderNumber</td><td>s:string</td><td>1..1</td><td>This the Shoxl Shop unique order number</td></tr><tr><td>OrderLines</td><td>tns:ArrayOfOrderLineRequest</td><td>0..1</td><td>A list of order lines. The order needs to be calculated for.</td></tr><tr><td>ShipmentMethodCode</td><td>s:int</td><td>1..1</td><td>A Shipment Method Code: 0 = pickup by customer, 1 = default delivery</td></tr></tbody></table>

#### *Complex Type: tns:ArrayOfOrderLineRequest*

<table data-header-hidden><thead><tr><th width="178.0752688172043">Component</th><th width="194">Type</th><th width="150">Occurs</th><th>Description</th></tr></thead><tbody><tr><td>Component</td><td>Type</td><td>Occurs</td><td>Description</td></tr><tr><td>Sequence</td><td></td><td>1..1</td><td></td></tr><tr><td>OrderLine</td><td>tns:OrderLineRequest</td><td>0..*</td><td></td></tr></tbody></table>

#### *Complex Type: tns:OrderLineRequest*

A orderline Request contains all the information needed to calculate.

<table data-header-hidden><thead><tr><th width="181">Component</th><th>Type</th><th width="150">Occurs</th><th>Description</th></tr></thead><tbody><tr><td>Component</td><td>Type</td><td>Occurs</td><td>Description</td></tr><tr><td>Sequence</td><td></td><td>1..1</td><td></td></tr><tr><td>IsExternal</td><td>s:boolean</td><td>1..1</td><td>If the order line is added by the ERP system (for example when its an extra fee or shipping costs), this field must be set true. If Shoxl Shop adds an order line this field is set false.</td></tr><tr><td>ProductNumber</td><td>s:string</td><td>1..1</td><td>The product number for the requested product details, this can be a customer-specific product number</td></tr><tr><td>Quantity</td><td>s:int</td><td>1..1</td><td>The amount of products ordered</td></tr></tbody></table>

### Output (Literal)

The output of this method is the document element tns:CalculateOrderResponse having the structure defined by the following table.

<table data-header-hidden><thead><tr><th width="178">Element</th><th>Type</th><th width="150">Occurs</th><th>Description</th></tr></thead><tbody><tr><td>Element</td><td>Type</td><td>Occurs</td><td>Description</td></tr><tr><td>Sequence</td><td></td><td>1..1</td><td></td></tr><tr><td>CalculateOrderResult</td><td>tns:CalculateOrderResult</td><td>0..1</td><td></td></tr></tbody></table>

#### *Complex Type: tns:CalculateOrderResult*

**Description**

The CalculateOrderResult contains the update order line information from the

ERP system.

<table data-header-hidden><thead><tr><th>Component</th><th width="196">Type</th><th width="150">Occurs</th><th>Description</th></tr></thead><tbody><tr><td>Component</td><td>Type</td><td>Occurs</td><td>Description</td></tr><tr><td>Sequence</td><td></td><td>1..1</td><td></td></tr><tr><td>ErrorCode</td><td>s:string</td><td>0..1</td><td>An error code returned by the ERP system</td></tr><tr><td>ErrorDescription</td><td>s:string</td><td>0..1</td><td>The error description related to the error code returned by the ERP system</td></tr><tr><td>OrderLines</td><td>tns:ArrayOfOrderLine</td><td>0..1</td><td>The calculated orderlines.</td></tr><tr><td>TotalAmount</td><td>s:int</td><td>1..1</td><td>The total amount of items in the order</td></tr><tr><td>TotalDiscountExclVat</td><td>s:decimal</td><td>1..1</td><td>The total amount of discount excluding VAT</td></tr><tr><td>TotalPriceExclVat</td><td>s:decimal</td><td>1..1</td><td>The total price of the order excluding VAT</td></tr><tr><td>TotalPriceInclVat</td><td>s:decimal</td><td>1..1</td><td>The total price of the order including VAT</td></tr><tr><td>TotalVat</td><td>s:decimal</td><td>1..1</td><td>The total amount of VAT</td></tr></tbody></table>

## REST API:

**URL:** /Shoxl/v1/CalculateOrder\
**Method:** POST

**Request body:**

### CalculateOrderRequest{

| Parameter           | Type                      |                                                                                   |
| ------------------- | ------------------------- | --------------------------------------------------------------------------------- |
| accountNumber       | <p>string<br>required</p> | This is the (project) account number of the customer.                             |
| externalOrderNumber | string                    | This the Shoxl Shop unique order number                                           |
| orderLines          | \[OrderLineRequest]       | The order needs to be calculated for.                                             |
| shipmentMethodCode  | integer($int32)           | A Shipment Method Code: 0 = pickup by customer, 1 = default delivery              |
| shippingCountry     | string                    | The country where the order is shipped to. Must be a two-letter ISO country code. |

}

#### &#x20;OrderLineRequest{

| parameter     | type                      |
| ------------- | ------------------------- |
| isExternal    | boolean                   |
| productNumber | <p>string<br>required</p> |
| quantity      | integer($int32)           |

}

#### Example:

```
{
  "accountNumber": "string",
  "externalOrderNumber": "string",
  "orderLines": [
    {
      "isExternal": true,
      "productNumber": "string",
      "quantity": 0
    }
  ],
  "shipmentMethodCode": 0,
  "shippingCountry": "BE"
}
```

###

**Response body:**

### CalculateOrderResult{

| errorCode            | <p>string<br>nullable: true</p> |
| -------------------- | ------------------------------- |
| errorDescription     | <p>string<br>nullable: true</p> |
| orderLines           | \[OrderLine]                    |
| totalAmount          | integer($int32)                 |
| totalDiscountExclVat | number($double)                 |
| totalPriceExclVat    | number($double)                 |
| totalPriceInclVat    | number($double)                 |
| totalVat             | number($double)                 |

}

### **Orderline{**

| baseUnit               | <p>string<br>nullable: true</p>          |
| ---------------------- | ---------------------------------------- |
| carrier                | <p>string<br>nullable: true</p>          |
| discountAmountExclVat  | <p>number($double)<br>nullable: true</p> |
| discountDescription    | <p>string<br>nullable: true</p>          |
| discountPercentage     | <p>number($double)<br>nullable: true</p> |
| grossPriceExclVat      | number($double)                          |
| isExternal             | boolean                                  |
| nettoPriceExclVat      | number($double)                          |
| nettoPriceInclVat      | number($double)                          |
| orderLineStatus        | integer($int32)                          |
| priceUnit              | number($double)                          |
| productDescription     | <p>string<br>nullable: true</p>          |
| productNumber          | <p>string<br>nullable: true</p>          |
| quantity               | number($double)                          |
| remainingQuantity      | number($double)                          |
| subTotalPriceExclVat   | number($double)                          |
| subTotalPriceInclVat   | number($double)                          |
| trackAndTraceReference | <p>string<br>nullable: true</p>          |
| vatCode                | integer($int32)                          |
| type                   | integer($int32)                          |
| relatedProductNumber   | <p>string<br>nullable: true</p>          |

}&#x20;

**Types**:

| Type | Values                                                                                                                          |
| ---- | ------------------------------------------------------------------------------------------------------------------------------- |
| Type | <p>None = 0</p><p>Product = 1</p><p>Shipping = 2</p><p>Payment = 3</p><p>Other = 4</p><p>Discount = 5</p><p>DisposalFee = 6</p> |

#### Example:

```
{
  "errorCode": "string",
  "errorDescription": "string",
  "orderLines": [
    {
      "baseUnit": "string",
      "carrier": "string",
      "discountAmountExclVat": 0,
      "discountDescription": "string",
      "discountPercentage": 0,
      "grossPriceExclVat": 0,
      "isExternal": true,
      "nettoPriceExclVat": 0,
      "nettoPriceInclVat": 0,
      "orderLineStatus": 0,
      "priceUnit": 0,
      "productDescription": "string",
      "productNumber": "string",
      "quantity": 0,
      "remainingQuantity": 0,
      "subTotalPriceExclVat": 0,
      "subTotalPriceInclVat": 0,
      "trackAndTraceReference": "string",
      "vatCode": 0,
      "type": 0,
      "relatedProductNumber": "string"
    }
  ],
  "totalAmount": 0,
  "totalDiscountExclVat": 0,
  "totalPriceExclVat": 0,
  "totalPriceInclVat": 0,
  "totalVat": 0
}
```
