*/ class Payment implements EventSubscriberInterface { /** * Check if a module is valid * * @param IsValidPaymentEvent $event */ public function isValid(IsValidPaymentEvent $event, $eventName, EventDispatcherInterface $dispatcher) { $module = $event->getModule(); // dispatch event to target specific module $dispatcher->dispatch( TheliaEvents::getModuleEvent( TheliaEvents::MODULE_PAYMENT_IS_VALID, $module->getCode() ), $event ); if ($event->isPropagationStopped()) { return; } // call legacy module method $event->setValidModule($module->isValidPayment()) ->setMinimumAmount($module->getMinimumAmount()) ->setMaximumAmount($module->getMaximumAmount()); } /** * @inheritdoc */ public static function getSubscribedEvents() { return [ TheliaEvents::MODULE_PAYMENT_IS_VALID => ['isValid', 128], ]; } }