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(); } }