示例#1
0
 /**
  * Fetch transaction details info
  *
  * Update transaction info if there is one placing transaction only
  *
  * @param \Magento\Payment\Model\InfoInterface $payment
  * @param string $transactionId
  * @return array
  */
 public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payment, $transactionId)
 {
     $transaction = $payment->getTransaction($transactionId);
     $response = $this->getTransactionResponse($transactionId);
     if ($response->getXResponseCode() == self::RESPONSE_CODE_APPROVED) {
         if ($response->getTransactionStatus() == 'voided') {
             $payment->setIsTransactionDenied(true);
         } else {
             $transaction->setAdditionalInformation(self::TRANSACTION_FRAUD_STATE_KEY, false);
             $payment->setIsTransactionApproved(true);
         }
     } elseif ($response->getXResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED) {
         $payment->setIsTransactionDenied(true);
     }
     $this->addStatusCommentOnUpdate($payment, $response, $transactionId);
     return parent::fetchTransactionInfo($payment, $transactionId);
 }