Exemple #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']]);
 }
Exemple #2
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();
 }
Exemple #3
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']]);
 }
Exemple #4
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']]);
 }
Exemple #5
0
 public function getAction($action)
 {
     switch ($action) {
         case 'check':
             return new CheckAction();
             break;
         case 'payment':
             return new PaymentAction();
             break;
         case 'cancel':
             return new CancelAction();
             break;
         case 'status':
             return new StatusAction();
             break;
         default:
             Error::getInstance()->catchError(Error::UNKNOWN_ACTION);
             break;
     }
 }
Exemple #6
0
 private function getPropertiesForLog()
 {
     return ['response_time_date' => date('Y-m-d H:i:s'), 'response_time_float' => microtime(true), 'response_signature' => $this->_xmlSign, 'xml' => $this->_signedXml, 'error_code' => Error::getInstance()->currentErrorCode];
 }
Exemple #7
0
 public function checkSign()
 {
     /**
      * @var $signature Signature
      * @var $error Error
      */
     $signature = Signature::getInstance();
     if (!$signature->verifySign($this->_url, urldecode($this->_sign))) {
         $error = Error::getInstance();
         $error->catchError(Error::ERROR_SIGNATURE_VERIFICATION);
     }
 }