vendor/launchpad/backend/src/Base/EventSubscriber/Transaction/TransactionEventSubscriber.php line 54

Open in your IDE?
  1. <?php
  2. namespace LaunchPad\Bundle\LaunchPadBundle\Base\EventSubscriber\Transaction;
  3. use Psr\Container\ContainerInterface;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Symfony\Component\EventDispatcher\GenericEvent;
  6. class TransactionEventSubscriber implements EventSubscriberInterface
  7. {
  8.     const EVENT_TRANSACTIONS_PARSED     'lp.event.transactions.parsed';
  9.     const EVENT_TRANSACTION_PROCESSED   'lp.event.transaction.processed';
  10.     private $container;
  11.     public function __construct(ContainerInterface $container)
  12.     {
  13.         $this->container $container;
  14.     }
  15.     public static function getSubscribedEvents()
  16.     {
  17.         return array(
  18.             self::EVENT_TRANSACTIONS_PARSED => 'transactionsParsed',
  19.             self::EVENT_TRANSACTION_PROCESSED => 'transactionsProcessed'
  20.         );
  21.     }
  22.     /**
  23.      * Transactions parsed
  24.      *
  25.      * @param GenericEvent $event
  26.      * @throws \Doctrine\ORM\NonUniqueResultException
  27.      * @throws \GuzzleHttp\Exception\GuzzleException
  28.      */
  29.     public function transactionsParsed(GenericEvent $event)
  30.     {
  31.         $subject $event->getSubject();
  32.         $transactions $subject['transactions'];
  33.         $isRealTime = @$subject['isRealTime'];
  34.         if($isRealTime) {
  35.             $this->container->get('lp.transaction')->sendNotifications($transactions);
  36.         }
  37.     }
  38.     /**
  39.      * Transactions processed
  40.      *
  41.      * @param GenericEvent $event
  42.      * @throws \Doctrine\ORM\NonUniqueResultException
  43.      * @throws \GuzzleHttp\Exception\GuzzleException
  44.      */
  45.     public function transactionsProcessed(GenericEvent $event)
  46.     {
  47.         $subject $event->getSubject();
  48.         $transaction $subject;
  49.         // Handle exchange for the transaction
  50.         $this->container->get('lp.transaction')->handleTransactionExchange($transaction);
  51.     }
  52.     /**
  53.      * Document requested
  54.      *
  55.      * @param GenericEvent $event
  56.      */
  57.     public function onImportDone(GenericEvent $event)
  58.     {
  59.     }
  60. }