Skip to content

Commit

Permalink
make listeners more extenable
Browse files Browse the repository at this point in the history
  • Loading branch information
David Höck committed May 26, 2020
1 parent b050753 commit 53ba931
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 24 deletions.
14 changes: 6 additions & 8 deletions src/EventListener/CreditMemoListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,29 @@

class CreditMemoListener implements EventSubscriberInterface
{

/**
* @var RefundOrderLinesFactoryInterface
*/
private $refundOrderLinesFactory;
protected $refundOrderLinesFactory;
/**
* @var PaymentRepositoryInterface
*/
private $paymentRepository;
protected $paymentRepository;
/**
* @var RegistryInterface
*/
private $payum;
protected $payum;
/**
* @var GetStatusFactoryInterface
*/
private $getStatusRequestFactory;
protected $getStatusRequestFactory;

public function __construct(
RefundOrderLinesFactoryInterface $refundOrderLinesFactory,
PaymentRepositoryInterface $paymentRepository,
RegistryInterface $payum,
GetStatusFactoryInterface $getStatusRequestFactory
)
{
) {
$this->refundOrderLinesFactory = $refundOrderLinesFactory;
$this->paymentRepository = $paymentRepository;
$this->payum = $payum;
Expand Down Expand Up @@ -116,7 +114,7 @@ public function onEnterComplete(Event $event)
*
* @return PaymentInterface|null
*/
private function getFirstValidPayment(OrderInterface $order)
protected function getFirstValidPayment(OrderInterface $order)
{
foreach ($this->paymentRepository->findForPayable($order) as $payment) {
if (in_array($payment->getState(), [PaymentInterface::STATE_AUTHORIZED, PaymentInterface::STATE_COMPLETED], true)) {
Expand Down
13 changes: 6 additions & 7 deletions src/EventListener/OrderShipmentEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,26 @@ class OrderShipmentEventListener
/**
* @var PaymentRepositoryInterface
*/
private $paymentRepository;
protected $paymentRepository;
/**
* @var CreateShipmentFactoryInterface
*/
private $createShipmentFactory;
protected $createShipmentFactory;
/**
* @var RegistryInterface
*/
private $payum;
protected $payum;
/**
* @var GetStatusFactoryInterface
*/
private $getStatusFactory;
protected $getStatusFactory;

public function __construct(
PaymentRepositoryInterface $paymentRepository,
CreateShipmentFactoryInterface $createShipmentFactory,
RegistryInterface $payum,
GetStatusFactoryInterface $getStatusFactory
)
{
) {
$this->paymentRepository = $paymentRepository;
$this->createShipmentFactory = $createShipmentFactory;
$this->payum = $payum;
Expand Down Expand Up @@ -127,7 +126,7 @@ public function onEnterShipped(Event $event)
*
* @return PaymentInterface|null
*/
private function findFirstValidPayment(OrderInterface $order)
protected function findFirstValidPayment(OrderInterface $order)
{
foreach ($this->paymentRepository->findForPayable($order) as $payment) {
if (in_array($payment->getState(), [OrderPaymentInterface::STATE_AUTHORIZED, OrderPaymentInterface::STATE_COMPLETED], true)) {
Expand Down
9 changes: 4 additions & 5 deletions src/EventListener/PaymentWorkflowListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,22 @@ class PaymentWorkflowListener implements EventSubscriberInterface
/**
* @var RefundArbitraryAmountFactoryInterface
*/
private $refundArbitraryAmountFactory;
protected $refundArbitraryAmountFactory;
/**
* @var GetStatusFactoryInterface
*/
private $getStatusRequestFactory;
protected $getStatusRequestFactory;
/**
* @var RegistryInterface
*/
private $payum;
protected $payum;


public function __construct(
RegistryInterface $payum,
RefundArbitraryAmountFactoryInterface $refundArbitraryAmountFactory,
GetStatusFactoryInterface $getStatusRequestFactory
)
{
) {
$this->refundArbitraryAmountFactory = $refundArbitraryAmountFactory;
$this->getStatusRequestFactory = $getStatusRequestFactory;
$this->payum = $payum;
Expand Down
1 change: 0 additions & 1 deletion src/Factory/RefundOrderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace CoreShop\Payum\MollieBundle\Factory;


use CoreShop\Payum\MollieBundle\Request\Api\RefundOrder;

class RefundOrderFactory implements RefundOrderFactoryInterface
Expand Down
2 changes: 0 additions & 2 deletions src/Factory/RefundOrderFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

namespace CoreShop\Payum\MollieBundle\Factory;



use CoreShop\Payum\MollieBundle\Request\Api\RefundOrder;

interface RefundOrderFactoryInterface
Expand Down
1 change: 0 additions & 1 deletion src/Factory/RefundOrderLinesFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace CoreShop\Payum\MollieBundle\Factory;


use CoreShop\Payum\MollieBundle\Request\Api\RefundOrderLines;

interface RefundOrderLinesFactoryInterface
Expand Down

0 comments on commit 53ba931

Please sign in to comment.