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_Block_Placeform extends Mage_Core_Block_Template
21: {
22: /**
23: * Return checkout session instance
24: *
25: * @return Mage_Checkout_Model_Session
26: */
27: protected function _getCheckout()
28: {
29: return Mage::getSingleton('checkout/session');
30: }
31:
32: /**
33: * Return order instance
34: *
35: * @return Mage_Sales_Model_Order|null
36: */
37: protected function _getOrder()
38: {
39: if ($this->getOrder()) {
40: return $this->getOrder();
41: } elseif ($orderIncrementId = $this->_getCheckout()->getLastRealOrderId()) {
42: return Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
43: } else {
44: return null;
45: }
46: }
47:
48: /**
49: * Get Form data by using ogone payment api
50: *
51: * @return array
52: */
53: public function getFormData()
54: {
55: return $this->_getOrder()->getPayment()->getMethodInstance()->getFormFields();
56: }
57:
58: /**
59: * Getting gateway url
60: *
61: * @return string
62: */
63: public function getFormAction()
64: {
65: return $this->_getOrder()->getPayment()->getMethodInstance()->getUrl();
66: }
67: }
68: