Exemple #1
0
 /**
  * Get allowed currencies
  *
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return array
  */
 protected function getAllowedCurrencies(\XLite\Model\Payment\Method $method)
 {
     return array_merge(parent::getAllowedCurrencies($method), array('EUR', 'TWD', 'USD', 'THB', 'GBP', 'CZK', 'HKD', 'HUF', 'SGD', 'SKK', 'JPY', 'EEK', 'CAD', 'BGN', 'AUD', 'PLN', 'CHF', 'ISK', 'DKK', 'INR', 'SEK', 'LVL', 'NOK', 'KRW', 'ILS', 'ZAR', 'MYR', 'RON', 'NZD', 'HRK', 'TRY', 'LTL', 'AED', 'JOD', 'MAD', 'OMR', 'QAR', 'RSD', 'SAR', 'TND'));
 }
Exemple #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);
     $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');
     }
 }
Exemple #3
0
 /**
  * Define saved into transaction data schema
  *
  * @return array
  */
 protected function defineSavedData()
 {
     $data = parent::defineSavedData();
     $data['TRANSTIME'] = 'Transaction timestamp';
     $data['PNREF'] = 'Unique Payflow transaction ID (PNREF)';
     $data['PPREF'] = 'Unique PayPal transaction ID (PPREF)';
     // PPA and PL
     $data['TYPE'] = 'Transaction type';
     // PL
     $data['TRXTYPE'] = 'Transaction type';
     // PPA and EC
     $data['RESULT'] = 'Transaction result code (RESULT)';
     $data['RESPMSG'] = 'Transaction result message (RESPMSG)';
     $data['CORRELATIONID'] = 'Tracking ID';
     // PPA and EC
     $data['FEEAMT'] = 'Transaction fee';
     // EC
     $data['PENDINGREASON'] = 'Pending reason';
     // EC
     return $data;
 }