Ejemplo n.º 1
0
 /**
  * Process callback
  *
  * @param \XLite\Model\Payment\Transaction $transaction Callback-owner transaction
  *
  * @return void
  */
 public function processCallback(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processCallback($transaction);
     $request = \XLite\Core\Request::getInstance();
     if (!$request->isPost()) {
         // Callback request must be POST
         $this->markCallbackRequestAsInvalid(static::t('Request type must be POST'));
     } elseif (!isset($request->RESULT)) {
         if (Paypal\Model\Payment\Processor\PaypalIPN::getInstance()->isCallbackIPN()) {
             // If callback is IPN request from Paypal
             Paypal\Model\Payment\Processor\PaypalIPN::getInstance()->processCallbackIPN($transaction, $this);
             $transaction->registerTransactionInOrderHistory('callback, IPN');
             $transaction->getOrder()->setPaymentStatusByTransaction($transaction);
             \XLite\Core\Database::getEM()->flush();
         } else {
             // RESULT parameter must be presented in all callback requests
             $this->markCallbackRequestAsInvalid(static::t('\'RESULT\' argument not found'));
         }
     } else {
         $this->setDetail('status', isset($request->RESPMSG) ? $request->RESPMSG : 'Unknown', 'Status');
         $this->saveDataFromRequest();
         if ('0' === $request->RESULT) {
             // Transaction successful if RESULT == '0'
             $status = $transaction::STATUS_SUCCESS;
         } elseif ('126' === $request->RESULT) {
             // This RESULT returned if merchant enabled fraud filters in thier PayPal account
             $status = $transaction::STATUS_PENDING;
         } else {
             $status = $transaction::STATUS_FAILED;
         }
         // Amount checking
         if (isset($request->AMT) && !$this->checkTotal($request->AMT)) {
             $status = $transaction::STATUS_FAILED;
         }
         Paypal\Main::addLog('processCallback', array('request' => $request, 'status' => $status));
         $transaction->setStatus($status);
         $this->updateInitialBackendTransaction($transaction, $status);
         $transaction->registerTransactionInOrderHistory('callback');
     }
 }
Ejemplo n.º 2
0
 /**
  * Process callback
  *
  * @param \XLite\Model\Payment\Transaction $transaction Callback-owner transaction
  *
  * @return void
  */
 public function processCallback(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processCallback($transaction);
     if (Paypal\Model\Payment\Processor\PaypalIPN::getInstance()->isCallbackIPN()) {
         // If callback is IPN request from Paypal
         Paypal\Model\Payment\Processor\PaypalIPN::getInstance()->processCallbackIPN($transaction, $this);
         $transaction->registerTransactionInOrderHistory('callback, IPN');
     }
     $this->saveDataFromRequest();
 }
Ejemplo n.º 3
0
 /**
  * Process callback
  *
  * @param \XLite\Model\Payment\Transaction $transaction Callback-owner transaction
  *
  * @return void
  */
 public function processCallback(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processCallback($transaction);
     if (\XLite\Module\CDev\Paypal\Model\Payment\Processor\PaypalIPN::getInstance()->isCallbackIPN()) {
         // If callback is IPN request from Paypal
         \XLite\Module\CDev\Paypal\Model\Payment\Processor\PaypalIPN::getInstance()->processCallbackIPN($transaction, $this);
     }
     $this->saveDataFromRequest();
 }