3

Please try this way using payment_method_is_active event observer. Create events.xml file with the below content. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="payment_method_is_active"> <observer name="...


3

You can get it with payment_method_is_active event observer. Create events.xml file with below content. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="payment_method_is_active"> <observer name="payroll_payment_method_is_active" ...


3

You are on a good path. To understand what is and isn't available it is helpful to check how the event is dispatched and used. You have already found the event itself payment_method_is_active - searching for it in the codebase will reveal how it is called: $this->eventManager->dispatch( 'payment_method_is_active', [ ...


2

In addition to @Kristof at Fooman First, you get customer id of the current quote using $observer->getEvent()->getQuote()->getCustomerId(). After that get Order COllection of that customer id. Observer code <?php namespace Ops\KgPayMethod\Observer; use Magento\Framework\Event\ObserverInterface; use Magento\Framework\Event\Observer; use ...


1

The payment data for the order is added under sales_order_payment table in the database. Yo need to use that table in your code to get the payments data in the collection. I've updated your code for the same. protected function _initSelect() { parent::_initSelect(); $this->getSelect()->joinLeft( ['secondTable' => $this->getTable(...


1

You can use Magento\Customer\Model\Session $customerSession to get current customer group id for logged in customers. You can use the below code in your DisablePayment.php file for the same. namespace Vendor\Module\Observer; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; use Psr\Log\LoggerInterface; class ...


Only top voted, non community-wiki answers of a minimum length are eligible