Skip to content

Commit

Permalink
Allow for customGemgento PayPal callback url
Browse files Browse the repository at this point in the history
  • Loading branch information
kpheasey committed Apr 24, 2015
1 parent 99fee4a commit 6245410
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function startAction()
Mage::logException($e);
}

header("Location: {$this->_gemgentoUrl()}checkout/address?alert=" . urlencode('There was a problem processing the PayPal payment'));
header("Location: {$this->_callbackUrl()}checkout/address?alert=" . urlencode('There was a problem processing the PayPal payment'));
exit;
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public function cancelAction()
Mage::logException($e);
}

header("Location: {$this->_gemgentoUrl()}cart");
header("Location: {$this->_callbackUrl()}cart");
exit;
}

Expand All @@ -127,7 +127,7 @@ public function returnAction()
try {
$this->_initCheckout();
$this->_checkout->returnFromPaypal($this->_initToken());
header("Location: {$this->_gemgentoUrl()}checkout/confirm");
header("Location: {$this->_callbackUrl()}checkout/confirm");
exit;
}
catch (Mage_Core_Exception $e) {
Expand All @@ -138,7 +138,7 @@ public function returnAction()
Mage::logException($e);
}

header("Location: {$this->_gemgentoUrl()}cart?alert=" . urlencode('There was a problem processing the PayPal payment. Your order has been canceled.'));
header("Location: {$this->_callbackUrl()}cart?alert=" . urlencode('There was a problem processing the PayPal payment. Your order has been canceled.'));
exit;
}

Expand Down Expand Up @@ -205,7 +205,7 @@ public function placeOrderAction()
Mage::getSingleton('core/session')->renewSession();
Mage::getSingleton('core/session')->unsSessionHosts();

header("Location: {$this->_gemgentoUrl()}checkout/thank_you?paypal={$order->getIncrementId()}");
header("Location: {$this->_callbackUrl()}checkout/paypal/{$order->getIncrementId()}");
exit;
}
catch (Mage_Core_Exception $e) {
Expand All @@ -216,7 +216,7 @@ public function placeOrderAction()
Mage::logException($e);
}

header("Location: {$this->_gemgentoUrl()}checkout/confirm?alert=" . urlencode('There was a problem processing the PayPal payment'));
header("Location: {$this->_callbackUrl()}checkout/confirm?alert=" . urlencode('There was a problem processing the PayPal payment'));
exit;
}

Expand Down Expand Up @@ -288,8 +288,8 @@ private function _getQuote()
*
* @return string
*/
private function _gemgentoUrl() {
$url = Mage::getStoreConfig("gemgento_push/settings/gemgento_url");
private function _callbackUrl() {
$url = Mage::getStoreConfig("gemgento_paypal/settings/callback_url");

if (substr($url, -1) != '/') {
$url .= '/';
Expand Down
22 changes: 22 additions & 0 deletions app/code/community/Gemgento/Paypal/etc/adminhtml.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<gemgento_paypal>
<title>Gemgento Paypal</title> <!-- Used in resources tree -->
</gemgento_paypal>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
11 changes: 10 additions & 1 deletion app/code/community/Gemgento/Paypal/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
<config>
<modules>
<Gemgento_Paypal>
<version>0.0.4</version>
<version>0.0.5</version>
</Gemgento_Paypal>
</modules>

<frontend>
<routers>
<paypal>
Expand All @@ -16,4 +17,12 @@
</paypal>
</routers>
</frontend>

<default>
<gemgento_paypal>
<settings>
<callback_url>http://localhost:3000/</callback_url>
</settings>
</gemgento_paypal>
</default>
</config>
41 changes: 41 additions & 0 deletions app/code/community/Gemgento/Paypal/etc/system.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<config>
<tabs>
<gemgento translate="label">
<label>Gemgento</label>
<sort_order>150</sort_order>
</gemgento>
</tabs>
<sections>
<gemgento_paypal>
<label>PayPal Settings</label>
<tab>gemgento</tab>
<frontend_type>text</frontend_type>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<sort_order>10</sort_order>
<groups>
<settings translate="label">
<label>Callback</label>
<frontend_type>text</frontend_type>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<expanded>1</expanded>
<fields>
<callback_url translate="label">
<label>Url</label>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</callback_url>
</fields>
</settings>
</groups>
</gemgento_paypal>
</sections>
</config>

0 comments on commit 6245410

Please sign in to comment.