public function getuserpaymentdetailsAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper("layout")->disableLayout();
     $aJson = null;
     $oModelVOrderPaymentHistory = new User_Model_VOrderPaymentHistory();
     $oModelOrderPayment = new User_Model_OrderPayment();
     if ($this->_request->isPost()) {
         $aPostData = $this->_request->getPost();
         $nOrderPaymentId = $aPostData["order_payment_id"];
         if ($oModelOrderPayment->getUserPayment($nOrderPaymentId)) {
             $aJson = $oModelVOrderPaymentHistory->getUserPaymentDetails($nOrderPaymentId)->toArray();
         }
     }
     header("Content-type: application/json");
     echo Zend_Json::encode($aJson);
     exit;
 }
Esempio n. 2
0
 public function statusAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper("layout")->disableLayout();
     if ($this->_request->isPost()) {
         $aPostData = $this->_request->getPost();
         $sHash = md5($aPostData["transaction_id"] . $aPostData["merchant_id"] . $aPostData["order_id"] . $aPostData["product_id"] . $aPostData["user_id"] . $aPostData["amount"] . $aPostData["descr"] . $aPostData["client_ip"] . $aPostData["time"] . $this->_sAuthKey2);
         if ($sHash === $aPostData["hash"]) {
             $oModelOrderPayment = new User_Model_OrderPayment();
             $oModelOrderJournal = new User_Model_OrderJournal();
             $oModelOrderFile = new User_Model_OrderFile();
             $oModelOrderCart = new Borrower_Model_OrderCart();
             $oModelOrderJournalOrderCart = new Borrower_Model_OrderJournalOrderCart();
             $oModelVOrderPaymentHistory = new User_Model_VOrderPaymentHistory();
             $sPathOld = APPLICATION_PATH . "/../files_scanned/";
             $sPathNew = APPLICATION_PATH . "/../../public_html/files_scanned/";
             $nOrderPaymentId = (int) $aPostData["order_id"];
             $nUserId = (int) $aPostData["user_id"];
             $nAmount = (int) $aPostData["amount"];
             $oOrderPayment = $oModelOrderPayment->getRow($nOrderPaymentId);
             if ($oOrderPayment->user_id === $nUserId && $oOrderPayment->amount === $nAmount && $oOrderPayment->is_ending !== 1) {
                 $oDb = Zend_Db_Table::getDefaultAdapter();
                 try {
                     if (!@is_dir($sPathNew)) {
                         if (!@mkdir($sPathNew, 0777)) {
                             throw new Zend_Exception();
                         }
                     }
                     if (!@is_dir($sPathOld)) {
                         throw new Zend_Exception();
                     }
                     $oDb->beginTransaction();
                     $oOrderJournal = $oModelVOrderPaymentHistory->getOrderJournal($nOrderPaymentId);
                     foreach ($oOrderJournal as $oRow) {
                         $nOrderJournalId = $oRow->order_journal_id;
                         if (!@is_dir($sPathNew . "user_id_" . $nUserId)) {
                             if (!@mkdir($sPathNew . "user_id_" . $nUserId, 0777)) {
                                 throw new Zend_Exception();
                             }
                         }
                         $oOrderFile = $oModelOrderFile->getRow($oRow->order_file_id);
                         if (!@copy($sPathOld . $oOrderFile->name, $sPathNew . "user_id_" . $nUserId . "/" . $oOrderFile->name)) {
                             throw new Zend_Exception();
                         }
                         $oModelOrderJournal->setOrderPaymentSuccess($nOrderJournalId);
                         $oMail = new AppCms2_Controller_Plugin_Mail();
                         $oMail->sendBorrowerOrderStatusInfo($nOrderJournalId, 5);
                     }
                     $oModelOrderPayment->editRow($nOrderPaymentId, array("is_ending" => 1, "date_is_ending" => time()));
                     $nOrderCartId = $oModelOrderCart->getOrderCartId($nUserId);
                     $oModelOrderJournalOrderCart->deleteCartJournals($nOrderCartId);
                     $oDb->commit();
                     echo "ACK";
                 } catch (Zend_Exception $e) {
                     $oDb->rollBack();
                 }
             }
         }
     }
     exit;
 }