All files / lib/resources orders.js

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43                                                                                     
/**
 * @name Orders
 * @description This module exposes functions
 *              related to the `/orders` path.
 *
 * @module orders
 **/
 
import { curry } from 'ramda'
 
import routes from '../routes'
import request from '../request'
 
const findAll = curry((opts, body) =>
  request.get(opts, routes.orders.base, body || {})
)
 
/**
 * `GET /orders`
 * Makes a request to /orders to get all orders.
 *
 * @param {Object} opts An options params which
 *                      is usually already bound
 *                      by `connect` functions.
 *
 * @param {Number} [body.id] The orders ID. If not sent a
 *                           orders list will be returned instead.
 * @param {Number} [body.count] Pagination option for orders list.
 *                              Number of orders in a page
 * @param {Number} [body.page] Pagination option for orders list.
 *                             The page index.
 * @param {Number} [body.status] The paymentLinks Status. If not sent a
 *                           orders list will be returned instead.
 * @param {Number} [body.payment_link_id] The paymentLinks ID. If not sent a
 *                           orders list will be returned instead.
*/
const all = (opts, body) =>
  findAll(opts, body)
 
export default {
  all,
}