function resellerclubsdhosting_CreateAccount($params) { global $orderbox; try { $client_details = $orderbox->api('GET', '/customers/details.json', array('username' => $params['clientsdetails']['email']), $response); if (is_array($client_details) && strtolower($client_details['status']) == 'error') { $resellerclub_customer_id = _createCustomer($params); } else { $resellerclub_customer_id = $client_details['customerid']; } // add new order in resellerclub $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('domain-name' => $params['domain'], 'customer-id' => $resellerclub_customer_id, 'months' => $months, 'invoice-option' => 'NoInvoice', 'plan-id' => $plan_pieces['id'], 'enable-ssl' => true, 'enable-maintenance' => false); $order_api_result = $orderbox->api('POST', '/webservices/add.json', $order_details); if (is_array($order_api_result) && strtolower($order_api_result['status']) == 'error') { return $order_api_result['message']; } /** * Set cpanel auth details generated by WHMCS to blank to use the details set by Resellerclub */ $sql_clear_cpanel_auth_details = "UPDATE tblhosting SET username = '', password = '' WHERE domain = '{$params['domain']}'"; $res_clear_cpanel_auth_details = mysql_query($sql_clear_cpanel_auth_details); if ($res_clear_cpanel_auth_details === false) { $local_api_values = array('serviceid' => $params['serviceid'], 'serviceusername' => ' ', 'servicepassword' => ' '); $clear_cpanel_auth_details = localAPI('updateclientproduct', $local_api_values); } return 'success'; } catch (Exception $e) { return "Customer sign up error - " . $e->getMessage(); } }
function resellerclubvpsus_CreateAccount($params) { global $orderbox; try { $client_details = $orderbox->api('GET', '/customers/details.json', array('username' => $params['clientsdetails']['email']), $response, 'resellerclubvpslinuxus', 'create'); if (is_array($client_details) && strtolower($client_details['status']) == 'error') { $resellerclub_customer_id = _createCustomer($params); } else { $resellerclub_customer_id = $client_details['customerid']; } // add new order in resellerclub $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('domain-name' => $params['domain'], 'customer-id' => $resellerclub_customer_id, 'months' => $months, 'invoice-option' => 'NoInvoice', 'plan-id' => $plan_pieces['id']); if (count($params['configoptions']) >= 1) { foreach ($params['configoptions'] as $config_key => $config_value) { $config_key = trim(strtolower($config_key)); if ($config_key == 'whmcs' && $config_value == 1) { $order_details['addons'][] = 'whmcs'; } if ($config_key == 'cpanel' && $config_value == 1) { $order_details['addons'][] = 'cpanel'; } if ($config_key == 'dedicated ip' && $config_value >= 1) { $order_details['no-of-dedicated-ip'] = $config_value; } } } if ('windows' == $plan_pieces['type']) { $api_path_order_add = '/vps/windows/add.json'; } else { $api_path_order_add = '/vps/linux/add.json'; } $order_api_result = $orderbox->api('POST', $api_path_order_add, $order_details, $response, 'resellerclubvpslinuxus', 'create'); if (is_array($order_api_result) && strtolower($order_api_result['status']) == 'error') { return $order_api_result['message']; } /** * Set cpanel auth details generated by WHMCS to blank to use the details set by Resellerclub */ $sql_clear_cpanel_auth_details = "UPDATE tblhosting SET username = '', password = '' WHERE domain = '{$params['domain']}'"; $res_clear_cpanel_auth_details = mysql_query($sql_clear_cpanel_auth_details); if ($res_clear_cpanel_auth_details === false) { $local_api_values = array('serviceid' => $params['serviceid'], 'serviceusername' => ' ', 'servicepassword' => ' '); $clear_cpanel_auth_details = localAPI('updateclientproduct', $local_api_values); } return 'success'; } catch (Exception $e) { return "Customer sign up error - " . $e->getMessage(); } }