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

![version](https://badgen.net/npm/v/@plasma-platform/service-orders)
![nextVersion](https://badgen.net/npm/v/@plasma-platform/service-orders/next)
![downloads](https://badgen.net/npm/dt/@plasma-platform/service-orders)
![license](https://badgen.net/npm/license/@plasma-platform/service-orders)
![dependency](https://badgen.net/npm/dependents/@plasma-platform/service-orders)  

* * *

[Full documentation](https://templatemonster.gitlab.io/PlasmaPlatform/Frontend/plasma-platform/?path=/story/plasma-platform-sdk--service-orders)  
install:  
`npm i @plasma-platform/service-orders -S`  

# Short documentation

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

### Table of Contents

-   [OrdersService](#ordersservice)
    -   [messages](#messages)
    -   [changeOrderPhoneNumber](#changeorderphonenumber)
        -   [Parameters](#parameters)
        -   [Examples](#examples)
    -   [checkOrders](#checkorders)
        -   [Parameters](#parameters-1)
        -   [Examples](#examples-1)
    -   [checkRepurchase](#checkrepurchase)
        -   [Parameters](#parameters-2)
        -   [Examples](#examples-2)
    -   [getListOfUserOrders](#getlistofuserorders)
        -   [Parameters](#parameters-3)
        -   [Examples](#examples-3)
    -   [getOrderById](#getorderbyid)
        -   [Parameters](#parameters-4)
        -   [Examples](#examples-4)
    -   [getOrderByIdPublic](#getorderbyidpublic)
        -   [Parameters](#parameters-5)
        -   [Examples](#examples-5)
    -   [checkDownloadLinkStatusByToken](#checkdownloadlinkstatusbytoken)
        -   [Parameters](#parameters-6)
        -   [Examples](#examples-6)
    -   [restoreDownloadLinkStatusByToken](#restoredownloadlinkstatusbytoken)
        -   [Parameters](#parameters-7)
        -   [Examples](#examples-7)
    -   [getInvoiceData](#getinvoicedata)
        -   [Parameters](#parameters-8)
        -   [Examples](#examples-8)
    -   [createInvoice](#createinvoice)
        -   [Parameters](#parameters-9)
        -   [Examples](#examples-9)

## OrdersService

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

### messages

object with class service messages

Type: [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

### 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>** 

### checkRepurchase

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

Check repurchase

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** params object
    -   `params.products` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Array of products objects.
        -   `params.products.type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** template, offer, membership, item.
        -   `params.products.id` **[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.checkRepurchase(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>** 

### getInvoiceData

-   **See: <http://service-orders.templatemonsterdev.com/api/v2/invoices/:order_id>**

Get invoice data

#### Parameters

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

#### Examples

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

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

### createInvoice

-   **See: <http://service-orders.templatemonsterdev.com/api/v2/invoices/:order_id>**

Invoices - Create Invoice

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** params object
    -   `params.order_id` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (required) Order ID for import
    -   `params.billingName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (required) Billing user name
    -   `params.billingCountryISO2` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (required) Country in ISO2
    -   `params.billingCity` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (required) City
    -   `params.billingAddress` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (required) Address
    -   `params.billingZip` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (required) Zip
    -   `params.companyName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Company name
    -   `params.billingStateISO2` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** State in ISO2
    -   `params.taxId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** taxID

#### Examples

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

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