Skip to content

Instantly share code, notes, and snippets.

@borriglione
Created September 5, 2013 16:09
Show Gist options
  • Save borriglione/6452305 to your computer and use it in GitHub Desktop.
Save borriglione/6452305 to your computer and use it in GitHub Desktop.
Hotfix - Multistore Redirect Payment Methods
diff --git a/app/code/community/Netresearch/OPS/controllers/ApiController.php b/app/code/community/Netresearch/OPS/controllers/ApiController.php
index 61f5154..e14f995 100644
--- a/app/code/community/Netresearch/OPS/controllers/ApiController.php
+++ b/app/code/community/Netresearch/OPS/controllers/ApiController.php
@@ -32,6 +32,24 @@ class Netresearch_OPS_ApiController extends Netresearch_OPS_Controller_Abstract
public function postBackAction()
{
$params = $this->getRequest()->getParams();
+ /**
+ * Hotfix
+ *
+ * If the current storeID != the storeID of the order redirect to the postback-URL of the order store
+ */
+ if (Mage::app()->getStore()->getId() != $this->_getOrder()->getStoreId()) {
+ $redirectRoute = Mage::getUrl(
+ 'ops/api/postBack',
+ array(
+ '_store' => $this->_getOrder()->getStoreId(),
+ '_nosid' => true,
+ '_query' => $params
+ )
+ );
+ $this->_redirectUrl($redirectRoute);
+ return;
+ }
+
try {
$status = $this->getPaymentHelper()->applyStateForOrder(
$this->_getOrder(),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment