Skip to content

Commit 8cd0ec7

Browse files
author
Viktor Tymchynskyi
committed
Merge remote-tracking branch 'origin/MAGETWO-50986' into MPI-BUGFIXES
2 parents b026110 + 9bf523d commit 8cd0ec7

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

app/code/Magento/Authorizenet/Model/Directpost.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
119119
*/
120120
protected $transactionRepository;
121121

122+
/**
123+
* @var \Psr\Log\LoggerInterface
124+
*/
125+
private $psrLogger;
126+
122127
/**
123128
* @param \Magento\Framework\Model\Context $context
124129
* @param \Magento\Framework\Registry $registry
@@ -761,7 +766,7 @@ protected function addStatusComment(\Magento\Sales\Model\Order\Payment $payment)
761766
{
762767
try {
763768
$transactionId = $this->getResponse()->getXTransId();
764-
$data = $payment->getMethodInstance()->getTransactionDetails($transactionId);
769+
$data = $this->transactionService->getTransactionDetails($this, $transactionId);
765770
$transactionStatus = (string)$data->transaction->transactionStatus;
766771
$fdsFilterAction = (string)$data->transaction->FDSFilterAction;
767772

@@ -779,6 +784,7 @@ protected function addStatusComment(\Magento\Sales\Model\Order\Payment $payment)
779784
$payment->getOrder()->addStatusHistoryComment($message);
780785
}
781786
} catch (\Exception $e) {
787+
$this->getPsrLogger()->critical($e);
782788
//this request is optional
783789
}
784790
return $this;
@@ -805,7 +811,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
805811
$order->registerCancellation($message)->save();
806812
} catch (\Exception $e) {
807813
//quiet decline
808-
$this->logger->critical($e);
814+
$this->getPsrLogger()->critical($e);
809815
}
810816
}
811817

@@ -973,4 +979,18 @@ protected function getTransactionResponse($transactionId)
973979

974980
return $response;
975981
}
982+
983+
/**
984+
* @return \Psr\Log\LoggerInterface
985+
*
986+
* @deprecated
987+
*/
988+
private function getPsrLogger()
989+
{
990+
if (null === $this->psrLogger) {
991+
$this->psrLogger = \Magento\Framework\App\ObjectManager::getInstance()
992+
->get(\Psr\Log\LoggerInterface::class);
993+
}
994+
return $this->psrLogger;
995+
}
976996
}

0 commit comments

Comments
 (0)