From 9481f9341b59e5ba42e6ea95985b6f70df5a5a33 Mon Sep 17 00:00:00 2001 From: ibrahimlawal Date: Fri, 9 Sep 2016 05:04:44 +0100 Subject: [PATCH] Default to Payment Accepted --- .../Inline/controllers/PaymentController.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/code/community/Paystack/Inline/controllers/PaymentController.php b/app/code/community/Paystack/Inline/controllers/PaymentController.php index eadd7b7..bafacf5 100644 --- a/app/code/community/Paystack/Inline/controllers/PaymentController.php +++ b/app/code/community/Paystack/Inline/controllers/PaymentController.php @@ -12,13 +12,13 @@ * @license https://raw.githubusercontent.com/PaystackHQ/paystack-magento/master/LICENSE MIT License (MIT) */ -class Paystack_Inline_PaymentController extends Mage_Core_Controller_Front_Action +class Paystack_Inline_PaymentController extends Mage_Core_Controller_Front_Action { - public function cancelAction() + public function cancelAction() { Mage::getSingleton('core/session')->addError( Mage::helper('paystack_inline')->__("Payment cancelled.")); - + $session = Mage::getSingleton('checkout/session'); if ($session->getLastRealOrderId()) { @@ -48,7 +48,7 @@ public function cancelAction() return $this->getResponse()->setRedirect( Mage::getUrl('checkout/onepage')); } - public function popAction() + public function popAction() { $this->loadLayout(); $block = $this->getLayout()->createBlock('Mage_Core_Block_Template','paystack_inline',array('template' => 'paystack/pop.phtml')); @@ -56,18 +56,18 @@ public function popAction() $this->renderLayout(); } - public function responseAction() + public function responseAction() { $success = false; $orderId = $this->getRequest()->get("orderId"); $trxref = $this->getRequest()->get("trxref"); - + // Both are required if(!$orderId || !$trxref){ return; } - + // trxref must start with orderId by design if(strpos($trxref, $orderId) !== 0){ return; @@ -92,7 +92,7 @@ public function responseAction() } elseif($transactionStatus->status == 'success') { - $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true, 'Payment Success.'); + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Payment Success.'); $order->save(); Mage::getSingleton('checkout/session')->unsQuoteId(); @@ -106,13 +106,13 @@ public function responseAction() Mage::getSingleton('checkout/session')->unsQuoteId(); } - - + + if(!$success){ Mage::getSingleton('core/session')->addError( Mage::helper('paystack_inline')->__("There was an error processing your payment. Please try again.")); Mage_Core_Controller_Varien_Action::_redirect('checkout/cart'); } - + } -} \ No newline at end of file +}