Skip to content

Commit 61e2a50

Browse files
mcahrimanVeronikaYarats
authored andcommitted
MAGETWO-91735: Customer's store credit is not given back after Authorize.net failed payment
- Change order cancellation procedure during failed checkout to comply with plugin event observers - Static tests fixes
1 parent cf69967 commit 61e2a50

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ public function void(\Magento\Payment\Model\InfoInterface $payment)
372372

373373
/**
374374
* Refund the amount
375+
*
375376
* Need to decode last 4 digits for request.
376377
*
377378
* @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment
@@ -682,6 +683,7 @@ protected function matchAmount($amount)
682683

683684
/**
684685
* Operate with order using information from Authorize.net.
686+
*
685687
* Authorize order or authorize and capture it.
686688
*
687689
* @param \Magento\Sales\Model\Order $order
@@ -699,6 +701,7 @@ protected function processOrder(\Magento\Sales\Model\Order $order)
699701
//decline the order (in case of wrong response code) but don't return money to customer.
700702
$message = $e->getMessage();
701703
$this->declineOrder($order, $message, false);
704+
702705
throw $e;
703706
}
704707

@@ -769,7 +772,7 @@ protected function processPaymentFraudStatus(\Magento\Sales\Model\Order\Payment
769772
}
770773

771774
/**
772-
* Add status comment
775+
* Add status comment to history
773776
*
774777
* @param \Magento\Sales\Model\Order\Payment $payment
775778
* @return $this
@@ -824,6 +827,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
824827
->void($response);
825828
}
826829
$order->registerCancellation($message)->save();
830+
$this->_eventManager->dispatch('order_cancel_after', ['order' => $order ]);
827831
} catch (\Exception $e) {
828832
//quiet decline
829833
$this->getPsrLogger()->critical($e);
@@ -858,7 +862,7 @@ public function getConfigInterface()
858862
* Getter for specified value according to set payment method code
859863
*
860864
* @param mixed $key
861-
* @param null $storeId
865+
* @param mixed $storeId
862866
* @return mixed
863867
*/
864868
public function getValue($key, $storeId = null)
@@ -922,6 +926,8 @@ public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payme
922926
}
923927

924928
/**
929+
* Add status comment on update
930+
*
925931
* @param \Magento\Sales\Model\Order\Payment $payment
926932
* @param \Magento\Framework\DataObject $response
927933
* @param string $transactionId
@@ -996,6 +1002,8 @@ protected function getTransactionResponse($transactionId)
9961002
}
9971003

9981004
/**
1005+
* Retrieve PSR Logger if not properly loaded via DI
1006+
*
9991007
* @return \Psr\Log\LoggerInterface
10001008
*
10011009
* @deprecated 100.1.0
@@ -1038,7 +1046,9 @@ private function getOrderIncrementId(): string
10381046
}
10391047

10401048
/**
1041-
* Checks if filter action is Report Only. Transactions that trigger this filter are processed as normal,
1049+
* Checks if filter action is Report Only.
1050+
*
1051+
* Transactions that trigger this filter are processed as normal,
10421052
* but are also reported in the Merchant Interface as triggering this filter.
10431053
*
10441054
* @param string $fdsFilterAction

0 commit comments

Comments
 (0)