Example #1
0
//if ($_SERVER['REMOTE_ADDR'] == "203.190.41.220") {
if ($rowOrder) {
    if ($status_code == 00) {
        $rowOrder->orderStatus = 3;
    } else {
        $rowOrder->orderStatus = 6;
    }
    $rowOrder->paymentDate = $datenow;
    $tblNsiapay = new Pandamp_Modules_Payment_Nsiapay_Model_Nsiapay();
    $tblNsiapay->update(array('status' => 'paid', 'finishtime' => date('YmdHis')), "transidmerchant='" . $transidmerchant . "'");
    $tblNhis = new Pandamp_Modules_Payment_NsiapayHistory_Model_NsiapayHistory();
    $tblNhis->insert(array('orderId' => $rowOrder->orderId, 'paymentStatus' => 'paid', 'dateAdded' => date('YmdHis')));
    $redirect_url = _MERCHANTWEB . "?status_code=" . $status_code . "&order_number=" . $transidmerchant;
    $rowOrder->save();
    $tblHistory = new Pandamp_Modules_Payment_OrderHistory_Model_OrderHistory();
    $orderHistory = array('orderId' => $rowOrder->orderId, 'orderStatusId' => $rowOrder->orderStatus, 'dateCreated' => date('YmdHis'), 'userNotified' => 0, 'note' => 'paid with nsiapay method');
    $tblHistory->insert($orderHistory);
} else {
    $redirect_url = _MERCHANTWEB;
}
//}
//else
//{
//	$rowOrder->orderStatus = 7;
//	$rowOrder->datePurchased = $datenow;
//
//	$rowOrder->save();
//
//	$redirect_url = _MERCHANTWEB."?status_code=7&order_number=".$transidmerchant;
//}
$redirect_url = str_replace("&", "&", $redirect_url);
 public function trdetailAction()
 {
     $this->_checkAuth();
     $orderId = $this->_request->getParam('id');
     $userId = $this->_userInfo->userId;
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
     $tblOrderDetail = new Pandamp_Modules_Payment_OrderDetail_Model_OrderDetail();
     $tblOrderHistory = new Pandamp_Modules_Payment_OrderHistory_Model_OrderHistory();
     $tblOrderPaypalHistory = new Pandamp_Modules_Payment_Paypal_Model_Paypal();
     $rowset = $tblOrder->getOrderAndStatus($orderId);
     $rowsetDetail = $tblOrderDetail->fetchAll($tblOrderDetail->select()->where("orderId='" . $orderId . "'"));
     $rowsetHistory = $tblOrderHistory->getUserHistory($orderId);
     $rowsetPaypalHistory = $tblOrderPaypalHistory->fetchAll($tblOrderPaypalHistory->select()->where("orderId='" . $orderId . "'"));
     //print_r($rowsetHistory);
     $this->view->listOrder = $rowset;
     $this->view->listOrderDetail = $rowsetDetail;
     $this->view->rowsetHistory = $rowsetHistory;
     $this->view->rowsetPaypalHistory = $rowsetPaypalHistory;
 }
 protected function updateInvoiceMethod($orderId, $payMethod, $status, $notify, $note)
 {
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
     $rows = $tblOrder->find($orderId)->current();
     $row = array();
     $ivnum = $rows->invoiceNumber;
     /*if(empty($ivnum)){
     			if($status==3 || $status==5 || (!empty($_SESSION['_method'])&&($_SESSION['_method'] =='paypal')))
     			$ivnum = $this->getInvoiceNumber();
     			//$row=array ('invoiceNumber'	=> $ivnum);
     		}*/
     //if( )$ivnum = $this->getInvoiceNumber();
     $row = array('orderStatus' => $status, 'paymentMethod' => $payMethod);
     //$_SESSION['_method'] = '';
     /*$this->_paymentMethod=$payMethod;//set payment method on table
     		$row->paymentMethod=$this->_paymentMethod;*/
     $tblOrder->update($row, 'orderId = ' . $orderId);
     $tblHistory = new Pandamp_Modules_Payment_OrderHistory_Model_OrderHistory();
     $rowHistory = $tblHistory->fetchNew();
     $rowHistory->orderId = $orderId;
     $rowHistory->orderStatusId = $status;
     $rowHistory->dateCreated = date('YmdHis');
     $rowHistory->userNotified = $notify;
     $rowHistory->note = $note;
     $rowHistory->save();
     return $ivnum;
 }