1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file has been created by developers from BitBag. |
5
|
|
|
* Feel free to contact us once you face any issues or want to start |
6
|
|
|
* You can find more information about us on https://bitbag.io and write us |
7
|
|
|
* an email on [email protected]. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
declare(strict_types=1); |
11
|
|
|
|
12
|
|
|
namespace BitBag\SyliusMolliePlugin\EventListener; |
13
|
|
|
|
14
|
|
|
use BitBag\SyliusMolliePlugin\Factory\MollieGatewayFactory; |
15
|
|
|
use BitBag\SyliusMolliePlugin\Repository\PaymentMethodRepositoryInterface; |
16
|
|
|
use Doctrine\Common\Persistence\ObjectRepository; |
|
|
|
|
17
|
|
|
use Sylius\Component\Core\Model\PaymentMethodInterface; |
18
|
|
|
use Sylius\RefundPlugin\Entity\RefundPaymentInterface; |
19
|
|
|
use Sylius\RefundPlugin\Event\RefundPaymentGenerated; |
20
|
|
|
use Sylius\RefundPlugin\StateResolver\RefundPaymentCompletedStateApplierInterface; |
21
|
|
|
|
22
|
|
|
final class RefundPaymentGeneratedAutoCompleteListener |
23
|
|
|
{ |
24
|
|
|
/** @var ObjectRepository */ |
25
|
|
|
private $refundPaymentRepository; |
26
|
|
|
|
27
|
|
|
/** @var RefundPaymentCompletedStateApplierInterface */ |
28
|
|
|
private $refundPaymentCompletedStateApplier; |
29
|
|
|
|
30
|
|
|
/** @var PaymentMethodRepositoryInterface */ |
31
|
|
|
private $paymentMethodRepository; |
32
|
|
|
|
33
|
|
|
public function __construct( |
34
|
|
|
ObjectRepository $refundPaymentInterface, |
35
|
|
|
RefundPaymentCompletedStateApplierInterface $refundPaymentCompletedStateApplier, |
36
|
|
|
PaymentMethodRepositoryInterface $paymentMethodRepository |
37
|
|
|
) { |
38
|
|
|
$this->refundPaymentRepository = $refundPaymentInterface; |
39
|
|
|
$this->refundPaymentCompletedStateApplier = $refundPaymentCompletedStateApplier; |
40
|
|
|
$this->paymentMethodRepository = $paymentMethodRepository; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function __invoke(RefundPaymentGenerated $refundPaymentGenerated): void |
44
|
|
|
{ |
45
|
|
|
/** @var PaymentMethodInterface $paymentMethod */ |
46
|
|
|
$paymentMethod = $this->paymentMethodRepository->find($refundPaymentGenerated->paymentMethodId()); |
47
|
|
|
|
48
|
|
|
if (MollieGatewayFactory::FACTORY_NAME !== $paymentMethod->getGatewayConfig()->getFactoryName()) { |
|
|
|
|
49
|
|
|
return; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** @var RefundPaymentInterface $refundPayment */ |
53
|
|
|
$refundPayment = $this->refundPaymentRepository->find($refundPaymentGenerated->id()); |
54
|
|
|
|
55
|
|
|
$this->refundPaymentCompletedStateApplier->apply($refundPayment); |
56
|
|
|
} |
57
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths