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 Pandamp_Modules_Payment_Confirm_Model_PaymentConfirmation();
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_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 Pandamp_Modules_Payment_OrderHistory_Model_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', 'site', array('sended' => '1'));
 }
Example #2
0
 function processAction()
 {
     $formater = new Pandamp_Core_Hol_User();
     $orderId = $this->_request->getParam('orderId');
     $packageId = $this->_request->getParam('packageId');
     $paymentSubscription = $this->_request->getParam('paymentSubscription');
     $this->_orderIdNumber = $orderId;
     if (empty($orderId)) {
         echo "kosong";
         die;
     }
     include_once ROOT_DIR . '/app/models/Store.php';
     $modelAppStore = new App_Model_Store();
     if ($modelAppStore->isOrderPaid($orderId)) {
         //forward to error page
         $this->_helper->redirector->gotoSimple('error', 'store', 'hol-site', array('view' => 'orderalreadypaid'));
         die;
     }
     //$tblOrder = new App_Model_Db_Table_Order();
     $items = App_Model_Show_Order::show()->getOrderDetail($orderId);
     $tmpMethod = $this->_request->getParam('method');
     if (!empty($tmpMethod)) {
         $items[0]['paymentMethod'] = $tmpMethod;
     }
     $tblUser = new App_Model_Db_Table_User();
     $rowUser = $tblUser->find($items[0]['userId'])->current();
     $total = $formater->checkPromoValidation('Total', $packageId, $rowUser->promotionId, $paymentSubscription);
     switch ($items[0]['paymentMethod']) {
         case 'nsiapay':
             require_once 'PaymentGateway/Nsiapay.php';
             // include the class file
             $paymentObject = new Nsiapay();
             // initiate an instance of the class
             if ($this->_testMode) {
                 $paymentObject->enableTestMode();
             }
             $paymentObject->addField('TYPE', "IMMEDIATE");
             $subTotal = 0;
             for ($iCart = 0; $iCart < count($items); $iCart++) {
                 $i = $iCart + 1;
                 $basket[] = $items[$iCart]['documentName'] . "," . $items[$iCart]['price'] . ".00" . "," . $items[$iCart]['qty'] . "," . $items[$iCart]['finalPrice'] . ".00";
                 $subTotal += $items[$iCart]['price'] * $items[$iCart]['qty'];
             }
             $ca = implode(";", $basket);
             $merchantId = "000100090000028";
             $paymentObject->addField("BASKET", $ca);
             $paymentObject->addField("MERCHANTID", $merchantId);
             $paymentObject->addField("CHAINNUM", "NA");
             $paymentObject->addField("TRANSIDMERCHANT", $items[0]['invoiceNumber']);
             $paymentObject->addField("AMOUNT", $subTotal);
             $paymentObject->addField("CURRENCY", "360");
             $paymentObject->addField("PurchaseCurrency", "360");
             $paymentObject->addField("acquirerBIN", "360");
             $paymentObject->addField("password", "123456");
             $paymentObject->addField("URL", "http://hukumonline.pl");
             $paymentObject->addField("MALLID", "199");
             $paymentObject->addField("SESSIONID", Zend_Session::getId());
             $sha1 = sha1($subTotal . ".00" . $merchantId . "08iIWbWvO16w" . $items[0]['invoiceNumber']);
             //                echo $subTotal.".00".$merchantId."08iIWbWvO16w".$items[0]['invoiceNumber']."<br>";
             //                echo $sha1;die;
             $paymentObject->addField("WORDS", $sha1);
             //$paymentObject->dumpFields();
             $this->_helper->layout->disableLayout();
             $paymentObject->submitPayment();
             break;
         case 'manual':
         case 'bank':
             /*
              1. update order status
              2. redirect to instruction page 
             */
             //setting payment and status as pending (1), notify = 0, notes = 'paid with...'
             $this->updateInvoiceMethod($orderId, 'bank', 1, 0, 'paid with manual method');
             // HAP: i think we should send this notification when user were on page "Complete Order" and after confirmation made by user is approved;
             //$this->Mailer($orderId, 'admin-order', 'admin');
             //$this->Mailer($orderId, 'user-order', 'user');
             $this->_helper->redirector('instruction', 'payment', 'membership', array('orderId' => $orderId));
             break;
     }
 }
Example #3
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'));
 }