src/Service/App/Merchant/Integrations/Notando/Listener/PaidInvoiceListener.php line 59

Open in your IDE?
  1. <?php
  2. namespace App\Service\App\Merchant\Integrations\Notando\Listener;
  3. use App\Background\Data\NotandoCreateInvoiceData;
  4. use App\Core\BackgroundWork\Contract\IClient;
  5. use App\Core\MerchantSelector\Contract\IMerchantSelector;
  6. use App\Service\App\Merchant\CustomFeature\Implementation\NotandoCustomFeature;
  7. use App\Service\App\Merchant\Invoice\Event\PaidInvoiceEvent;
  8. class PaidInvoiceListener
  9. {
  10.     /**
  11.      * Background job client
  12.      *
  13.      * @var IClient
  14.      */
  15.     private IClient $backgroundClient;
  16.     /**
  17.      * Merchant selector
  18.      *
  19.      * @var IMerchantSelector
  20.      */
  21.     private IMerchantSelector $merchantSelector;
  22.     /**
  23.      * Notando custom feature instance
  24.      *
  25.      * @var NotandoCustomFeature
  26.      */
  27.     private NotandoCustomFeature $notandoCustomFeature;
  28.     /**
  29.      * Constructor
  30.      *
  31.      * @param NotandoCustomFeature $notandoCustomFeature
  32.      * @param IClient $backgroundClient
  33.      * @param IMerchantSelector $merchantSelector
  34.      */
  35.     public function __construct(
  36.         NotandoCustomFeature $notandoCustomFeature,
  37.         IClient $backgroundClient,
  38.         IMerchantSelector $merchantSelector
  39.     )
  40.     {
  41.         $this->notandoCustomFeature $notandoCustomFeature;
  42.         $this->backgroundClient $backgroundClient;
  43.         $this->merchantSelector $merchantSelector;
  44.     }
  45.     /**
  46.      * Listen on paid invoice event
  47.      *
  48.      * @param PaidInvoiceEvent $event
  49.      * @return void
  50.      */
  51.     public function onAction(PaidInvoiceEvent $event): void
  52.     {
  53.         // we will sync the invoice to Notando when it is finalized
  54.         /*if (!$this->notandoCustomFeature->isEnabled()) {
  55.             return;
  56.         }
  57.         $this->backgroundClient->runJob(
  58.             new NotandoCreateInvoiceData($event->getInvoiceId(), $this->merchantSelector->getMerchant())
  59.         );*/
  60.     }
  61. }