protected function updateInvoiceMethod($orderId, $payMethod, $status, $notify, $note) { $tblOrder = new Kutu_Core_Orm_Table_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 Kutu_Core_Orm_Table_OrderHistory(); $rowHistory = $tblHistory->fetchNew(); $rowHistory->orderId = $orderId; $rowHistory->orderStatusId = $status; $rowHistory->dateCreated = date('YmdHis'); $rowHistory->userNotified = $notify; $rowHistory->note = $note; $rowHistory->save(); return $ivnum; }
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', '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->_userDetailInfo->guid, $value)) { //forward to error page $this->_helper->redirector->gotoSimple('error', 'store', 'site', array('view' => 'notowner')); die; } } //if orderId status is PAID redirect to error page //die('here'); $tblConfirm = new Kutu_Core_Orm_Table_PaymentConfirmation(); $tblOrder = new Kutu_Core_Orm_Table_Order(); $r = $this->getRequest(); $amount = 0; //var_dump($r->getParam('orderId')); //die(); foreach ($r->getParam('orderId') as $ksy => $value) { $amount += $tblOrder->getAmount($value, $r->getParam('currency')); } 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 Kutu_Core_Orm_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(); //$this->Mailer($data['orderId'], 'admin-confirm', 'admin'); $mod = new App_Model_Store_Mailer(); $mod->sendUserBankConfirmationToAdmin($data['orderId']); } $this->_helper->redirector->gotoSimple('confirm', 'store_payment', 'site', array('sended' => '1')); }
public function payconfirmnoAction() { //print_r($this->_request->getParams()); $id = $this->_request->getParam('id'); //$method = $this->_request->getParam('method'); /*if($this->_request->getParam('method') == 'bank'){ $method = 1; }else{ $method = 5; }*/ $this->view->idOrder = $id; $this->view->warn = ''; if ($this->_request->isPost('adminNotes') == true) { if (strlen($this->_request->getParam('adminNotes')) == 0) { $this->view->warn = '<div class="error"> Please insert some notes</div>'; } else { $id = $this->_request->getParam('id'); $method = 6; $tblOrder = new Kutu_Core_Orm_Table_Order(); $tblHistory = new Kutu_Core_Orm_Table_OrderHistory(); $tblConfirm = new Kutu_Core_Orm_Table_PaymentConfirmation(); //echo $method; //select payment date from paymentconfirmation $date = $tblConfirm->fetchAll($tblConfirm->select()->where("orderId = " . $id . " AND confirmed = 0")); //$data['paidDate'] = @$date[0]->paymentDate; //update order $data['orderStatus'] = $method; $data['adminNotes'] = $this->_request->getParam('adminNotes'); $tblOrder->update($data, "orderId = " . $id); //update paymentconfirmation $dataConfirm['confirmed'] = 1; $dataConfirm['adminNotes'] = $this->_request->getParam('adminNotes'); $tblConfirm->update($dataConfirm, "orderId = " . $id); //add history $dataHistory = $tblHistory->fetchNew(); //history data $dataHistory['orderId'] = $id; $dataHistory['orderStatusId'] = $method; $dataHistory['dateCreated'] = date('Y-m-d'); $dataHistory['userNotified'] = 1; $dataHistory['note'] = 'rejected'; $dataHistory->save(); $mod = new App_Model_Store_Mailer(); $mod->sendReceiptToUser($id, 'Bank Transfer', "REJECTED", 1); //redirect to confirmation page $this->_helper->redirector('confirm'); } } }
public function payconfirmAction() { $this->_checkAuth(); $tblConfirm = new Kutu_Core_Orm_Table_PaymentConfirmation(); $tblOrder = new Kutu_Core_Orm_Table_Order(); $r = $this->getRequest(); $amount = 0; foreach ($r->getParam('orderId') as $ksy => $value) { $amount += $tblOrder->getAmount($value, $r->getParam('currency')); } 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 Kutu_Core_Orm_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(); $this->Mailer($data['orderId'], 'admin-confirm', 'admin'); } $this->_helper->redirector->gotoSimple('confirm', 'store_payment', 'site', array('sended' => '1')); }
public function payconfirmnoAction() { //print_r($this->_request->getParams()); $id = $this->_request->getParam('id'); //$method = $this->_request->getParam('method'); /*if($this->_request->getParam('method') == 'bank'){ $method = 1; }else{ $method = 5; }*/ $method = 6; $tblOrder = new Kutu_Core_Orm_Table_Order(); $tblHistory = new Kutu_Core_Orm_Table_OrderHistory(); $tblConfirm = new Kutu_Core_Orm_Table_PaymentConfirmation(); //echo $method; //select payment date from paymentconfirmation $date = $tblConfirm->fetchAll($tblConfirm->select()->where("orderId = " . $id . " AND confirmed = 0")); //$data['paidDate'] = @$date[0]->paymentDate; //update order $data['orderStatus'] = $method; $tblOrder->update($data, "orderId = " . $id); //mailer $this->Mailer($id, 'user-confirm', 'user'); //update paymentconfirmation $dataConfirm['confirmed'] = 1; $tblConfirm->update($dataConfirm, "orderId = " . $id); //add history $dataHistory = $tblHistory->fetchNew(); //history data $dataHistory['orderId'] = $id; $dataHistory['orderStatusId'] = $method; $dataHistory['dateCreated'] = date('Y-m-d'); $dataHistory['userNotified'] = 1; $dataHistory['note'] = 'rejected'; $dataHistory->save(); //redirect to confirmation page $this->_helper->redirector('confirm'); }