Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Phoenix_Moneybookers_Block_Form
  • Phoenix_Moneybookers_Block_Info
  • Phoenix_Moneybookers_Block_Jsinit
  • Phoenix_Moneybookers_Block_Payment
  • Phoenix_Moneybookers_Block_Placeform
  • Phoenix_Moneybookers_Block_Redirect
  • Phoenix_Moneybookers_Helper_Data
  • Phoenix_Moneybookers_Model_Abstract
  • Phoenix_Moneybookers_Model_Acc
  • Phoenix_Moneybookers_Model_Csi
  • Phoenix_Moneybookers_Model_Did
  • Phoenix_Moneybookers_Model_Dnk
  • Phoenix_Moneybookers_Model_Ebt
  • Phoenix_Moneybookers_Model_Ent
  • Phoenix_Moneybookers_Model_Event
  • Phoenix_Moneybookers_Model_Gcb
  • Phoenix_Moneybookers_Model_Gir
  • Phoenix_Moneybookers_Model_Idl
  • Phoenix_Moneybookers_Model_Lsr
  • Phoenix_Moneybookers_Model_Mae
  • Phoenix_Moneybookers_Model_Npy
  • Phoenix_Moneybookers_Model_Obt
  • Phoenix_Moneybookers_Model_Pli
  • Phoenix_Moneybookers_Model_Psp
  • Phoenix_Moneybookers_Model_Pwy
  • Phoenix_Moneybookers_Model_Sft
  • Phoenix_Moneybookers_Model_So2
  • Phoenix_Moneybookers_Model_Wlt
  • Phoenix_Moneybookers_MoneybookersController
  • Phoenix_Moneybookers_ProcessingController
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * @category    Phoenix
 16:  * @package     Phoenix_Moneybookers
 17:  * @copyright   Copyright (c) 2012 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
 18:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 19:  */
 20: class Phoenix_Moneybookers_ProcessingController extends Mage_Core_Controller_Front_Action
 21: {
 22:     /**
 23:      * Get singleton of Checkout Session Model
 24:      *
 25:      * @return Mage_Checkout_Model_Session
 26:      */
 27:     protected function _getCheckout()
 28:     {
 29:         return Mage::getSingleton('checkout/session');
 30:     }
 31: 
 32:     /**
 33:      * Iframe page which submits the payment data to Moneybookers.
 34:      */
 35:     public function placeformAction()
 36:     {
 37:        $this->loadLayout();
 38:        $this->renderLayout();
 39:     }
 40: 
 41:     /**
 42:      * Show orderPlaceRedirect page which contains the Moneybookers iframe.
 43:      */
 44:     public function paymentAction()
 45:     {
 46:         try {
 47:             $session = $this->_getCheckout();
 48: 
 49:             $order = Mage::getModel('sales/order');
 50:             $order->loadByIncrementId($session->getLastRealOrderId());
 51:             if (!$order->getId()) {
 52:                 Mage::throwException('No order for processing found');
 53:             }
 54:             $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
 55:                 Mage::helper('moneybookers')->__('The customer was redirected to Moneybookers.')
 56:             );
 57:             $order->save();
 58: 
 59:             $session->setMoneybookersQuoteId($session->getQuoteId());
 60:             $session->setMoneybookersRealOrderId($session->getLastRealOrderId());
 61:             $session->getQuote()->setIsActive(false)->save();
 62:             $session->clear();
 63: 
 64:             $this->loadLayout();
 65:             $this->renderLayout();
 66:         } catch (Exception $e){
 67:             Mage::logException($e);
 68:             parent::_redirect('checkout/cart');
 69:         }
 70:     }
 71: 
 72:     /**
 73:      * Action to which the customer will be returned when the payment is made.
 74:      */
 75:     public function successAction()
 76:     {
 77:         $event = Mage::getModel('moneybookers/event')
 78:                  ->setEventData($this->getRequest()->getParams());
 79:         try {
 80:             $quoteId = $event->successEvent();
 81:             $this->_getCheckout()->setLastSuccessQuoteId($quoteId);
 82:             $this->_redirect('checkout/onepage/success');
 83:             return;
 84:         } catch (Mage_Core_Exception $e) {
 85:             $this->_getCheckout()->addError($e->getMessage());
 86:         } catch(Exception $e) {
 87:             Mage::logException($e);
 88:         }
 89:         $this->_redirect('checkout/cart');
 90:     }
 91: 
 92:     /**
 93:      * Action to which the customer will be returned if the payment process is
 94:      * cancelled.
 95:      * Cancel order and redirect user to the shopping cart.
 96:      */
 97:     public function cancelAction()
 98:     {
 99:         $event = Mage::getModel('moneybookers/event')
100:                  ->setEventData($this->getRequest()->getParams());
101:         $message = $event->cancelEvent();
102: 
103:         // set quote to active
104:         $session = $this->_getCheckout();
105:         if ($quoteId = $session->getMoneybookersQuoteId()) {
106:             $quote = Mage::getModel('sales/quote')->load($quoteId);
107:             if ($quote->getId()) {
108:                 $quote->setIsActive(true)->save();
109:                 $session->setQuoteId($quoteId);
110:             }
111:         }
112: 
113:         $session->addError($message);
114:         $this->_redirect('checkout/cart');
115:     }
116: 
117:     /**
118:      * Action to which the transaction details will be posted after the payment
119:      * process is complete.
120:      */
121:     public function statusAction()
122:     {
123:         $event = Mage::getModel('moneybookers/event')
124:             ->setEventData($this->getRequest()->getParams());
125:         $message = $event->processStatusEvent();
126:         $this->getResponse()->setBody($message);
127:     }
128: 
129:     /**
130:      * Set redirect into responce. This has to be encapsulated in an JavaScript
131:      * call to jump out of the iframe.
132:      *
133:      * @param string $path
134:      * @param array $arguments
135:      */
136:     protected function _redirect($path, $arguments=array())
137:     {
138:         $this->getResponse()->setBody(
139:             $this->getLayout()
140:                 ->createBlock('moneybookers/redirect')
141:                 ->setRedirectUrl(Mage::getUrl($path, $arguments))
142:                 ->toHtml()
143:         );
144:         return $this;
145:     }
146: }
147: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0