public function executeVerifyPayment(sfWebRequest $request) { $this->setLayout(false); sfProjectConfiguration::getActive()->loadHelpers(array('I18N', 'Variable')); $this->forward404Unless($this->getUser()->isMyOrder(Doctrine::getTable('ProductOrder')->find($this->getRequestParameter('orderID')))); # getting current banklink object $bankLink = CBanklink::getBank(Doctrine::getTable('ProductOrder')->find($request->getParameter('orderID'))->getType()); # handling BANK callback and creating payment $payment = $bankLink->HandleCallback(); # getting ORDER object $order = Doctrine::getTable('ProductOrder')->find($payment->ixOrder); /* if order is still NEW: change status, generate ticket, send e-mail to user, send request to webservice */ if ($order->getStatus() == ProductOrderTable::STATUS_NEW) { //$order->raw_response = $this->logRequestVariables(); if ($payment && $payment->isSuccessful) { $order->status = ProductOrderTable::STATUS_PAID; $order->save(); # send invoice to mail //generate invoice // $arguments = array('orderID' => $order['id'] ); // $options = array('host' => $request->getHost(), 'culture' => $this->getUser()->getCulture()); // $invoiceGenTask = new sfInvoiceGenerationTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter()); // chdir(sfConfig::get('sf_root_dir')); // hack to start task from Action // $invoiceGenTask->run($arguments, $options); } else { $order->status = ProductOrderTable::STATUS_CANCELED; $order->save(); } } $this->redirect($this->getComponent('linker', 'myOrdersLinkBuilder')); }
static function getBankLinkByType($type) { return CBanklink::getBank($type); }