Phoenix_Moneybookers - Version 1.2.4

Version Notes

1.2.4

Download this release

Release Info

Developer Magento Core Team
Extension Phoenix_Moneybookers
Version 1.2.4
Comparing to
See all releases


Version 1.2.4

Files changed (88) hide show
  1. app/code/community/Phoenix/Moneybookers/Block/Form.php +93 -0
  2. app/code/community/Phoenix/Moneybookers/Block/Info.php +51 -0
  3. app/code/community/Phoenix/Moneybookers/Block/Jsinit.php +49 -0
  4. app/code/community/Phoenix/Moneybookers/Block/Payment.php +39 -0
  5. app/code/community/Phoenix/Moneybookers/Block/Placeform.php +67 -0
  6. app/code/community/Phoenix/Moneybookers/Block/Redirect.php +30 -0
  7. app/code/community/Phoenix/Moneybookers/Helper/Data.php +130 -0
  8. app/code/community/Phoenix/Moneybookers/Model/Abstract.php +208 -0
  9. app/code/community/Phoenix/Moneybookers/Model/Acc.php +27 -0
  10. app/code/community/Phoenix/Moneybookers/Model/Csi.php +27 -0
  11. app/code/community/Phoenix/Moneybookers/Model/Did.php +27 -0
  12. app/code/community/Phoenix/Moneybookers/Model/Dnk.php +27 -0
  13. app/code/community/Phoenix/Moneybookers/Model/Ebt.php +27 -0
  14. app/code/community/Phoenix/Moneybookers/Model/Ent.php +27 -0
  15. app/code/community/Phoenix/Moneybookers/Model/Event.php +254 -0
  16. app/code/community/Phoenix/Moneybookers/Model/Gcb.php +27 -0
  17. app/code/community/Phoenix/Moneybookers/Model/Gir.php +27 -0
  18. app/code/community/Phoenix/Moneybookers/Model/Idl.php +27 -0
  19. app/code/community/Phoenix/Moneybookers/Model/Lsr.php +27 -0
  20. app/code/community/Phoenix/Moneybookers/Model/Mae.php +27 -0
  21. app/code/community/Phoenix/Moneybookers/Model/Npy.php +27 -0
  22. app/code/community/Phoenix/Moneybookers/Model/Obt.php +27 -0
  23. app/code/community/Phoenix/Moneybookers/Model/Pli.php +27 -0
  24. app/code/community/Phoenix/Moneybookers/Model/Psp.php +27 -0
  25. app/code/community/Phoenix/Moneybookers/Model/Pwy.php +27 -0
  26. app/code/community/Phoenix/Moneybookers/Model/Sft.php +27 -0
  27. app/code/community/Phoenix/Moneybookers/Model/So2.php +27 -0
  28. app/code/community/Phoenix/Moneybookers/Model/Wlt.php +28 -0
  29. app/code/community/Phoenix/Moneybookers/controllers/MoneybookersController.php +87 -0
  30. app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php +146 -0
  31. app/code/community/Phoenix/Moneybookers/etc/config.xml +305 -0
  32. app/code/community/Phoenix/Moneybookers/etc/system.xml +1201 -0
  33. app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/mysql4-upgrade-1.2-1.2.0.1.php +41 -0
  34. app/design/adminhtml/default/default/layout/moneybookers.xml +28 -0
  35. app/design/adminhtml/default/default/template/moneybookers/info.phtml +26 -0
  36. app/design/adminhtml/default/default/template/moneybookers/jsinit.phtml +37 -0
  37. app/design/adminhtml/default/default/template/moneybookers/pdf/info.phtml +24 -0
  38. app/design/frontend/base/default/layout/moneybookers.xml +41 -0
  39. app/design/frontend/base/default/template/moneybookers/blank.phtml +34 -0
  40. app/design/frontend/base/default/template/moneybookers/form.phtml +48 -0
  41. app/design/frontend/base/default/template/moneybookers/info.phtml +32 -0
  42. app/design/frontend/base/default/template/moneybookers/payment.phtml +39 -0
  43. app/design/frontend/base/default/template/moneybookers/placeform.phtml +42 -0
  44. app/design/frontend/base/default/template/moneybookers/redirect.phtml +29 -0
  45. app/etc/modules/Phoenix_Moneybookers.xml +29 -0
  46. app/locale/en_US/Phoenix_Moneybookers.csv +42 -0
  47. app/locale/en_US/template/email/moneybookers_activateemail.html +6 -0
  48. js/mage/adminhtml/moneybookers.js +162 -0
  49. package.xml +35 -0
  50. skin/adminhtml/default/default/images/moneybookers/banner.jpg +0 -0
  51. skin/frontend/base/default/images/moneybookers/banner_120_de.gif +0 -0
  52. skin/frontend/base/default/images/moneybookers/banner_120_de.png +0 -0
  53. skin/frontend/base/default/images/moneybookers/banner_120_dk.gif +0 -0
  54. skin/frontend/base/default/images/moneybookers/banner_120_fr.gif +0 -0
  55. skin/frontend/base/default/images/moneybookers/banner_120_fr.png +0 -0
  56. skin/frontend/base/default/images/moneybookers/banner_120_int.gif +0 -0
  57. skin/frontend/base/default/images/moneybookers/banner_120_int.png +0 -0
  58. skin/frontend/base/default/images/moneybookers/banner_120_pl.gif +0 -0
  59. skin/frontend/base/default/images/moneybookers/banner_120_pl.png +0 -0
  60. skin/frontend/base/default/images/moneybookers/banner_120_sp.gif +0 -0
  61. skin/frontend/base/default/images/moneybookers/banner_120_sp.png +0 -0
  62. skin/frontend/base/default/images/moneybookers/moneybookers_acc.png +0 -0
  63. skin/frontend/base/default/images/moneybookers/moneybookers_csi.gif +0 -0
  64. skin/frontend/base/default/images/moneybookers/moneybookers_did.gif +0 -0
  65. skin/frontend/base/default/images/moneybookers/moneybookers_dnk.gif +0 -0
  66. skin/frontend/base/default/images/moneybookers/moneybookers_ebt.gif +0 -0
  67. skin/frontend/base/default/images/moneybookers/moneybookers_ent.gif +0 -0
  68. skin/frontend/base/default/images/moneybookers/moneybookers_gcb.gif +0 -0
  69. skin/frontend/base/default/images/moneybookers/moneybookers_gir.gif +0 -0
  70. skin/frontend/base/default/images/moneybookers/moneybookers_idl.gif +0 -0
  71. skin/frontend/base/default/images/moneybookers/moneybookers_lsr.gif +0 -0
  72. skin/frontend/base/default/images/moneybookers/moneybookers_mae.gif +0 -0
  73. skin/frontend/base/default/images/moneybookers/moneybookers_npy.gif +0 -0
  74. skin/frontend/base/default/images/moneybookers/moneybookers_obt_de.png +0 -0
  75. skin/frontend/base/default/images/moneybookers/moneybookers_obt_dk.png +0 -0
  76. skin/frontend/base/default/images/moneybookers/moneybookers_obt_ee.png +0 -0
  77. skin/frontend/base/default/images/moneybookers/moneybookers_obt_en.png +0 -0
  78. skin/frontend/base/default/images/moneybookers/moneybookers_obt_fl.png +0 -0
  79. skin/frontend/base/default/images/moneybookers/moneybookers_obt_lt.png +0 -0
  80. skin/frontend/base/default/images/moneybookers/moneybookers_obt_lv.png +0 -0
  81. skin/frontend/base/default/images/moneybookers/moneybookers_obt_pl.png +0 -0
  82. skin/frontend/base/default/images/moneybookers/moneybookers_obt_se.png +0 -0
  83. skin/frontend/base/default/images/moneybookers/moneybookers_pli.gif +0 -0
  84. skin/frontend/base/default/images/moneybookers/moneybookers_psp.gif +0 -0
  85. skin/frontend/base/default/images/moneybookers/moneybookers_pwy.gif +0 -0
  86. skin/frontend/base/default/images/moneybookers/moneybookers_sft.gif +0 -0
  87. skin/frontend/base/default/images/moneybookers/moneybookers_so2.gif +0 -0
  88. skin/frontend/base/default/images/moneybookers/moneybookers_wlt.gif +0 -0
app/code/community/Phoenix/Moneybookers/Block/Form.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Block_Form extends Mage_Payment_Block_Form
21
+ {
22
+ /**
23
+ * Available locales for content URL generation
24
+ *
25
+ * @var array
26
+ */
27
+ protected $_supportedInfoLocales = array('de');
28
+
29
+ /**
30
+ * Default locale for content URL generation
31
+ *
32
+ * @var string
33
+ */
34
+ protected $_defaultInfoLocale = 'en';
35
+
36
+ /**
37
+ * Constructor. Set template.
38
+ */
39
+ protected function _construct()
40
+ {
41
+ parent::_construct();
42
+ $this->setTemplate('moneybookers/form.phtml');
43
+ }
44
+
45
+ /**
46
+ * Return payment logo image src
47
+ *
48
+ * @param string $payment Payment Code
49
+ * @return string|bool
50
+ */
51
+ public function getPaymentImageSrc($payment)
52
+ {
53
+ if ($payment == 'moneybookers_obt') {
54
+ $payment .= '_'.$this->getInfoLocale();
55
+ }
56
+
57
+ $imageFilename = Mage::getDesign()
58
+ ->getFilename('images' . DS . 'moneybookers' . DS . $payment, array('_type' => 'skin'));
59
+
60
+ if (file_exists($imageFilename . '.png')) {
61
+ return $this->getSkinUrl('images/moneybookers/' . $payment . '.png');
62
+ } else if (file_exists($imageFilename . '.gif')) {
63
+ return $this->getSkinUrl('images/moneybookers/' . $payment . '.gif');
64
+ }
65
+
66
+ return false;
67
+ }
68
+
69
+ /**
70
+ * Return supported locale for information text
71
+ *
72
+ * @return string
73
+ */
74
+ public function getInfoLocale()
75
+ {
76
+ $locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
77
+ if (!in_array($locale, $this->_supportedInfoLocales)) {
78
+ $locale = $this->_defaultInfoLocale;
79
+ }
80
+ return $locale;
81
+ }
82
+
83
+ /**
84
+ * Return info URL for eWallet payment
85
+ *
86
+ * @return string
87
+ */
88
+ public function getWltInfoUrl()
89
+ {
90
+ $locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
91
+ return 'http://www.moneybookers.com/app/?l=' . strtoupper($locale);
92
+ }
93
+ }
app/code/community/Phoenix/Moneybookers/Block/Info.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Block_Info extends Mage_Payment_Block_Info
21
+ {
22
+ /**
23
+ * Constructor. Set template.
24
+ */
25
+ protected function _construct()
26
+ {
27
+ parent::_construct();
28
+ $this->setTemplate('moneybookers/info.phtml');
29
+ }
30
+
31
+ /**
32
+ * Returns code of payment method
33
+ *
34
+ * @return string
35
+ */
36
+ public function getMethodCode()
37
+ {
38
+ return $this->getInfo()->getMethodInstance()->getCode();
39
+ }
40
+
41
+ /**
42
+ * Build PDF content of info block
43
+ *
44
+ * @return string
45
+ */
46
+ public function toPdf()
47
+ {
48
+ $this->setTemplate('moneybookers/pdf/info.phtml');
49
+ return $this->toHtml();
50
+ }
51
+ }
app/code/community/Phoenix/Moneybookers/Block/Jsinit.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Block_Jsinit extends Mage_Adminhtml_Block_Template
21
+ {
22
+ /**
23
+ * Include JS in head if section is moneybookers
24
+ */
25
+ protected function _prepareLayout()
26
+ {
27
+ $section = $this->getAction()->getRequest()->getParam('section', false);
28
+ if ($section == 'moneybookers') {
29
+ $this->getLayout()
30
+ ->getBlock('head')
31
+ ->addJs('mage/adminhtml/moneybookers.js');
32
+ }
33
+ parent::_prepareLayout();
34
+ }
35
+
36
+ /**
37
+ * Print init JS script into body
38
+ * @return string
39
+ */
40
+ protected function _toHtml()
41
+ {
42
+ $section = $this->getAction()->getRequest()->getParam('section', false);
43
+ if ($section == 'moneybookers') {
44
+ return parent::_toHtml();
45
+ } else {
46
+ return '';
47
+ }
48
+ }
49
+ }
app/code/community/Phoenix/Moneybookers/Block/Payment.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Block_Payment extends Mage_Core_Block_Template
21
+ {
22
+ /**
23
+ * Return Payment logo src
24
+ *
25
+ * @return string
26
+ */
27
+ public function getMoneybookersLogoSrc()
28
+ {
29
+ $locale = Mage::getModel('moneybookers/acc')->getLocale();
30
+ $logoFilename = Mage::getDesign()
31
+ ->getFilename('images' . DS . 'moneybookers' . DS . 'banner_120_' . $locale . '.gif', array('_type' => 'skin'));
32
+
33
+ if (file_exists($logoFilename)) {
34
+ return $this->getSkinUrl('images/moneybookers/banner_120_'.$locale.'.gif');
35
+ }
36
+
37
+ return $this->getSkinUrl('images/moneybookers/banner_120_int.gif');
38
+ }
39
+ }
app/code/community/Phoenix/Moneybookers/Block/Placeform.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_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
+ }
app/code/community/Phoenix/Moneybookers/Block/Redirect.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Block_Redirect extends Mage_Core_Block_Template
21
+ {
22
+ /**
23
+ * Constructor. Set template.
24
+ */
25
+ protected function _construct()
26
+ {
27
+ parent::_construct();
28
+ $this->setTemplate('moneybookers/redirect.phtml');
29
+ }
30
+ }
app/code/community/Phoenix/Moneybookers/Helper/Data.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Helper_Data extends Mage_Payment_Helper_Data
21
+ {
22
+ const XML_PATH_EMAIL = 'moneybookers/settings/moneybookers_email';
23
+ const XML_PATH_CUSTOMER_ID = 'moneybookers/settings/customer_id';
24
+ const XML_PATH_SECRET_KEY = 'moneybookers/settings/secret_key';
25
+
26
+ /**
27
+ * Internal parameters for validation
28
+ */
29
+ protected $_moneybookersServer = 'https://www.moneybookers.com';
30
+ protected $_checkEmailUrl = '/app/email_check.pl';
31
+ protected $_checkEmailCustId = '6999315';
32
+ protected $_checkEmailPassword = 'a4ce5a98a8950c04a3d34a2e2cb8c89f';
33
+ protected $_checkSecretUrl = '/app/secret_word_check.pl';
34
+ protected $_activationEmailTo = 'ecommerce@moneybookers.com';
35
+ protected $_activationEmailSubject = 'Magento Moneybookers Activation';
36
+ protected $_moneybookersMasterCustId = '7283403';
37
+ protected $_moneybookersMasterSecretHash = 'c18524b6b1082653039078a4700367f0';
38
+
39
+ /**
40
+ * Send activation Email to Moneybookers
41
+ */
42
+ public function activateEmail()
43
+ {
44
+ $storeId = Mage::app()->getStore()->getId();
45
+
46
+ $translate = Mage::getSingleton('core/translate');
47
+ /* @var $translate Mage_Core_Model_Translate */
48
+ $translate->setTranslateInline(false);
49
+
50
+ Mage::getModel('core/email_template')
51
+ ->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
52
+ ->sendTransactional(
53
+ 'moneybookers_activateemail',
54
+ Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId),
55
+ $this->_activationEmailTo,
56
+ null,
57
+ array(
58
+ 'subject' => $this->_activationEmailSubject,
59
+ 'email_addr' => Mage::getStoreConfig(self::XML_PATH_EMAIL),
60
+ 'url' => Mage::getBaseUrl(),
61
+ 'customer_id' => Mage::getStoreConfig(self::XML_PATH_CUSTOMER_ID),
62
+ 'language' => Mage::getModel('core/locale')->getDefaultLocale()
63
+ )
64
+ );
65
+
66
+ $translate->setTranslateInline(true);
67
+ }
68
+
69
+ /**
70
+ * Check if email is registered at Moneybookers
71
+ *
72
+ * @param array $params
73
+ * @return array
74
+ */
75
+ public function checkEmailRequest(Array $params) {
76
+ $response = null;
77
+ try {
78
+ $response = $this->_getHttpsPage($this->_moneybookersServer . $this->_checkEmailUrl, array(
79
+ 'email' => $params['email'],
80
+ 'cust_id' => $this->_checkEmailCustId,
81
+ 'password' => $this->_checkEmailPassword)
82
+ );
83
+ } catch (Exception $e) {
84
+ Mage::log($e->getMessage());
85
+ return null;
86
+ }
87
+ return $response;
88
+ }
89
+
90
+ /**
91
+ * Check if entered secret is valid
92
+ * @param array $params
93
+ * @return array
94
+ */
95
+ public function checkSecretRequest(Array $params)
96
+ {
97
+ $response = null;
98
+ try {
99
+ $response = $this->_getHttpsPage($this->_moneybookersServer . $this->_checkSecretUrl, array(
100
+ 'email' => $params['email'],
101
+ 'secret' => md5(md5($params['secret']) . $this->_moneybookersMasterSecretHash),
102
+ 'cust_id' => $this->_moneybookersMasterCustId)
103
+ );
104
+ } catch (Exception $e) {
105
+ Mage::log($e->getMessage());
106
+ return null;
107
+ }
108
+ return $response;
109
+ }
110
+
111
+ /**
112
+ * Reading a page via HTTPS and returning its content.
113
+ */
114
+ protected function _getHttpsPage($host, $parameter)
115
+ {
116
+ $client = new Varien_Http_Client();
117
+ $client->setUri($host)
118
+ ->setConfig(array('timeout' => 30))
119
+ ->setHeaders('accept-encoding', '')
120
+ ->setParameterGet($parameter)
121
+ ->setMethod(Zend_Http_Client::GET);
122
+ $request = $client->request();
123
+ // Workaround for pseudo chunked messages which are yet too short, so
124
+ // only an exception is is thrown instead of returning raw body
125
+ if (!preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $request->getRawBody(), $m))
126
+ return $request->getRawBody();
127
+
128
+ return $request->getBody();
129
+ }
130
+ }
app/code/community/Phoenix/Moneybookers/Model/Abstract.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ abstract class Phoenix_Moneybookers_Model_Abstract extends Mage_Payment_Model_Method_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_abstract';
26
+
27
+ protected $_formBlockType = 'moneybookers/form';
28
+ protected $_infoBlockType = 'moneybookers/info';
29
+
30
+ /**
31
+ * Availability options
32
+ */
33
+ protected $_isGateway = true;
34
+ protected $_canAuthorize = true;
35
+ protected $_canCapture = true;
36
+ protected $_canCapturePartial = false;
37
+ protected $_canRefund = false;
38
+ protected $_canVoid = false;
39
+ protected $_canUseInternal = false;
40
+ protected $_canUseCheckout = true;
41
+ protected $_canUseForMultishipping = false;
42
+
43
+ protected $_paymentMethod = 'abstract';
44
+ protected $_defaultLocale = 'en';
45
+ protected $_supportedLocales = array('cn', 'cz', 'da', 'en', 'es', 'fi', 'de', 'fr', 'gr', 'it', 'nl', 'ro', 'ru', 'pl', 'sv', 'tr');
46
+ protected $_hidelogin = '1';
47
+
48
+ protected $_order;
49
+
50
+ /**
51
+ * Get order model
52
+ *
53
+ * @return Mage_Sales_Model_Order
54
+ */
55
+ public function getOrder()
56
+ {
57
+ if (!$this->_order) {
58
+ $this->_order = $this->getInfoInstance()->getOrder();
59
+ }
60
+ return $this->_order;
61
+ }
62
+
63
+ /**
64
+ * Return url for redirection after order placed
65
+ * @return string
66
+ */
67
+ public function getOrderPlaceRedirectUrl()
68
+ {
69
+ return Mage::getUrl('moneybookers/processing/payment');
70
+ }
71
+
72
+ /**
73
+ * Capture payment through Moneybookers api
74
+ *
75
+ * @param Varien_Object $payment
76
+ * @param decimal $amount
77
+ * @return Phoenix_Moneybookers_Model_Abstract
78
+ */
79
+ public function capture(Varien_Object $payment, $amount)
80
+ {
81
+ $payment->setStatus(self::STATUS_APPROVED)
82
+ ->setTransactionId($this->getTransactionId())
83
+ ->setIsTransactionClosed(0);
84
+
85
+ return $this;
86
+ }
87
+
88
+ /**
89
+ * Camcel payment
90
+ *
91
+ * @param Varien_Object $payment
92
+ * @return Phoenix_Moneybookers_Model_Abstract
93
+ */
94
+ public function cancel(Varien_Object $payment)
95
+ {
96
+ $payment->setStatus(self::STATUS_DECLINED)
97
+ ->setTransactionId($this->getTransactionId())
98
+ ->setIsTransactionClosed(1);
99
+
100
+ return $this;
101
+ }
102
+
103
+ /**
104
+ * Return url of payment method
105
+ *
106
+ * @return string
107
+ */
108
+ public function getUrl()
109
+ {
110
+ return 'https://www.moneybookers.com/app/payment.pl';
111
+ }
112
+
113
+ /**
114
+ * Return url of payment method
115
+ *
116
+ * @return string
117
+ */
118
+ public function getLocale()
119
+ {
120
+ $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
121
+ if (is_array($locale) && !empty($locale) && in_array($locale[0], $this->_supportedLocales)) {
122
+ return $locale[0];
123
+ }
124
+ return $this->getDefaultLocale();
125
+ }
126
+
127
+ /**
128
+ * prepare params array to send it to gateway page via POST
129
+ *
130
+ * @return array
131
+ */
132
+ public function getFormFields()
133
+ {
134
+ $order_id = $this->getOrder()->getRealOrderId();
135
+ $billing = $this->getOrder()->getBillingAddress();
136
+ if ($this->getOrder()->getBillingAddress()->getEmail()) {
137
+ $email = $this->getOrder()->getBillingAddress()->getEmail();
138
+ } else {
139
+ $email = $this->getOrder()->getCustomerEmail();
140
+ }
141
+
142
+ $params = array(
143
+ 'merchant_fields' => 'partner',
144
+ 'partner' => 'magento',
145
+ 'pay_to_email' => Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_EMAIL),
146
+ 'transaction_id' => $order_id,
147
+ 'return_url' => Mage::getUrl('moneybookers/processing/success', array('transaction_id' => $order_id)),
148
+ 'cancel_url' => Mage::getUrl('moneybookers/processing/cancel', array('transaction_id' => $order_id)),
149
+ 'status_url' => Mage::getUrl('moneybookers/processing/status'),
150
+ 'language' => $this->getLocale(),
151
+ 'amount' => round($this->getOrder()->getGrandTotal(), 2),
152
+ 'currency' => $this->getOrder()->getOrderCurrencyCode(),
153
+ 'recipient_description' => $this->getOrder()->getStore()->getWebsite()->getName(),
154
+ 'firstname' => $billing->getFirstname(),
155
+ 'lastname' => $billing->getLastname(),
156
+ 'address' => $billing->getStreet(-1),
157
+ 'postal_code' => $billing->getPostcode(),
158
+ 'city' => $billing->getCity(),
159
+ 'country' => $billing->getCountryModel()->getIso3Code(),
160
+ 'pay_from_email' => $email,
161
+ 'phone_number' => $billing->getTelephone(),
162
+ 'detail1_description' => Mage::helper('moneybookers')->__('Order ID'),
163
+ 'detail1_text' => $order_id,
164
+ 'payment_methods' => $this->_paymentMethod,
165
+ 'hide_login' => $this->_hidelogin,
166
+ 'new_window_redirect' => '1'
167
+ );
168
+
169
+ // add optional day of birth
170
+ if ($billing->getDob()) {
171
+ $params['date_of_birth'] = Mage::app()->getLocale()->date($billing->getDob(), null, null, false)->toString('dmY');
172
+ }
173
+
174
+ return $params;
175
+ }
176
+ /**
177
+ * Get initialized flag status
178
+ * @return true
179
+ */
180
+ public function isInitializeNeeded()
181
+ {
182
+ return true;
183
+ }
184
+
185
+ /**
186
+ * Instantiate state and set it to state onject
187
+ * //@param
188
+ * //@param
189
+ */
190
+ public function initialize($paymentAction, $stateObject)
191
+ {
192
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
193
+ $stateObject->setState($state);
194
+ $stateObject->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
195
+ $stateObject->setIsNotified(false);
196
+ }
197
+
198
+ /**
199
+ * Get config action to process initialization
200
+ *
201
+ * @return string
202
+ */
203
+ public function getConfigPaymentAction()
204
+ {
205
+ $paymentAction = $this->getConfigData('payment_action');
206
+ return empty($paymentAction) ? true : $paymentAction;
207
+ }
208
+ }
app/code/community/Phoenix/Moneybookers/Model/Acc.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Acc extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_acc';
26
+ protected $_paymentMethod = 'ACC';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Csi.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Csi extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_csi';
26
+ protected $_paymentMethod = 'CSI';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Did.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Did extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_did';
26
+ protected $_paymentMethod = 'DID';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Dnk.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Dnk extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_dnk';
26
+ protected $_paymentMethod = 'DNK';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Ebt.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Ebt extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_ebt';
26
+ protected $_paymentMethod = 'EBT';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Ent.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Ent extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_ent';
26
+ protected $_paymentMethod = 'ENT';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Event.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
21
+ /**
22
+ * Moneybookers notification processor model
23
+ */
24
+ class Phoenix_Moneybookers_Model_Event
25
+ {
26
+ const MONEYBOOKERS_STATUS_FAIL = -2;
27
+ const MONEYBOOKERS_STATUS_CANCEL = -1;
28
+ const MONEYBOOKERS_STATUS_PENDING = 0;
29
+ const MONEYBOOKERS_STATUS_SUCCESS = 2;
30
+
31
+ /*
32
+ * @param Mage_Sales_Model_Order
33
+ */
34
+ protected $_order = null;
35
+
36
+ /**
37
+ * Event request data
38
+ * @var array
39
+ */
40
+ protected $_eventData = array();
41
+
42
+ /**
43
+ * Enent request data setter
44
+ * @param array $data
45
+ * @return Phoenix_Moneybookers_Model_Event
46
+ */
47
+ public function setEventData(array $data)
48
+ {
49
+ $this->_eventData = $data;
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ * Event request data getter
55
+ * @param string $key
56
+ * @return array|string
57
+ */
58
+ public function getEventData($key = null)
59
+ {
60
+ if (null === $key) {
61
+ return $this->_eventData;
62
+ }
63
+ return isset($this->_eventData[$key]) ? $this->_eventData[$key] : null;
64
+ }
65
+
66
+ /**
67
+ * Get singleton of Checkout Session Model
68
+ *
69
+ * @return Mage_Checkout_Model_Session
70
+ */
71
+ protected function _getCheckout()
72
+ {
73
+ return Mage::getSingleton('checkout/session');
74
+ }
75
+
76
+ /**
77
+ * Process status notification from Monebookers server
78
+ *
79
+ * @return String
80
+ */
81
+ public function processStatusEvent()
82
+ {
83
+ try {
84
+ $params = $this->_validateEventData();
85
+ $msg = '';
86
+ switch($params['status']) {
87
+ case self::MONEYBOOKERS_STATUS_FAIL: //fail
88
+ $msg = Mage::helper('moneybookers')->__('Payment failed.');
89
+ $this->_processCancel($msg);
90
+ break;
91
+ case self::MONEYBOOKERS_STATUS_CANCEL: //cancel
92
+ $msg = Mage::helper('moneybookers')->__('Payment was canceled.');
93
+ $this->_processCancel($msg);
94
+ break;
95
+ case self::MONEYBOOKERS_STATUS_PENDING: //pending
96
+ $msg = Mage::helper('moneybookers')->__('Pending bank transfer created.');
97
+ $this->_processSale($params['status'], $msg);
98
+ break;
99
+ case self::MONEYBOOKERS_STATUS_SUCCESS: //ok
100
+ $msg = Mage::helper('moneybookers')->__('The amount has been authorized and captured by Moneybookers.');
101
+ $this->_processSale($params['status'], $msg);
102
+ break;
103
+ }
104
+ return $msg;
105
+ } catch (Mage_Core_Exception $e) {
106
+ return $e->getMessage();
107
+ } catch(Exception $e) {
108
+ Mage::logException($e);
109
+ }
110
+ return;
111
+ }
112
+
113
+ /**
114
+ * Process cancelation
115
+ */
116
+ public function cancelEvent() {
117
+ try {
118
+ $this->_validateEventData(false);
119
+ $this->_processCancel('Payment was canceled.');
120
+ return Mage::helper('moneybookers')->__('The order has been canceled.');
121
+ } catch (Mage_Core_Exception $e) {
122
+ return $e->getMessage();
123
+ } catch(Exception $e) {
124
+ Mage::logException($e);
125
+ }
126
+ return '';
127
+ }
128
+
129
+ /**
130
+ * Validate request and return QuoteId
131
+ * Can throw Mage_Core_Exception and Exception
132
+ *
133
+ * @return int
134
+ */
135
+ public function successEvent(){
136
+ $this->_validateEventData(false);
137
+ return $this->_order->getQuoteId();
138
+ }
139
+
140
+ /**
141
+ * Processed order cancelation
142
+ * @param string $msg Order history message
143
+ */
144
+ protected function _processCancel($msg)
145
+ {
146
+ $this->_order->cancel();
147
+ $this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_CANCELED, $msg);
148
+ $this->_order->save();
149
+ }
150
+
151
+ /**
152
+ * Processes payment confirmation, creates invoice if necessary, updates order status,
153
+ * sends order confirmation to customer
154
+ * @param string $msg Order history message
155
+ */
156
+ protected function _processSale($status, $msg)
157
+ {
158
+ switch ($status) {
159
+ case self::MONEYBOOKERS_STATUS_SUCCESS:
160
+ $this->_createInvoice();
161
+ $this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $msg);
162
+ // save transaction ID
163
+ $this->_order->getPayment()->setLastTransId($this->getEventData('mb_transaction_id'));
164
+ // send new order email
165
+ $this->_order->sendNewOrderEmail();
166
+ $this->_order->setEmailSent(true);
167
+ break;
168
+ case self::MONEYBOOKERS_STATUS_PENDING:
169
+ $this->_order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, $msg);
170
+ // save transaction ID
171
+ $this->_order->getPayment()->setLastTransId($this->getEventData('mb_transaction_id'));
172
+ break;
173
+ }
174
+ $this->_order->save();
175
+ }
176
+
177
+ /**
178
+ * Builds invoice for order
179
+ */
180
+ protected function _createInvoice()
181
+ {
182
+ if (!$this->_order->canInvoice()) {
183
+ return;
184
+ }
185
+ $invoice = $this->_order->prepareInvoice();
186
+ $invoice->register()->capture();
187
+ $this->_order->addRelatedObject($invoice);
188
+ }
189
+
190
+ /**
191
+ * Checking returned parameters
192
+ * Thorws Mage_Core_Exception if error
193
+ * @param bool $fullCheck Whether to make additional validations such as payment status, transaction signature etc.
194
+ *
195
+ * @return array $params request params
196
+ */
197
+ protected function _validateEventData($fullCheck = true)
198
+ {
199
+ // get request variables
200
+ $params = $this->_eventData;
201
+ if (empty($params)) {
202
+ Mage::throwException('Request does not contain any elements.');
203
+ }
204
+
205
+ // check order ID
206
+ if (empty($params['transaction_id'])
207
+ || ($fullCheck == false && $this->_getCheckout()->getMoneybookersRealOrderId() != $params['transaction_id']))
208
+ {
209
+ Mage::throwException('Missing or invalid order ID.');
210
+ }
211
+ // load order for further validation
212
+ $this->_order = Mage::getModel('sales/order')->loadByIncrementId($params['transaction_id']);
213
+ if (!$this->_order->getId())
214
+ Mage::throwException('Order not found.');
215
+
216
+ // make additional validation
217
+ if ($fullCheck) {
218
+ // check payment status
219
+ if (empty($params['status'])) {
220
+ Mage::throwException('Unknown payment status.');
221
+ }
222
+
223
+ // check transaction signature
224
+ if (empty($params['md5sig'])) {
225
+ Mage::throwException('Invalid transaction signature.');
226
+ }
227
+
228
+ $checkParams = array('merchant_id', 'transaction_id', 'secret', 'mb_amount', 'mb_currency', 'status');
229
+ $md5String = '';
230
+ foreach ($checkParams as $key) {
231
+ if ($key == 'merchant_id') {
232
+ $md5String .= Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_CUSTOMER_ID, $this->_order->getStoreId());
233
+ } elseif ($key == 'secret') {
234
+ $md5String .= strtoupper(md5(Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_SECRET_KEY, $this->_order->getStoreId())));
235
+ } elseif (isset($params[$key])) {
236
+ $md5String .= $params[$key];
237
+ }
238
+ }
239
+ $md5String = strtoupper(md5($md5String));
240
+
241
+ if ($md5String != $params['md5sig']) {
242
+ Mage::throwException('Hash is not valid.');
243
+ }
244
+
245
+ // check transaction amount if currency matches
246
+ if ($this->_order->getOrderCurrencyCode() == $params['mb_currency']) {
247
+ if (round($this->_order->getGrandTotal(), 2) != $params['mb_amount']) {
248
+ Mage::throwException('Transaction amount does not match.');
249
+ }
250
+ }
251
+ }
252
+ return $params;
253
+ }
254
+ }
app/code/community/Phoenix/Moneybookers/Model/Gcb.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Gcb extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_gcb';
26
+ protected $_paymentMethod = 'GCB';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Gir.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Gir extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_gir';
26
+ protected $_paymentMethod = 'GIR';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Idl.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Idl extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_idl';
26
+ protected $_paymentMethod = 'IDL';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Lsr.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Lsr extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_lsr';
26
+ protected $_paymentMethod = 'LSR';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Mae.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Mae extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_mae';
26
+ protected $_paymentMethod = 'MAE';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Npy.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Npy extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_npy';
26
+ protected $_paymentMethod = 'NPY';
27
+ }
app/code/community/Phoenix/Moneybookers/Model/Obt.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Model_Obt extends Phoenix_Moneybookers_Model_Abstract
21
+ {
22
+ /**
23
+ * unique internal payment method identifier
24
+ */
25
+ protected $_code = 'moneybookers_obt';
26
+ protected $_paymentMethod = 'OBT';
27
+ }