@@ -26,6 +26,18 @@ class Mage_Payment_Helper_Data extends Mage_Core_Helper_Abstract
2626
2727 protected $ _moduleName = 'Mage_Payment ' ;
2828
29+ /**
30+ * Retrieve the class name of the payment method's model
31+ *
32+ * @param $code
33+ * @return string|null
34+ */
35+ public function getMethodModelClassName ($ code )
36+ {
37+ $ key = self ::XML_PATH_PAYMENT_METHODS . '/ ' . $ code . '/model ' ;
38+ return Mage::getStoreConfig ($ key );
39+ }
40+
2941 /**
3042 * Retrieve method model object
3143 *
@@ -34,8 +46,7 @@ class Mage_Payment_Helper_Data extends Mage_Core_Helper_Abstract
3446 */
3547 public function getMethodInstance ($ code )
3648 {
37- $ key = self ::XML_PATH_PAYMENT_METHODS . '/ ' . $ code . '/model ' ;
38- $ class = Mage::getStoreConfig ($ key );
49+ $ class = $ this ->getMethodModelClassName ($ code );
3950 if (is_null ($ class )) {
4051 Mage::logException (new Exception (sprintf ('Unknown payment method with code "%s" ' , $ code )));
4152 return false ;
@@ -156,7 +167,13 @@ public function getRecurringProfileMethods($store = null)
156167 {
157168 $ result = [];
158169 foreach ($ this ->getPaymentMethods ($ store ) as $ code => $ data ) {
159- $ method = $ this ->getMethodInstance ($ code );
170+ $ paymentMethodModelClassName = $ this ->getMethodModelClassName ($ code );
171+ if (!$ paymentMethodModelClassName ) {
172+ continue ;
173+ }
174+
175+ /** @var Mage_Payment_Model_Method_Abstract $method */
176+ $ method = Mage::getModel ($ paymentMethodModelClassName );
160177 if ($ method && $ method ->canManageRecurringProfiles ()) {
161178 $ result [] = $ method ;
162179 }
@@ -207,8 +224,9 @@ public function getPaymentMethodList($sorted = true, $asLabelValue = false, $wit
207224 if ((isset ($ data ['title ' ]))) {
208225 $ methods [$ code ] = $ data ['title ' ];
209226 } else {
210- if ($ this ->getMethodInstance ($ code )) {
211- $ methods [$ code ] = $ this ->getMethodInstance ($ code )->getConfigData ('title ' , $ store );
227+ $ paymentMethodModelClassName = $ this ->getMethodModelClassName ($ code );
228+ if ($ paymentMethodModelClassName ) {
229+ $ methods [$ code ] = Mage::getModel ($ paymentMethodModelClassName )->getConfigData ('title ' , $ store );
212230 }
213231 }
214232 if ($ asLabelValue && $ withGroups && isset ($ data ['group ' ])) {
0 commit comments