Skip to content

Instantly share code, notes, and snippets.

@danielfone
Created November 14, 2011 02:34
Show Gist options
  • Save danielfone/1363107 to your computer and use it in GitHub Desktop.
Save danielfone/1363107 to your computer and use it in GitHub Desktop.
multi-store refund support
diff --git a/app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpost.php b/app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpost.php
index 96dde32..5b30bab 100644
--- a/app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpost.php
+++ b/app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpost.php
@@ -48,6 +48,28 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
protected $_canSaveCc = false;
protected $_order;
+ protected $_store;
+
+ /**
+ * retrieve store for this payment
+ *
+ * @return Mage_Core_Model_Store
+ **/
+ protected function _getStore()
+ {
+ if ( ! $this->_store ) $this->_store = $this->_getOrder()->getStore();
+ return $this->_store;
+ }
+
+ /**
+ * retrieve config applicable to this payment
+ *
+ * @return string|null
+ **/
+ protected function _getConfig($value)
+ {
+ return $this->_getStore()->getConfig($value);
+ }
/**
* retrieve PostUsername from database
@@ -56,7 +78,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
*/
public function getPostUsername()
{
- return Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/'.$this->_code.'/postusername'));
+ return Mage::helper('core')->decrypt($this->_getConfig('payment/'.$this->_code.'/postusername'));
}
/**
@@ -66,7 +88,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
*/
public function getPostPassword()
{
- return Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/'.$this->_code.'/postpassword'));
+ return Mage::helper('core')->decrypt($this->_getConfig('payment/'.$this->_code.'/postpassword'));
}
/**
@@ -77,7 +99,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
*/
protected function _getPxPostPaymentAction()
{
- switch(Mage::getStoreConfig('payment/'.$this->_code.'/payment_action')) {
+ switch($this->_getConfig('payment/'.$this->_code.'/payment_action')) {
case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
return MageBase_DpsPaymentExpress_Model_Method_Common::ACTION_AUTHORIZE;
break;
@@ -395,7 +417,7 @@ class MageBase_DpsPaymentExpress_Model_Method_Pxpost extends Mage_Payment_Model_
*/
public function debugToDb()
{
- return Mage::getStoreConfig('payment/'.$this->_code.'/debug');
+ return $this->_getConfig('payment/'.$this->_code.'/debug');
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment