/**
* Orders service.
* @module api/OrdersApi
*/
export default class OrdersApi {
/**
* Constructs a new OrdersApi.
* @alias OrdersApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
constructor(apiClient?: any);
apiClient: any;
/**
* Callback function to receive the result of the createOrder operation.
* @callback createOrderCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {OrdersCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Create Order
* Creates an order object and triggers an order creation event. Upsert Mode If you pass an id or a source_id that already exists in the order database, Voucherify will return a related order object with updated fields.
* @param {OrdersCreateRequestBody} ordersCreateRequestBody Specify the order parameters.
* @param {createOrderCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link OrdersCreateResponseBody}
* @returns {Promise<(OrdersCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `OrdersCreateResponseBody` object or with `undefined`.
*/
createOrder(ordersCreateRequestBody: OrdersCreateRequestBody, callback?: (error: Error | null, data?: OrdersCreateResponseBody, response?: any) => any): Promise<(OrdersCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the createOrderExport operation.
* @callback createOrderExportCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {OrdersExportCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Create Orders Export
* Creates a downloadable CSV file containing a list of orders. The parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the parameters.fields object in the request body. The available filters are all [order object](/api-reference/orders/order-calculated-object) attributes. Additionally, any metadata defined in the metadata schema can be exported. Passing an empty JSON will generate a file containing three default fields: id, source_id, and status. The fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields:
* @param {OrdersExportCreateRequestBody} ordersExportCreateRequestBody Specify which order parameters you would like to export.
* @param {createOrderExportCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link OrdersExportCreateResponseBody}
* @returns {Promise<(OrdersExportCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `OrdersExportCreateResponseBody` object or with `undefined`.
*/
createOrderExport(ordersExportCreateRequestBody: OrdersExportCreateRequestBody, callback?: (error: Error | null, data?: OrdersExportCreateResponseBody, response?: any) => any): Promise<(OrdersExportCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the getOrder operation.
* @callback getOrderCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {OrdersGetResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Get Order
* Retrieve a specific order by passing its ID.
* @param {String} orderId Unique Voucherify order ID or order source ID.
* @param {getOrderCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link OrdersGetResponseBody}
* @returns {Promise<(OrdersGetResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `OrdersGetResponseBody` object or with `undefined`.
*/
getOrder(orderId: string, callback?: (error: Error | null, data?: OrdersGetResponseBody, response?: any) => any): Promise<(OrdersGetResponseBody | undefined)>;
/**
* Callback function to receive the result of the importOrders operation.
* @callback importOrdersCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {OrdersImportCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Import Orders
* Historical orders This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the [update order](/api-reference/orders/update-order) endpoint should be used. This is critical because this endpoint does not store events or launch distributions. The orders will also have a created_at date thats assigned when theyve been imported to Voucherify. To keep track of the actual order creation date, add an order metadata in ISO 8601 date or date time format to each imported order. # Limitations ## Import volume There can be only a single on-going order import per tenant per project at a given time. The user can schedule more imports but those extra imports will be scheduled to run in sequence one by one. ## Maximum count of orders in single import There is a 2000 limit of orders per one request. # Notifications There are no notifications on the Dashboard because this import is launched via the API. # Triggered actions If you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segments summary. Consequently, this update will trigger - Customers entering into segments - Distributions based on any rules tied to customer entering segment(s) - Earning rules based on the customer entering segment(s) # What is not triggered 1. No webhooks are triggered during the import of orders - for both orders and upserted products / SKUs. 2. Distributions based on Order Update, Order Paid, Order Created and Order Cancelled. In other words if you have a distribution based on Order Paid and you import an order with a PAID status, the distribution is not going to be triggered. 3. No events are created during the import of orders - for both orders and upserted products / SKUs. In other words you wont see any events in the Activity tab in the Dashboard such as Order created or Order paid. If you are additionally upserting products / SKUs, then you wont see the Product created events listed, etc. 4. Earning rules based on Order Paid wont be triggered. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request with [GET Async Action](/api-reference/async-actions/get-async-action) endpoint.
* @param {Array.} ordersImportCreateRequestBodyItem The request body is sent in the form of an array of order objects.
* @param {importOrdersCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link OrdersImportCreateResponseBody}
* @returns {Promise<(OrdersImportCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `OrdersImportCreateResponseBody` object or with `undefined`.
*/
importOrders(ordersImportCreateRequestBodyItem: Array, callback?: (error: Error | null, data?: OrdersImportCreateResponseBody, response?: any) => any): Promise<(OrdersImportCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the listOrders operation.
* @callback listOrdersCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {OrdersListResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* List Orders
* Returns a list of orders.
* @param {{
limit?: Number,
page?: Number,
order?: Exclude,
}} [opts] Optional parameters
* @param {listOrdersCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link OrdersListResponseBody}
* @returns {Promise<(OrdersListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `OrdersListResponseBody` object or with `undefined`.
*/
listOrders(opts?: {
limit?: number;
page?: number;
order?: Exclude;
}, callback?: (error: Error | null, data?: OrdersListResponseBody, response?: any) => any): Promise<(OrdersListResponseBody | undefined)>;
/**
* Callback function to receive the result of the updateOrder operation.
* @callback updateOrderCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {OrdersUpdateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Update Order
* Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged.
* @param {String} orderId Unique Voucherify order ID or order source ID.
* @param {OrdersUpdateRequestBody} ordersUpdateRequestBody Specify the parameters of the order that are to be updated.
* @param {updateOrderCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link OrdersUpdateResponseBody}
* @returns {Promise<(OrdersUpdateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `OrdersUpdateResponseBody` object or with `undefined`.
*/
updateOrder(orderId: string, ordersUpdateRequestBody: OrdersUpdateRequestBody, callback?: (error: Error | null, data?: OrdersUpdateResponseBody, response?: any) => any): Promise<(OrdersUpdateResponseBody | undefined)>;
}
import OrdersCreateRequestBody from '../model/OrdersCreateRequestBody';
import OrdersCreateResponseBody from '../model/OrdersCreateResponseBody';
import OrdersExportCreateRequestBody from '../model/OrdersExportCreateRequestBody';
import OrdersExportCreateResponseBody from '../model/OrdersExportCreateResponseBody';
import OrdersGetResponseBody from '../model/OrdersGetResponseBody';
import OrdersImportCreateRequestBodyItem from '../model/OrdersImportCreateRequestBodyItem';
import OrdersImportCreateResponseBody from '../model/OrdersImportCreateResponseBody';
import ParameterOrderListOrders from '../model/ParameterOrderListOrders';
import OrdersListResponseBody from '../model/OrdersListResponseBody';
import OrdersUpdateRequestBody from '../model/OrdersUpdateRequestBody';
import OrdersUpdateResponseBody from '../model/OrdersUpdateResponseBody';