pn_sofortueberweisung - Version 1.1.4

Version Notes

- fixed problem with module not being deactivated properly
- changed sending of email

Download this release

Release Info

Developer Magento Core Team
Extension pn_sofortueberweisung
Version 1.1.4
Comparing to
See all releases


Version 1.1.4

Files changed (58) hide show
  1. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung.php +12 -0
  2. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit.php +63 -0
  3. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Form.php +36 -0
  4. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Tab/Form.php +70 -0
  5. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Tabs.php +42 -0
  6. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Grid.php +152 -0
  7. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Paycode.php +41 -0
  8. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Pnsofortueberweisung.php +63 -0
  9. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Info/Paycode.php +62 -0
  10. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Info/Pnsofortueberweisung.php +62 -0
  11. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Infobox.php +28 -0
  12. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Pnsofortueberweisung.php +50 -0
  13. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Pnsofortueberweisungnotice.php +28 -0
  14. app/code/community/Paymentnetwork/Pnsofortueberweisung/Helper/Data.php +346 -0
  15. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Convert/Order.php +44 -0
  16. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Convert/Quote.php +45 -0
  17. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Data/Form/Element/Link.php +54 -0
  18. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Mysql4/Pnsofortueberweisung.php +10 -0
  19. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Mysql4/Pnsofortueberweisung/Collection.php +10 -0
  20. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Mysql4/Setup.php +24 -0
  21. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Params.php +21 -0
  22. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Paycode.php +227 -0
  23. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Pnsofortueberweisung.php +174 -0
  24. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Status.php +15 -0
  25. app/code/community/Paymentnetwork/Pnsofortueberweisung/controllers/Adminhtml/PnsofortueberweisungController.php +117 -0
  26. app/code/community/Paymentnetwork/Pnsofortueberweisung/controllers/PcsofortueberweisungController.php +198 -0
  27. app/code/community/Paymentnetwork/Pnsofortueberweisung/controllers/PnsofortueberweisungController.php +225 -0
  28. app/code/community/Paymentnetwork/Pnsofortueberweisung/etc/config.xml +267 -0
  29. app/code/community/Paymentnetwork/Pnsofortueberweisung/etc/system.xml +144 -0
  30. app/code/community/Paymentnetwork/Pnsofortueberweisung/sql/pnsofortueberweisung_setup/mysql4-install-1.1.1.php +30 -0
  31. app/design/adminhtml/default/default/template/pnsofortueberweisung/form/paycode.phtml +21 -0
  32. app/design/adminhtml/default/default/template/pnsofortueberweisung/form/sofortueberweisung.phtml +21 -0
  33. app/design/adminhtml/default/default/template/pnsofortueberweisung/info/paycode.phtml +28 -0
  34. app/design/adminhtml/default/default/template/pnsofortueberweisung/info/pdf/paycode.phtml +27 -0
  35. app/design/adminhtml/default/default/template/pnsofortueberweisung/info/pdf/sofortueberweisung.phtml +26 -0
  36. app/design/adminhtml/default/default/template/pnsofortueberweisung/info/sofortueberweisung.phtml +25 -0
  37. app/design/frontend/default/default/layout/pnsofortueberweisung.xml +27 -0
  38. app/design/frontend/default/default/template/pnsofortueberweisung/form/paycode.phtml +39 -0
  39. app/design/frontend/default/default/template/pnsofortueberweisung/form/sofortueberweisung.phtml +41 -0
  40. app/design/frontend/default/default/template/pnsofortueberweisung/info/paycode.phtml +39 -0
  41. app/design/frontend/default/default/template/pnsofortueberweisung/info/sofortueberweisung.phtml +34 -0
  42. app/design/frontend/default/default/template/pnsofortueberweisung/infobox.phtml +42 -0
  43. app/design/frontend/default/default/template/pnsofortueberweisung/notice.phtml +2 -0
  44. app/etc/modules/Paymentnetwork_Sofortueberweisung.xml +11 -0
  45. app/locale/de_AT/Paymentnetwork_Sofortueberweisung.csv +46 -0
  46. app/locale/de_CH/Paymentnetwork_Sofortueberweisung.csv +46 -0
  47. app/locale/de_DE/Paymentnetwork_Sofortueberweisung.csv +46 -0
  48. app/locale/en_US/Paymentnetwork_Sofortueberweisung.csv +46 -0
  49. app/locale/fr_FR/Paymentnetwork_Sofortueberweisung.csv +46 -0
  50. app/locale/it_IT/Paymentnetwork_Sofortueberweisung.csv +46 -0
  51. app/locale/nl_NL/Paymentnetwork_Sofortueberweisung.csv +46 -0
  52. lib/Varien/Data/Form/Element/Linkpnso.php +117 -0
  53. package.xml +21 -0
  54. skin/frontend/default/default/images/pnsofortueberweisung/logo_paycode_198.gif +0 -0
  55. skin/frontend/default/default/images/pnsofortueberweisung/logo_sofortueberweisung170.jpg +0 -0
  56. skin/frontend/default/default/images/pnsofortueberweisung/logo_sofortueberweisung200.jpg +0 -0
  57. skin/frontend/default/default/images/pnsofortueberweisung/logo_tuev_144px.gif +0 -0
  58. skin/frontend/default/default/images/pnsofortueberweisung/piktogram.jpg +0 -0
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung.php ADDED
@@ -0,0 +1,12 @@
1
+ <?php
2
+ class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_pnsofortueberweisung';
7
+ $this->_blockGroup = 'pnsofortueberweisung';
8
+ $this->_headerText = Mage::helper('pnsofortueberweisung')->__('Item Manager');
9
+ $this->_addButtonLabel = Mage::helper('pnsofortueberweisung')->__('Add Item');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit.php ADDED
@@ -0,0 +1,63 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Edit.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
22
+ {
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+
27
+ $this->_objectId = 'id';
28
+ $this->_blockGroup = 'pnsofortueberweisung';
29
+ $this->_controller = 'adminhtml_pnsofortueberweisung';
30
+
31
+ $this->_updateButton('save', 'label', Mage::helper('pnsofortueberweisung')->__('Save Item'));
32
+ $this->_updateButton('delete', 'label', Mage::helper('pnsofortueberweisung')->__('Delete Item'));
33
+
34
+ $this->_addButton('saveandcontinue', array(
35
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
36
+ 'onclick' => 'saveAndContinueEdit()',
37
+ 'class' => 'save',
38
+ ), -100);
39
+
40
+ $this->_formScripts[] = "
41
+ function toggleEditor() {
42
+ if (tinyMCE.getInstanceById('pnsofortueberweisung_content') == null) {
43
+ tinyMCE.execCommand('mceAddControl', false, 'pnsofortueberweisung_content');
44
+ } else {
45
+ tinyMCE.execCommand('mceRemoveControl', false, 'pnsofortueberweisung_content');
46
+ }
47
+ }
48
+
49
+ function saveAndContinueEdit(){
50
+ editForm.submit($('edit_form').action+'back/edit/');
51
+ }
52
+ ";
53
+ }
54
+
55
+ public function getHeaderText()
56
+ {
57
+ if( Mage::registry('pnsofortueberweisung_data') && Mage::registry('pnsofortueberweisung_data')->getId() ) {
58
+ return Mage::helper('pnsofortueberweisung')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('pnsofortueberweisung_data')->getTitle()));
59
+ } else {
60
+ return Mage::helper('pnsofortueberweisung')->__('Add Item');
61
+ }
62
+ }
63
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Form.php ADDED
@@ -0,0 +1,36 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Form.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
22
+ {
23
+ protected function _prepareForm()
24
+ {
25
+ $form = new Varien_Data_Form(array(
26
+ 'id' => 'edit_form',
27
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
28
+ 'method' => 'post',
29
+ )
30
+ );
31
+
32
+ $form->setUseContainer(true);
33
+ $this->setForm($form);
34
+ return parent::_prepareForm();
35
+ }
36
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Tab/Form.php ADDED
@@ -0,0 +1,70 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Form.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
22
+ {
23
+ protected function _prepareForm()
24
+ {
25
+ $form = new Varien_Data_Form();
26
+ $this->setForm($form);
27
+ $fieldset = $form->addFieldset('pnsofortueberweisung_form', array('legend'=>Mage::helper('pnsofortueberweisung')->__('Item information')));
28
+
29
+ $fieldset->addField('title', 'text', array(
30
+ 'label' => Mage::helper('pnsofortueberweisung')->__('Title'),
31
+ 'class' => 'required-entry',
32
+ 'required' => true,
33
+ 'name' => 'title',
34
+ ));
35
+
36
+ $fieldset->addField('status', 'select', array(
37
+ 'label' => Mage::helper('pnsofortueberweisung')->__('Status'),
38
+ 'name' => 'status',
39
+ 'values' => array(
40
+ array(
41
+ 'value' => 1,
42
+ 'label' => Mage::helper('pnsofortueberweisung')->__('Enabled'),
43
+ ),
44
+
45
+ array(
46
+ 'value' => 2,
47
+ 'label' => Mage::helper('pnsofortueberweisung')->__('Disabled'),
48
+ ),
49
+ ),
50
+ ));
51
+
52
+ $fieldset->addField('content', 'editor', array(
53
+ 'name' => 'content',
54
+ 'label' => Mage::helper('pnsofortueberweisung')->__('Content'),
55
+ 'title' => Mage::helper('pnsofortueberweisung')->__('Content'),
56
+ 'style' => 'width:700px; height:500px;',
57
+ 'wysiwyg' => false,
58
+ 'required' => true,
59
+ ));
60
+
61
+ if ( Mage::getSingleton('adminhtml/session')->getSofortueberweisungData() )
62
+ {
63
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getSofortueberweisungData());
64
+ Mage::getSingleton('adminhtml/session')->setSofortueberweisungData(null);
65
+ } elseif ( Mage::registry('pnsofortueberweisung_data') ) {
66
+ $form->setValues(Mage::registry('pnsofortueberweisung_data')->getData());
67
+ }
68
+ return parent::_prepareForm();
69
+ }
70
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Tabs.php ADDED
@@ -0,0 +1,42 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Tabs.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
22
+ {
23
+
24
+ public function __construct()
25
+ {
26
+ parent::__construct();
27
+ $this->setId('pnsofortueberweisung_tabs');
28
+ $this->setDestElementId('edit_form');
29
+ $this->setTitle(Mage::helper('pnsofortueberweisung')->__('Item Information'));
30
+ }
31
+
32
+ protected function _beforeToHtml()
33
+ {
34
+ $this->addTab('form_section', array(
35
+ 'label' => Mage::helper('pnsofortueberweisung')->__('Item Information'),
36
+ 'title' => Mage::helper('pnsofortueberweisung')->__('Item Information'),
37
+ 'content' => $this->getLayout()->createBlock('pnsofortueberweisung/adminhtml_sofortueberweisung_edit_tab_form')->toHtml(),
38
+ ));
39
+
40
+ return parent::_beforeToHtml();
41
+ }
42
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Grid.php ADDED
@@ -0,0 +1,152 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Grid.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Grid extends Mage_Adminhtml_Block_Widget_Grid
22
+ {
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('pnsofortueberweisungGrid');
27
+ $this->setDefaultSort('pnsofortueberweisung_id');
28
+ $this->setDefaultDir('ASC');
29
+ $this->setSaveParametersInSession(true);
30
+ }
31
+
32
+ protected function _prepareCollection()
33
+ {
34
+ $collection = Mage::getModel('pnsofortueberweisung/pnsofortueberweisung')->getCollection();
35
+ $this->setCollection($collection);
36
+ return parent::_prepareCollection();
37
+ }
38
+
39
+ protected function _prepareColumns()
40
+ {
41
+ $this->addColumn('pnsofortueberweisung_id', array(
42
+ 'header' => Mage::helper('pnsofortueberweisung')->__('ID'),
43
+ 'align' =>'right',
44
+ 'width' => '50px',
45
+ 'index' => 'pnsofortueberweisung_id',
46
+ ));
47
+
48
+ $this->addColumn('title', array(
49
+ 'header' => Mage::helper('pnsofortueberweisung')->__('Title'),
50
+ 'align' =>'left',
51
+ 'index' => 'title',
52
+ ));
53
+
54
+ /*
55
+ $this->addColumn('content', array(
56
+ 'header' => Mage::helper('sofortueberweisung')->__('Item Content'),
57
+ 'width' => '150px',
58
+ 'index' => 'content',
59
+ ));
60
+ */
61
+
62
+ $this->addColumn('created_time', array(
63
+ 'header' => Mage::helper('pnsofortueberweisung')->__('Creation Time'),
64
+ 'align' => 'left',
65
+ 'width' => '120px',
66
+ 'type' => 'date',
67
+ 'default' => '--',
68
+ 'index' => 'created_time',
69
+ ));
70
+
71
+ $this->addColumn('update_time', array(
72
+ 'header' => Mage::helper('pnsofortueberweisung')->__('Update Time'),
73
+ 'align' => 'left',
74
+ 'width' => '120px',
75
+ 'type' => 'date',
76
+ 'default' => '--',
77
+ 'index' => 'update_time',
78
+ ));
79
+
80
+ $this->addColumn('status', array(
81
+ 'header' => Mage::helper('pnsofortueberweisung')->__('Status'),
82
+ 'align' => 'left',
83
+ 'width' => '80px',
84
+ 'index' => 'status',
85
+ 'type' => 'options',
86
+ 'options' => array(
87
+ 1 => 'Enabled',
88
+ 2 => 'Disabled',
89
+ ),
90
+ ));
91
+
92
+ $this->addColumn('action',
93
+ array(
94
+ 'header' => Mage::helper('pnsofortueberweisung')->__('Action'),
95
+ 'width' => '100',
96
+ 'type' => 'action',
97
+ 'getter' => 'getId',
98
+ 'actions' => array(
99
+ array(
100
+ 'caption' => Mage::helper('pnsofortueberweisung')->__('Edit'),
101
+ 'url' => array('base'=> '*/*/edit'),
102
+ 'field' => 'id'
103
+ )
104
+ ),
105
+ 'filter' => false,
106
+ 'sortable' => false,
107
+ 'index' => 'stores',
108
+ 'is_system' => true,
109
+ ));
110
+
111
+ $this->addExportType('*/*/exportCsv', Mage::helper('pnsofortueberweisung')->__('CSV'));
112
+ $this->addExportType('*/*/exportXml', Mage::helper('pnsofortueberweisung')->__('XML'));
113
+
114
+ return parent::_prepareColumns();
115
+ }
116
+
117
+ protected function _prepareMassaction()
118
+ {
119
+ $this->setMassactionIdField('pnsofortueberweisung_id');
120
+ $this->getMassactionBlock()->setFormFieldName('pnsofortueberweisung');
121
+
122
+ $this->getMassactionBlock()->addItem('delete', array(
123
+ 'label' => Mage::helper('pnsofortueberweisung')->__('Delete'),
124
+ 'url' => $this->getUrl('*/*/massDelete'),
125
+ 'confirm' => Mage::helper('sofortueberweisung')->__('Are you sure?')
126
+ ));
127
+
128
+ $statuses = Mage::getSingleton('pnsofortueberweisung/status')->getOptionArray();
129
+
130
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
131
+ $this->getMassactionBlock()->addItem('status', array(
132
+ 'label'=> Mage::helper('pnsofortueberweisung')->__('Change status'),
133
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
134
+ 'additional' => array(
135
+ 'visibility' => array(
136
+ 'name' => 'status',
137
+ 'type' => 'select',
138
+ 'class' => 'required-entry',
139
+ 'label' => Mage::helper('pnsofortueberweisung')->__('Status'),
140
+ 'values' => $statuses
141
+ )
142
+ )
143
+ ));
144
+ return $this;
145
+ }
146
+
147
+ public function getRowUrl($row)
148
+ {
149
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
150
+ }
151
+
152
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Paycode.php ADDED
@@ -0,0 +1,41 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Paycode.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Form_Paycode extends Mage_Payment_Block_Form
22
+ {
23
+ /**
24
+ * Init default template for block
25
+ */
26
+ protected function _construct()
27
+ {
28
+ parent::_construct();
29
+ $this->setTemplate('pnsofortueberweisung/form/paycode.phtml');
30
+ }
31
+
32
+ /**
33
+ * Retrieve payment configuration object
34
+ *
35
+ * @return Mage_Payment_Model_Config
36
+ */
37
+ protected function _getConfig()
38
+ {
39
+ return Mage::getSingleton('payment/config');
40
+ }
41
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Pnsofortueberweisung.php ADDED
@@ -0,0 +1,63 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Pnsofortueberweisung.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Form_Pnsofortueberweisung extends Mage_Payment_Block_Form
22
+ {
23
+ /**
24
+ * Init default template for block
25
+ */
26
+ protected function _construct()
27
+ {
28
+ parent::_construct();
29
+ $this->setTemplate('pnsofortueberweisung/form/sofortueberweisung.phtml');
30
+ }
31
+
32
+ /**
33
+ * Retrieve payment configuration object
34
+ *
35
+ * @return Mage_Payment_Model_Config
36
+ */
37
+ protected function _getConfig()
38
+ {
39
+ return Mage::getSingleton('payment/config');
40
+ }
41
+
42
+ public function getNetherlandBanks($selected)
43
+ {
44
+ $bankArray = Array(
45
+ 'NL_101' => 'ING Calculator',
46
+ 'NL_102' => 'Fortis Bank',
47
+ 'NL_103' => 'ABN Amro Bank',
48
+ 'NL_104' => 'SNS Bank',
49
+ 'NL_105' => 'Rabobank',
50
+ 'NL_106' => 'ING Wachtwoord',
51
+ 'NL_109' => 'SNS Regio Bank',
52
+ );
53
+
54
+ foreach($bankArray AS $key => $val){
55
+ $selectArray[$key] = Array('value' => $val,'selected' => 0);
56
+ if($key == $selected){
57
+ $selectArray[$key]['selected'] = 1;
58
+ }
59
+ }
60
+
61
+ return $selectArray;
62
+ }
63
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Info/Paycode.php ADDED
@@ -0,0 +1,62 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Paycode.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Info_Paycode extends Mage_Payment_Block_Info
22
+ {
23
+ /**
24
+ * Init default template for block
25
+ */
26
+ protected function _construct()
27
+ {
28
+ parent::_construct();
29
+ $this->setTemplate('pnsofortueberweisung/info/paycode.phtml');
30
+ }
31
+
32
+ /**
33
+ * Retrieve info model
34
+ *
35
+ * @return Mage_Sofortueberweisung_Model_Info
36
+ */
37
+ public function getInfo()
38
+ {
39
+ $info = $this->getData('info');
40
+
41
+ if (!($info instanceof Mage_Payment_Model_Info)) {
42
+ Mage::throwException($this->__('Can not retrieve payment info model object.'));
43
+ }
44
+ return $info;
45
+ }
46
+
47
+ /**
48
+ * Retrieve payment method model
49
+ *
50
+ * @return Mage_Payment_Model_Method_Abstract
51
+ */
52
+ public function getMethod()
53
+ {
54
+ return $this->getInfo()->getMethodInstance();
55
+ }
56
+
57
+ public function toPdf()
58
+ {
59
+ $this->setTemplate('pnsofortueberweisung/info/pdf/paycode.phtml');
60
+ return $this->toHtml();
61
+ }
62
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Info/Pnsofortueberweisung.php ADDED
@@ -0,0 +1,62 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Pnsofortueberweisung.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Info_Pnsofortueberweisung extends Mage_Payment_Block_Info
22
+ {
23
+ /**
24
+ * Init default template for block
25
+ */
26
+ protected function _construct()
27
+ {
28
+ parent::_construct();
29
+ $this->setTemplate('pnsofortueberweisung/info/sofortueberweisung.phtml');
30
+ }
31
+
32
+ /**
33
+ * Retrieve info model
34
+ *
35
+ * @return Mage_Sofortueberweisung_Model_Info
36
+ */
37
+ public function getInfo()
38
+ {
39
+ $info = $this->getData('info');
40
+
41
+ if (!($info instanceof Mage_Payment_Model_Info)) {
42
+ Mage::throwException($this->__('Can not retrieve payment info model object.'));
43
+ }
44
+ return $info;
45
+ }
46
+
47
+ /**
48
+ * Retrieve payment method model
49
+ *
50
+ * @return Mage_Payment_Model_Method_Abstract
51
+ */
52
+ public function getMethod()
53
+ {
54
+ return $this->getInfo()->getMethodInstance();
55
+ }
56
+
57
+ public function toPdf()
58
+ {
59
+ $this->setTemplate('pnsofortueberweisung/info/pdf/sofortueberweisung.phtml');
60
+ return $this->toHtml();
61
+ }
62
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Infobox.php ADDED
@@ -0,0 +1,28 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Infobox.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Infobox extends Mage_Core_Block_Template
22
+ {
23
+ protected function _construct()
24
+ {
25
+ parent::_construct();
26
+ $this->setTemplate('pnsofortueberweisung/infobox.phtml');
27
+ }
28
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Pnsofortueberweisung.php ADDED
@@ -0,0 +1,50 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Pnsofortueberweisung.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Pnsofortueberweisung extends Mage_Core_Block_Abstract
22
+ {
23
+ protected function _toHtml()
24
+ {
25
+ $payment = $this->getOrder()->getPayment()->getMethodInstance();
26
+
27
+ if($payment->getConfigData('project_pswd')){
28
+ $form = new Varien_Data_Form();
29
+ $form->setAction($payment->getUrl())
30
+ ->setId('pnsofortueberweisung')
31
+ ->setName('pnsofortueberweisung')
32
+ ->setMethod('POST')
33
+ ->setUseContainer(true);
34
+
35
+ foreach ($payment->getFormFields() as $field=>$value) {
36
+ $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
37
+ }
38
+ $html = '<html><body>';
39
+ $html.= $this->__('You will be redirected to Sofortueberweisung in a few seconds.');
40
+ $html.= $form->toHtml();
41
+ $html.= '<script type="text/javascript">document.getElementById("pnsofortueberweisung").submit();</script>';
42
+ $html.= '</body></html>';
43
+
44
+ return $html;
45
+ }else{
46
+ $html = $this->__('Theres no password defined');
47
+ return $html;
48
+ }
49
+ }
50
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Pnsofortueberweisungnotice.php ADDED
@@ -0,0 +1,28 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Pnsofortueberweisungnotice.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Block_Pnsofortueberweisungnotice extends Mage_Core_Block_Template
22
+ {
23
+ protected function _construct()
24
+ {
25
+ parent::_construct();
26
+ $this->setTemplate('pnsofortueberweisung/notice.phtml');
27
+ }
28
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Helper/Data.php ADDED
@@ -0,0 +1,346 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Data.php 278 2010-08-12 15:31:55Z poser $
20
+ */
21
+
22
+ class Paymentnetwork_Pnsofortueberweisung_Helper_Data extends Mage_Core_Helper_Abstract
23
+ {
24
+ var $hashfunction;
25
+ var $password;
26
+ var $password2;
27
+ var $formActionUrl;
28
+ var $version;
29
+
30
+
31
+
32
+ function classPnSofortueberweisung($password = '', $hashfunction = 'sha1') {
33
+
34
+ $this->password = $password;
35
+ $this->password2 = '';
36
+ $this->hashfunction = $hashfunction;
37
+ $this->version = 'pn_mag_1.1.4';
38
+ $this->formActionUrl = 'https://www.sofortueberweisung.de/payment/start?';
39
+
40
+
41
+ return true;
42
+ }
43
+
44
+ /**
45
+ * @param int $userId
46
+ * @param int $projectId
47
+ * @param string $amount
48
+ * @param string $currency EUR|CHF
49
+ * @param string [optional] $reason1
50
+ * @param string [optional] $reason2
51
+ * @param string [optional] $userVariable0
52
+ * @param string [optional] $userVariable1
53
+ * @param string [optional] $userVariable2
54
+ * @param string [optional] $userVariable3
55
+ * @param string [optional] $userVariable4
56
+ * @param string [optional] $userVariable5
57
+ * @param string [optional] $senderHolder
58
+ * @param string [optional] $senderAccountNumber
59
+ * @param string [optional] $senderBankCode
60
+ * @param string [optional] $senderCountryId
61
+ * @return string url with urlencoded variables
62
+ */
63
+ function getPaymentUrl($userId, $projectId, $amount, $currency,
64
+ $reason1 = '' , $reason2 = '' , $userVariable0 = '' , $userVariable1 = '' , $userVariable2 = '' ,
65
+ $userVariable3 = '' , $userVariable4 = '' , $userVariable5 = '',
66
+ $senderHolder = '', $senderAccountNumber = '', $senderBankCode = '', $senderCountryId = ''){
67
+
68
+
69
+ $data = $this->getPaymentParameters($userId, $projectId, $amount, $currency,
70
+ $reason1, $reason2, $userVariable0, $userVariable1, $userVariable2,
71
+ $userVariable3, $userVariable4, $userVariable5,
72
+ $senderHolder, $senderAccountNumber, $senderBankCode, $senderCountryId);
73
+
74
+ $dataString = '';
75
+ foreach ($data as $key => $value) {
76
+ $dataString .= $key.'='.urlencode($value).'&';
77
+ }
78
+ $dataString = substr($dataString, 0, -1); //remove last &
79
+
80
+ return $this->formActionUrl.$dataString;
81
+ }
82
+
83
+ /**
84
+ * @param int $userId
85
+ * @param int $projectId
86
+ * @param string $amount
87
+ * @param string $currency EUR|CHF
88
+ * @param string [optional] $reason1
89
+ * @param string [optional] $reason2
90
+ * @param string [optional] $userVariable0
91
+ * @param string [optional] $userVariable1
92
+ * @param string [optional] $userVariable2
93
+ * @param string [optional] $userVariable3
94
+ * @param string [optional] $userVariable4
95
+ * @param string [optional] $userVariable5
96
+ * @param string [optional] $senderHolder
97
+ * @param string [optional] $senderAccountNumber
98
+ * @param string [optional] $senderBankCode
99
+ * @param string [optional] $senderCountryId
100
+ * @return array array with parameters for payment message
101
+ */
102
+ function getPaymentParameters($userId, $projectId, $amount, $currency,
103
+ $reason1 = '' , $reason2 = '' , $userVariable0 = '' , $userVariable1 = '' , $userVariable2 = '' ,
104
+ $userVariable3 = '' , $userVariable4 = '' , $userVariable5 = '',
105
+ $senderHolder = '', $senderAccountNumber = '', $senderBankCode = '', $senderCountryId = '') {
106
+
107
+ $tmparray = array(
108
+ $userId,
109
+ $projectId,
110
+ $senderHolder,
111
+ $senderAccountNumber,
112
+ $senderBankCode,
113
+ $senderCountryId,
114
+ $amount,
115
+ $currency,
116
+ $reason1,
117
+ $reason2,
118
+ $userVariable0,
119
+ $userVariable1,
120
+ $userVariable2,
121
+ $userVariable3,
122
+ $userVariable4,
123
+ $userVariable5,
124
+ $this->password);
125
+
126
+ $hash = $this->generateHash(implode("|", $tmparray));
127
+
128
+ $data['user_id'] = $userId;
129
+ $data['project_id'] = $projectId;
130
+ $data['amount'] = $amount;
131
+ $data['currency_id'] = $currency;
132
+ $data['reason_1'] = $reason1;
133
+ $data['reason_2'] = $reason2;
134
+ $data['user_variable_0'] = $userVariable0;
135
+ $data['user_variable_1'] = $userVariable1;
136
+ $data['user_variable_2'] = $userVariable2;
137
+ $data['user_variable_3'] = $userVariable3;
138
+ $data['user_variable_4'] = $userVariable4;
139
+ $data['user_variable_5'] = $userVariable5;
140
+ $data['hash'] = $hash;
141
+ $data['encoding'] = 'UTF-8';
142
+ $data['payment_module'] = $this->version;
143
+ $data['interface_version'] = $this->version;
144
+
145
+ return $data;
146
+ }
147
+
148
+ /**
149
+ * checks server response and gets parameters
150
+ * @return $data array|string response parameters or ERROR_WRONG_HASH|ERROR_NO_ORDER_DETAILS if error
151
+ *
152
+ */
153
+ function getNotification(){
154
+
155
+ $fields = array(
156
+ 'transaction', 'user_id', 'project_id',
157
+ 'sender_holder', 'sender_account_number', 'sender_bank_code', 'sender_bank_name', 'sender_bank_bic', 'sender_iban', 'sender_country_id',
158
+ 'recipient_holder', 'recipient_account_number', 'recipient_bank_code', 'recipient_bank_name', 'recipient_bank_bic', 'recipient_iban', 'recipient_country_id',
159
+ 'international_transaction', 'amount', 'currency_id',
160
+ 'reason_1', 'reason_2',
161
+ 'security_criteria',
162
+ 'user_variable_0', 'user_variable_1', 'user_variable_2', 'user_variable_3', 'user_variable_4', 'user_variable_5',
163
+ 'created'
164
+ );
165
+
166
+ $data = array();
167
+ foreach($fields as $key) {
168
+ $data[$key] = $_POST[$key];
169
+ }
170
+
171
+ //sanitize input
172
+ $data['amount'] = number_format($data['amount'], 2, '.', '');
173
+ $data['transaction'] = preg_replace('#[^A-Za-z0-9_-]+#', '', $data['transaction']);
174
+ $data['user_id'] = preg_replace('#[^0-9]+#', '', $data['user_id']);
175
+ $data['project_id'] = preg_replace('#[^0-9]+#', '', $data['project_id']);
176
+
177
+ if (empty($data['user_id']) || empty($data['project_id']) || empty($data['amount']) || empty($_POST['hash'])) {
178
+ return 'ERROR_NOTIFICATION_INCOMPLETE';
179
+ }
180
+
181
+ if(empty($this->password)) {
182
+ return 'ERROR_NO_PASSWORD';
183
+ }
184
+ $data['project_password'] = $this->password;
185
+
186
+ $validationhash = $this->generateHash(implode('|', $data));
187
+ $messagehash = $_POST['hash'];
188
+
189
+ if ($validationhash != $messagehash) {
190
+ return 'ERROR_WRONG_HASH';
191
+ }
192
+
193
+ return $data;
194
+ }
195
+
196
+ /**
197
+ * checks wich hash algorithms are supported by the server
198
+ * and returns the best one
199
+ *
200
+ * @return sha512|sha256|sha1|md5|empty string
201
+ */
202
+ function getSupportedHashAlgorithm() {
203
+
204
+ $algorithms = $this->getSupportedHashAlgorithms();
205
+
206
+ if(is_array($algorithms))
207
+ return $algorithms[0];
208
+ else
209
+ return ''; //no hash function found
210
+ }
211
+
212
+ /**
213
+ * checks wich hash algorithms are supported by the server
214
+ *
215
+ * @return array with all supported algorithms, preferred as first one (index 0)
216
+ */
217
+ function getSupportedHashAlgorithms() {
218
+
219
+ $algorithms = array();
220
+
221
+ if(function_exists('hash') && in_array('sha512', hash_algos()))
222
+ $algorithms[] = 'sha512';
223
+
224
+ if(function_exists('hash') && in_array('sha256', hash_algos()))
225
+ $algorithms[] = 'sha256';
226
+
227
+ if(function_exists('sha1')) //deprecated
228
+ $algorithms[] = 'sha1';
229
+
230
+ if(function_exists('md5')) //deprecated
231
+ $algorithms[] = 'md5';
232
+
233
+ return $algorithms;
234
+ }
235
+
236
+
237
+ /**
238
+ * generates a html-page that sets post-parameters and redirects to the SU-autoinstaller
239
+ * sets password, password2 and hashfunction
240
+ *
241
+ * @param unknown_type $projectName
242
+ * @param unknown_type $projectHomepage
243
+ * @param unknown_type $projectEmail
244
+ * @param unknown_type $projectLanguage
245
+ * @param unknown_type $currency
246
+ * @param unknown_type $cancelLink
247
+ * @param unknown_type $successLink
248
+ * @param unknown_type $notificationLink
249
+ * @param unknown_type $backLink
250
+ * @return string
251
+ */
252
+ function getAutoInstallPage($projectName, $projectHomepage, $projectEmail, $projectLanguage, $currency,
253
+ $cancelLink, $successLink, $notificationLink, $backLink, $shopSystemId){
254
+
255
+ $this->password = $this->generateRandomValue();
256
+ $this->password2 = $this->generateRandomValue();
257
+ $this->hashfunction = $this->getSupportedHashAlgorithm();
258
+
259
+ $html = '
260
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
261
+ <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
262
+ <head>
263
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
264
+ <title>Schnellregistrierung | sofortueberweisung.de</title>
265
+ </head>
266
+ <body onload="document.getElementById(\'form\').submit()">
267
+ <form method="post" action="https://www.sofortueberweisung.de/payment/createNew/" id="form">
268
+ <input type="hidden" name="project_name" value="'.$projectName.'">
269
+ <input type="hidden" name="project_homepage" value="'.$projectHomepage.'">
270
+ <input type="hidden" name="projectsnotification_email_email" value="'.$projectEmail.'">
271
+ <input type="hidden" name="projectsnotification_email_activated" value="1">
272
+ <input type="hidden" name="projectsnotification_email_language_id" value="'.$projectLanguage.'">
273
+ <input type="hidden" name="projectssetting_interface_cancel_link" value="'.$cancelLink.'">
274
+ <input type="hidden" name="projectssetting_interface_success_link_redirect" value="1">
275
+ <input type="hidden" name="projectssetting_interface_success_link" value="'.$successLink.'">
276
+ <input type="hidden" name="projectssetting_currency_id" value="'.$currency.'">
277
+ <input type="hidden" name="projectssetting_locked_amount" value="1">
278
+ <input type="hidden" name="projectssetting_locked_reason_1" value="1">
279
+ <input type="hidden" name="projectssetting_locked_reason_2" value="1">
280
+ <input type="hidden" name="projectssetting_interface_input_hash_check_enabled" value="1">
281
+ <input type="hidden" name="projectssetting_project_password" value="'.$this->password.'">
282
+ <input type="hidden" name="project_notification_password" value="'.$this->password2.'">
283
+ <input type="hidden" name="project_shop_system_id" value="'.$shopSystemId.'">
284
+ <input type="hidden" name="project_hash_algorithm" value="'.$this->hashfunction.'">
285
+ <input type="hidden" name="user_shop_system_id" value="'.$shopSystemId.'">
286
+ <input type="hidden" name="projectsnotification_http_activated" value="1">
287
+ <input type="hidden" name="projectsnotification_http_url" value="'.$notificationLink.'">
288
+ <input type="hidden" name="projectsnotification_http_method" value="1">
289
+ <input type="hidden" name="backlink" value="'.$backLink.'">
290
+ <input type="hidden" name="debug" value="0">
291
+ <noscript><input type="submit"></noscript>
292
+ </form>
293
+ </body>
294
+ </html>
295
+ ';
296
+ return $html;
297
+ }
298
+
299
+ /**
300
+ * @param string $data string to be hashed
301
+ * @return string the hash
302
+ */
303
+ function generateHash($data){
304
+
305
+ if($this->hashfunction == 'sha1')
306
+ return sha1($data);
307
+
308
+ //mcrypt installed?
309
+ if(function_exists('hash') && in_array($this->hashfunction, hash_algos()))
310
+ return hash($this->hashfunction, $data);
311
+
312
+ return md5($data); //fallback to md5
313
+ }
314
+
315
+ /**
316
+ * @param int [optional] $length length of return value, default 24
317
+ * @return string
318
+ */
319
+ function generateRandomValue($length = 24) {
320
+ $randomValue = '';
321
+
322
+ //if php >= 5.3 and openssl installed we will use its more secure random generator
323
+ if(function_exists('openssl_random_pseudo_bytes')) {
324
+ $p = base64_encode(openssl_random_pseudo_bytes($length, $strong)); //output is base64: a-zA-Z0-9/+
325
+ if($strong === TRUE)
326
+ {
327
+ $randomValue = preg_replace('#[^A-Za-z0-9]#', '', $p); //remove all special chars
328
+ $randomValue = substr($randomValue, 0, $length); //base64 is about 33% longer, so needs to get truncated
329
+ }
330
+ }
331
+
332
+ //fallback to mt_rand for php < 5.3
333
+ if(strlen($randomValue) < $length)
334
+ {
335
+ $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; //62 chars 0-9A-Za-z
336
+ $charactersLength = strlen($characters)-1;
337
+
338
+ //select some random characters from all characters
339
+ for ($i = 0; $i < $length; $i++) {
340
+ $randomValue .= $characters[mt_rand(0, $charactersLength)];
341
+ }
342
+ }
343
+
344
+ return $randomValue;
345
+ }
346
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Convert/Order.php ADDED
@@ -0,0 +1,44 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Order.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Model_Convert_Order extends Mage_Sales_Model_Convert_Order
22
+ {
23
+ /**
24
+ * Convert order payment to quote payment
25
+ *
26
+ * @param Mage_Sales_Model_Order_Payment $payment
27
+ * @return Mage_Sales_Model_Quote_Payment
28
+ */
29
+ public function paymentToQuotePayment(Mage_Sales_Model_Order_Payment $payment, $quotePayment=null)
30
+ {
31
+ $quotePayment = parent::paymentToQuotePayment($payment, $quotePayment);
32
+
33
+ $quotePayment->setSuAccountNumber($payment->getSuAccountNumber())
34
+ ->setSuBankCode($payment->getSuBankCode())
35
+ ->setSuNlBankCode($payment->getSuNlBankCode())
36
+ ->setSuPaycode($payment->getSuPaycode())
37
+ ->setSuSecurity($payment->getSuSecurity())
38
+ ->setSuIban($payment->getSuIban())
39
+ ->setSuBic($payment->getSuBic())
40
+ ->setSuHolder($payment->getSuHolder());
41
+
42
+ return $quotePayment;
43
+ }
44
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Convert/Quote.php ADDED
@@ -0,0 +1,45 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Quote.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Model_Convert_Quote extends Mage_Sales_Model_Convert_Quote
22
+ {
23
+
24
+ /**
25
+ * Convert quote payment to order payment
26
+ *
27
+ * @param Mage_Sales_Model_Quote_Payment $payment
28
+ * @return Mage_Sales_Model_Quote_Payment
29
+ */
30
+ public function paymentToOrderPayment(Mage_Sales_Model_Quote_Payment $payment)
31
+ {
32
+ $orderPayment = parent::paymentToOrderPayment($payment);
33
+ $orderPayment->setSuAccountNumber($payment->getSuAccountNumber())
34
+ ->setSuBankCode($payment->getSuBankCode())
35
+ ->setSuNlBankCode($payment->getSuNlBankCode())
36
+ ->setSuPaycode($payment->getSuPaycode())
37
+ ->setSuSecurity($payment->getSuSecurity())
38
+ ->setSuIban($payment->getSuIban())
39
+ ->setSuBic($payment->getSuBic())
40
+ ->setSuHolder($payment->getSuHolder());
41
+
42
+ return $orderPayment;
43
+ }
44
+
45
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Data/Form/Element/Link.php ADDED
@@ -0,0 +1,54 @@
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
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Paymentnetwork
22
+ * @package Paymentnetwork_Sofortueberweisung
23
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ * @version $Id: Link.php 190 2010-06-02 14:34:14Z thoma $
26
+ */
27
+
28
+ /**
29
+ * Data form abstract class
30
+ *
31
+ * @category Paymentnetwork
32
+ * @package Paymentnetwork_Sofortueberweisung
33
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
34
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
35
+ * @version $Id: Link.php 190 2010-06-02 14:34:14Z thoma $
36
+ */
37
+ class Varien_Data_Form_Element_Label extends Varien_Data_Form_Element_Abstract
38
+ {
39
+ public function __construct($attributes=array())
40
+ {
41
+ parent::__construct($attributes);
42
+ $this->setType('label');
43
+ }
44
+
45
+ public function getElementHtml()
46
+ {
47
+ $html = $this->getBold() ? '<strong>' : '';
48
+ $html.= $this->getValue();
49
+ $html.= $this->getBold() ? '</strong>' : '';
50
+ $html.= $this->getAfterElementHtml();
51
+ return $html;
52
+ }
53
+
54
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Mysql4/Pnsofortueberweisung.php ADDED
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ class Paymentnetwork_Pnsofortueberweisung_Model_Mysql4_Pnsofortueberweisung extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the sofortueberweisung_id refers to the key field in your database table.
8
+ $this->_init('pnsofortueberweisung/pnsofortueberweisung', 'pnsofortueberweisung_id');
9
+ }
10
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Mysql4/Pnsofortueberweisung/Collection.php ADDED
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ class Paymentnetwork_Pnsofortueberweisung_Model_Mysql4_Pnsofortueberweisung_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('pnsofortueberweisung/pnsofortueberweisung');
9
+ }
10
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,24 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Setup.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
22
+ {
23
+
24
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Params.php ADDED
@@ -0,0 +1,21 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Params.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Model_Params extends Varien_Object{}
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Paycode.php ADDED
@@ -0,0 +1,227 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Paycode.php 190 2010-06-02 14:34:14Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Model_Paycode extends Mage_Payment_Model_Method_Abstract
22
+ {
23
+
24
+ /**
25
+ * Availability options
26
+ */
27
+ protected $_code = 'paycode';
28
+ protected $_paymentMethod = 'paycode';
29
+
30
+ protected $_formBlockType = 'pnsofortueberweisung/form_paycode';
31
+ protected $_infoBlockType = 'pnsofortueberweisung/info_paycode';
32
+
33
+ const STATUS_UNKNOWN = 'UNKNOWN';
34
+ const STATUS_APPROVED = 'APPROVED';
35
+ const STATUS_ERROR = 'ERROR';
36
+ const STATUS_DECLINED = 'DECLINED';
37
+ const STATUS_VOID = 'VOID';
38
+ const STATUS_SUCCESS = 'SUCCESS';
39
+
40
+ protected $_isGateway = false;
41
+ protected $_canAuthorize = true;
42
+ protected $_canCapture = false;
43
+ protected $_canCapturePartial = false;
44
+ protected $_canRefund = false;
45
+ protected $_canVoid = false;
46
+ protected $_canUseInternal = false;
47
+ protected $_canUseCheckout = true;
48
+ protected $_canUseForMultishipping = true;
49
+ protected $_supportedLocales = array('en', 'de', 'fr');
50
+
51
+ public function _construct()
52
+ {
53
+ parent::_construct();
54
+ $this->_init('pnsofortueberweisung/paycode');
55
+ }
56
+
57
+ public function getUrl(){
58
+ return $this->getConfigData('url');
59
+ }
60
+
61
+ /**
62
+ * Return payment method type string
63
+ *
64
+ * @return string
65
+ */
66
+ public function getPaymentMethodType()
67
+ {
68
+ return $this->_paymentMethod;
69
+ }
70
+
71
+ public function getSecurityKey(){
72
+ return uniqid(rand(), true);
73
+ }
74
+
75
+ public function assignData($data)
76
+ {
77
+ if (!($data instanceof Varien_Object)) {
78
+ $data = new Varien_Object($data);
79
+ }
80
+ $info = $this->getInfoInstance();
81
+ $info->setSuAccountNumber($data->getSuAccountNumber())
82
+ ->setSuBankCode($data->getSuBankCode())
83
+ ->setSuPaycode($data->getSuPaycode())
84
+ ->setSuIban($data->getSuIban())
85
+ ->setSuBic($data->getSuBic())
86
+ ->setSuHolder($data->getSuHolder());
87
+
88
+ return $this;
89
+ }
90
+
91
+ public function validate()
92
+ {
93
+ parent::validate();
94
+
95
+ if (!$this->getQuote()->getPayment()->getSuHolder()) {
96
+ Mage::throwException(Mage::helper('pnsofortueberweisung')->__('Please fill out the account holder'));
97
+ }
98
+ if (!$this->getQuote()->getPayment()->getSuBankCode()) {
99
+ Mage::throwException(Mage::helper('pnsofortueberweisung')->__('Please fill out the account number'));
100
+ }
101
+ if (!$this->getQuote()->getPayment()->getSuBankCode()) {
102
+ Mage::throwException(Mage::helper('pnsofortueberweisung')->__('Please fill out the bank code'));
103
+ }
104
+ return $this;
105
+ }
106
+
107
+ /**
108
+ * Send authorize request to gateway
109
+ *
110
+ * @param Varien_Object $payment
111
+ * @param decimal $amount
112
+ * @return Mage_Paygate_Model_Authorizenet
113
+ */
114
+ public function authorize(Varien_Object $payment, $amount)
115
+ {
116
+ $payment->setAmount($this->getQuote()->getGrandTotal());
117
+ $error = false;
118
+ $security = $this->getSecurityKey();
119
+ $payment->setSuSecurity($security);
120
+
121
+ if($payment->getAmount()){
122
+
123
+ $amount = number_format($this->getQuote()->getGrandTotal(),2,'.','');
124
+ $billing = $this->getQuote()->getBillingAddress();
125
+
126
+ $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
127
+ if (is_array($locale) && !empty($locale) && in_array($locale[0], $this->_supportedLocales))
128
+ $locale = strtoupper($locale[0]);
129
+ else
130
+ $locale = strtoupper($this->getDefaultLocale());
131
+
132
+ $params = Array(
133
+ 'user_id' => $this->getConfigData('customer'),
134
+ 'project_id' => $this->getConfigData('project'),
135
+ 'amount' => $amount,
136
+ 'reason_1' => Mage::helper('pnsofortueberweisung')->__('Order: ').$this->getQuote()->getReservedOrderId(),
137
+ 'reason_2' => '',
138
+ 'sender_holder' => $payment->getSuHolder(),
139
+ 'sender_account_number' => $payment->getSuAccountNumber(),
140
+ 'sender_bank_code' => $payment->getSuBankCode(),
141
+ 'sender_bank_bic' => $payment->getSuBic(),
142
+ 'sender_iban' => $payment->getSuIban(),
143
+ 'sender_country_id' => $billing->getCountry(),
144
+ 'user_variable_0' => $this->getQuote()->getReservedOrderId(),
145
+ 'user_variable_1' => $payment->getSuSecurity(),
146
+ 'user_variable_2' => '',
147
+ 'user_variable_3' => '',
148
+ 'user_variable_4' => '',
149
+ 'user_variable_5' => '',
150
+ 'expires' => $this->getConfigData('expires'),
151
+ 'language_id' => $locale,
152
+ );
153
+
154
+ if($this->getConfigData('check_input_yesno') == 1)
155
+ $params['hash'] = md5(implode('|',$params).'|'.$this->getConfigData('project_pswd'));
156
+
157
+ $result = $this->_postRequest($params);
158
+
159
+ if(strstr($result,'Errors') === false){
160
+ $payment->setSuPaycode($result);
161
+ $payment->setStatus(self::STATUS_APPROVED);
162
+ }else{
163
+ $error = Mage::helper('pnsofortueberweisung')->__('Please check your account data.');
164
+ }
165
+ }else{
166
+ $error = Mage::helper('pnsofortueberweisung')->__('Invalid amount for authorization.');
167
+ }
168
+
169
+ if ($error !== false) {
170
+ Mage::throwException($error);
171
+ }
172
+
173
+ return $this;
174
+ }
175
+
176
+ protected function _postRequest($request)
177
+ {
178
+ $client = new Varien_Http_Client();
179
+
180
+ $client->setUri($this->getUrl());
181
+ $client->setConfig(array(
182
+ 'maxredirects'=>2,
183
+ 'timeout'=>60,
184
+ ));
185
+
186
+ $client->setParameterGet($request);
187
+ $client->setMethod(Zend_Http_Client::GET);
188
+ try {
189
+ $response = $client->request();
190
+ } catch (Exception $e) {
191
+ Mage::throwException(
192
+ Mage::helper('pnsofortueberweisung')->__('Gateway request error: %s', $e->getMessage())
193
+ );
194
+ }
195
+
196
+ $responseBody = $response->getBody();
197
+
198
+ return $responseBody;
199
+ }
200
+
201
+ /**
202
+ * Get quote
203
+ *
204
+ * @return Mage_Sales_Model_Order
205
+ */
206
+ public function getQuote()
207
+ {
208
+ if (empty($this->_quote)) {
209
+ $this->_quote = $this->getCheckout()->getQuote();
210
+ }
211
+ return $this->_quote;
212
+ }
213
+
214
+ /**
215
+ * Get checkout
216
+ *
217
+ * @return Mage_Sales_Model_Order
218
+ */
219
+ public function getCheckout()
220
+ {
221
+ if (empty($this->_checkout)) {
222
+ $this->_checkout = Mage::getSingleton('checkout/session');
223
+ }
224
+ return $this->_checkout;
225
+ }
226
+
227
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Pnsofortueberweisung.php ADDED
@@ -0,0 +1,174 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: Pnsofortueberweisung.php 199 2010-06-10 14:56:03Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Model_Pnsofortueberweisung extends Mage_Payment_Model_Method_Abstract
22
+ {
23
+
24
+ /**
25
+ * Availability options
26
+ */
27
+ protected $_code = 'pnsofortueberweisung';
28
+ protected $_paymentMethod = 'pnsofortueberweisung';
29
+
30
+ protected $_formBlockType = 'pnsofortueberweisung/form_pnsofortueberweisung';
31
+ protected $_infoBlockType = 'pnsofortueberweisung/info_pnsofortueberweisung';
32
+
33
+ protected $_isGateway = false;
34
+ protected $_canAuthorize = true;
35
+ protected $_canCapture = false;
36
+ protected $_canCapturePartial = false;
37
+ protected $_canRefund = false;
38
+ protected $_canVoid = false;
39
+ protected $_canUseInternal = false;
40
+ protected $_canUseCheckout = true;
41
+ protected $_canUseForMultishipping = true;
42
+
43
+
44
+ public function _construct()
45
+ {
46
+ parent::_construct();
47
+ $this->_init('pnsofortueberweisung/pnsofortueberweisung');
48
+ }
49
+
50
+ public function getUrl(){
51
+ return $this->getConfigData('url');
52
+ }
53
+
54
+ /**
55
+ * Return redirect block type
56
+ *
57
+ * @return string
58
+ */
59
+ public function getRedirectBlockType()
60
+ {
61
+ return $this->_redirectBlockType;
62
+ }
63
+
64
+ /**
65
+ * Return payment method type string
66
+ *
67
+ * @return string
68
+ */
69
+ public function getPaymentMethodType()
70
+ {
71
+ return $this->_paymentMethod;
72
+ }
73
+
74
+
75
+ /**
76
+ * Get redirect URL
77
+ *
78
+ * @return Mage_Payment_Helper_Data
79
+ */
80
+ public function getOrderPlaceRedirectUrl()
81
+ {
82
+ return Mage::getUrl('pnsofortueberweisung/pnsofortueberweisung/redirect');
83
+ }
84
+
85
+ public function assignData($data)
86
+ {
87
+ if (!($data instanceof Varien_Object)) {
88
+ $data = new Varien_Object($data);
89
+ }
90
+ $info = $this->getInfoInstance();
91
+ $info->setSuAccountNumber($data->getSuAccountNumber())
92
+ ->setSuBankCode($data->getSuBankCode())
93
+ ->setSuNlBankCode($data->getSuNlBankCode())
94
+ ->setSuHolder($data->getSuHolder());
95
+
96
+ return $this;
97
+ }
98
+
99
+ public function getSecurityKey(){
100
+ return uniqid(rand(), true);
101
+ }
102
+
103
+ public function validate()
104
+ {
105
+ parent::validate();
106
+
107
+
108
+ return $this;
109
+ }
110
+
111
+ public function getFormFields()
112
+ {
113
+ $amount = number_format($this->getOrder()->getGrandTotal(),2,'.','');
114
+ $billing = $this->getOrder()->getBillingAddress();
115
+ $security = $this->getSecurityKey();
116
+
117
+ $this->getOrder()->getPayment()->setSuSecurity($security)->save();
118
+
119
+ $pnSu = Mage::helper('pnsofortueberweisung');
120
+ $pnSu->classPnSofortueberweisung($this->getConfigData('project_pswd'));
121
+ return $pnSu->getPaymentParameters(
122
+ $this->getConfigData('customer'),
123
+ $this->getConfigData('project'),
124
+ $amount,
125
+ $this->getOrder()->getOrderCurrencyCode(),
126
+ Mage::helper('pnsofortueberweisung')->__('Order No.: ').$this->getOrder()->getRealOrderId(),
127
+ '' ,
128
+ $this->getOrder()->getRealOrderId(),
129
+ $this->getOrder()->getPayment()->getSuSecurity());
130
+
131
+ }
132
+
133
+ /**
134
+ * Get quote
135
+ *
136
+ * @return Mage_Sales_Model_Order
137
+ */
138
+ public function getQuote()
139
+ {
140
+ if (empty($this->_quote)) {
141
+ $this->_quote = $this->getCheckout()->getQuote();
142
+ }
143
+ return $this->_quote;
144
+ }
145
+
146
+ /**
147
+ * Get checkout
148
+ *
149
+ * @return Mage_Sales_Model_Order
150
+ */
151
+ public function getCheckout()
152
+ {
153
+ if (empty($this->_checkout)) {
154
+ $this->_checkout = Mage::getSingleton('checkout/session');
155
+ }
156
+ return $this->_checkout;
157
+ }
158
+
159
+ /**
160
+ * Get order model
161
+ *
162
+ * @return Mage_Sales_Model_Order
163
+ */
164
+ public function getOrder()
165
+ {
166
+ if (!$this->_order) {
167
+ $paymentInfo = $this->getInfoInstance();
168
+ $this->_order = Mage::getModel('sales/order')
169
+ ->loadByIncrementId($paymentInfo->getOrder()->getRealOrderId());
170
+ }
171
+ return $this->_order;
172
+ }
173
+
174
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Status.php ADDED
@@ -0,0 +1,15 @@
1
+ <?php
2
+
3
+ class Paymentnetwork_Pnsofortueberweisung_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('pnsofortueberweisung')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('pnsofortueberweisung')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/controllers/Adminhtml/PnsofortueberweisungController.php ADDED
@@ -0,0 +1,117 @@
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 Paymentnetwork
16
+ * @package Paymentnetwork_Sofortueberweisung
17
+ * @copyright Copyright (c) 2008 [m]zentrale GbR, 2010 Payment Network AG
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ * @version $Id: PnsofortueberweisungController.php 205 2010-06-14 12:53:41Z thoma $
20
+ */
21
+ class Paymentnetwork_Pnsofortueberweisung_Adminhtml_PnsofortueberweisungController extends Mage_Adminhtml_Controller_Action
22
+ {
23
+
24
+ protected function _initAction() {
25
+ $this->loadLayout()
26
+ ->_setActiveMenu('pnsofortueberweisung/items')
27
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
28
+
29
+ return $this;
30
+ }
31
+
32
+ public function indexAction() {
33
+ $this->_initAction()
34
+ ->renderLayout();
35
+ }
36
+
37
+ public function saveConfigAction() {
38
+ $params = $this->getRequest()->getParams();
39
+ $session = Mage::getSingleton('adminhtml/session');
40
+ if($this->getRequest()->getParams()){
41
+ $groups = Array();
42
+ $groups['pnsofortueberweisung']['fields']['customer']['value'] = $params["user_id"];
43
+ $groups['pnsofortueberweisung']['fields']['project']['value'] = $params["project_id"];
44
+ $groups['pnsofortueberweisung']['fields']['check_input_yesno']['value'] = 1;
45
+ $groups['pnsofortueberweisung']['fields']['project_pswd']['value'] = $session->getData('projectssetting_project_password');
46
+ $session->unsetData('projectssetting_project_password');
47
+ $groups['pnsofortueberweisung']['fields']['notification_pswd']['value'] = $session->getData('project_notification_password');
48
+ $session->unsetData('project_notification_password');
49
+
50
+ #echo "<pre>";
51
+ #print_r($groups);
52
+ #echo "</pre>";
53
+
54
+ try {
55
+ Mage::getModel('adminhtml/config_data')
56
+ ->setSection('payment')
57
+ ->setWebsite($this->getRequest()->getParam('website'))
58
+ ->setStore($this->getRequest()->getParam('store'))
59
+ ->setGroups($groups)
60
+ ->save();
61
+ }catch (Mage_Core_Exception $e) {
62
+ foreach(split("\n", $e->getMessage()) as $message) {
63
+ $session->addError($message);
64
+ }
65
+ }
66
+ catch (Exception $e) {
67
+ $session->addException($e, Mage::helper('adminhtml')->__('Error while saving this configuration: '.$e->getMessage()));
68
+ }
69
+
70
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('pnsofortueberweisung')->__('Item was successfully saved'));
71
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
72
+ }
73
+ #echo "aha";
74
+ #exit;
75
+ $this->_redirect('adminhtml/system_config/edit', array('section'=>'payment'));
76
+ return;
77
+ }
78
+
79
+ public function saveConfigPcAction() {
80
+
81
+ $params = $this->getRequest()->getParams();
82
+ $session = Mage::getSingleton('adminhtml/session');
83
+ if($this->getRequest()->getParams()){
84
+ $groups = Array();
85
+ $groups['paycode']['fields']['customer']['value'] = $params["user_id"];
86
+ $groups['paycode']['fields']['project']['value'] = $params["project_id"];
87
+ $groups['paycode']['fields']['check_input_yesno']['value'] = 1;
88
+
89
+ #echo "<pre>";
90
+ #print_r($groups);
91
+ #echo "</pre>";
92
+
93
+ try {
94
+ Mage::getModel('adminhtml/config_data')
95
+ ->setSection('payment')
96
+ ->setWebsite($this->getRequest()->getParam('website'))
97
+ ->setStore($this->getRequest()->getParam('store'))
98
+ ->setGroups($groups)
99
+ ->save();
100
+ }catch (Mage_Core_Exception $e) {
101
+ foreach(split("\n", $e->getMessage()) as $message) {
102
+ $session->addError($message);
103
+ }
104
+ }
105
+ catch (Exception $e) {
106
+ $session->addException($e, Mage::helper('adminhtml')->__('Error while saving this configuration: '.$e->getMessage()));
107
+ }
108
+
109
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('pnsofortueberweisung')->__('Item was successfully saved'));
110
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
111
+ }
112
+ #echo "aha";
113
+ #exit;
114
+ $this->_redirectUrl('/index.php/admin/system_config/edit/section/payment');
115
+ return;
116
+ }
117
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/controllers/PcsofortueberweisungController.php ADDED
@@ -0,0 +1,198 @@