Пример #1
0
function mcs_CreateAccount($params)
{
    $serviceid = $params["serviceid"];
    $pid = $params["pid"];
    $producttype = $params["producttype"];
    $domain = $params["domain"];
    $username = $params["username"];
    $password = $params["password"];
    $clientsdetails = $params["clientsdetails"];
    $customfields = $params["customfields"];
    $configoptions = $params["configoptions"];
    $clientid = $params["userid"];
    $configoption1 = $params["configoption1"];
    $configoption2 = $params["configoption2"];
    $configoption3 = $params["configoption3"];
    $configoption4 = $params["configoption4"];
    $params["admin"] = admin();
    $server = $params["server"];
    $serverid = $params["serverid"];
    $serverip = $params["serverip"];
    $serverusername = $params["serverusername"];
    $serverpassword = $params["serverpassword"];
    $serveraccesshash = $params["serveraccesshash"];
    $serversecure = $params["serversecure"];
    $json = json_encode($params);
    $json = json_decode($json);
    $ip = $json->customfields;
    foreach ($ip as $j => $v) {
        $ipaddr = $v;
    }
    $hasil = json_encode(_getclientsproducts($clientid, $serviceid, $pid));
    $billingcycle = _get_order_duration_months(json_decode($hasil)->products->product[0]->billingcycle);
    $data = array('api_key' => apikey(), 'ip' => $ipaddr, 'pname' => $configoption1, 'billingcycle' => $billingcycle);
    $buatorder = Mcs::exec('order', 'addorder', http_build_query($data));
    if ($buatorder->result == 'success') {
        $result = 'success';
    } else {
        $result = "error";
    }
    return $result;
}
function resellerclubsdhostingin_ChangePackage($params)
{
    global $orderbox;
    try {
        $plan_pieces = _get_plan_details($params['configoption1']);
        if ('windows' == $plan_pieces['type']) {
            $api_path_orderid_from_domain = '/singledomainhosting/windows/in/orderid.json';
            $api_path_order_modify = '/singledomainhosting/windows/in/modify.json';
        } else {
            $api_path_orderid_from_domain = '/singledomainhosting/linux/in/orderid.json';
            $api_path_order_modify = '/singledomainhosting/linux/in/modify.json';
        }
        $order_id_result = $orderbox->api('GET', $api_path_orderid_from_domain, array('domain-name' => $params['domain']), $response, 'resellerclubsdhostingin', 'changepackage');
        if (is_array($order_id_result) && array_key_exists('status', $order_id_result) && strtolower($order_id_result['status']) == 'error') {
            return $order_id_result['message'];
        } else {
            $order_id = $order_id_result;
            $plan_pieces = _get_plan_details($params['configoption1']);
            $billing_cycle = _get_order_billing_cycle($params['clientsdetails']['userid'], $params['serviceid'], $params['domain'], $params['pid']);
            $billing_cycle = strtolower($billing_cycle);
            $months = _get_order_duration_months($billing_cycle);
            $order_details = array('order-id' => $order_id, 'new-plan-id' => $plan_pieces['id'], 'months' => $months, 'invoice-option' => 'NoInvoice');
            $order_api_result = $orderbox->api('POST', $api_path_order_modify, $order_details, $response, 'resellerclubsdhostingin', 'changepackage');
            if (is_array($order_api_result) && strtolower($order_api_result['status']) == 'error') {
                return $order_api_result['message'];
            }
            return 'success';
        }
    } catch (Exception $e) {
        return "Order Upgrade/Downgrade error - " . $e->getMessage();
    }
}
function resellerclubvpsus_ChangePackage($params)
{
    global $orderbox;
    try {
        $api_path = '/vps/linux/orderid.json';
        $order_id_result = $orderbox->api('GET', $api_path, array('domain-name' => $params['domain']), $response, 'resellerclubvpslinuxus', 'changepackage');
        if (is_array($order_id_result) && array_key_exists('status', $order_id_result) && strtolower($order_id_result['status']) == 'error') {
            return $order_id_result['message'];
        } else {
            $order_id = $order_id_result;
            $plan_pieces = _get_plan_details($params['configoption1']);
            $billing_cycle = _get_order_billing_cycle($params['clientsdetails']['userid'], $params['serviceid'], $params['domain'], $params['pid']);
            $billing_cycle = strtolower($billing_cycle);
            $months = _get_order_duration_months($billing_cycle);
            $order_details = array('order-id' => $order_id, 'new-plan-id' => $plan_pieces['id'], 'months' => $months);
            $api_path = '/vps/linux/modify-pricing.json';
            $order_api_result = $orderbox->api('GET', $api_path, $order_details, $response, 'resellerclubvpslinuxus', 'renew');
            if (is_array($order_api_result) && strtolower($order_api_result['status']) == 'error') {
                return $order_api_result['message'];
            }
            return 'success';
        }
    } catch (Exception $e) {
        return "Order Upgrade/Downgrade error - " . $e->getMessage();
    }
}