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_MoneybookersController extends Mage_Adminhtml_Controller_Action
21: {
22: /**
23: * Retrieve Moneybookers helper
24: *
25: * @return Phoenix_Moneybookers_Helper_Data
26: */
27: protected function _getHelper()
28: {
29: return Mage::helper('moneybookers');
30: }
31:
32: /**
33: * Send activation Email to Moneybookers
34: */
35: public function activateemailAction()
36: {
37: $this->_getHelper()->activateEmail();
38: }
39:
40: /**
41: * Check if email is registered at Moneybookers
42: */
43: public function checkemailAction()
44: {
45: try {
46: $params = $this->getRequest()->getParams();
47: if (empty($params['email'])) {
48: Mage::throwException('Error: No parameters specified');
49: }
50: $response = $this->_getHelper()->checkEmailRequest($params);
51: if (empty($response)) {
52: Mage::throwException('Error: Connection to moneybookers.com failed');
53: }
54: $this->getResponse()->setBody($response);
55: return;
56: } catch (Mage_Core_Exception $e) {
57: $response = $e->getMessage();
58: } catch (Exception $e) {
59: $response = 'Error: System error during request';
60: }
61: $this->getResponse()->setBody($response);
62: }
63:
64: /**
65: * Check if entered secret is valid
66: */
67: public function checksecretAction()
68: {
69: try {
70: $params = $this->getRequest()->getParams();
71: if (empty($params['email']) || empty($params['secret'])) {
72: Mage::throwException('Error: No parameters specified');
73: }
74: $response = $this->_getHelper()->checkSecretRequest($params);
75: if (empty($response)) {
76: Mage::throwException('Error: Connection to moneybookers.com failed');
77: }
78: $this->getResponse()->setBody($response);
79: return;
80: } catch (Mage_Core_Exception $e) {
81: $response = $e->getMessage();
82: } catch (Exception $e) {
83: $response = 'Error: System error during request';
84: }
85: $this->getResponse()->setBody($response);
86: }
87: }
88: