From 624541051b41b8e3abacd322068b6f857bac9bcc Mon Sep 17 00:00:00 2001 From: Kevin Pheasey Date: Fri, 24 Apr 2015 10:39:24 -0400 Subject: [PATCH] Allow for customGemgento PayPal callback url --- .../Paypal/controllers/ExpressController.php | 16 ++++---- .../Gemgento/Paypal/etc/adminhtml.xml | 22 ++++++++++ .../community/Gemgento/Paypal/etc/config.xml | 11 ++++- .../community/Gemgento/Paypal/etc/system.xml | 41 +++++++++++++++++++ 4 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 app/code/community/Gemgento/Paypal/etc/adminhtml.xml create mode 100644 app/code/community/Gemgento/Paypal/etc/system.xml diff --git a/app/code/community/Gemgento/Paypal/controllers/ExpressController.php b/app/code/community/Gemgento/Paypal/controllers/ExpressController.php index 23e5c2c..e4f6c4a 100644 --- a/app/code/community/Gemgento/Paypal/controllers/ExpressController.php +++ b/app/code/community/Gemgento/Paypal/controllers/ExpressController.php @@ -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; } @@ -111,7 +111,7 @@ public function cancelAction() Mage::logException($e); } - header("Location: {$this->_gemgentoUrl()}cart"); + header("Location: {$this->_callbackUrl()}cart"); exit; } @@ -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) { @@ -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; } @@ -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) { @@ -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; } @@ -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 .= '/'; diff --git a/app/code/community/Gemgento/Paypal/etc/adminhtml.xml b/app/code/community/Gemgento/Paypal/etc/adminhtml.xml new file mode 100644 index 0000000..37529b0 --- /dev/null +++ b/app/code/community/Gemgento/Paypal/etc/adminhtml.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + Gemgento Paypal + + + + + + + + + + \ No newline at end of file diff --git a/app/code/community/Gemgento/Paypal/etc/config.xml b/app/code/community/Gemgento/Paypal/etc/config.xml index 0b7fafc..98decc7 100644 --- a/app/code/community/Gemgento/Paypal/etc/config.xml +++ b/app/code/community/Gemgento/Paypal/etc/config.xml @@ -2,9 +2,10 @@ - 0.0.4 + 0.0.5 + @@ -16,4 +17,12 @@ + + + + + http://localhost:3000/ + + + diff --git a/app/code/community/Gemgento/Paypal/etc/system.xml b/app/code/community/Gemgento/Paypal/etc/system.xml new file mode 100644 index 0000000..ca873d8 --- /dev/null +++ b/app/code/community/Gemgento/Paypal/etc/system.xml @@ -0,0 +1,41 @@ + + + + + + 150 + + + + + + gemgento + text + 1 + 1 + 1 + 10 + + + + text + 10 + 1 + 1 + 1 + 1 + + + + text + 1 + 1 + 1 + 1 + + + + + + + \ No newline at end of file