PageRenderTime 48ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/app/code/community/Phoenix/Moneybookers/controllers/MoneybookersController.php

https://bitbucket.org/claudiu_marginean/magento-hg-mirror
PHP | 87 lines | 52 code | 3 blank | 32 comment | 5 complexity | 79f384514987ab367f8bd59108b04a00 MD5 | raw file
Possible License(s): CC-BY-SA-3.0, LGPL-2.1, GPL-2.0, WTFPL
  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) 2009 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. * Send activation Email to Moneybookers
  33. */
  34. public function activateemailAction()
  35. {
  36. $this->_getHelper()->activateEmail();
  37. }
  38. /**
  39. * Check if email is registered at Moneybookers
  40. */
  41. public function checkemailAction()
  42. {
  43. try {
  44. $params = $this->getRequest()->getParams();
  45. if (empty($params['email'])) {
  46. Mage::throwException('Error: No parameters specified');
  47. }
  48. $response = $this->_getHelper()->checkEmailRequest($params);
  49. if (empty($response)) {
  50. Mage::throwException('Error: Connection to moneybookers.com failed');
  51. }
  52. $this->getResponse()->setBody($response);
  53. return;
  54. } catch (Mage_Core_Exception $e) {
  55. $response = $e->getMessage();
  56. } catch (Exception $e) {
  57. $response = 'Error: System error during request';
  58. }
  59. $this->getResponse()->setBody($response);
  60. }
  61. /**
  62. * Check if entered secret is valid
  63. */
  64. public function checksecretAction()
  65. {
  66. try {
  67. $params = $this->getRequest()->getParams();
  68. if (empty($params['email']) || empty($params['secret'])) {
  69. Mage::throwException('Error: No parameters specified');
  70. }
  71. $response = $this->_getHelper()->checkSecretRequest($params);
  72. if (empty($response)) {
  73. Mage::throwException('Error: Connection to moneybookers.com failed');
  74. }
  75. $this->getResponse()->setBody($response);
  76. return;
  77. } catch (Mage_Core_Exception $e) {
  78. $response = $e->getMessage();
  79. } catch (Exception $e) {
  80. $response = 'Error: System error during request';
  81. }
  82. $this->getResponse()->setBody($response);
  83. }
  84. }