Esempio n. 1
0
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     try {
         $invoiceLog = $this->_logDirectAction($request, $response, $invokeArgs);
         $transaction = $this->createTransaction($request, $response, $invokeArgs);
         if (!$transaction) {
             throw new Am_Exception_InputError("Request not handled - createTransaction() returned null");
         }
         $transaction->setInvoiceLog($invoiceLog);
         try {
             $transaction->process();
         } catch (Exception $e) {
             if ($invoiceLog) {
                 $invoiceLog->add($e);
             }
             throw $e;
         }
         if ($invoiceLog) {
             $invoiceLog->setProcessed();
         }
         //show thanks page without redirect
         if ($transaction->isFirst()) {
             $this->displayThanks($request, $response, $invokeArgs, $transaction->getInvoice());
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         $view = new Am_View($this->getDi());
         $view->assign('error', $e->getMessage());
         $view->assign('is_html', false);
         $view->placeholder("head-start")->prepend(sprintf('<base href="%s://%s" />', empty($_SERVER['HTTPS']) ? 'http' : 'https', Am_Controller::escape($_SERVER['HTTP_HOST'])));
         $this->invoice = $transaction->getInvoice();
         $view->placeholder("head-start")->prepend(sprintf('<meta http-equiv="refresh" content="0;url=%s">', $this->getCancelUrl()));
         $view->display('error.phtml');
     }
 }