I want to assign specific payment method only for selected one customer group,
successfully get customer group & Payment method code,
How to add condition, following are my workout,
Following Tutorial : https://meetanshi.com/blog/disable-payment-method-programmatically-in-magento/
workout :
<?php
class Gta_FindPaymentGateway_Model_Observer
{
public function paymenter($Observer)
{
if(Mage::getSingleton('customer/session')->isLoggedIn())
{
// Get group Id
$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
//Get customer Group name
$group = Mage::getModel('customer/group')->load($groupId);
$allPaymentMethods = Mage::getModel('payment/config')->getAllMethods();
foreach($allPaymentMethods as $paymentMethod)
{
if(($paymentMethod->getCode() == 'payubiz') && $group->getCode() !== 'Tester'))
{
$result = $Observer->getResult();
$result->isAvailable = false;
}
}
}
}
}
?>
Above script no error, but condition not working.