예제 #1
0
 /**
  * Result URL
  */
 public function executeResult(sfWebRequest $request)
 {
     $invoiceId = (int) $request->getParameter('LMI_PAYMENT_NO');
     $invoice = Doctrine::getTable('Invoice')->findOneById($invoiceId);
     if (!$invoice) {
         return $this->renderText('INVOICE NOT FOUND');
         return sfView::NONE;
     }
     $wallets = $this->getWallets($invoice);
     // Предварительный запрос
     if ($request->getParameter('LMI_PREREQUEST')) {
         $form = new WebmoneyPreResultForm($invoice, $wallets);
         $form->bind($params = $request->getPostParameters());
         if ($form->isValid()) {
             return $this->renderText('YES');
         } else {
             return $this->renderText('INVALID');
         }
         return sfView::NONE;
     }
     // Оповещение о платеже
     $form = new WebmoneyResultForm($invoice, $wallets);
     $form->bind($params = $request->getPostParameters());
     if ($form->isValid()) {
         $this->complete($invoice, $params);
         return $this->renderText('YES');
     }
     return sfView::NONE;
 }
 /**
  * Config
  */
 public function configure()
 {
     parent::configure();
     $this->widgetSchema['LMI_MODE'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['LMI_SYS_INVS_NO'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['LMI_SYS_TRANS_NO'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['LMI_SYS_TRANS_DATE'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['LMI_PAYER_PURSE'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['LMI_PAYER_WM'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['LMI_HASH'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['LMI_PAYMENT_DESC'] = new sfWidgetFormInputHidden();
     $this->validatorSchema['LMI_HASH'] = new sfValidatorPass();
     $this->validatorSchema['LMI_MODE'] = new sfValidatorPass();
     $this->validatorSchema['LMI_SYS_INVS_NO'] = new sfValidatorPass();
     $this->validatorSchema['LMI_SYS_TRANS_NO'] = new sfValidatorPass();
     $this->validatorSchema['LMI_SYS_TRANS_DATE'] = new sfValidatorPass();
     $this->validatorSchema['LMI_PAYER_PURSE'] = new sfValidatorPass();
     $this->validatorSchema['LMI_PAYER_WM'] = new sfValidatorPass();
     $this->validatorSchema['LMI_PAYMENT_DESC'] = new sfValidatorPass();
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'validateHash'))));
 }