Пример #1
0
 public function run()
 {
     /** @var $error Error */
     $error = Error::getInstance();
     /** @var $request Request */
     $request = Request::getInstance();
     $this->getUserInformation();
     if (!$this->isUserExist()) {
         $error->catchError(Error::USER_NOT_FOUND);
     }
     if (!$this->isAvailablePaymentType()) {
         $error->catchError(Error::INCORRECT_VALUE_PAYMENT_TYPE);
     }
     if (!$this->isCorrectAmount()) {
         $error->catchError(Error::INCORRECT_PAYMENT);
     }
     $this->getReceiptInformation();
     if ($this->isReceiptExist()) {
         if ($this->isCanceled()) {
             $error->catchError(Error::RECEIPT_CANCEL, ['authcode' => $this->_receipt['authcode']]);
         } else {
             $error->catchError(Error::INCORRECT_RECEIPT);
         }
     }
     $this->_provider->savePayment($request);
     $this->_provider->initCallback($request);
     $this->getReceiptInformation();
     Response::getInstance()->giveXML(['authcode' => $this->_receipt['authcode']]);
 }
Пример #2
0
 public function catchError($name, $params = array())
 {
     if (is_numeric($name)) {
         $error_code = $name;
     } else {
         $error_code = constant('self::' . $name);
     }
     $this->currentErrorCode = $error_code;
     if (self::NO_ERRORS != $error_code) {
         //завершаем приложение
         Response::getInstance()->giveXML($params);
     }
 }
Пример #3
0
 public function run()
 {
     /** @var $error Error */
     $error = Error::getInstance();
     $this->getUserInformation();
     if (!$this->isUserExist()) {
         $error->catchError(Error::USER_NOT_FOUND);
     }
     if (!$this->isAvailablePaymentType()) {
         $error->catchError(Error::INCORRECT_VALUE_PAYMENT_TYPE);
     }
     if (!$this->isCorrectAmount()) {
         $error->catchError(Error::INCORRECT_PAYMENT);
     }
     Response::getInstance()->giveXML();
 }
Пример #4
0
 public function run()
 {
     /** @var $error Error */
     $error = Error::getInstance();
     $this->getReceiptInformation();
     if (!$this->isReceiptExist()) {
         $error->catchError(Error::INCORRECT_RECEIPT);
     }
     if (!$this->isCancelAvailable()) {
         $error->catchError(Error::PAYMENT_CAN_NOT_BE_CANCELED);
     }
     if ($this->isCanceled()) {
         $error->catchError(Error::RECEIPT_CANCEL, ['authcode' => $this->_receipt['authcode']]);
     }
     $this->cancelPayment();
     $this->initCallback();
     Response::getInstance()->giveXML(['authcode' => $this->_receipt['authcode']]);
 }
Пример #5
0
 public function run()
 {
     /** @var $error Error */
     $error = Error::getInstance();
     $this->getReceiptInformation();
     if (!$this->isReceiptExist()) {
         $error->catchError(Error::INCORRECT_RECEIPT);
     }
     if (!$this->isStatusExist()) {
         $error->catchError(Error::UNKNOWN_RECEIPT_STATUS);
     }
     if ($this->isCanceled()) {
         $error->catchError(Error::RECEIPT_CANCEL, ['authcode' => $this->_receipt['authcode']]);
     }
     if (!$this->isReceiptPaid()) {
         $error->catchError(Error::NOT_FOUND_SUCCESS_RECEIPT);
     }
     Response::getInstance()->giveXML(['authcode' => $this->_receipt['authcode']]);
 }