} } unset($_SESSION['uid']); exit; } else { if ($action == "order") { check_token("WHMCS.admin.default"); $_SESSION['uid'] = $userid; if ($type == "product") { $upgrades = SumUpPackageUpgradeOrder($id, $newproductid, $billingcycle, $promocode, $service_paymentmethod, true); } else { if ($type == "configoptions") { $upgrades = SumUpConfigOptionsOrder($id, $configoption, $promocode, $service_paymentmethod, true); } } $upgradedata = createUpgradeOrder($id, "", $promocode, $service_paymentmethod); $orderid = $upgradedata['orderid']; unset($_SESSION['uid']); echo "<s"; echo "cript language=\"javascript\">\nwindow.opener.location.href = \"orders.php?action=view&id="; echo $orderid; echo "\";\nwindow.close();\n</script>\n"; exit; } else { if (!$action) { if (!$type) { $type = "product"; } $configoptions = getCartConfigOptions($service_pid, "", $service_billingcycle, $id); echo "\n<p>"; echo "<s";
$selectedvalue = $option['selectedvalue']; $selectedqty = $option['selectedqty']; if (!isset($configoptions[$id])) { if ($optiontype == "3" || $optiontype == "4") { $selectedvalue = $selectedqty; } $configoptions[$id] = $selectedvalue; continue; } } $upgrades = SumUpConfigOptionsOrder($serviceid, $configoptions, $promocode, $paymentmethod, $checkout); foreach ($upgrades as $i => $vals) { foreach ($vals as $k => $v) { $apiresults[$k . ($i + 1)] = $v; } } $subtotal = $GLOBALS['subtotal']; $discount = $GLOBALS['discount']; $apiresults['subtotal'] = formatCurrency($subtotal); $apiresults['discount'] = formatCurrency($discount); $apiresults['total'] = formatCurrency($subtotal - $discount); } else { $apiresults = array("result" => "error", "message" => "Invalid Upgrade Type"); return null; } } if (!$checkout) { return null; } $upgradedata = createUpgradeOrder($serviceid, $ordernotes, $promocode, $paymentmethod); $apiresults = array_merge($apiresults, $upgradedata);
$paymentmethod = $_POST['paymentmethod']; if ($type == "package") { $newproductid = $_POST['pid']; $newproductbillingcycle = $_POST['billingcycle']; $upgrades = SumUpPackageUpgradeOrder($serviceid, $newproductid, $newproductbillingcycle, $promocode, $paymentmethod, true); } else { if ($type == "configoptions") { $configoptions = $_POST['configoption']; $upgrades = SumUpConfigOptionsOrder($serviceid, $configoptions, $promocode, $paymentmethod, true); } } $ordernotes = ""; if ($notes && $notes != $_LANG['ordernotesdescription']) { $ordernotes = $notes; } $_SESSION['upgradeorder'] = createUpgradeOrder($serviceid, $ordernotes, $promocode, $paymentmethod); redir("step=4"); } else { if ($step == "4") { $orderfrm = new WHMCS_OrderForm(); $invoiceid = (int) $invoiceid; if ($invoiceid) { $result = select_query("tblinvoices", "id,total,paymentmethod", array("userid" => $_SESSION['uid'], "id" => $invoiceid)); $data = mysql_fetch_array($result); $invoiceid = $data['id']; $total = $data['total']; $paymentmethod = $data['paymentmethod']; if ($invoiceid && 0 < $total) { $paymentmethod = WHMCS_Gateways::makesafename($paymentmethod); if (!$paymentmethod) { exit("Unexpected payment method value. Exiting.");