public function processReturn(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processReturn($transaction);
     $result = \XLite\Core\Request::getInstance()->status;
     $status = 'Paid' == $result ? $transaction::STATUS_PENDING : $transaction::STATUS_FAILED;
     $this->transaction->setStatus($status);
 }
Exemple #2
0
 /**
  * Get allowed currencies
  * https://developer.paypal.com/docs/classic/api/currency_codes/
  *
  * @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('AUD', 'BRL', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MYR', 'MXN', 'NOK', 'NZD', 'PHP', 'PLN', 'GBP', 'RUB', 'SGD', 'SEK', 'CHF', 'TWD', 'THB', 'TRY', 'USD'));
 }
 public function isConfigured(\XLite\Model\Payment\Method $method)
 {
     return parent::isConfigured($method) && $method->getSetting('integrationkey');
 }
Exemple #4
0
 public function isConfigured(\XLite\Model\Payment\Method $method)
 {
     return parent::isConfigured($method) && $method->getSetting('apiKey') && $method->getSetting('apiSecret') && $method->getSetting('ipnSecret');
 }
Exemple #5
0
 /**
  * Multivendor must be enabled
  *
  * @param \XLite\Model\Order          $order  Order
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return boolean
  */
 public function isApplicable(\XLite\Model\Order $order, \XLite\Model\Payment\Method $method)
 {
     return $this->canEnable($method) && parent::isApplicable($order, $method);
 }
 /**
  * Process input errors
  *
  * @param array $data Input data
  *
  * @return array
  */
 public function getInputErrors(array $data)
 {
     $errors = parent::getInputErrors($data);
     foreach ($this->getInputDataLabels() as $k => $t) {
         if (!isset($data[$k]) || !$data[$k]) {
             $errors[] = \XLite\Core\Translation::lbl('X field is required', array('field' => $t));
         }
     }
     return $errors;
 }
Exemple #7
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->client = new \XLite\Module\CDev\XPaymentsConnector\Core\XPaymentsClient();
 }
 /**
  * Generate transaction ID
  *
  * @param \XLite\Model\Payment\Transaction $transaction Transaction
  * @param string                           $prefix      Prefix OPTIONAL
  *
  * @return string
  */
 public function generateTransactionId(\XLite\Model\Payment\Transaction $transaction, $prefix = null)
 {
     return substr(preg_replace('/\\W/Ss', '', parent::generateTransactionId($transaction, $prefix)), 0, 20);
 }
Exemple #9
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($method->getSetting('currency')));
 }
Exemple #10
0
 /**
  * Log redirect form
  *
  * @param array $list Form fields list
  *
  * @return void
  */
 protected function logRedirect(array $list)
 {
     $list = $this->maskCell($list, 'gwlogin');
     parent::logRedirect($list);
 }
Exemple #11
0
 /**
  * Process return
  *
  * @param \XLite\Model\Payment\Transaction $transaction Return-owner transaction
  *
  * @return void
  */
 public function processReturn(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processReturn($transaction);
     $request = \XLite\Core\Request::getInstance();
     static::log(array('request' => $request->getData()));
     $status = '';
     $notes = array();
     if ($request->type == 'accept') {
         $status = $transaction::STATUS_SUCCESS;
         $this->setDetail('result', 'Accept', 'Result');
         $notes[] = 'Accept';
     } elseif ($request->type == 'cancel') {
         $status = $transaction::STATUS_CANCELED;
         $this->setDetail('result', 'Cancel', 'Result');
         $notes[] = 'Cancel';
     } elseif ($request->type == 'decline') {
         $status = $transaction::STATUS_FAILED;
         $this->setDetail('result', 'Decline', 'Result');
         $notes[] = 'Decline';
     } elseif ($request->type == 'exception') {
         $status = $transaction::STATUS_FAILED;
         $this->setDetail('result', 'Exception', 'Result');
         $notes[] = 'Exception';
     } else {
         $status = $transaction::STATUS_FAILED;
         $this->setDetail('result', 'Result is incorrect', 'Result');
         $notes[] = 'Result is incorrect';
     }
     if (!$request->orderID) {
         $status = $transaction::STATUS_FAILED;
         $this->setDetail('order_checking', 'Order ID is empty', 'Checking');
         $notes[] = 'Order ID is empty';
     }
     $fields = $request->getGetData();
     unset($fields['SHASIGN'], $fields['target'], $fields['type'], $fields[self::RETURN_TXN_ID]);
     $hash = $this->generateSign($fields, $this->getSetting('shaOut'));
     if ($hash != $request->SHASIGN) {
         $status = $transaction::STATUS_FAILED;
         $this->setDetail('sha_verification', 'SHA verification failed', 'Verification');
         $notes[] = 'SHA verification failed';
     }
     if (!$this->checkTotal($request->amount)) {
         $status = $transaction::STATUS_FAILED;
         $this->setDetail('total_checking', 'Total checking failed', 'Checking');
         $notes[] = 'Total checking failed';
     }
     if (!$this->checkCurrency($request->CURRENCY)) {
         $status = $transaction::STATUS_FAILED;
         $this->setDetail('currency_checking', 'Currency checking failed', 'Checking');
         $notes[] = 'Currency checking failed';
     }
     $this->transaction->setStatus($status);
     $this->transaction->setNote(implode('. ', $notes));
 }
Exemple #12
0
 /**
  * Check - payment method is configured or not
  *
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return boolean
  */
 public function isConfigured(\XLite\Model\Payment\Method $method)
 {
     return parent::isConfigured($method) && $method->getSetting('vendorName') && $method->getSetting('password') && $this->isMcryptDecrypt();
 }
Exemple #13
0
 /**
  * Define saved into transaction data schema
  *
  * @return array
  */
 protected function defineSavedData()
 {
     $data = parent::defineSavedData();
     $data['orderID'] = 'Order reference';
     $data['amount'] = 'Order amount';
     $data['currency'] = 'Currency of the order';
     $data['TRXDATE'] = 'Transaction date';
     $data['PM'] = 'Payment method';
     $data['BRAND'] = 'Payment method info';
     $data['ACCEPTANCE'] = 'Acceptance code returned by acquirer';
     $data['STATUS'] = 'Transaction status code';
     $data['PAYID'] = 'Payment reference in ePDQ system';
     $data['NCERROR'] = 'Error code';
     return $data;
 }
Exemple #14
0
 /**
  * Check - payment method is configured or not
  *
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return boolean
  */
 public function isConfigured(\XLite\Model\Payment\Method $method)
 {
     return parent::isConfigured($method) && $method->getSetting('store_id') && $method->getSetting('hpp_key');
 }
 /**
  * Check - payment method is configured or not
  *
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return boolean
  */
 public function isConfigured(\XLite\Model\Payment\Method $method)
 {
     return parent::isConfigured($method) && $method->getSetting('testPublicKey') && $method->getSetting('testSecretKey');
 }