/** * Fetch transaction details info * * Update transaction info if there is one placing transaction only * * @param \Magento\Payment\Model\Info $payment * @param string $transactionId * @return array */ public function fetchTransactionInfo(\Magento\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); }