npm package: @plasma-platform/tm-service-orders
Description: Service Orders Api
Author: Kyrylo Voronoi
Latest version: 2.1.9

# Documentation

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [OrdersService](#ordersservice)
    -   [messages](#messages)
    -   [changeOrderPhoneNumber](#changeorderphonenumber)
    -   [checkOrders](#checkorders)
    -   [getListOfUserOrders](#getlistofuserorders)
    -   [getOrderById](#getorderbyid)
    -   [getOrderByIdPublic](#getorderbyidpublic)
    -   [checkDownloadLinkStatusByToken](#checkdownloadlinkstatusbytoken)
    -   [restoreDownloadLinkStatusByToken](#restoredownloadlinkstatusbytoken)

## OrdersService

-   **See: <http://service-orders.dev/doc/>**

### messages

object with class service messages

### changeOrderPhoneNumber

Orders - Change the phone number of the order

**Parameters**

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.orderId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ID of order (required).
    -   `params.phoneNumber` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** order phone number (required).

**Examples**

```javascript
(async () => {
  const service = new Service(url, token);
  const request = await service.changeOrderPhoneNumber(orderId);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

### checkOrders

-   **See: <http://service-orders.dev/api/v2/orders>**

Check orders

**Parameters**

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** params object
    -   `params.productType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of product. Allowed values: 'template', 'offer', 'membership'.
    -   `params.productIds` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ID's of products
    -   `params.orderIds` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ID's of orders
    -   `params.userId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Customer's ID
    -   `params.email` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Customer's email
    -   `params.status` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Order status
    -   `params.dateFrom` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Date range start
    -   `params.dateTo` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Date range end
    -   `params.paidOnly` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Search only paid orders
    -   `params.strict` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Strict search mode

**Examples**

```javascript
(async () => {
  const service = new Service('http://service-orders.dev/api/v2/');
  const request = await service.checkOrders(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

### getListOfUserOrders

-   **See: <http://service-orders.dev/api/v2/orders>**

Get list of users orders

**Parameters**

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** params object
    -   `params.page` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** page number to view.
    -   `params.perPage` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** records per page.
    -   `params.productType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** type of product. Allowed values: 'template', 'offer', 'membership'.
    -   `params.productIds` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ID's of products.
    -   `params.orderIds` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ID's of orders.
    -   `params.status` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** order status
    -   `params.email` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Customer's email
    -   `params.dateFrom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Date range start
    -   `params.dateTo` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Date range end
    -   `params.paidOnly` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Search only paid orders
    -   `params.strict` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Strict search mode

**Examples**

```javascript
(async () => {
  const service = new Service('http://service-orders.dev/api/v2/', token);
  const request = await service.getListOfUserOrders(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

### getOrderById

-   **See: <http://service-orders.dev/api/v2/orders/:id>**

Get order by ID

**Parameters**

-   `orderId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ID of order.

**Examples**

```javascript
(async () => {
  const service = new Service('http://service-orders.dev/api/v2/', token);
  const request = await service.getOrderById(orderId);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

### getOrderByIdPublic

Orders - Get order public data

**Parameters**

-   `orderId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ID of order (required).

**Examples**

```javascript
(async () => {
  const service = new Service(url);
  const request = await service.getOrderByIdPublic(orderId);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

### checkDownloadLinkStatusByToken

-   **See: <http://service-orders.dev/api/v1/orders/:orderId/:productId/download-link>**

Check download link status by access token

**Parameters**

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** params object
    -   `params.orderId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Order id (required).
    -   `params.productId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Product id (required).

**Examples**

```javascript
(async () => {
  const service = new Service('http://service-orders.dev/api/v1/', token);
  const request = await service.checkDownloadLinkStatusByToken(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

### restoreDownloadLinkStatusByToken

-   **See: <http://service-orders.dev/api/v1/orders/:orderId/:productId/download-link>**

Restore download link status by access token

**Parameters**

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** params object
    -   `params.orderId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Order id (required).
    -   `params.productId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Product id (required).

**Examples**

```javascript
(async () => {
  const service = new Service('http://service-orders.dev/api/v1/', token);
  const request = await service.restoreDownloadLinkStatusByToken(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>**