function db_cancelOrder($orderid) { $orderItems = db_getOrderItems($orderid); foreach ($orderItems as $orderItem) { db_cancelOrderItem($orderid, $orderItem->itemid); } $sql = "UPDATE mdl_shoppingcart_order SET cancelled = 1, fulfillmentorderstate= 'CANCELLED' where id =" . $orderid; return execute_sql($sql, false); }
$Gresponse->log->LogResponse("Cancelled " + $data[$root]['google-order-number']['VALUE']); $order = db_getOrderByOrderNumber($data[$root]['google-order-number']['VALUE']); cancelTransaction($order->id); $orderItems = db_getOrderItems($orderid); foreach ($orderItems as $orderItem) { db_cancelOrderItem($orderid, $orderItem->itemid); } $Grequest->SendBuyerMessage($data[$root]['google-order-number']['VALUE'], "Sorry, your order is cancelled by the store", true); break; case 'CANCELLED_BY_GOOGLE': $Gresponse->log->LogResponse("Cancelled by Google " + $data[$root]['google-order-number']['VALUE']); $order = db_getOrderByOrderNumber($data[$root]['google-order-number']['VALUE']); cancelTransaction($order->id); $orderItems = db_getOrderItems($orderid); foreach ($orderItems as $orderItem) { db_cancelOrderItem($orderid, $orderItem->itemid); } $Grequest->SendBuyerMessage($data[$root]['google-order-number']['VALUE'], "Sorry, your order is cancelled by Google", true); break; default: break; } } if ($fulfillmentStateHasChanged) { switch ($new_fulfillment_order) { case 'NEW': break; case 'PROCESSING': break; case 'DELIVERED': break;
function db_cancelOrder($orderid) { $orderItems = db_getOrderItems($orderid); foreach ($orderItems as $orderItem) { db_cancelOrderItem($orderid, $orderItem['itemid']); } $sql = "UPDATE module_vlabs_shoppingcart_order SET cancelled = 1, fulfillmentorderstate= 'CANCELLED' where id =" . $orderid; return eF_executeQuery($sql); }
db_cancelOrderItem($dbOrder->id, $dbItem->id); $success = true; } }else{ $success = false; $message = "Google could not refund the amount of ".$refundAmount." to the order ".$dbOrder->ordernumber."."; } $message = "Refunds not available through this system, please contact the administrator for further details."; jh end*/ } else { $success = false; $message = "Item " . $dbItem_name . " could not be cancelled because it has been consumed by the buyer."; } } else { $success = db_cancelOrderItem($dbOrder_id, $dbItem_id); if ($success) { $body = '<p>The item ' . $dbItem_name . ' from order ' . $dbOrder_ordernumber . ' has been cancelled.<p>'; } else { $message = "Item could not be cancelled in database"; $body = '<p>The cancellation of item ' . $dbItem_name . ' from order ' . $dbOrder_ordernumber . ' has not been completed.<p>'; } } $itemsCancelled = db_getCancelledOrderItems($dbOrder_id); $items = refactored_db_getOrderItems($dbOrder_id); if (count($items) == count($itemsCancelled)) { if ($dbOrder_payment) { /* jh as mentioned in above NOTE, google events will be omited for now db_cancelGoogleCheckoutOrder($dbOrder_id); $gresponse = $Grequest->SendCancelOrder($dbOrder->ordernumber, "Order has been cancelled due to a partial or complete refund.".
$message = "Google could not cancel item " . $dbItem->name; } } else { db_cancelOrderItem($dbOrder->id, $dbItem->id); $success = true; } } else { $success = false; $message = "Google could not refund the amount of " . $refundAmount . " to the order " . $dbOrder->ordernumber . "."; } } else { $success = false; $message = "Item " . $dbItem->name . " could not be cancelled because it has been consumed by the buyer."; } } else { $success = db_cancelOrderItem($dbOrder->id, $dbItem->id); if ($success) { $body = '<p>The item ' . $dbItem->name . ' from order ' . $dbOrder->ordernumber . ' has been cancelled.<p>'; } else { $message = "Item could not be cancelled in database"; $body = '<p>The cancellation of item ' . $dbItem->name . ' from order ' . $dbOrder->ordernumber . ' has not been completed.<p>'; } } $itemsCancelled = db_getCancelledOrderItems($dbOrder->id); $items = db_getOrderItems($dbOrder->id); if (count($items) == count($itemsCancelled)) { if ($dbOrder->payment) { db_cancelGoogleCheckoutOrder($dbOrder->id); $gresponse = $Grequest->SendCancelOrder($dbOrder->ordernumber, "Order has been cancelled due to a partial or complete refund." . "Contact the administrator for further details."); } else { db_cancelOrder($dbOrder->id);