Example #1
0
 /**
  * Fetch transaction details info
  *
  * Update transaction info if there is one placing transaction only
  *
  * @param Mage_Payment_Model_Info $payment
  * @param string $transactionId
  * @return array
  */
 public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
 {
     $data = parent::fetchTransactionInfo($payment, $transactionId);
     $cardsStorage = $this->getCardsStorage($payment);
     if ($cardsStorage->getCardsCount() != 1) {
         return $data;
     }
     $cards = $cardsStorage->getCards();
     $card = array_shift($cards);
     /*
      * We need try to get transaction from Mage::registry,
      * because in cases when fetch calling from Mage_Adminhtml_Sales_TransactionsController::fetchAction()
      * this line "$transaction = $payment->getTransaction($transactionId)" loads a fetching transaction into a new object,
      * so some changes (for ex. $transaction->setAdditionalInformation($this->_isTransactionFraud, false) ) will not saved,
      * because controller have another object for this transaction and Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS isn't includes _isTransactionFraud flag.
      */
     $transaction = Mage::registry('current_transaction');
     if (is_null($transaction)) {
         //this is for payment info update:
         $transactionId = $card->getLastTransId();
         $transaction = $payment->getTransaction($transactionId);
     }
     //because in child transaction, the txn_id spoils by added additional word (@see $this->_preauthorizeCaptureCardTransaction()):
     if (empty($transactionId) || $transaction->getParentId()) {
         $transactionId = $transaction->getAdditionalInformation($this->_realTransactionIdKey);
     }
     $response = $this->_getTransactionDetails($transactionId);
     $data = array_merge($data, $response->getData());
     if ($response->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
         $transaction->setAdditionalInformation($this->_isTransactionFraud, false);
         $payment->setIsTransactionApproved(true);
     } elseif ($response->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED) {
         $payment->setIsTransactionDenied(true);
     }
     return $data;
 }
 /**
  * Fetch transaction details info
  *
  * Update transaction info if there is one placing transaction only
  *
  * @param Mage_Payment_Model_Info $payment
  * @param string $transactionId
  * @return array
  */
 public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
 {
     $cardsStorage = $this->getCardsStorage($payment);
     if ($cardsStorage->getCardsCount() != 1) {
         return parent::fetchTransactionInfo($payment, $transactionId);
     }
     $cards = $cardsStorage->getCards();
     $card = array_shift($cards);
     $transactionId = $card->getLastTransId();
     $transaction = $payment->getTransaction($transactionId);
     if (!$transaction->getAdditionalInformation($this->_isTransactionFraud)) {
         return parent::fetchTransactionInfo($payment, $transactionId);
     }
     $response = $this->_getTransactionDetails($transactionId);
     if ($response->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
         $transaction->setAdditionalInformation($this->_isTransactionFraud, false);
         $payment->setIsTransactionApproved(true);
     } elseif ($response->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED) {
         $payment->setIsTransactionDenied(true);
     }
     return parent::fetchTransactionInfo($payment, $transactionId);
 }
Example #3
0
 /**
  * Fetch transaction info -- fraud detection
  */
 public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
 {
     $this->_log('fetchTransactionInfo(' . $transactionId . ')');
     $this->_loadOrCreateCard($payment);
     /**
      * Process transaction and results
      */
     $this->_beforeFraudUpdate($payment, $transactionId);
     $response = $this->gateway()->fraudUpdate($payment, $transactionId);
     $this->_afterFraudUpdate($payment, $transactionId, $response);
     if ($response->getIsApproved()) {
         $transaction = $payment->getTransaction($transactionId);
         $transaction->setAdditionalInformation('is_transaction_fraud', false);
         $payment->setIsTransactionApproved(true);
     } elseif ($response->getIsDenied()) {
         $payment->setIsTransactionDenied(true);
     }
     $this->_log(json_encode($response->getData()));
     return parent::fetchTransactionInfo($payment, $transactionId);
 }