Example #1
0
 protected function _postDelete()
 {
     $tblOrderDetail = new App_Model_Db_Table_OrderDetail();
     $tblOrderDetail->delete("orderId=" . $this->orderId);
     $tblOrderHistory = new App_Model_Db_Table_OrderHistory();
     $tblOrderHistory->delete("orderId=" . $this->orderId);
     $tblPaymentHistory = new App_Model_Db_Table_PaymentConfirmation();
     $tblPaymentHistory->delete("orderId=" . $this->orderId);
     $tblNsiapay = new App_Model_Db_Table_Nsiapay();
     $tblNsiapay->delete("orderId=" . $this->orderId);
     $tblNsiapayHistory = new App_Model_Db_Table_NsiapayHistory();
     $tblNsiapayHistory->delete("orderId='{$this->invoiceNumber}'");
 }
Example #2
0
 public function deleteconfirmAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $id = $this->_request->getParam('orderId');
     $modelPc = new App_Model_Db_Table_PaymentConfirmation();
     $rowPc = $modelPc->find($id)->current();
     if ($rowPc) {
         $rowPc->delete();
     }
 }
Example #3
0
 public function payconfirmAction()
 {
     $this->_checkAuth();
     //if there is orderId send by previous page
     $tmpOrderId = $this->_request->getParam('orderId');
     if (empty($tmpOrderId)) {
         $this->_helper->redirector->gotoSimple('error', 'store', 'hol-site', array('view' => 'noorderfound'));
         die;
     }
     //[TODO]
     // 1. must check if user who sent the confirmation is the user who own the orderId.
     // 2. if no.1 above return false for at least one orderId, then forward to Error Page.
     $modelAppStore = new App_Model_Store();
     foreach ($this->_request->getParam('orderId') as $key => $value) {
         if (!$modelAppStore->isUserOwnOrder($this->_user->kopel, $value)) {
             //forward to error page
             $this->_helper->redirector->gotoSimple('error', 'store', 'site', array('view' => 'notowner'));
             die;
         }
     }
     $tblConfirm = new App_Model_Db_Table_PaymentConfirmation();
     $tblOrder = new App_Model_Db_Table_Order();
     $r = $this->getRequest();
     $amount = 0;
     foreach ($r->getParam('orderId') as $ksy => $value) {
         $amount += App_Model_Show_Order::show()->getAmount($value);
     }
     foreach ($r->getParam('orderId') as $key => $row) {
         $data = $tblConfirm->fetchNew();
         $data['paymentMethod'] = $r->getParam('paymentMethod');
         $data['destinationAccount'] = $r->getParam('destinationAccount');
         $data['paymentDate'] = $r->getParam('paymentDate');
         $data['amount'] = $amount;
         $data['currency'] = $r->getParam('currency');
         $data['senderAccount'] = $r->getParam('senderAccount');
         $data['senderAccountName'] = $r->getParam('senderAccountName');
         $data['bankName'] = $r->getParam('bankName');
         $data['note'] = $r->getParam('note');
         $data['orderId'] = $row;
         $data->save();
         $statdata['orderStatus'] = 4;
         $tblOrder->update($statdata, 'orderId = ' . $data['orderId']);
         $tblHistory = new App_Model_Db_Table_OrderHistory();
         //add history
         $dataHistory = $tblHistory->fetchNew();
         //history data
         $dataHistory['orderId'] = $data['orderId'];
         $dataHistory['orderStatusId'] = 6;
         $dataHistory['dateCreated'] = date('Y-m-d');
         $dataHistory['userNotified'] = 1;
         $dataHistory['note'] = 'Waiting Confirmation';
         $dataHistory->save();
         $mod = new App_Model_Store_Mailer();
         $mod->sendUserBankConfirmationToAdmin($data['orderId']);
     }
     $this->_helper->redirector->gotoSimple('confirm', 'store_payment', 'hol-site', array('sended' => '1'));
 }
Example #4
0
 public function payconfirmAction()
 {
     $this->_checkAuth();
     $tmpOrderId = $this->_request->getParam('orderId');
     if (empty($tmpOrderId)) {
         $this->_helper->redirector->gotoSimple('error', 'manager', 'shop', array('view' => 'noorderfound'));
         die;
     }
     $modelAppStore = new App_Model_Store();
     foreach ($this->_request->getParam('orderId') as $key => $value) {
         if (!$modelAppStore->isUserOwnOrder($this->_user->kopel, $value)) {
             $this->_helper->redirector->gotoSimple('error', 'manager', 'shop', array('view' => 'notowner'));
             die;
         }
     }
     $tblConfirm = new App_Model_Db_Table_PaymentConfirmation();
     $tblOrder = new App_Model_Db_Table_Order();
     $r = $this->getRequest();
     $amount = 0;
     foreach ($r->getParam('orderId') as $ksy => $value) {
         $amount += App_Model_Show_Order::show()->getAmount($value);
     }
     foreach ($r->getParam('orderId') as $key => $row) {
         $data = $tblConfirm->fetchNew();
         $data['paymentMethod'] = $r->getParam('paymentMethod');
         $data['destinationAccount'] = $r->getParam('destinationAccount');
         //$data['paymentDate'] = $r->getParam('paymentDate');
         $data['paymentDate'] = date("Y-m-d H:i:s");
         $data['amount'] = $amount;
         $data['currency'] = $r->getParam('currency');
         $data['senderAccount'] = $r->getParam('senderAccount');
         $data['senderAccountName'] = $r->getParam('senderAccountName');
         $data['bankName'] = $r->getParam('bankName');
         $data['note'] = $r->getParam('note');
         $data['orderId'] = $row;
         $data->save();
         $statdata['orderStatus'] = 4;
         $tblOrder->update($statdata, 'orderId = ' . $data['orderId']);
         $tblHistory = new App_Model_Db_Table_OrderHistory();
         //add history
         $dataHistory = $tblHistory->fetchNew();
         //history data
         $dataHistory['orderId'] = $data['orderId'];
         $dataHistory['orderStatusId'] = 6;
         $dataHistory['dateCreated'] = date('Y-m-d');
         $dataHistory['userNotified'] = 1;
         $dataHistory['note'] = 'Waiting Confirmation';
         $dataHistory->save();
         $mod = new App_Model_Store_Mailer();
         $mod->sendUserBankConfirmationToAdmin($data['orderId']);
     }
     $this->_helper->redirector->gotoSimple('confirm', 'payment', 'shop', array('sended' => '1'));
 }