本文整理汇总了PHP中UpdateOrderStatus函数的典型用法代码示例。如果您正苦于以下问题:PHP UpdateOrderStatus函数的具体用法?PHP UpdateOrderStatus怎么用?PHP UpdateOrderStatus使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UpdateOrderStatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ProcessGatewayPing
public function ProcessGatewayPing()
{
$this->SetOrderData(LoadPendingOrdersByToken($_REQUEST['USER1']));
if($this->GetGatewayAmount() == 0) {
return false;
}
$orderid = $this->GetCombinedOrderId();
$hash = md5($GLOBALS['ISC_CFG']['serverStamp'].$_REQUEST['AMOUNT'].$orderid.$_REQUEST['USER1'].$this->GetValue('paypallogin').$this->GetValue('paypalpartner'));
if ($_REQUEST['USER2'] != $hash) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix.'HashMismatch'));
return false;
}
if (!isset($_REQUEST['INVOICE']) || $orderid != $_REQUEST['INVOICE']) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix.'OrderMismatch'), sprintf("Sent %s. Received %s", $orderid, $_REQUEST['INVOICE']));
return false;
}
if ($this->GetGatewayAmount() != $_REQUEST['AMOUNT']) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix.'PaymentMismatch'), sprintf("Sent %s. Received %s", $this->GetGatewayAmount(), $_REQUEST['AMOUNT']));
return false;
}
if ($_REQUEST['RESULT'] == 0 && $_REQUEST['RESPMSG'] == 'Approved') {
$oldOrderStatus = $this->GetOrderStatus();
// If the order was previously incomplete, we need to do some extra work
if($oldOrderStatus == ORDER_STATUS_INCOMPLETE) {
// If a customer doesn't return to the store from PayPal, their cart will never be
// emptied. So what we do here, is if we can, load up the existing customers session
// and empty the cart and kill the checkout process. When they next visit the store,
// everything should be "hunky-dory."
session_write_close();
$session = new ISC_SESSION($_REQUEST['USER3']);
}
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), GetLang($this->_languagePrefix.'Success'));
// Update the status for all orders that we've just received the payment for
foreach($this->GetOrders() as $orderId => $order) {
$status = ORDER_STATUS_AWAITING_FULFILLMENT;
// If it's a digital order & awaiting fulfillment, automatically complete it
if($order['ordisdigital'] && ORDER_STATUS_AWAITING_FULFILLMENT) {
$status = ORDER_STATUS_COMPLETED;
}
UpdateOrderStatus($orderId, $status);
}
return true;
}
// $transactionId = $_REQUEST['PNREF'];
return false;
}
示例2: updateMultiOrderStatusRequestAction
private function updateMultiOrderStatusRequestAction()
{
$success = (int)@$_REQUEST['success'];
$failed = (int)@$_REQUEST['failed'];
$result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]order_status WHERE statusid='" . $GLOBALS['ISC_CLASS_DB']->Quote(@$_REQUEST['statusId']) . "'");
if (isId(@$_REQUEST['orderId']) && isId(@$_REQUEST['statusId']) && ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) && UpdateOrderStatus($_REQUEST['orderId'], $_REQUEST['statusId'])) {
echo '1';
$success++;
} else {
echo '0';
$failed++;
}
$message = sprintf(GetLang('OrderUpdateStatusReport'), $success, $row['statusdesc']);
if ($failed) {
$message .= sprintf(GetLang('OrderUpdateStatusReportFail'), $failed);
}
MessageBox($message, MSG_SUCCESS);
exit;
}
示例3: ProcessGatewayPing
public function ProcessGatewayPing()
{
if (!isset($_POST['ordertoken'])) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'ErrorInvalid'));
return false;
}
$this->SetOrderData(LoadPendingOrdersByToken($_POST['ordertoken']));
if (!isset($_POST['hash']) || !isset($_POST['amount']) || !isset($_POST['currency']) || !isset($_POST['orderref']) || !isset($_POST['ordertoken'])) {
$this->TransferToProvider('Card Details Invalid', $_POST['ordertoken']);
}
if ($_POST['hash'] != md5($this->GetValue('SecretWord') . $_POST['orderref'] . $this->GetValue('MerchantId') . $_POST['amount'] . $_POST['currency'])) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'ErrorInvalid'));
return false;
}
$updatedOrder = array('ordpayproviderid' => $_REQUEST['streference'], 'ordpaymentstatus' => 'captured');
$this->UpdateOrders($updatedOrder);
foreach ($this->GetOrders() as $orderId => $order) {
$status = ORDER_STATUS_AWAITING_FULFILLMENT;
// If it's a digital order & awaiting fulfillment, automatically complete it
if ($order['ordisdigital']) {
$status = ORDER_STATUS_COMPLETED;
}
UpdateOrderStatus($orderId, $status);
}
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'Success'));
header('Location: ' . $GLOBALS['ShopPath'] . '/finishorder.php');
return true;
}
示例4: ProcessGatewayPing
public function ProcessGatewayPing()
{
$this->SetOrderData(LoadPendingOrdersByToken($_REQUEST['USER1']));
if ($this->GetGatewayAmount() == 0) {
return false;
}
$orderid = $this->GetCombinedOrderId();
$hash = md5($GLOBALS['ISC_CFG']['serverStamp'] . $_REQUEST['AMOUNT'] . $orderid . $_REQUEST['USER1'] . $this->GetValue('paypallogin') . $this->GetValue('paypalpartner'));
if ($_REQUEST['USER2'] != $hash) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'HashMismatch'));
return false;
}
if (!isset($_REQUEST['INVOICE']) || $orderid != $_REQUEST['INVOICE']) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'OrderMismatch'), sprintf("Sent %s. Received %s", $orderid, $_REQUEST['INVOICE']));
return false;
}
if ($this->GetGatewayAmount() != $_REQUEST['AMOUNT']) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'PaymentMismatch'), sprintf("Sent %s. Received %s", $this->GetGatewayAmount(), $_REQUEST['AMOUNT']));
return false;
}
if ($_REQUEST['RESULT'] == 0 && $_REQUEST['RESPMSG'] == 'Approved') {
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'Success'));
// Update the status for all orders that we've just received the payment for
foreach ($this->GetOrders() as $orderId => $order) {
$status = ORDER_STATUS_AWAITING_FULFILLMENT;
// If it's a digital order & awaiting fulfillment, automatically complete it
if ($order['ordisdigital'] && ORDER_STATUS_AWAITING_FULFILLMENT) {
$status = ORDER_STATUS_COMPLETED;
}
UpdateOrderStatus($orderId, $status);
}
return true;
}
// $transactionId = $_REQUEST['PNREF'];
return false;
}
示例5: ProcessGatewayPing
public function ProcessGatewayPing()
{
$siteid = $_REQUEST['site_id'];
$productid = $_REQUEST['product_id'];
$email = $_REQUEST['email'];
$country = $_REQUEST['country'];
$name = $_REQUEST['name'];
$city = $_REQUEST['city'];
$street = $_REQUEST['street'];
$state = $_REQUEST['state'];
$zip = $_REQUEST['zip'];
$hash = $_REQUEST['cs1'];
$session = $_REQUEST['cs2'];
$currency = $_REQUEST['currency'];
$siteCurrency = GetDefaultCurrency();
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), 'ChronoPay Pingback');
if ($currency != $siteCurrency['currencycode']) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), sprintf(GetLang($this->_languagePrefix . 'CurrencyMismatch'), $siteCurrency['currencycode'], $currency));
return false;
}
$this->SetOrderData(LoadPendingOrdersByToken($session));
if (md5($GLOBALS['ISC_CFG']['serverStamp'] . $session . $this->GetCombinedOrderId() . $this->GetValue('ProductId')) != $hash) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'HashMismatch'));
return false;
}
if (isset($_REQUEST['transaction_id'])) {
$updatedOrder = array('ordpayproviderid' => $_REQUEST['transaction_id'], 'ordpaymentstatus' => 'captured');
}
$this->UpdateOrders($updatedOrder);
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'Success'));
// Update the status for all orders that we've just received the payment for
foreach ($this->GetOrders() as $orderId => $order) {
$status = ORDER_STATUS_AWAITING_FULFILLMENT;
// If it's a digital order & awaiting fulfillment, automatically complete it
if ($order['ordisdigital'] && ORDER_STATUS_AWAITING_FULFILLMENT) {
$status = ORDER_STATUS_COMPLETED;
}
UpdateOrderStatus($orderId, $status);
}
return true;
}
示例6: ProcessGatewayPing
//.........这里部分代码省略.........
$newOrderStatus = ORDER_STATUS_INCOMPLETE;
break;
case '2': // auth refused
$newOrderStatus = ORDER_STATUS_DECLINED;
break;
case '5': // authorized
$newOrderStatus = ORDER_STATUS_AWAITING_PAYMENT;
break;
case '51': // awaiting authorization
case '52': // authorization unknown
$newOrderStatus = ORDER_STATUS_PENDING;
break;
case '6': // authorized and cancelled
$newOrderStatus = ORDER_STATUS_INCOMPLETE;
break;
case '7': // payment deleted
case '74': // payment deleted
$newOrderStatus = ORDER_STATUS_AWAITING_PAYMENT;
break;
case '8': // refund
$newOrderStatus = ORDER_STATUS_REFUNDED;
break;
case '9': // payment authorized and captured
$newOrderStatus = ORDER_STATUS_AWAITING_FULFILLMENT;
break;
case '91': // awaiting payment
case '93': // payment refused (tech problem or expired auth)
$newOrderStatus = ORDER_STATUS_AWAITING_PAYMENT;
break;
case '92': // unknown payment
$newOrderStatus = ORDER_STATUS_PENDING;
break;
case '94': // payment declined by aquirer
$newOrderStatus = ORDER_STATUS_DECLINED;
break;
default :
$newOrderStatus = ORDER_STATUS_DECLINED;
$statusLang = 'Unknown';
break;
}
// if the order is currently incomplete and the new status isn't incomplete (ie. transaction cancelled by customer), then empty the cart
if($this->GetOrderStatus() == ORDER_STATUS_INCOMPLETE && $newOrderStatus != ORDER_STATUS_INCOMPLETE) {
session_write_close();
$session = new ISC_SESSION($sessionToken);
EmptyCartAndKillCheckout();
}
// update orders with the transaction id
$updatedOrder = array(
'ordpayproviderid' => $transactionId
);
// if captured then update pay status in order
if ($newOrderStatus == ORDER_STATUS_AWAITING_FULFILLMENT) {
$updatedOrder['ordpaymentstatus'] = 'captured';
}
$this->UpdateOrders($updatedOrder);
// we only want to notify the customer of a successfull order
$emailCustomer = false;
if ($newOrderStatus != ORDER_STATUS_INCOMPLETE) {
$emailCustomer = true;
}
// update order statuses
foreach($this->GetOrders() as $orderId => $order) {
// digital orders should complete right away if captured
if($order['ordisdigital'] && $newOrderStatus == ORDER_STATUS_AWAITING_FULFILLMENT) {
$newOrderStatus = ORDER_STATUS_COMPLETED;
}
UpdateOrderStatus($orderId, $newOrderStatus, $emailCustomer);
}
// Log this payment response
$oldStatus = GetOrderStatusById($order['ordstatus']);
if(!$oldStatus) {
$oldStatus = 'Incomplete';
}
$newStatus = GetOrderStatusById($newOrderStatus);
if (!$newStatus) {
$newStatus = 'Incomplete';
}
$extra = GetLang('OgoneSuccessDetails', array(
"orderId" => implode(', ', array_keys($this->GetOrders())),
"amount" => $gateway_amount,
"paymentId" => $transactionId,
"paymentStatus" => $status,
"paymentDesc" => GetLang('OgoneTransactionStatus' . $statusLang),
"newStatus" => $newStatus,
"oldStatus" => $oldStatus
));
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->_name), GetLang('OgoneSuccess', array('orderId' => $orderId)), $extra);
return true;
}
示例7: CommitShipment
/**
* Commit a new shipment to the database.
*
* @param array An array of information about the shipment.
* @return boolean True if successful, false if not.
*/
private function CommitShipment($data)
{
$order = GetOrder($data['orderId'], true);
if (!isset($data['shiptrackno'])) {
$data['shiptrackno'] = '';
}
$GLOBALS['ISC_CLASS_DB']->StartTransaction();
$newShipment = array('shipdate' => time(), 'shiptrackno' => $data['shiptrackno'], 'shipmethod' => $data['shipmethod'], 'shiporderid' => $data['orderId'], 'shiporderdate' => $order['orddate'], 'shipcomments' => $data['shipcomments'], 'shipvendorid' => $order['ordvendorid'], 'shipcustid' => $order['ordcustid'], 'shipbillfirstname' => $order['ordbillfirstname'], 'shipbilllastname' => $order['ordbilllastname'], 'shipbillcompany' => $order['ordbillcompany'], 'shipbillstreet1' => $order['ordbillstreet1'], 'shipbillstreet2' => $order['ordbillstreet2'], 'shipbillsuburb' => $order['ordbillsuburb'], 'shipbillstate' => $order['ordbillstate'], 'shipbillzip' => $order['ordbillzip'], 'shipbillcountry' => $order['ordbillcountry'], 'shipbillcountrycode' => $order['ordbillcountrycode'], 'shipbillcountryid' => $order['ordbillcountryid'], 'shipbillstateid' => $order['ordbillstateid'], 'shipbillphone' => $order['ordbillphone'], 'shipbillemail' => $order['ordbillemail'], 'shipshipfirstname' => $order['ordshipfirstname'], 'shipshiplastname' => $order['ordshiplastname'], 'shipshipcompany' => $order['ordshipcompany'], 'shipshipstreet1' => $order['ordshipstreet1'], 'shipshipstreet2' => $order['ordshipstreet2'], 'shipshipsuburb' => $order['ordshipsuburb'], 'shipshipstate' => $order['ordshipstate'], 'shipshipzip' => $order['ordshipzip'], 'shipshipcountry' => $order['ordshipcountry'], 'shipshipcountrycode' => $order['ordshipcountrycode'], 'shipshipcountryid' => $order['ordshipcountryid'], 'shipshipstateid' => $order['ordshipstateid'], 'shipshipphone' => $order['ordshipphone'], 'shipshipemail' => $order['ordshipemail']);
$shipmentId = $GLOBALS['ISC_CLASS_DB']->InsertQuery('shipments', $newShipment);
if (!$shipmentId) {
return false;
}
$totalShipped = $order['ordtotalshipped'];
// Now actually create the shipment based on all the items that were selected
foreach ($data['quantity'] as $productId => $quantity) {
if (!isset($order['products'][$productId])) {
return false;
}
$product = $order['products'][$productId];
// We didn't choose to ship any of this item
if ((int) $data['quantity'][$product['orderprodid']] <= 0 || $product['ordprodtype'] != 'physical') {
continue;
}
$newItem = array('shipid' => $shipmentId, 'itemordprodid' => (int) $productId, 'itemprodid' => $product['ordprodid'], 'itemprodsku' => $product['ordprodsku'], 'itemprodname' => $product['ordprodname'], 'itemqty' => (int) $quantity, 'itemprodoptions' => $product['ordprodoptions'], 'itemprodvariationid' => $product['ordprodvariationid']);
if (isset($product['ordprodeventdate'])) {
$newItem['itemprodeventdate'] = $product['ordprodeventdate'];
}
if (isset($product['ordprodeventname'])) {
$newItem['itemprodeventname'] = $product['ordprodeventname'];
}
if (!$GLOBALS['ISC_CLASS_DB']->InsertQuery('shipment_items', $newItem)) {
$GLOBALS['ISC_CLASS_DB']->RollbackTransaction();
return false;
}
// Increase the amount of items shipped for this product
$totalShipped += $quantity;
$updatedOrderItem = array('ordprodqtyshipped' => $product['ordprodqtyshipped'] + $quantity);
if (!$GLOBALS['ISC_CLASS_DB']->UpdateQuery('order_products', $updatedOrderItem, "orderprodid='" . (int) $product['orderprodid'] . "'")) {
$GLOBALS['ISC_CLASS_DB']->RollbackTransaction();
return false;
}
}
$updatedOrder = array('ordtotalshipped' => $totalShipped);
// Chose to update the status of this order
if (isset($data['ordstatus'])) {
if (isset($GLOBALS['StillShippable'])) {
$newStatus = ORDER_STATUS_PARTIALLY_SHIPPED;
} else {
$newStatus = ORDER_STATUS_SHIPPED;
if (!$order['ordtrackingno']) {
$updatedOrder['ordtrackingno'] = $data['shiptrackno'];
}
}
UpdateOrderStatus($order['orderid'], $newStatus);
}
if (!$GLOBALS['ISC_CLASS_DB']->UpdateQuery('orders', $updatedOrder, "orderid='" . (int) $order['orderid'] . "'")) {
$GLOBALS['ISC_CLASS_DB']->RollbackTransaction();
return false;
}
// Still here? Commit and send back the ID of the new shipment
$GLOBALS['ISC_CLASS_DB']->CommitTransaction();
return $shipmentId;
}
示例8: RefundOrder
private function RefundOrder()
{
$message = '';
$messageStaus = MSG_ERROR;
$provider = null;
if (!isset($_REQUEST['orderid'])) {
return false;
}
$orderId = $_REQUEST['orderid'];
$order = GetOrder($_REQUEST['orderid']);
if (!isset($order['orderid'])) {
return false;
}
/* Validate posted data*/
$refundType = '';
if (!isset($_REQUEST['refundType'])) {
return false;
}
$refundType = $_REQUEST['refundType'];
//preset the refund amount to the available amount of the order
$refundAmt = $order['ordgatewayamount'] - $order['ordrefundedamount'];
//refund partial amount
if ($refundType == 'partial') {
//is refund amount specified
if (!isset($_REQUEST['refundAmt']) || $_REQUEST['refundAmt'] == '') {
$message = GetLang('EnterRefundAmount');
} else {
if (!is_numeric($_REQUEST['refundAmt']) || $_REQUEST['refundAmt'] <= 0) {
$message = GetLang('InvalidRefundAmountFormat');
} else {
if ($_REQUEST['refundAmt'] + $order['ordrefundedamount'] > $order['ordgatewayamount']) {
$message = GetLang('InvalidRefundAmount');
} else {
$refundAmt = $_REQUEST['refundAmt'];
}
}
}
}
//there is an error message
if ($message != '') {
FlashMessage($message, $messageStatus, 'index.php?ToDo=viewOrders');
}
$transactionId = trim($order['ordpayproviderid']);
if ($transactionId == '') {
$message = GetLang('OrderTranscationIDNotFound');
} else {
if (!GetModuleById('checkout', $provider, $order['orderpaymentmodule'])) {
$message = GetLang('PaymentMethodNotExist');
} else {
if (!$provider->IsEnabled()) {
$message = GetLang('PaymentProviderIsDisabled');
} else {
if (!method_exists($provider, "DoRefund")) {
$message = GetLang('RefundNotAvailable');
} else {
//still here, perform a delay capture
if ($provider->DoRefund($order, $message, $refundAmt)) {
$messageStatus = MSG_SUCCESS;
//update order status
$orderStatus = ORDER_STATUS_REFUNDED;
UpdateOrderStatus($order['orderid'], $orderStatus, true);
}
}
}
}
}
FlashMessage($message, $messageStatus, 'index.php?ToDo=viewOrders');
return $message;
}
示例9: ProcessGatewayPing
public function ProcessGatewayPing()
{
$transactionid = $_REQUEST['transaction_id'];
$order_id = $_REQUEST['order_id'];
$amount = $_REQUEST['amount'];
$from_email = $_REQUEST['from_email'];
$session = $_REQUEST['session'];
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), 'APC Pingback');
$this->SetOrderData(LoadPendingOrdersByToken($session));
if (md5($GLOBALS['ISC_CFG']['serverStamp'] . number_format($amount, 2) . $this->GetValue('merchantid') . $session) != $_REQUEST['hash']) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'HashMismatch'));
return false;
}
if (function_exists("curl_exec")) {
// Use CURL if it's available
$ch = curl_init('https://www.nochex.com/nochex.dll/apc/apc');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
// Setup the proxy settings if there are any
if (GetConfig('HTTPProxyServer')) {
curl_setopt($ch, CURLOPT_PROXY, GetConfig('HTTPProxyServer'));
if (GetConfig('HTTPProxyPort')) {
curl_setopt($ch, CURLOPT_PROXYPORT, GetConfig('HTTPProxyPort'));
}
}
if (GetConfig('HTTPSSLVerifyPeer') == 0) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
$result = curl_exec($ch);
if (curl_errno($ch)) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'CurlError'));
return false;
}
}
if (isset($result) && $result == 'AUTHORISED') {
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'Success'));
// Update the status for all orders that we've just received the payment for
foreach ($this->GetOrders() as $orderId => $order) {
$status = ORDER_STATUS_AWAITING_FULFILLMENT;
// If it's a digital order & awaiting fulfillment, automatically complete it
if ($order['ordisdigital'] && ORDER_STATUS_AWAITING_FULFILLMENT) {
$status = ORDER_STATUS_COMPLETED;
}
UpdateOrderStatus($orderId, $status);
}
return true;
}
return false;
}
示例10: CommitShipment
//.........这里部分代码省略.........
'shipshipphone' => $address['phone'],
'shipshipemail' => $address['email'],
);
$shipmentId = $GLOBALS['ISC_CLASS_DB']->InsertQuery('shipments', $newShipment);
if(!$shipmentId) {
return false;
}
$totalShipped = $order['ordtotalshipped'];
// Number of items already shipped for this address
$query = "
SELECT total_shipped
FROM [|PREFIX|]order_shipping
WHERE order_address_id='".$address['id']."'
";
$totalAddressShipped = $this->db->fetchOne($query);
// Now actually create the shipment based on all the items that were selected
foreach($data['quantity'] as $productId => $quantity) {
if(!isset($addressProducts[$productId])) {
return false;
}
$product = $addressProducts[$productId];
// We didn't choose to ship any of this item
if((int)$data['quantity'][$product['orderprodid']] <= 0 || $product['ordprodtype'] != 'physical') {
continue;
}
$newItem = array(
'shipid' => $shipmentId,
'itemordprodid' => (int)$productId,
'itemprodid' => $product['ordprodid'],
'itemprodsku' => $product['ordprodsku'],
'itemprodname' => $product['ordprodname'],
'itemqty' => (int)$quantity,
'itemprodoptions' => $product['ordprodoptions'],
'itemprodvariationid' => $product['ordprodvariationid']
);
if (isset($product['ordprodeventdate'])) {
$newItem['itemprodeventdate'] = $product['ordprodeventdate'];
}
if (isset($product['ordprodeventname'])) {
$newItem['itemprodeventname'] = $product['ordprodeventname'];
}
if(!$GLOBALS['ISC_CLASS_DB']->InsertQuery('shipment_items', $newItem)) {
$GLOBALS['ISC_CLASS_DB']->RollbackTransaction();
return false;
}
// Increase the amount of items shipped for this product
$totalShipped += $quantity;
$totalAddressShipped += $quantity;
$updatedOrderItem = array(
'ordprodqtyshipped' => $product['ordprodqtyshipped'] + $quantity
);
if(!$GLOBALS['ISC_CLASS_DB']->UpdateQuery('order_products', $updatedOrderItem, "orderprodid='".(int)$product['orderprodid']."'")) {
$GLOBALS['ISC_CLASS_DB']->RollbackTransaction();
return false;
}
}
$updatedOrder = array(
'ordtotalshipped' => $totalShipped
);
// Chose to update the status of this order
if(isset($data['ordstatus'])) {
if(isset($GLOBALS['StillShippable'])) {
$newStatus = ORDER_STATUS_PARTIALLY_SHIPPED;
}
else {
$newStatus = ORDER_STATUS_SHIPPED;
}
UpdateOrderStatus($order['orderid'], $newStatus);
}
if(!$GLOBALS['ISC_CLASS_DB']->UpdateQuery('orders', $updatedOrder, "orderid='".(int)$order['orderid']."'")) {
$GLOBALS['ISC_CLASS_DB']->RollbackTransaction();
return false;
}
// Update the order_shipping table to indicate what's shipped
$updatedShipping = array(
'total_shipped' => $totalAddressShipped
);
if(!$this->db->updateQuery('order_shipping', $updatedShipping,
'order_address_id='.$address['id'])) {
$this->db->rollbackTransaction();
return false;
}
// Still here? Commit and send back the ID of the new shipment
$GLOBALS['ISC_CLASS_DB']->CommitTransaction();
return $shipmentId;
}
示例11: updateOrderStatusBoxRequest
private function updateOrderStatusBoxRequest()
{
$success = (int) @$_REQUEST['success'];
$failed = (int) @$_REQUEST['failed'];
$result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]order_status WHERE statusid='" . $GLOBALS['ISC_CLASS_DB']->Quote(@$_REQUEST['statusId']) . "'");
$_SESSION["canupdateorder"] = "";
if (isId(@$_REQUEST['orderId']) && isId(@$_REQUEST['statusId']) && ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) && UpdateOrderStatus($_REQUEST['orderId'], $_REQUEST['statusId'])) {
echo '1';
$success++;
} else {
echo '0';
$failed++;
}
$message = sprintf(GetLang('OrderUpdateStatusReport'), $success, $row['statusdesc']);
if ($failed) {
$message .= sprintf(GetLang('OrderUpdateStatusReportFail'), $failed);
}
MessageBox($message, MSG_SUCCESS);
//2011-4-21 ronnie add
if ($_SESSION["canupdateorder"] != "") {
//echo MessageBox($_SESSION["canupdateorder"], MSG_ERROR);
echo $_SESSION["canupdateorder"];
}
exit;
}
示例12: ProcessGatewayPing
/**
* Process the NAB pingback
*/
public function ProcessGatewayPing()
{
if(!isset($_REQUEST['payment_reference']) || !isset($_REQUEST['bank_reference']) || !isset($_REQUEST['orderToken']) || !isset($_REQUEST['signature'])) {
exit;
}
$paymentReference = $_REQUEST['payment_reference'];
$paymentAmount = number_format($_REQUEST['payment_amount'], 2, '.', '');
$orderToken = $_REQUEST['orderToken'];
$sessionToken = $_REQUEST['sessionToken'];
$requestSignature = $_REQUEST['signature'];
$transactionId = $_REQUEST['payment_number'];
$bankReference = $_REQUEST['bank_reference'];
$this->SetOrderData(LoadPendingOrdersByToken($orderToken));
$orders = $this->GetOrders();
list(,$order) = each($orders);
$orderId = $order['orderid'];
// GetGatewayAmount returns the amount from the order record, so $amount is that but formatted into #.##
$amount = number_format($this->GetGatewayAmount(), 2, '.', '');
// verify that the signature matches
$verifySignature = md5($amount . $orderToken . $orderId . GetConfig('EncryptionToken'));
if ($verifySignature != $requestSignature) {
$errorMsg = GetLang('NabSignatureMismatchDetails', array('orderId' => $orderId, 'transactionId' => $transactionId));
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang('NabSignatureMismatch'), $errorMsg);
return false;
}
/** @var ISC_TRANSACTION */
$transaction = GetClass('ISC_TRANSACTION');
$previousTransaction = $transaction->LoadByTransactionId($transactionId, $this->GetId());
if(is_array($previousTransaction) && $previousTransaction['transactionid']) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), sprintf(GetLang('NabTransactionAlreadyProcessed'), $_REQUEST['payment_date']));
return false;
}
// Need to finish the processing of the pingback
$newTransaction = array(
'providerid' => $this->GetId(),
'transactiondate' => $_REQUEST['payment_date'],
'transactionid' => $transactionId,
'orderid' => $orderId,
'message' => 'Completed',
'status' => '',
'amount' => $_REQUEST['payment_amount'],
'extrainfo' => array()
);
$newTransaction['status'] = TRANS_STATUS_COMPLETED;
$newOrderStatus = ORDER_STATUS_AWAITING_FULFILLMENT;
$transaction->Create($newTransaction);
// If the order was previously incomplete, empty the customers cart
if($this->GetOrderStatus() == ORDER_STATUS_INCOMPLETE) {
session_write_close();
$session = new ISC_SESSION($sessionToken);
EmptyCartAndKillCheckout();
}
$status = $newOrderStatus;
// If it's a digital order & awaiting fulfillment, automatically complete it
if($order['ordisdigital'] && $status == ORDER_STATUS_AWAITING_FULFILLMENT) {
$status = ORDER_STATUS_COMPLETED;
}
UpdateOrderStatus($orderId, $status);
$updatedOrder = array(
'ordpayproviderid' => $_REQUEST['payment_number'],
'ordpaymentstatus' => 'captured',
);
$this->UpdateOrders($updatedOrder);
// This was a successful order
$oldStatus = GetOrderStatusById($this->GetOrderStatus());
if(!$oldStatus) {
$oldStatus = 'Incomplete';
}
$newStatus = GetOrderStatusById($newOrderStatus);
$extra = GetLang('NabSuccessDetails',
array(
'orderId' => $orderId,
'amount' => $amount,
'bankAuth' => $bankReference,
'transactionId' => $transactionId,
'paymentStatus' => 'Captured',
'newOrderStatus' => $newStatus,
'oldOrderStatus' => $oldStatus,
//.........这里部分代码省略.........
示例13: _handleAuctionCheckoutComplete
//.........这里部分代码省略.........
$paymentHoldStatus = $body['TransactionArray']['Transaction']['Status']['PaymentHoldStatus'];
if (in_array(trim($paymentHoldStatus), $completedPaymentHoldStatus)) {
$orderStatus = ORDER_STATUS_AWAITING_FULFILLMENT;
}
if ($existingOrderId != 0) {
if (!isset ($existingOrder)) {
$existingOrder = GetOrder($existingOrderId, false, true, true);
}
// check if there're any existing order need to be updated.
// in the case, paypal release the hold payment of buyer
if ($existingOrder['ordstatus'] == ORDER_STATUS_AWAITING_PAYMENT
&& $orderStatus == ORDER_STATUS_AWAITING_FULFILLMENT) {
// update the quantity for each transaction
$GLOBALS["ISC_CLASS_DB"]->StartTransaction();
foreach ($order['Transaction'] as $eachTransaction) {
// Get product Id
try {
$itemObj = new ISC_ADMIN_EBAY_ITEMS($eachTransaction['ItemId']);
$productId = $itemObj->getProductId();
} catch (Exception $e) {
$this->log->LogSystemDebug('ebay', $e->getMessage());
return false;
}
// update the item quantity in store
$updatedData['quantity_remaining'] = $itemObj->getQuantityRemaining() - $eachTransaction['QuantityPurchased'];
if (!$GLOBALS['ISC_CLASS_DB']->UpdateQuery('ebay_items', $updatedData, "ebay_item_id='" . $eachTransaction['ItemId'] . "'")) {
$this->log->LogSystemDebug('ebay', $GLOBALS["ISC_CLASS_DB"]->Error());
$GLOBALS["ISC_CLASS_DB"]->RollbackTransaction();
return false;
}
if (!UpdateOrderStatus($existingOrderId, $orderStatus, true, true)) {
$GLOBALS["ISC_CLASS_DB"]->RollbackTransaction();
return false;
}
}
$GLOBALS["ISC_CLASS_DB"]->CommitTransaction();
// update the store inventory if necessary
if (GetConfig('UpdateInventoryLevels') == 1) {
DecreaseInventoryFromOrder($existingOrderId);
}
$this->log->LogSystemDebug('ebay', 'The status of the store order ('. $existingOrderId .') has been updated to: Awaiting Fulfillment');
}
return true;
}
$order['ShippingTotalCost'] = $order['ShippingInsuranceCost'] + $order['ShippingCost'];
// Buyer's address information
$addressMap = array(
'Name',
'CompanyName',
'Street1',
'Street2',
'CityName',
'PostalCode',
'Country',
'CountryName',
'Phone',
'StateOrProvince',
);
// Initialize the value, make sure it's not empty
示例14: UpdateOrderStatus
/**
* Update the order status of a specific order from the manage orders page
*
* @return void
**/
private function UpdateOrderStatus()
{
$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('orders');
if (isset($_REQUEST['o']) && isset($_REQUEST['s'])) {
$order_id = (int) $_REQUEST['o'];
$status = (int) $_REQUEST['s'];
$order = GetOrder($order_id);
if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $order['ordvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
echo 0;
exit;
}
if (UpdateOrderStatus($order_id, $status)) {
echo 1;
} else {
echo 0;
}
} else {
echo 0;
}
exit;
}
示例15: ProcessGatewayPing
public function ProcessGatewayPing()
{
$hash = $_REQUEST['isc_hash'];
$returnStatus = $_REQUEST['status'];
$md5sig = $_REQUEST['md5sig'];
$merchant_id = $_REQUEST['merchant_id'];
$pay_to_email = $_REQUEST['pay_to_email'];
$mb_amount = $_REQUEST['mb_amount'];
$mb_transaction_id = $_REQUEST['mb_transaction_id'];
$session = $_REQUEST['isc_session'];
$mb_currency = $_REQUEST['mb_currency'];
$transaction_id = $_REQUEST['transaction_id'];
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), 'MoneyBookers Pingback');
$this->SetOrderData(LoadPendingOrdersByToken($session));
if (md5($GLOBALS['ISC_CFG']['serverStamp'] . $this->GetCombinedOrderId() . $session . number_format($this->GetGatewayAmount(), 2)) != $hash) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'HashMismatch'));
return false;
}
if (strtoupper(md5($merchant_id . $transaction_id . strtoupper(md5($this->GetValue('secretword'))) . $mb_amount . $mb_currency . $returnStatus)) != $md5sig) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'HashMBMismatch'));
return false;
}
$currency = GetDefaultCurrency();
if ($returnStatus != 2) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'Failure'));
return false;
}
if ($mb_currency != $currency['currencycode']) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'CurrencyMismatch'));
return false;
}
if ($mb_amount != $this->GetGatewayAmount()) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'PaymentMismatch'));
return false;
}
if ($pay_to_email != $this->GetValue('mbemail')) {
$GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'AccountMismatch'));
return false;
}
$GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('payment', $this->GetName()), GetLang($this->_languagePrefix . 'Success'));
// Update the status for all orders that we've just received the payment for
foreach ($this->GetOrders() as $orderId => $order) {
$status = ORDER_STATUS_AWAITING_FULFILLMENT;
// If it's a digital order & awaiting fulfillment, automatically complete it
if ($order['ordisdigital'] && ORDER_STATUS_AWAITING_FULFILLMENT) {
$status = ORDER_STATUS_COMPLETED;
}
UpdateOrderStatus($orderId, $status);
}
return true;
}