<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Created by Console.
 * User: Droideve Technology
 * Date: {date}
 * Time: {time}
 */
class Api extends API_Controller
{

    public function __construct()
    {
        parent::__construct();
        $this->load->model("nsorder/Nsorder_model", "mOrderModel");
    }


    public function createOrder()
    {
        echo json_encode($this->mOrderModel->createOrder(array(
            "module" => RequestInput::post("module"),
            "module_id" => intval(RequestInput::post("module_id")),
            "req_cf_data" => RequestInput::post("req_cf_data"),

            "req_cf_id" => RequestInput::post("req_cf_id"),
            "user_id" => RequestInput::post("user_id"),
            "qte" => intval(RequestInput::post("qte")),
            "amount" => intval(RequestInput::post("amount")),
            "cart" => RequestInput::post("cart"),

            "couponCode" => RequestInput::post("couponCode"),

            "user_token" => RequestInput::post("user_token"),
            "payment_method" => RequestInput::post("payment_method"),

        )));

    }


    public function getOrders()
    {

        $result = $this->mOrderModel->getOrders(array(
            "id" => RequestInput::post("order_id"),
            "module" => RequestInput::post("module"),
            "module_id" => intval(RequestInput::post("module_id")),
            "user_id" => intval(RequestInput::post("user_id")),
            "limit" => intval(RequestInput::post("limit")),
            "page" => intval(RequestInput::post("page")),
            "except" => RequestInput::post("except"),
            "order_by" => RequestInput::post("order_by"),
        ));

        echo json_encode($result, JSON_FORCE_OBJECT);
    }


}

/* End of file CategoryDB.php */