<?php
namespace App\Services\Transaction\Workflow\EventSubscriber\Sepa\Plais;
use App\Services\SepaMessaging\Plais\CctinitService;
use App\Entity\Transaction;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Workflow\Event\Event;
class PlaisSepaCctinitSubscriber implements EventSubscriberInterface
{
/**
* @var CctinitService
*/
private $cctinitService;
public function __construct(
CctinitService $cctinitService
) {
$this->cctinitService = $cctinitService;
}
public static function getSubscribedEvents()
{
return [
'workflow.sepa_transaction_creating.completed.accept' => 'generateCardsta',
'workflow.sepa_transaction_creating.completed.reject' => 'generateCardsta',
];
}
public function generateCardsta(Event $event)
{
/** @var Transaction $transaction */
$transaction = $event->getSubject()->getEntity();
$this->cctinitService->generateCardsta($transaction);
}
}