Example #1
0
 /**
  * Set X-Payments API error to:
  *  - Logs
  *  - Transaction data
  *  - Controller
  *
  * @param \XLite\Model\Payment\Transaction $transaction Transaction
  * @param string $message Error message
  *
  * @return void
  */
 protected function setXpcInitError(\XLite\Model\Payment\Transaction $transaction, $message = '')
 {
     self::writeLogError('X-Paymets payment initialization failed: ' . $message);
     $transaction->setDataCell('status', $message, 'X-Payments error', 'C');
     $transaction->setNote($message);
     $iframe = \XLite::getController()->getIframe();
     $iframe->setError($message);
     if (\XLite::getController()->isCheckoutReady()) {
         $type = $this->isChangeMethodMessage($message) ? \XLite\Module\CDev\XPaymentsConnector\Core\Iframe::IFRAME_CHANGE_METHOD : \XLite\Module\CDev\XPaymentsConnector\Core\Iframe::IFRAME_ALERT;
         $iframe->setType($type);
     } else {
         $iframe->setType(\XLite\Module\CDev\XPaymentsConnector\Core\Iframe::IFRAME_DO_NOTHING);
     }
     $this->clearInitDataFromSession();
     $iframe->finalize();
 }
 /**
  * {@inheritDoc}
  */
 public function setNote($note)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setNote', array($note));
     return parent::setNote($note);
 }
Example #3
0
 /**
  * Set note
  *
  * @param string $note
  *
  * @return Transaction
  */
 public function setNote($note)
 {
     if (strlen($note) > self::NOTE_LIMIT) {
         // truncate note for STRICT_TRANS_TABLES
         $note = function_exists('mb_substr') ? mb_substr($value, 0, self::NOTE_LIMIT - 3) : substr($value, 0, self::NOTE_LIMIT - 3);
         $note .= '...';
     }
     return parent::setNote($note);
 }