function infoTabAction()
 {
     require_once APPLICATION_PATH . '/default/controllers/AdminUsersController.php';
     $this->setActiveMenu('users-browse');
     $user_id = $this->_request->getInt('user_id');
     if (!$user_id) {
         throw Am_Exception_InputError("Empty [user_id] passsed");
     }
     $cc = $this->getDi()->ccRecordTable->findFirstByUserId($user_id);
     /* @var $cc CcRecord */
     $this->view->cc = $cc;
     $this->view->addUrl = $this->getUrl(null, null, null, 'user_id', $this->getInt('user_id'), array('add' => 1));
     if ($cc || $this->_request->getInt('add') || $this->_request->get('_save_')) {
         $form = $this->createAdminForm((bool) $cc);
         if ($form) {
             if ($form->isSubmitted() && $form->validate()) {
                 if (!$cc) {
                     $cc = $this->getDi()->ccRecordTable->createRecord();
                 }
                 $form->toCcRecord($cc);
                 $cc->user_id = $user_id;
                 $cc->save();
             } elseif ($cc) {
                 $arr = $cc->toArray();
                 unset($arr['cc_number']);
                 $form->addDataSource(new HTML_QuickForm2_DataSource_Array($arr));
             }
             $this->view->form = $form;
             $this->view->form->setAction($this->_request->getRequestUri());
         }
     }
     $this->view->display('admin/cc/info-tab.phtml');
 }
Example #2
0
 function infoTabEcheckAction()
 {
     require_once APPLICATION_PATH . '/default/controllers/AdminUsersController.php';
     $this->setActiveMenu('users-browse');
     $user_id = $this->_request->getInt('user_id');
     if (!$user_id) {
         throw Am_Exception_InputError("Empty [user_id] passsed");
     }
     $echeck = $this->getDi()->echeckRecordTable->findFirstByUserId($user_id);
     $this->view->echeck = $echeck;
     $this->view->addUrl = $this->getUrl(null, null, null, 'user_id', $this->getInt('user_id'), array('add' => 1));
     if ($echeck || $this->_request->getInt('add') || $this->_request->get('_save_')) {
         $form = $this->createEcheckAdminForm((bool) $echeck);
         if ($form) {
             if ($form->isSubmitted() && $form->validate()) {
                 if (!$echeck) {
                     $echeck = $this->getDi()->echeckRecordTable->createRecord();
                 }
                 $form->toEcheckRecord($echeck);
                 $echeck->user_id = $user_id;
                 $echeck->save();
                 Am_Controller::redirectLocation($this->_request->getRequestUri());
             } elseif ($echeck) {
                 $arr = $echeck->toArray();
                 unset($arr['echeck_ban']);
                 $form->addDataSource(new HTML_QuickForm2_DataSource_Array($arr));
             }
             $this->view->form = $form;
             $this->view->form->setAction($this->_request->getRequestUri());
         }
     }
     $this->view->display('admin/echeck/info-tab.phtml');
     // ????
 }
Example #3
0
 public function thanksAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     $log = $this->logRequest($request);
     try {
         $transaction = $this->createThanksTransaction($request, $response, $invokeArgs);
     } catch (Am_Exception_Paysystem_NotImplemented $e) {
         $this->logError("[thanks] page handling is not implemented for this plugin. Define [createThanksTransaction] method in plugin");
         throw $e;
     }
     $transaction->setInvoiceLog($log);
     try {
         $transaction->process();
     } catch (Am_Exception_Paysystem_TransactionAlreadyHandled $e) {
         // ignore this error, as it happens in "thanks" transaction
         // we may have received IPN about the payment earlier
     } catch (Exception $e) {
         throw $e;
         $this->getDi()->errorLogTable->logException($e);
         throw Am_Exception_InputError(___("Error happened during transaction handling. Please contact website administrator"));
     }
     $log->setInvoice($transaction->getInvoice())->update();
     $this->invoice = $transaction->getInvoice();
     $response->setRedirect($this->getReturnUrl());
 }
Example #4
0
 public function thanksAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     $log = $this->logRequest($request);
     $transaction = new Am_Paysystem_Transaction_Twocheckout_Thanks($this, $request, $response, $invokeArgs);
     $transaction->setInvoiceLog($log);
     try {
         $transaction->process();
     } catch (Am_Exception_Paysystem_TransactionAlreadyHandled $e) {
         // Ignore. Just show receipt.
     } catch (Exception $e) {
         throw $e;
         $this->getDi()->errorLogTable->logException($e);
         throw Am_Exception_InputError(___("Error happened during transaction handling. Please contact website administrator"));
     }
     $log->setInvoice($transaction->getInvoice())->update();
     $this->invoice = $transaction->getInvoice();
     $response->setRedirect($this->getReturnUrl());
 }
Example #5
0
 public function thanksAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     $log = $this->logRequest($request);
     try {
         $transaction = $this->createThanksTransaction($request, $response, $invokeArgs);
     } catch (Am_Exception_Paysystem_NotImplemented $e) {
         $this->logError("[thanks] page handling is not implemented for this plugin. Define [createThanksTransaction] method in plugin");
         throw $e;
     }
     $transaction->setInvoiceLog($log);
     if ($request->get("pesapal_transaction_status") == Am_Paysystem_Transaction_Pesapal_Thanks::PENDING) {
         $invoice = $this->getDi()->invoiceTable->findFirstBy(array('public_id' => $transaction->findInvoiceId()));
         $invoice->data()->set('pesapal_transaction_tracking_id', $transaction->getUniqId())->update();
         $view = new Am_View();
         $view->addScriptPath(dirname(__FILE__));
         $response->setBody($view->render("payment-pesapal-pending.phtml"));
         return;
     }
     try {
         $transaction->process();
     } catch (Am_Exception_Paysystem_TransactionAlreadyHandled $e) {
         // ignore this error, as it happens in "thanks" transaction
         // we may have received IPN about the payment earlier
     } catch (Exception $e) {
         throw $e;
         $this->getDi()->errorLogTable->logException($e);
         throw Am_Exception_InputError(___("Error happened during transaction handling. Please contact website administrator"));
     }
     $log->setInvoice($transaction->getInvoice())->update();
     $this->invoice = $transaction->getInvoice();
     $response->setRedirect($this->getReturnUrl());
 }
Example #6
0
 public function refundAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     $log = $this->logRequest($request);
     $transaction = new Am_Paysystem_Transaction_Swreg_Refund($this, $request, $response, $invokeArgs);
     $transaction->setInvoiceLog($log);
     try {
         $transaction->process();
     } catch (Exception $e) {
         throw $e;
         $this->getDi()->errorLogTable->logException($e);
         throw Am_Exception_InputError(___("Error happened during transaction handling. Please contact website administrator"));
     }
     $log->setInvoice($transaction->getInvoice())->update();
 }