echo "TRUE|Ignore pending"; ob_flush(); updatePaynlTransaction($transactionId, $state); die; break; case "PAID": if (!$isExchange) { updateOrderStatus($method, $orderId); updatePaynlTransaction($transactionId, $state); //clean up cart & session $cart =& $_SESSION['cart']; $cart->reset(true); zen_redirect(zen_href_link(FILENAME_CHECKOUT_SUCCESS)); } else { updatePaynlTransaction($transactionId, $state); updateOrderStatus($method, $orderId); echo "TRUE|PAID"; ob_flush(); $cart =& $_SESSION['cart']; $cart->reset(true); zen_session_unregister('sendto'); zen_session_unregister('billto'); zen_session_unregister('shipping'); zen_session_unregister('payment'); zen_session_unregister('comments'); } break; case "CANCEL": if ($isExchange) { echo "TRUE|CANCEL"; deleteOrder($orderId);
//check if the user new balance is greater than the ordered airtime if ($new_balance + 1 > $latest_order_amount) { //send airtime //building the recipients array $recipients = array(); $data = array(); $data['phoneNumber'] = $phone; $data['amount'] = "KES " . $latest_order_amount; array_push($recipients, $data); //sending the airtime sendAirtime($recipients); //reduce the user balance by the sent airtime amount $balance = $new_balance - $latest_order_amount; // and update user balance updateUserBalance($user['id'], $balance); updateOrderStatus($order['id']); echo "your airtime is on its way"; exit; } else { //send SMS telling the user that he doesn't have sufficient money for the order $message = "Hey you, your have insufficient funds to proceed with this transaction"; sendSMS($phone, $message); echo "Check your phone for an SMS"; exit; } //top up the users account //from the users account, remove amount equal to the airtime ordered ///send airtime //nouns orders, users, account, airtime, //verbs top up, store, make payments, send airtime //users - phone, balance,
$result = mysqli_query($connection, $query2); if ($result) { echo "ההודעה נשלחה בהצלחה"; } else { echo "תקלה בשליחת ההודעה"; } mysqli_close($connection); } } //Handle AJAX POST Requests if (isset($_POST['functionName'])) { if ($_POST['functionName'] == 'buildOrderInfoPage') { buildOrderInfoPage($_POST['linkURL']); } else { if ($_POST['functionName'] == 'updateOrderStatus') { updateOrderStatus($_POST['orderNum'], $_POST['status']); } else { if ($_POST['functionName'] == 'CloseOrder') { CloseOrder($_POST['orderNum']); } } } } //Get specific order by orderNumber from DB function getOrderDatails($num) { include 'db.php'; mysqli_set_charset($connection, "utf-8"); $query1 = "\tSELECT * FROM `tbl_users_216` WHERE `orderNumber`="; $query1 .= $num; $result = mysqli_query($connection, $query1);
die(json_encode(array('status' => 'failure', 'content' => 'error50'))); } } if ($statusId == 2) { //已经付款 if (allowUpdateCheck(array(1, 2), $orderId)) { updateOrderStatus($orderId, $statusId); die(json_encode(array('status' => 'success', 'content' => ''))); } else { die(json_encode(array('status' => 'failure', 'content' => 'error50'))); } } if ($statusId == 3) { //处理中 if (allowUpdateCheck(2, $orderId)) { updateOrderStatus($orderId, $statusId); die(json_encode(array('status' => 'success', 'content' => ''))); } else { die(json_encode(array('status' => 'failure', 'content' => 'error50'))); } } die(json_encode(array('status' => 'failure', 'content' => 'error30'))); } die(json_encode(array('status' => 'failure', 'content' => '0'))); function allowUpdateCheck($checkStatus, $orderId) { global $db; $sql = 'select orders_status from orders where orders_id=' . (int) $orderId; $result = $db->Execute($sql); if ($result->RecordCount() > 0) { $now_status = $result->fields['orders_status'];
$newComments = updateOrderStatus($PnagInvoice, $orderId, $srOrderStatusArr['confirmed'], $historyComments['customer'], $time, $newTotal); } break; case PnagInvoice::REFUNDED_REFUNDED_REFUNDED: case PnagInvoice::LOSS_CANCELED: case PnagInvoice::LOSS_CONFIRMATION_PERIOD_EXPIRED: $historyComments = getHistoryComments($completeInvoiceStatus); $newComments = updateOrderStatus($PnagInvoice, $orderId, $srOrderStatusArr['cancelled'], $historyComments['customer'], $time, false); break; default: if ($newTotal) { insertNewTotalCommentToHistory($orderId, $lastOrderStatus, $time, $newTotal); } $historyComments = array(); if (refundedInvoiceWasJustReanimated($orderId, $PnagInvoice->getStatus())) { $newComments = updateOrderStatus($PnagInvoice, $orderId, $srOrderStatusArr['confirmed'], MODULE_PAYMENT_SOFORT_SR_TRANSLATE_INVOICE_REANIMATED, $time, false, true); $historyComments['customer'] = MODULE_PAYMENT_SOFORT_SR_TRANSLATE_INVOICE_REANIMATED; $historyComments['seller'] = MODULE_PAYMENT_SOFORT_SR_TRANSLATE_INVOICE_REANIMATED; } else { $SofortOrderSynchronisation = new sofortOrderSynchronisation(); $SofortOrderSynchronisation->editArticlesShop($PnagInvoice, $orderId); echo MODULE_PAYMENT_SOFORT_SR_STATUSUPDATE_UNNECESSARY . ' (Status: ' . $completeInvoiceStatus . ")\n"; $historyComments['customer'] = ""; $historyComments['seller'] = ""; } break; } if ($newComments != '') { $historyComments['customer'] = $newComments; $historyComments['seller'] = $newComments; }