Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PaymentPlugin.php
Go to the documentation of this file.
1 <?php
7 
11 
18 {
22  private $guaranteeCancelingService;
23 
27  public function __construct(
28  GuaranteeCancelingServiceInterface $guaranteeCancelingService
29  ) {
30  $this->guaranteeCancelingService = $guaranteeCancelingService;
31  }
32 
45  {
46  if ($this->isPaymentDenied($payment, $result)) {
47  $this->guaranteeCancelingService->cancelForOrder($payment->getParentId());
48  }
49 
50  return $result;
51  }
52 
63  private function isPaymentDenied($payment, $result)
64  {
65  return $result !== false || $payment->getIsTransactionClosed();
66  }
67 }
$payment
Definition: order.php:17
__construct(GuaranteeCancelingServiceInterface $guaranteeCancelingService)
afterDenyPayment(MethodInterface $subject, $result, InfoInterface $payment)