public function getMethodInstance($code)
    {
        $key = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/model';
        $class = Mage::getStoreConfig($key);

        if (!$class && strpos($code, 'adyen_hpp') !== false) {
            $methodCode = substr($code, strlen('adyen_hpp_'));
            Mage::getSingleton('adyen/observer')->createPaymentMethodFromHpp(
                $methodCode, array(),
                Mage::app()->getStore(), '0'
            );
            $class = Mage::getStoreConfig($key);
        } elseif (!$class && strpos($code, 'adyen_oneclick') !== false) {
            $methodCode = substr($code, strlen('adyen_oneclick_'));
            $store = Mage::getSingleton('adminhtml/session_quote')->getStore();
            Mage::getSingleton('adyen/billing_agreement_observer')->createPaymentMethodFromOneClick(
                $methodCode,
                array(), $store
            );
            $class = Mage::getStoreConfig($key, $store->getId());
        }

        $methodInstance = Mage::getModel($class);
        if (method_exists($methodInstance, 'setCode')) {
            $methodInstance->setCode($code);
        }

        return $methodInstance;
    }