本文整理汇总了PHP中Order::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getInstance方法的具体用法?PHP Order::getInstance怎么用?PHP Order::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order::getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
$order = Order::getInstance();
$cart_order_id = $_POST['orderRef'];
$order_summary = $order->getSummary($cart_order_id);
if (isset($_POST['signature'])) {
$check = $_POST;
unset($check['signature']);
ksort($check);
$build_query = http_build_query($check, '', '&');
$build_query = preg_replace('/%0D%0A|%0A%0D|%0A|%0D/i', '%0A', $build_query);
$sig_check = $_POST['signature'] == hash("SHA512", $build_query . $this->_module['merchant_passphrase']);
} else {
$sig_check = true;
}
if ($_POST['responseCode'] == '0' && $sig_check) {
$order->orderStatus(Order::ORDER_PROCESS, $cart_order_id);
$order->paymentStatus(Order::PAYMENT_SUCCESS, $cart_order_id);
}
$transData['notes'] = $sig_check == true ? 'response signature check verified' : 'response signature check failed';
$transData['gateway'] = 'CharityClear';
$transData['order_id'] = $_POST['orderRef'];
$transData['trans_id'] = $_POST['xref'];
$transData['amount'] = $_POST['amountReceived'] > 0 ? $_POST['amountReceived'] / 100 : '';
$transData['status'] = $_POST['responseMessage'];
$transData['customer_id'] = $order_summary['customer_id'];
$transData['extra'] = '';
$order->logTransaction($transData);
$url = explode('/modules/gateway/CharityClear', $GLOBALS['storeURL']);
httpredir($url[0] . '/index.php?_a=complete');
// ccNow doesn't send back any data at all right now so we have to leave it pending
//httpredir(currentPage(array('_g', 'type', 'cmd', 'module'), array('_a' => 'complete')));
return false;
}
示例2: extendedCheckout
public function extendedCheckout(PaymentObjectInterface $paymentObj, $getUrlOnly = false)
{
$obj = new \stdClass();
\Order\Order::getInstance()->validateOrder($paymentObj);
// Must be in specific order for checksum ---------
$obj->MerchantID = $this->getMerchantID();
$obj->Timestamp = $this->getTimeStamp();
$obj->Amount = $paymentObj->getAmount();
$obj->Country = $paymentObj->getCountry();
$obj->Currency = $paymentObj->getCurrency();
$obj->Description = $paymentObj->getDescription();
$obj->EndUserIP = $this->getIP();
$obj->Issuer = $paymentObj->getIssuer();
$obj->Language = $paymentObj->getLanguage();
$obj->OrderID = $paymentObj->getOrderID();
$obj->PaymentMethod = $paymentObj->getPaymentMethod();
$obj->Reference = $paymentObj->getReference();
$obj->URLCompleted = $this->getSuccessURL();
$obj->URLError = $this->getErrorURL();
$obj->XML = Order::getInstance()->createXML();
// ------------------------------------------------
$obj->Checksum = $this->generateChecksum($obj, $this->getSecretCode());
$result = $this->client->CheckoutExtended(array('request' => $obj));
/* store the checksum momentarily */
$checksum = $result->CheckoutExtendedResult->Checksum;
/* Replace the checksum in the data with secretCode to generate a new checksum */
$result->CheckoutExtendedResult->Checksum = $this->getSecretCode();
/* Verify response data */
if ($checksum != $this->generateChecksum($result->CheckoutExtendedResult)) {
throw new \Exception("Data could not be verified");
}
/* Return mister checksum */
$result->CheckoutExtendedResult->Checksum = $checksum;
/* Return just the payment URL if required */
if ($getUrlOnly) {
return $result->CheckoutExtendedResult->PaymentScreenURL;
}
$transactionObj = new TransactionObject();
$transactionObj->setData($result->CheckoutExtendedResult);
/* Default return all data */
return $transactionObj;
}
示例3: process
public function process()
{
$coinbase_order = $this->coinbase->call("orders/" . $_GET["order"]["uuid"])->data;
$order = Order::getInstance();
if ($coinbase_order->status == "mispaid") {
$order->orderStatus(Order::ORDER_PENDING, $this->order_number);
$order->paymentStatus(Order::PAYMENT_PENDING, $this->order_number);
$transData['notes'] = "Bitcoin payment mispaid";
$order->logTransaction($transData);
$GLOBALS['gui']->setError("Your Bitcoin payment was the incorrect amount. Please contact support to resolve your order.");
} elseif ($coinbase_order->status == "expired") {
$order->orderStatus(Order::ORDER_PENDING, $this->order_number);
$order->paymentStatus(Order::PAYMENT_PENDING, $this->order_number);
$transData['notes'] = "Bitcoin payment expired";
$order->logTransaction($transData);
$GLOBALS['gui']->setError("Your Bitcoin payment has expired before you could make your payment. Please contact support to resolve your order.");
} else {
$order->orderStatus(Order::ORDER_PROCESS, $this->order_number);
$order->paymentStatus(Order::PAYMENT_SUCCESS, $this->order_number);
$transData['notes'] = "Bitcoin payment successful";
$order->logTransaction($transData);
}
httpredir(currentPage(array('_g', 'type', 'cmd', 'module'), array('_a' => 'complete')));
}
示例4: unlink
$cleanup = '<?php unlink(__FILE__); ?>';
$filename = 'print.' . $print_hash . '.php';
if (file_put_contents(CC_FILES_DIR . $filename, $template . $cleanup)) {
httpredir($GLOBALS['storeURL'] . '/files/' . $filename);
} else {
$GLOBALS['main']->setACPWarning($lang['orders']['error_print_generate']);
httpredir(currentPage(array('print')));
}
} else {
$GLOBALS['main']->setACPWarning($lang['orders']['order_not_found']);
httpredir(currentPage(array('print')));
}
} else {
if (isset($_POST['multi-order']) && !empty($_POST['multi-order'])) {
// Update selected orders to given status
$order = Order::getInstance();
// An admin is working on this so lets NOT send out email notifications
//$order->disableAdminEmail();
$updated = false;
$deleted = false;
$add_array = array();
foreach ($_POST['multi-order'] as $order_id) {
// If multi action variable is numeric we need to update the order status
if (!empty($_POST['multi-status'])) {
if ($order->orderStatus((int) $_POST['multi-status'], $order_id)) {
$updated = true;
}
}
switch ($_POST['multi-action']) {
case 'print':
$add_array['print'][] = $order_id;
示例5: UserViewInvoice
public static function UserViewInvoice($invid)
{
$xtpl = self::$xtpl;
$invoice = Invoice::getInstance();
$xtpl->assign('FINCURR', 'current');
$xtpl->assign('INVSCURR', 'current');
if (!is_numeric($invid)) {
$xtpl->parse('main.viewinvoice.inverror');
} else {
$invdata = $invoice->FetchData($invid);
if ($invdata['accountid'] != self::$userid) {
$xtpl->parse('main.viewinvoice.invrights');
} else {
$order = Order::getInstance();
$pkg = Package::getInstance();
$orderdata = $order->FetchData($invdata['orderid']);
$pkgdata = $pkg->FetchData($orderdata['productid']);
$xtpl->assign('INV', $invdata);
$xtpl->assign('PKG', $pkgdata);
$xtpl->assign('ORDER', $orderdata);
if ($invdata['status'] == 'Paid') {
$xtpl->parse('main.viewinvoice.invoice.paid');
}
$xtpl->parse('main.viewinvoice.invoice');
}
}
$xtpl->parse('main.viewinvoice');
$xtpl->parse('main');
$xtpl->out('main');
}
示例6: Unsuspend
public function Unsuspend($orderid)
{
$order = Order::getInstance();
$sm = ServerModule::getInstance();
$order->orderid = $orderid;
$order->Update('', 'status', 'Terminated');
$orderdata = $order->FetchData();
$server = Server::getInstance();
$sm->id = $order->FindModuleID();
$serverdata = $server->FetchData($orderdata['serverid']);
return $sm->UnsuspendService(unserialize($serverdata['accessdata']), unserialize($orderdata['accessdata']));
}
示例7: _orders
/**
* Orders
*/
private function _orders()
{
// Order history
$template = 'templates/content.orders.php';
if ($GLOBALS['user']->is()) {
$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->account['your_account'], 'index.php?_a=account');
$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->account['your_orders'], currentPage(array('cart_order_id'), null, false));
if (isset($_GET['cart_order_id']) && Order::validOrderId(trim($_GET['cart_order_id']))) {
if (($orders = $GLOBALS['db']->select('CubeCart_order_summary', false, array('customer_id' => $GLOBALS['user']->get('customer_id'), 'cart_order_id' => $_GET['cart_order_id']))) !== false) {
$template = 'templates/content.receipt.php';
$order = $orders[0];
$GLOBALS['gui']->addBreadcrumb($order['cart_order_id'], currentPage());
if (($items = $GLOBALS['db']->select('CubeCart_order_inventory', false, array('cart_order_id' => $order['cart_order_id']))) !== false) {
foreach ($items as $item) {
// Do price formatting
$item['price_total'] = $GLOBALS['tax']->priceFormat($item['price'] * $item['quantity'], true);
$item['price'] = $GLOBALS['tax']->priceFormat($item['price']);
$item['options'] = unserialize($item['product_options']);
$vars['items'][] = $item;
}
$GLOBALS['smarty']->assign('ITEMS', $vars['items']);
}
// Taxes
if (($taxes = $GLOBALS['db']->select('CubeCart_order_tax', false, array('cart_order_id' => $order['cart_order_id']))) !== false) {
$GLOBALS['tax']->loadTaxes($GLOBALS['config']->get('config', 'basket_tax_by_delivery') ? $order['country'] : $order['country_d']);
foreach ($taxes as $vat) {
$detail = $GLOBALS['tax']->fetchTaxDetails($vat['tax_id']);
$vars['taxes'][] = array('name' => $detail['name'], 'value' => $GLOBALS['tax']->priceFormat($vat['amount'], true));
}
} else {
$vars['taxes'][] = array('name' => $GLOBALS['language']->basket['total_tax'], 'value' => $GLOBALS['tax']->priceFormat($order['total_tax']));
}
$GLOBALS['smarty']->assign('TAXES', $vars['taxes']);
$order['state'] = getStateFormat($order['state']);
$order['country'] = getCountryFormat($order['country']);
$order['state_d'] = is_numeric($order['state_d']) ? getStateFormat($order['state_d']) : $order['state_d'];
$order['country_d'] = getCountryFormat($order['country_d']);
if ($order['discount'] > 0) {
$GLOBALS['smarty']->assign('DISCOUNT', true);
}
// Loop through price values, and do the formatting
foreach (array('discount', 'shipping', 'subtotal', 'total', 'total_tax') as $key) {
$order[$key] = $GLOBALS['tax']->priceFormat($order[$key], true);
}
$order['order_status'] = $GLOBALS['language']->order_state['name_' . $order['status']];
$order['order_date_formatted'] = formatTime($order['order_date'], false, true);
foreach ($GLOBALS['hooks']->load('class.cubecart.order_summary') as $hook) {
include $hook;
}
$GLOBALS['smarty']->assign('SUM', $order);
$GLOBALS['smarty']->assign('ORDER', $order);
$GLOBALS['session']->delete('ghost_customer_id');
// Courier Tracking URLs
if (!empty($order['ship_method'])) {
// Load the module
$method = str_replace(' ', '_', $order['ship_method']);
$ship_class = CC_ROOT_DIR . '/modules/shipping/' . $method . '/' . 'shipping.class.php';
if (file_exists($ship_class)) {
include $ship_class;
if (class_exists($method) && method_exists((string) $method, 'tracking')) {
$shipping = new $method(false);
$url = $shipping->tracking($order['ship_tracking']);
$url = empty($url) && filter_var($order['ship_tracking'], FILTER_VALIDATE_URL) ? $order['ship_tracking'] : $url;
$delivery = array('url' => $url, 'method' => $order['ship_method'], 'date' => !empty($order['ship_date']) ? $order['ship_date'] : '', 'tracking' => $order['ship_tracking']);
}
unset($ship_class);
} else {
$delivery = array('url' => filter_var($order['ship_tracking'], FILTER_VALIDATE_URL) ? $order['ship_tracking'] : '', 'method' => $order['ship_method'], 'product' => $order['ship_product'], 'tracking' => $order['ship_tracking'], 'date' => !empty($order['ship_date']) ? $order['ship_date'] : '');
}
if (empty($delivery['date']) && empty($delivery['url']) && empty($delivery['tracking'])) {
$delivery = false;
}
} else {
$delivery = false;
}
$GLOBALS['smarty']->assign('DELIVERY', $delivery);
} else {
httpredir(currentPage(array('cart_order_id')));
}
} else {
if (isset($_GET['cancel']) && Order::validOrderId(trim($_GET['cancel']))) {
$order = Order::getInstance();
if ($order->orderStatus(Order::ORDER_CANCELLED, $_GET['cancel'])) {
// Specify order was cancelled by customer
$note = array('admin_id' => 0, 'cart_order_id' => $_GET['cancel'], 'content' => $GLOBALS['language']->orders['cancel_by_customer']);
$GLOBALS['db']->insert('CubeCart_order_notes', $note);
$GLOBALS['gui']->setError($GLOBALS['language']->orders['notify_order_cancelled']);
}
httpredir(currentPage(array('cancel')));
} else {
if (isset($_GET['reorder']) && Order::validOrderId(trim($_GET['reorder']))) {
$basket = $GLOBALS['db']->select('CubeCart_order_summary', array('basket'), array('cart_order_id' => $_GET['reorder'], 'customer_id' => $GLOBALS['user']->get('customer_id')));
$past_data = unserialize($basket[0]['basket']);
$GLOBALS['cart']->basket['contents'] = $past_data['contents'];
$GLOBALS['cart']->save();
httpredir('?_a=basket');
}
//.........这里部分代码省略.........