pn_sofortueberweisung - Version 1.1.9

Version Notes

- added translationstrings
- fixed issue with missing transaction-type "order" in magento 1.4.1.1 - 1.5

Download this release

Release Info

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


Code changes from version 1.1.8 to 1.1.9

Files changed (59) hide show
  1. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit.php +1 -1
  2. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Form.php +1 -1
  3. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Tab/Form.php +1 -1
  4. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Tabs.php +1 -1
  5. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Grid.php +1 -1
  6. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/System/Config/Fieldset/Global.php +194 -0
  7. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Paycode.php +1 -1
  8. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Pnsofortueberweisung.php +1 -1
  9. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Sofortlastschrift.php +53 -0
  10. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Sofortrechnung.php +55 -0
  11. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Info/Paycode.php +1 -1
  12. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Info/Pnsofortueberweisung.php +1 -1
  13. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Infobox.php +1 -1
  14. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Pnsofortueberweisung.php +1 -1
  15. app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Pnsofortueberweisungnotice.php +1 -1
  16. app/code/community/Paymentnetwork/Pnsofortueberweisung/Helper/Data.php +2 -2
  17. app/code/community/Paymentnetwork/Pnsofortueberweisung/Helper/Sofortlib.php +2002 -0
  18. app/code/community/Paymentnetwork/Pnsofortueberweisung/Helper/log.txt +974 -0
  19. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Abstract.php +158 -0
  20. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Convert/Order.php +1 -1
  21. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Convert/Quote.php +1 -1
  22. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Data/Form/Element/Link.php +2 -2
  23. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Mysql4/Setup.php +1 -1
  24. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Order/Invoice.php +876 -0
  25. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Order/Pdf/Invoice.php +137 -0
  26. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Params.php +1 -1
  27. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Paycode.php +1 -1
  28. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Pnsofort.php +92 -0
  29. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Pnsofortueberweisung.php +1 -1
  30. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Sofortlastschrift.php +93 -0
  31. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/Sofortrechnung.php +114 -0
  32. app/code/community/Paymentnetwork/Pnsofortueberweisung/Model/System/Config/Source/Logo.php +33 -0
  33. app/code/community/Paymentnetwork/Pnsofortueberweisung/controllers/Adminhtml/PnsofortueberweisungController.php +1 -1
  34. app/code/community/Paymentnetwork/Pnsofortueberweisung/controllers/PcsofortueberweisungController.php +1 -1
  35. app/code/community/Paymentnetwork/Pnsofortueberweisung/controllers/PnsofortueberweisungController.php +2 -2
  36. app/code/community/Paymentnetwork/Pnsofortueberweisung/etc/config.xml +2 -2
  37. app/code/community/Paymentnetwork/Pnsofortueberweisung/etc/system.xml +1 -1
  38. app/code/community/Paymentnetwork/Pnsofortueberweisung/sql/pnsofortueberweisung_setup/mysql4-install-1.1.1.php +1 -1
  39. app/design/adminhtml/default/default/template/pnsofortueberweisung/form/paycode.phtml +1 -1
  40. app/design/adminhtml/default/default/template/pnsofortueberweisung/form/sofortueberweisung.phtml +1 -1
  41. app/design/adminhtml/default/default/template/pnsofortueberweisung/info/paycode.phtml +1 -1
  42. app/design/adminhtml/default/default/template/pnsofortueberweisung/info/pdf/paycode.phtml +1 -1
  43. app/design/adminhtml/default/default/template/pnsofortueberweisung/info/pdf/sofortueberweisung.phtml +1 -1
  44. app/design/adminhtml/default/default/template/pnsofortueberweisung/info/sofortueberweisung.phtml +1 -1
  45. app/design/adminhtml/default/default/template/pnsofortueberweisung/system/config/fieldset/global.phtml +69 -0
  46. app/design/frontend/default/default/template/pnsofortueberweisung/form/paycode.phtml +1 -1
  47. app/design/frontend/default/default/template/pnsofortueberweisung/form/sofortlastschrift.phtml +44 -0
  48. app/design/frontend/default/default/template/pnsofortueberweisung/form/sofortrechnung.phtml +42 -0
  49. app/design/frontend/default/default/template/pnsofortueberweisung/form/sofortueberweisung.phtml +1 -1
  50. app/design/frontend/default/default/template/pnsofortueberweisung/info/paycode.phtml +1 -1
  51. app/design/frontend/default/default/template/pnsofortueberweisung/info/sofortueberweisung.phtml +1 -1
  52. app/design/frontend/default/default/template/pnsofortueberweisung/infobox.phtml +1 -1
  53. app/locale/de_AT/Paymentnetwork_Sofortueberweisung.csv +7 -1
  54. app/locale/de_CH/Paymentnetwork_Sofortueberweisung.csv +7 -1
  55. app/locale/de_DE/Paymentnetwork_Sofortueberweisung.csv +7 -1
  56. lib/Varien/Data/Form/Element/Linkpnso.php +1 -1
  57. package.xml +8 -10
  58. skin/frontend/default/default/images/pnsofortueberweisung/sofortlastschrift.png +0 -0
  59. skin/frontend/default/default/images/pnsofortueberweisung/sofortrechnung.gif +0 -0
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Form.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Tab/Form.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 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
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Edit/Tabs.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/Pnsofortueberweisung/Grid.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_Pnsofortueberweisung_Grid extends Mage_Adminhtml_Block_Widget_Grid
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Adminhtml/System/Config/Fieldset/Global.php ADDED
@@ -0,0 +1,194 @@
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: PnsofortueberweisungController.php 277 2010-08-12 14:55:44Z poser $
20
+ */
21
+
22
+ class Paymentnetwork_Pnsofortueberweisung_Block_Adminhtml_System_Config_Fieldset_Global extends Mage_Adminhtml_Block_System_Config_Form_Fieldset implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
+ /**
25
+ * Associative array of PayPal product selection elements
26
+ *
27
+ * @var array
28
+ */
29
+ protected $_elements = array();
30
+
31
+ /**
32
+ * Custom template
33
+ *
34
+ * @var string
35
+ */
36
+ protected $_template = 'pnsofortueberweisung/system/config/fieldset/global.phtml';
37
+
38
+ /**
39
+ * Render fieldset html
40
+ *
41
+ * @param Varien_Data_Form_Element_Abstract $fieldset
42
+ * @return string
43
+ */
44
+ public function render(Varien_Data_Form_Element_Abstract $fieldset)
45
+ {
46
+ foreach ($fieldset->getSortedElements() as $element) {
47
+ $htmlId = $element->getHtmlId();
48
+ $this->_elements[$htmlId] = $element;
49
+ }
50
+ $originalData = $fieldset->getOriginalData();
51
+ $this->addData(array(
52
+ 'fieldset_label' => $fieldset->getLegend(),
53
+ 'fieldset_help_url' => isset($originalData['help_url']) ? $originalData['help_url'] : '',
54
+ ));
55
+
56
+ return $this->_getHeaderHtml($fieldset).$this->toHtml().$this->_getFooterHtml($fieldset);
57
+ }
58
+
59
+ /**
60
+ * Get array of element objects
61
+ *
62
+ * @return array
63
+ */
64
+ public function getElements()
65
+ {
66
+ return $this->_elements;
67
+ }
68
+
69
+ /**
70
+ * Return checkbox html with hidden field for correct config values
71
+ *
72
+ * @param string $elementId
73
+ * @return string
74
+ */
75
+ public function getElementHtml(Varien_Data_Form_Element_Abstract $element)
76
+ {
77
+ if($element->getType() != 'checkbox')
78
+ return $element->getElementHtml();
79
+
80
+ $configValue = (string)$element->getValue();
81
+ if ($configValue) {
82
+ $element->setChecked(true);
83
+ } else {
84
+ $element->setValue('1');
85
+ }
86
+ if ($element->getCanUseDefaultValue() && $element->getInherit()) {
87
+ $element->setDisabled(true);
88
+ }
89
+
90
+ $hidden = new Varien_Data_Form_Element_Hidden(array(
91
+ 'html_id' => $element->getHtmlId() . '_value',
92
+ 'name' => $element->getName(),
93
+ 'value' => '0'
94
+ ));
95
+ $hidden->setForm($element->getForm());
96
+ return $hidden->getElementHtml() . $element->getElementHtml();
97
+ }
98
+
99
+ /**
100
+ * Whether element should be rendered in "simplified" mode
101
+ *
102
+ * @param Varien_Data_Form_Element_Abstract $element
103
+ * @return bool
104
+ */
105
+ public function getIsElementSimplified(Varien_Data_Form_Element_Abstract $element)
106
+ {
107
+ $originalData = $element->getOriginalData();
108
+ return isset($originalData['is_simplified']) && 1 == $originalData['is_simplified'];
109
+ }
110
+
111
+ /**
112
+ * Getter for element label
113
+ *
114
+ * @param Varien_Data_Form_Element_Abstract $element
115
+ * @return string
116
+ */
117
+ public function getElementLabel(Varien_Data_Form_Element_Abstract $element)
118
+ {
119
+ return $element->getLabel();
120
+ }
121
+
122
+ /**
123
+ * Getter for element comment
124
+ *
125
+ * @param Varien_Data_Form_Element_Abstract $element
126
+ * @return string
127
+ */
128
+ public function getElementComment(Varien_Data_Form_Element_Abstract $element)
129
+ {
130
+ return $element->getComment();
131
+ }
132
+
133
+ /**
134
+ * Getter for element comment
135
+ *
136
+ * @param Varien_Data_Form_Element_Abstract $element
137
+ * @return string
138
+ */
139
+ public function getElementOriginalData(Varien_Data_Form_Element_Abstract $element, $key)
140
+ {
141
+ $data = $element->getOriginalData();
142
+ return isset($data[$key]) ? $data[$key] : '';
143
+ }
144
+
145
+ /**
146
+ * Check whether checkbox has "Use default" option or not
147
+ *
148
+ * @param Varien_Data_Form_Element_Abstract $element
149
+ * @return bool
150
+ */
151
+ public function hasInheritElement(Varien_Data_Form_Element_Abstract $element)
152
+ {
153
+ return (bool)$element->getCanUseDefaultValue();
154
+ }
155
+
156
+ /**
157
+ * Return "Use default" checkbox html
158
+ *
159
+ * @param Varien_Data_Form_Element_Abstract $element
160
+ * @return string
161
+ */
162
+ public function getInheritElementHtml(Varien_Data_Form_Element_Abstract $element)
163
+ {
164
+ $elementId = $element->getHtmlId();
165
+ $inheritCheckbox = new Varien_Data_Form_Element_Checkbox(array(
166
+ 'html_id' => $elementId . '_inherit',
167
+ 'name' => preg_replace('/\[value\](\[\])?#x2F;', '[inherit]', $element->getName()),
168
+ 'value' => '1',
169
+ 'class' => 'checkbox config-inherit',
170
+ 'onclick' => 'toggleValueElements(this, $(\'' . $elementId . '\').up())'
171
+ ));
172
+ if ($element->getInherit()) {
173
+ $inheritCheckbox->setChecked(true);
174
+ }
175
+
176
+ $inheritCheckbox->setForm($element->getForm());
177
+ return $inheritCheckbox->getElementHtml();
178
+ }
179
+
180
+ /**
181
+ * Return label for "Use default" checkbox
182
+ *
183
+ * @param Varien_Data_Form_Element_Abstract $element
184
+ * @return string
185
+ */
186
+ public function getInheritElementLabelHtml(Varien_Data_Form_Element_Abstract $element)
187
+ {
188
+ return sprintf('<label for="%s" class="inherit" title="%s">%s</label>',
189
+ $element->getHtmlId() . '_inherit',
190
+ $element->getDefaultValue(),
191
+ Mage::helper('adminhtml')->__('Use Default')
192
+ );
193
+ }
194
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Paycode.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Form_Paycode extends Mage_Payment_Block_Form
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Pnsofortueberweisung.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Form_Pnsofortueberweisung extends Mage_Payment_Block_Form
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Sofortlastschrift.php ADDED
@@ -0,0 +1,53 @@
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_Sofortlastschrift extends Mage_Payment_Block_Form
22
+ {
23
+ /**
24
+ * Init default template for block
25
+ */
26
+ protected function _construct()
27
+ {
28
+ $this->setTemplate('pnsofortueberweisung/form/sofortlastschrift.phtml');
29
+ if($this->isDisplayText()) {
30
+ $this->setMethodTitle('');
31
+ $this->setMethodLabelAfterHtml('<img src="'.$this->getImageUrl().'">');
32
+ }
33
+ return parent::_construct();
34
+ }
35
+
36
+ /**
37
+ * Retrieve payment configuration object
38
+ *
39
+ * @return Mage_Payment_Model_Config
40
+ */
41
+ protected function _getConfig()
42
+ {
43
+ return Mage::getSingleton('payment/config');
44
+ }
45
+
46
+ public function getImageUrl() {
47
+ return Mage::getStoreConfig('payment/pnsofort/logourl').Mage::helper('pnsofortueberweisung')->__('de').'/sl/'.Mage::getStoreConfig('payment/sofort/logo').'.png';
48
+ }
49
+
50
+ public function isDisplayText() {
51
+ return substr(Mage::getStoreConfig('payment/sofort/logo'), 0, 4) == 'logo';
52
+ }
53
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Form/Sofortrechnung.php ADDED
@@ -0,0 +1,55 @@
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_Sofortrechnung extends Mage_Payment_Block_Form
22
+ {
23
+ /**
24
+ * Init default template for block
25
+ */
26
+ protected function _construct()
27
+ {
28
+ $this->setTemplate('pnsofortueberweisung/form/sofortrechnung.phtml');
29
+ if($this->isDisplayText()) {
30
+ $this->setMethodTitle('');
31
+ $this->setMethodLabelAfterHtml('<img src="'.$this->getImageUrl().'">');
32
+ }
33
+ return parent::_construct();
34
+ }
35
+
36
+ /**
37
+ * Retrieve payment configuration object
38
+ *
39
+ * @return Mage_Payment_Model_Config
40
+ */
41
+ protected function _getConfig()
42
+ {
43
+ return Mage::getSingleton('payment/config');
44
+ }
45
+
46
+ public function getImageUrl()
47
+ {
48
+ return Mage::getStoreConfig('payment/pnsofort/logourl').'de/sr/'.Mage::getStoreConfig('payment/sofort/logo').'.png';
49
+ }
50
+
51
+ public function isDisplayText()
52
+ {
53
+ return substr(Mage::getStoreConfig('payment/sofort/logo'), 0, 4) == 'logo';
54
+ }
55
+ }
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Info/Paycode.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Info_Paycode extends Mage_Payment_Block_Info
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Info/Pnsofortueberweisung.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Info_Pnsofortueberweisung extends Mage_Payment_Block_Info
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Infobox.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Infobox extends Mage_Core_Block_Template
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Pnsofortueberweisung.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Pnsofortueberweisung extends Mage_Core_Block_Abstract
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Block/Pnsofortueberweisungnotice.php CHANGED
@@ -16,7 +16,7 @@
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
{
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 378 2010-06-02 14:34:14Z thoma $
20
*/
21
class Paymentnetwork_Pnsofortueberweisung_Block_Pnsofortueberweisungnotice extends Mage_Core_Block_Template
22
{
app/code/community/Paymentnetwork/Pnsofortueberweisung/Helper/Data.php CHANGED
@@ -16,7 +16,7 @@
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 495 2011-05-25 13:06:11Z poser $
20
*/
21
22
class Paymentnetwork_Pnsofortueberweisung_Helper_Data extends Mage_Core_Helper_Abstract
@@ -34,7 +34,7 @@ class Paymentnetwork_Pnsofortueberweisung_Helper_Data extends Mage_Core_Helper_A
34
$this->password = $password;
35
$this->password2 = '';
36
$this->hashfunction = $hashfunction;
37
- $this->version = 'pn_mag_1.1.8';
38
$this->formActionUrl = 'https://www.sofortueberweisung.de/payment/start?';
39
40
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 736 2011-06-06 13:50:46Z poser $
20
*/
21
22
class Paymentnetwork_Pnsofortueberweisung_Helper_Data extends Mage_Core_Helper_Abstract
34
$this->password = $password;
35
$this->password2 = '';
36
$this->hashfunction = $hashfunction;
37
+ $this->version = 'pn_mag_1.1.9';
38
$this->formActionUrl = 'https://www.sofortueberweisung.de/payment/start?';
39
40
app/code/community/Paymentnetwork/Pnsofortueberweisung/Helper/Sofortlib.php ADDED
@@ -0,0 +1,2002 @@
1
+ <?php
2
+ /**
3
+ * @version SofortLib 1.1.0 - $Date: 2011-02-07 12:01:24 +0100 (Mo, 07 Feb 2011) $
4
+ * @author Payment Network AG (integration@payment-network.com)
5
+ * @link http://www.payment-network.com/
6
+ *
7
+ * Copyright (c) 2010 Payment Network AG
8
+ * $Id: sofortLib.php 433 2011-02-07 11:01:24Z poser $
9
+ *
10
+ */
11
+
12
+ //dummy for now, so we can easily include our standard library
13
+ class Paymentnetwork_Pnsofortueberweisung_Helper_Sofortlib
14
+ {
15
+ }
16
+
17
+ /**
18
+ * interface for Payment Network XML-Api
19
+ *
20
+ * this class implements basic http authentication and a xml-parser
21
+ * for parsing response messages
22
+ *
23
+ * requires libcurl and openssl
24
+ *
25
+ * Copyright (c) 2010 Payment Network AG
26
+ *
27
+ * $Date: 2011-03-10 14:48:12 +0100 (Do, 10 Mrz 2011) $
28
+ * @version SofortLib 1.1.0 $Id: sofortLib.php 450 2011-03-10 13:48:12Z poser $
29
+ * @author Payment Network AG http://www.payment-network.com (integration@payment-network.com)
30
+ *
31
+ */
32
+ class SofortLib_Abstract extends SofortLib
33
+ {
34
+
35
+ /**
36
+ * generate XML message
37
+ * @return string
38
+ */
39
+ function toXml() {
40
+ trigger_error('Missing implementation of toXml()', E_USER_NOTICE);
41
+ }
42
+
43
+ /**
44
+ * Override this callback
45
+ * its being called everytime we find a closing xml-tag
46
+ *
47
+ * @protected
48
+ * @param string $data data of this tag
49
+ * @param string $tag name of this tag
50
+ */
51
+ function onParseTag($data, $tag) {
52
+ trigger_error('Missing implementation of onParseTag()', E_USER_NOTICE);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * This class is for confirming and changing invoices
58
+ *
59
+ * eg: $confirmObj = new SofortLib_ConfirmSr('yourapikey');
60
+ *
61
+ * $confirmObj->confirmInvoice('1234-456-789654-31321')->sendRequest();
62
+ *
63
+ * Copyright (c) 2010 Payment Network AG
64
+ *
65
+ * $Date: 2011-03-10 14:48:12 +0100 (Do, 10 Mrz 2011) $
66
+ * @version SofortLib 1.1.0 $Id: sofortLib.php 450 2011-03-10 13:48:12Z poser $
67
+ * @author Payment Network AG http://www.payment-network.com (integration@payment-network.com)
68
+ *
69
+ */
70
+ class SofortLib_ConfirmSr extends SofortLib_Abstract
71
+ {
72
+ var $parameters;
73
+ var $file;
74
+ var $error;
75
+
76
+
77
+ /**
78
+ * create new confirm object
79
+ *
80
+ * @param String $apikey your API-key
81
+ */
82
+ function SofortLib_ConfirmSr($apikey) {
83
+ $this->SofortLib($apikey, 'https://api.sofort.com/api/xml/');
84
+ }
85
+
86
+ /**
87
+ * generate XML message
88
+ * @return string
89
+ */
90
+ function toXml() {
91
+ $msg = '<?xml version="1.0" encoding="UTF-8"?>';
92
+ $msg .= $this->_arrayToXml($this->parameters, 'confirm_sr');
93
+
94
+ return $msg;
95
+ }
96
+
97
+ /**
98
+ * send this message and get response
99
+ *
100
+ * @return SofortLib_TransactionData $this
101
+ */
102
+ function sendRequest() {
103
+ $data = $this->_sendMessage($this->toXml());
104
+ $this->_initParser();
105
+ $this->_parse($data);
106
+
107
+ $this->log(__CLASS__ . ' -> '. $this->formatXmlString($this->toXml()));
108
+ $this->log(__CLASS__ . ' <- '. $this->formatXmlString($data));
109
+
110
+ return $this;
111
+ }
112
+
113
+ /**
114
+ * Parser for response from server
115
+ * this callback will be called for every closing xml-tag
116
+ * @private
117
+ */
118
+ function onParseTag($data, $tag){
119
+ switch($tag) {
120
+ case 'download_url':
121
+ $this->file = $data;
122
+ break;
123
+ default:
124
+ break;
125
+ }
126
+ }
127
+
128
+ /**
129
+ * Set the transaction you want to confirm/change
130
+ * @param String $arg Transaction Id
131
+ * @return SofortLib_ConfirmSr
132
+ */
133
+ function setTransaction($arg) {
134
+ $this->parameters['transaction'] = $arg;
135
+ return $this;
136
+ }
137
+
138
+ /**
139
+ * add one item to the cart if you want to change the invoice
140
+ *
141
+ * @param string $productNumber product number, EAN code, ISBN number or similar
142
+ * @param string $title description of this title
143
+ * @param double $unit_price gross price of one item
144
+ * @param int $productType product type number see manual
145
+ * @param string $description additional description of this item
146
+ * @param int $quantity default 1
147
+ * @param int $tax tax in percent, default 19
148
+ */
149
+ function addItem($productNumber, $title, $unit_price, $productType = 0, $description = '', $quantity = 1, $tax = 19) {
150
+ $unit_price = number_format($unit_price, 2, '.','');
151
+ $tax = number_format($tax, 2, '.','');
152
+ $quantity = intval($quantity);
153
+ $this->parameters['items'][] = array('product_number' => $productNumber,
154
+ 'product_type' => $productType, 'title' => $title, 'description' => $description,
155
+ 'quantity' => $quantity, 'unit_price' => $unit_price, 'tax' => $tax);
156
+ }
157
+
158
+ /**
159
+ * cancel the invoice
160
+ * @param string $transaction the transaction id
161
+ * @return SofortLib_ConfirmSr
162
+ */
163
+ function cancelInvoice($transaction = '') {
164
+ if(empty($transaction) && array_key_exists('transaction', $this->parameters)) {
165
+ $transaction = $this->parameters['transaction'];
166
+ }
167
+
168
+ if(!empty($transaction)) {
169
+ $this->parameters = NULL;
170
+ $this->parameters['transaction'] = $transaction;
171
+ $this->parameters['items'] = array();
172
+ }
173
+
174
+ return $this;
175
+ }
176
+
177
+ /**
178
+ * confirm the invoice
179
+ * @param string $transaction the transaction id
180
+ * @return SofortLib_ConfirmSr
181
+ */
182
+ function confirmInvoice($transaction = '') {
183
+ if(empty($transaction) && array_key_exists('transaction', $this->parameters)) {
184
+ $transaction = $this->parameters['transaction'];
185
+ }
186
+
187
+ if(!empty($transaction)) {
188
+ $this->parameters = NULL;
189
+ $this->parameters['transaction'] = $transaction;
190
+ }
191
+
192
+ return $this;
193
+ }
194
+
195
+
196
+ /**
197
+ * after you you changed/confirmed an invoice you
198
+ * can download the new invoice-pdf with this function
199
+ * @return string url
200
+ */
201
+ function getInvoiceUrl() {
202
+ return $this->file;
203
+ }
204
+ }
205
+
206
+
207
+ /**
208
+ * This class is for retrieving information about transactions,
209
+ * you can search by transaction-id or by date
210
+ *
211
+ * eg: $transactionDataObj = new SofortLib_TransactionData('yourapikey');
212
+ *
213
+ * $transactionDataObj->setTransaction('1234-456-789654-31321')->sendRequest();
214
+ *
215
+ * echo $transactionDataObj->getStatus();
216
+ *
217
+ * Copyright (c) 2010 Payment Network AG
218
+ *
219
+ * $Date: 2011-03-10 14:48:12 +0100 (Do, 10 Mrz 2011) $
220
+ * @version SofortLib 1.1.0 $Id: sofortLib.php 450 2011-03-10 13:48:12Z poser $
221
+ * @author Payment Network AG http://www.payment-network.com (integration@payment-network.com)
222
+ *
223
+ */
224
+ class SofortLib_TransactionData extends SofortLib_Abstract
225
+ {
226
+ var $transaction = array();
227
+ var $time=array();
228
+ var $response = array(array());
229
+ var $count = 0;
230
+
231
+ function SofortLib_TransactionData($apikey) {
232
+ $this->SofortLib($apikey, 'https://api.sofort.com/api/xml/');
233
+ }
234
+
235
+ /**
236
+ * use this function if you want to request
237
+ * detailed information about a single transaction
238
+ *
239
+ * @param String $arg
240
+ * @return SofortLib_TransactionData $this
241
+ */
242
+ function setTransaction($arg) {
243
+ $this->transaction = array($arg);
244
+ return $this;
245
+ }
246
+
247
+ /**
248
+ * use this function if you want to request
249
+ * detailed information about several transactions
250
+ * at once
251
+ *
252
+ * @param String $arg
253
+ * @return SofortLib_TransactionData $this
254
+ */
255
+ function addTransaction($arg) {
256
+ $this->transaction[] = $arg;
257
+ return $this;
258
+ }
259
+
260
+ /**
261
+ * you can request all transactions of a certain time
262
+ * period
263
+ *
264
+ * use setNumber() to limit the results
265
+ *
266
+ * @param string $from date possible formats: 2011-01-25 or 2011-01-25T19:01:02+02:00
267
+ * @param string $to date possible formats: 2011-01-25 or 2011-01-25T19:01:02+02:00
268
+ * @return SofortLib_TransactionData $this
269
+ * @see setNumber()
270
+ */
271
+ function setTime($from, $to) {
272
+ $this->time['from_time'] = $from;
273
+ $this->time['to_time'] = $to;
274
+ return $this;
275
+ }
276
+
277
+ /**
278
+ * you can limit the number of results
279
+ *
280
+ * @param int $number number of results [0-100]
281
+ * @param int $page result page
282
+ * @return SofortLib_TransactionData $this
283
+ * @see setTime()
284
+ */
285
+ function setNumber($number, $page='1') {
286
+ $this->time['number'] = $number;
287
+ $this->time['page'] = $page;
288
+ return $this;
289
+ }
290
+
291
+ /**
292
+ * send this message and get response
293
+ *
294
+ * @return SofortLib_TransactionData $this
295
+ */
296
+ function sendRequest() {
297
+ $data = $this->_sendMessage($this->toXml());
298
+ $this->_initParser();
299
+ $this->_parse($data);
300
+
301
+ $this->log(__CLASS__ . ' -> '. $this->formatXmlString($this->toXml()));
302
+ $this->log(__CLASS__ . ' <- '. $this->formatXmlString($data));
303
+
304
+ return $this;
305
+ }
306
+
307
+ /**
308
+ * Parser for response from server
309
+ * this callback will be called for every closing xml-tag
310
+ * @private
311
+ */
312
+ function onParseTag($data, $tag){
313
+ switch($tag) {
314
+ case 'transaction_details':
315
+ if($this->_getParentTag() == 'transactions') {
316
+ array_push($this->response, array());
317
+ $this->count += 1;
318
+ }
319
+ break;
320
+ case 'status':
321
+ case 'status_reason':
322
+ case 'payment_method':
323
+ case 'amount':
324
+ case 'currency_code':
325
+ case 'transaction':
326
+ case 'time':
327
+ if($this->_getParentTag() == 'transaction_details') {
328
+ $i = count($this->response)-1;
329
+ $this->response[$i][$tag] = $data;
330
+ }
331
+ break;
332
+ case 'reason':
333
+ case 'user_variable':
334
+ if($this->_getParentTag() == 'user_variables' || $this->_getParentTag() == 'reasons') {
335
+ $i = count($this->response)-1;
336
+ $this->response[$i][$tag][] = $data;
337
+ }
338
+ break;
339
+ case 'salutation':
340
+ case 'firstname':
341
+ case 'lastname':
342
+ case 'street':
343
+ case 'street_number':
344
+ case 'zipcode':
345
+ case 'city':
346
+ case 'country_code':
347
+ if($this->_getParentTag() == 'invoice_address' || $this->_getParentTag() == 'shipping_address') {
348
+ $i = count($this->response)-1;
349
+ $this->response[$i][$this->_getParentTag()][$tag] = $data;
350
+ }
351
+ break;
352
+ case 'transactions':
353
+ array_pop($this->response); //we added one level too many
354
+ $this->count -= 1;
355
+ break;
356
+ default:
357
+ break;
358
+ }
359
+ }
360
+
361
+ /**
362
+ * generate XML message
363
+ * @return string
364
+ */
365
+ function toXml() {
366
+ $msg = '<?xml version="1.0" encoding="UTF-8"?>';
367
+ if(count($this->transaction) > 0) {
368
+ $msg .= '<transaction_request>';
369
+ $msg .= $this->_indexedArrayToXmlList($this->transaction, 'transaction');
370
+ $msg .= '</transaction_request>';
371
+ }
372
+ else
373
+ $msg .= $this->_arrayToXml($this->time, 'transaction_request');
374
+
375
+ return $msg;
376
+ }
377
+
378
+ /**
379
+ * returns the InvoiceAddress
380
+ * @param int $i if you request multiple transactions at once you can set the number here
381
+ * @return array
382
+ */
383
+ function getInvoiceAddress($i = 0) {
384
+ if($i < 0 || $i > $this->count)
385
+ return false;
386
+
387
+ return $this->response[$i]['invoice_address'];
388
+ }
389
+
390
+ /**
391
+ * returns the ShippingAddress
392
+ * @param int $i if you request multiple transactions at once you can set the number here
393
+ * @return array
394
+ */
395
+ function getShippingAddress($i = 0) {
396
+ if($i < 0 || $i > $this->count)
397
+ return false;
398
+
399
+ return $this->response[$i]['shipping_address'];
400
+ }
401
+
402
+ /**
403
+ * returns the status of a transaction
404
+ * @param int $i if you request multiple transactions at once you can set the number here
405
+ * @return string pending|received|loss|refunded
406
+ */
407
+ function getStatus($i = 0) {
408
+ if($i < 0 || $i > $this->count)
409
+ return false;
410
+
411
+ return $this->response[$i]['status'];
412
+ }
413
+
414
+ /**
415
+ * returns the detailed status description of a transaction
416
+ * @param int $i if you request multiple transactions at once you can set the number here
417
+ * @return string message
418
+ */
419
+ function getStatusReason($i = 0) {
420
+ if($i < 0 || $i > $this->count)
421
+ return false;
422
+
423
+ return $this->response[$i]['status_reason'];
424
+ }
425
+
426
+ /**
427
+ * returns the total amount of a transaction
428
+ * @param int $i if you request multiple transactions at once you can set the number here
429
+ * @return double amount
430
+ */
431
+ function getAmount($i = 0) {
432
+ if($i < 0 || $i > $this->count)
433
+ return false;
434
+
435
+ return $this->response[$i]['amount'];
436
+ }
437
+
438
+ /**
439
+ * returns the currency of a transaction
440
+ * @param int $i if you request multiple transactions at once you can set the number here
441
+ * @return string EUR|USD|GBP....
442
+ */
443
+ function getCurrency($i = 0) {
444
+ if($i < 0 || $i > $this->count)
445
+ return false;
446
+
447
+ return $this->response[$i]['currency_code'];
448
+ }
449
+
450
+ /**
451
+ * returns the payment method of a transaction
452
+ * @param int $i if you request multiple transactions at once you can set the number here
453
+ * @return string su|sr|sl|sv|ls
454
+ */
455
+ function getPaymentMethod($i = 0) {
456
+ if($i < 0 || $i > $this->count)
457
+ return false;
458
+
459
+ return $this->response[$i]['payment_method'];
460
+ }
461
+
462
+ /**
463
+ * returns the transaction id of a transaction
464
+ * @param int $i if you request multiple transactions at once you can set the number here
465
+ * @return string transaction id
466
+ */
467
+ function getTransaction($i = 0) {
468
+ if($i < 0 || $i > $this->count)
469
+ return false;
470
+
471
+ return $this->response[$i]['transaction'];
472
+ }
473
+
474
+ /**
475
+ * returns the user variable of a transaction
476
+ * @param int $n number of the variable
477
+ * @param int $i if you request multiple transactions at once you can set the number here
478
+ * @return string the content of this variable
479
+ */
480
+ function getUserVariable($n, $i = 0) {
481
+ if($i < 0 || $i > $this->count)
482
+ return false;
483
+
484
+ return $this->response[$i]['user_variable'][$n];
485
+ }
486
+
487
+ /**
488
+ * returns the time of a transaction
489
+ * @param int $i if you request multiple transactions at once you can set the number here
490
+ * @return string time e.g. 2011-01-01T12:35:09+01:00 use strtotime() to convert it to unixtime
491
+ */
492
+ function getTime($i = 0) {
493
+ if($i < 0 || $i > $this->count)
494
+ return false;
495
+
496
+ return $this->response[$i]['time'];
497
+ }
498
+ }
499
+
500
+
501
+ /**
502
+ * This class should be called when you receive a notification about
503
+ * a status change.
504
+ *
505
+ * In rare cases notifications might be double or even wrong alltogether (if
506
+ * send by a malicious user). So don't use this to change your status but instead
507
+ * use the transaction id to query the webservice for detailed data (SofortLib_TransactionData)
508
+ *
509
+ * eg: $notificationObj = new SofortLib_Notification();
510
+ *
511
+ * $transactionId = $notificationObj->getNotification();
512
+ *
513
+ * Copyright (c) 2010 Payment Network AG
514
+ *
515
+ * $Date: 2011-03-10 14:48:12 +0100 (Do, 10 Mrz 2011) $
516
+ * @version SofortLib 1.1.0 $Id: sofortLib.php 450 2011-03-10 13:48:12Z poser $
517
+ * @author Payment Network AG http://www.payment-network.com (integration@payment-network.com)
518
+ *
519
+ */
520
+ class SofortLib_Notification extends SofortLib_Abstract
521
+ {
522
+ var $transactionId = '';
523
+ var $time;
524
+ var $parameters = array();
525
+
526
+ /**
527
+ * creates a new notification object for receiving notifications
528
+ */
529
+ function SofortLib_Notification() {
530
+ $this->SofortLib('', '');
531
+ }
532
+
533
+ /**
534
+ * reads the input and tries to read the transaction id
535
+ *
536
+ * @return array transactionid=>status
537
+ */
538
+ function getNotification() {
539
+ $data = file_get_contents('php://input');
540
+
541
+
542
+ //we don't really need a huge parser, simply extract the transaction-id
543
+ if(!preg_match('#<transaction>([0-9a-z-]+)</transaction>#i', $data, $matches)) {
544
+ $this->log(__CLASS__ . ' <- '. $data);
545
+ $this->errors['error']['message'] = 'could not parse message';
546
+ return false;
547
+ }
548
+ $this->transactionId = $matches[1];
549
+
550
+ $this->log(__CLASS__ . ' <- '. $this->formatXmlString($data));
551
+
552
+
553
+ preg_match('#<time>(.+)</time>#i', $data, $matches);
554
+ $this->time = $matches[1];
555
+
556
+ // $this->_initParser();
557
+ // $this->_parse($data);
558
+
559
+ return $this->transactionId;
560
+ }
561
+
562
+
563
+ ////not in use!!////
564
+ /**
565
+ * Parser for response from server
566
+ * this callback will be called for every closing xml-tag
567
+ * @private
568
+ */
569
+ function onParseTag($data, $tag){
570
+ switch($tag) {
571
+ case 'transaction':
572
+ $this->transactionId = $data;
573
+ break;
574
+ case 'time':
575
+ $this->time = $data;
576
+ break;
577
+ break;
578
+ }
579
+ }
580
+
581
+ function getTime() {
582
+ return $this->time;
583
+ }
584
+
585
+
586
+ function getTransactionId() {
587
+ return $this->transactionId;
588
+ }
589
+ }
590
+
591
+ /**
592
+ * Setup a multipay payment session
593
+ * after the configuration of multiple payment methods you will receive
594
+ * an url and a transaction id, your customer should be redirected to this
595
+ * url you can use the transaction id for future reference of this payment
596
+ *
597
+ * eg: TODO
598
+ *
599
+ * Copyright (c) 2010 Payment Network AG
600
+ *
601
+ * $Date: 2011-03-10 14:48:12 +0100 (Do, 10 Mrz 2011) $
602
+ * @version SofortLib 1.1.0 $Id: sofortLib.php 450 2011-03-10 13:48:12Z poser $
603
+ * @author Payment Network AG http://www.payment-network.com (integration@payment-network.com)
604
+ *
605
+ */
606
+ class SofortLib_Multipay extends SofortLib_Abstract
607
+ {
608
+ var $transactionId;
609
+ var $paymentUrl;
610
+ var $projectId;
611
+ var $parameters;
612
+ var $xml;
613
+
614
+ /**
615
+ * create a new payment object
616
+ * @param string $apikey your API key
617
+ * @param int $projectId your project id
618
+ */
619
+ function SofortLib_Multipay($apikey, $projectId) {
620
+ $this->SofortLib($apikey, 'https://api.sofort.com/api/xml/');
621
+ $this->parameters['project_id'] = $projectId;
622
+ }
623
+
624
+ /**
625
+ * the language code will help in determing what language to
626
+ * use when displaying the payment form, other data like
627
+ * browser settings and ip will be used as well
628
+ *
629
+ * @param string $arg de|en|nl|fr ...
630
+ * @return SofortLib_Multipay
631
+ */
632
+ function setLanguageCode($arg) {
633
+ $this->parameters['language_code'] = $arg;
634
+ return $this;
635
+ }
636
+
637
+ /**
638
+ * timeout how long this transaction configuration will be valid for
639
+ * this is the time between the generation of the payment url and
640
+ * the user completing the form, should be at least two to three minutes
641
+ * defaults to unlimited if not set
642
+ *
643
+ * @param int $arg timeout in seconds
644
+ * @return SofortLib_Multipay
645
+ */
646
+ function setTimeout($arg) {
647
+ $this->parameters['timeout'] = $arg;
648
+ return $this;
649
+ }
650
+
651
+ /**
652
+ * set the email address of the customer
653
+ * this will be used for sofortvorkasse and sofortrechnung
654
+ *
655
+ * @param string $arg email address
656
+ * @return SofortLib_Multipay
657
+ */
658
+ function setEmailCustomer($arg) {
659
+ $this->parameters['email_customer'] = $arg;
660
+ return $this;
661
+ }
662
+
663
+ /**
664
+ * set the phone number of the customer
665
+ *
666
+ * @param string $arg phone number
667
+ * @return SofortLib_Multipay
668
+ */
669
+ function setPhoneNumberCustomer($arg) {
670
+ $this->parameters['phone_customer'] = $arg;
671
+ return $this;
672
+ }
673
+
674
+ /**
675
+ * add another variable this can be your internal order id or similar
676
+ *
677
+ * @param string $arg the contents of the variable
678
+ * @return SofortLib_Multipay
679
+ */
680
+ function addUserVariable($arg) {
681
+ $this->parameters['user_variables'][] = $arg;
682
+ return $this;
683
+ }
684
+
685
+ /**
686
+ * set data of account
687
+ *
688
+ * @param string $bank_code bank code of bank
689
+ * @param string $account_number account number
690
+ * @param string $holder Name/Holder of this account
691
+ * @return SofortLib_Multipay $this
692
+ */
693
+ function setSenderAccount($bank_code, $account_number, $holder) {
694
+ $this->parameters['sender'] = array('holder' => $holder, 'account_number' => $account_number, 'bank_code' => $bank_code);
695
+ return $this;
696
+ }
697
+
698
+ /**
699
+ * amount of this payment
700
+ *
701
+ * @param double $arg
702
+ * @param string $currency currency of this transaction, default EUR
703
+ * @return SofortLib_Multipay $this
704
+ */
705
+ function setAmount($arg, $currency = 'EUR') {
706
+ $this->parameters['amount'] = $arg;
707
+ $this->parameters['currency_code'] = $currency;
708
+ return $this;
709
+ }
710
+
711
+ /**
712
+ * set the reason values of this transfer
713
+ *
714
+ * @param string $arg max 27 characters
715
+ * @param string $arg2 max 27 characters
716
+ * @return SofortLib_Multipay $this
717
+ */
718
+ function setReason($arg, $arg2='') {
719
+ $this->parameters['reasons'][0] = $arg;
720
+ $this->parameters['reasons'][1] = $arg2;
721
+ return $this;
722
+ }
723
+
724
+
725
+ /**
726
+ * the customer will be redirected to this url after a successful
727
+ * transaction, this should be a page where a short confirmation is
728
+ * displayed
729
+ *
730
+ * @param string $arg the url after a successful transaction
731
+ * @return SofortLib_Multipay
732
+ */
733
+ function setSuccessUrl($arg) {
734
+ $this->parameters['success_url'] = '<![CDATA['.$arg.']]>';
735
+ return $this;
736
+ }
737
+
738
+ /**
739
+ * the customer will be redirected to this url if he uses the
740
+ * abort link on the payment form, should redirect him back to
741
+ * his cart or to the payment selection page
742
+ *
743
+ * @param string $arg url for aborting the transaction
744
+ * @return SofortLib_Multipay
745
+ */
746
+ function setAbortUrl($arg) {
747
+ $this->parameters['abort_url'] = '<![CDATA['.$arg.']]>';
748
+ return $this;
749
+ }
750
+
751
+ /**
752
+ * if the customer takes too much time or if your timeout is set too short
753
+ * he will be redirected to this page
754
+ *
755
+ * @param string $arg url
756
+ * @return SofortLib_Multipay
757
+ */
758
+ function setTimeoutUrl($arg) {
759
+ $this->parameters['timeout_url'] = '<![CDATA['.$arg.']]>';
760
+ return $this;
761
+ }
762
+
763
+
764
+ /**
765
+ * set the url where you want notification about status changes
766
+ * being sent to. Use SofortLib_Notification and SofortLib_TransactionData
767
+ * to further process that notification
768
+ *
769
+ * @param string $arg url
770
+ * @return SofortLib_Multipay
771
+ */
772
+ function setNotificationUrl($arg) {
773
+ $this->parameters['notification_urls'] = array('<![CDATA['.$arg.']]>');
774
+ return $this;
775
+ }
776
+
777
+ /**
778
+ * you can set set multiple urls for receiving notifications
779
+ * this might be helpfull if you have several systems for processing
780
+ * an order (e.g. an ERP system)
781
+ *
782
+ * @param string $arg url
783
+ * @return SofortLib_Multipay
784
+ */
785
+ function addNotificationUrl($arg) {
786
+ $this->parameters['notification_urls'][] = '<![CDATA['.$arg.']]>';
787
+ return $this;
788
+ }
789
+
790
+ /**
791
+ * set the email address where you want notification about status changes
792
+ * being sent to.
793
+ *
794
+ * @param string $arg email address
795
+ * @return SofortLib_Multipay
796
+ */
797
+ function setNotificationEmail($arg) {
798
+ $this->parameters['notification_emails'] = array('<![CDATA['.$arg.']]>');
799
+ return $this;
800
+ }
801
+
802
+ /**
803
+ * you can set set multiple emails for receiving notifications
804
+ *
805
+ * @param string $arg email
806
+ * @return SofortLib_Multipay
807
+ */
808
+ function addNotificationEmail($arg) {
809
+ $this->parameters['notification_emails'][] = $arg;
810
+ return $this;
811
+ }
812
+
813
+ /**
814
+ * set the version of this payment module
815
+ * this is helpfull so the support staff can easily
816
+ * find out if someone uses an outdated module
817
+ *
818
+ * @param string $arg version string of your module
819
+ * @return SofortLib_Multipay
820
+ */
821
+ function setVersion($arg) {
822
+ $this->parameters['interface_version'] = $arg;
823
+ return $this;
824
+ }
825
+
826
+ /**
827
+ * add sofortueberweisung as payment method
828
+ * @param double $amount this amount only applies to this payment method
829
+ * @return SofortLib_Multipay $this
830
+ */
831
+ function setSofortueberweisung($amount='') {
832
+ $this->parameters['su'] = array();
833
+ if(!empty($amount)) {
834
+ $this->parameters['su']['amount'] = $amount;
835
+ }
836
+
837
+ return $this;
838
+ }
839
+
840
+ /**
841
+ * add sofortlastschrift as payment method
842
+ * @param double $amount this amount only applies to this payment method
843
+ * @return SofortLib_Multipay $this
844
+ */
845
+ function setSofortlastschrift($amount='') {
846
+ $this->parameters['sl'] = array();
847
+ if(!empty($amount)) {
848
+ $this->parameters['sl']['amount'] = $amount;
849
+ }
850
+
851
+ return $this;
852
+ }
853
+
854
+
855
+ /**
856
+ * add lastschrift as payment method
857
+ * @param double $amount this amount only applies to this payment method
858
+ * @return SofortLib_Multipay $this
859
+ */
860
+ function setLastschrift($amount='') {
861
+ $this->parameters['ls'] = array();
862
+ if(!empty($amount)) {
863
+ $this->parameters['ls']['amount'] = $amount;
864
+ }
865
+
866
+ return $this;
867
+ }
868
+
869
+ function setLastschriftBaseCheckDisabled() {
870
+ $this->parameters['ls']['base_check_disabled'] = 1;
871
+ return $this;
872
+ }
873
+
874
+ function setLastschriftExtendedCheckDisabled() {
875
+ $this->parameters['ls']['extended_check_disabled'] = 1;
876
+ return $this;
877
+ }
878
+
879
+ function setLastschriftMobileCheckDisabled() {
880
+ $this->parameters['ls']['mobile_check_disabled'] = 1;
881
+ return $this;
882
+ }
883
+
884
+ /**
885
+ * add sofortrechnung as payment method
886
+ * if you use this payment method you have to provide
887
+ * the customer address and cart as well
888
+ * the total amount of this payment method will
889
+ * be determined by the total of the cart
890
+ *
891
+ * @return SofortLib_Multipay $this
892
+ */
893
+ function setSofortrechnung() {
894
+ if(!array_key_exists('sr', $this->parameters)) {
895
+ $this->parameters['sr'] = array();
896
+ }
897
+ return $this;
898
+ }
899
+
900
+ /**
901
+ * add sofortvorkasse as payment method
902
+ * @param double $amount this amount only applies to this payment method
903
+ * @return SofortLib_Multipay $this
904
+ */
905
+ function setSofortvorkasse($amount='') {
906
+ $this->parameters['sv'] = array();
907
+ if(!empty($amount)) {
908
+ $this->parameters['sv']['amount'] = $amount;
909
+ }
910
+
911
+ return $this;
912
+ }
913
+
914
+ /**
915
+ * set the customer id which will appear on top of the invoice
916
+ * @param int $arg
917
+ * @return SofortLib_Multipay $this
918
+ */
919
+ function setSofortrechnungCustomerId($arg) {
920
+ $this->parameters['sr']['customer_id'] = $arg;
921
+ return $this;
922
+ }
923
+
924
+ /**
925
+ * set the order id which will appear on top of the invoice
926
+ * @param int $arg
927
+ * @return SofortLib_Multipay $this
928
+ */
929
+ function setSofortrechnungOrderId($arg) {
930
+ $this->parameters['sr']['order_id'] = $arg;
931
+ return $this;
932
+ }
933
+
934
+ /**
935
+ * set the invoice address of the customer
936
+ *
937
+ * @param string $firstname
938
+ * @param string $lastname
939
+ * @param string $street
940
+ * @param string $streetNumber
941
+ * @param string $zipcode
942
+ * @param string $city
943
+ * @param int $salutation [1|2] 1=Mr. 2=Mrs.
944
+ * @param string $country country code, only DE allowed at the moment
945
+ * @return SofortLib_Multipay $this
946
+ */
947
+ function setSofortrechnungInvoiceAddress($firstname, $lastname, $street, $streetNumber, $zipcode, $city, $salutation, $country = 'DE') {
948
+ $this->parameters['sr']['invoice_address']['salutation'] = $salutation;
949
+ $this->parameters['sr']['invoice_address']['firstname'] = $firstname;
950
+ $this->parameters['sr']['invoice_address']['lastname'] = $lastname;
951
+ $this->parameters['sr']['invoice_address']['street'] = $street;
952
+ $this->parameters['sr']['invoice_address']['street_number'] = $streetNumber;
953
+ $this->parameters['sr']['invoice_address']['zipcode'] = $zipcode;
954
+ $this->parameters['sr']['invoice_address']['city'] = $city;
955
+ $this->parameters['sr']['invoice_address']['country_code'] = $country;
956
+ return $this;
957
+ }
958
+
959
+ /**
960
+ * set the shipping address of the customer
961
+ *
962
+ * @param string $firstname
963
+ * @param string $lastname
964
+ * @param string $street
965
+ * @param string $streetNumber
966
+ * @param string $zipcode
967
+ * @param string $city
968
+ * @param int $salutation [1|2] 1=Mr. 2=Mrs.
969
+ * @param string $country country code, only DE allowed at the moment
970
+ * @return SofortLib_Multipay $this
971
+ */
972
+ function setSofortrechnungShippingAddress($firstname, $lastname, $street, $streetNumber, $zipcode, $city, $salutation, $country = 'DE') {
973
+ $this->parameters['sr']['shipping_address']['salutation'] = $salutation;
974
+ $this->parameters['sr']['shipping_address']['firstname'] = $firstname;
975
+ $this->parameters['sr']['shipping_address']['lastname'] = $lastname;
976
+ $this->parameters['sr']['shipping_address']['street'] = $street;
977
+ $this->parameters['sr']['shipping_address']['street_number'] = $streetNumber;
978
+ $this->parameters['sr']['shipping_address']['zipcode'] = $zipcode;
979
+ $this->parameters['sr']['shipping_address']['city'] = $city;
980
+ $this->parameters['sr']['shipping_address']['country_code'] = $country;
981
+
982
+ return $this;
983
+ }
984
+
985
+ /**
986
+ * add one item to the cart
987
+ *
988
+ * @param string $productNumber product number, EAN code, ISBN number or similar
989
+ * @param string $title description of this title
990
+ * @param double $unit_price gross price of one item
991
+ * @param int $productType product type number see manual (0=other, 1=shipping, ...)
992
+ * @param string $description additional description of this item
993
+ * @param int $quantity default 1
994
+ * @param int $tax tax in percent, default 19
995
+ */
996
+ function addSofortrechnungItem($productNumber, $title, $unit_price, $productType = 0, $description = '', $quantity = 1, $tax = 19) {
997
+ $unit_price = number_format($unit_price, 2, '.','');
998
+ $tax = number_format($tax, 2, '.','');
999
+ $quantity = intval($quantity);
1000
+ $this->parameters['sr']['items'][] = array('product_number' => $productNumber,
1001
+ 'product_type' => $productType, 'title' => $title, 'description' => $description,
1002
+ 'quantity' => $quantity, 'unit_price' => $unit_price, 'tax' => $tax);
1003
+ }
1004
+
1005
+ /**
1006
+ * Parser for response from server
1007
+ * this callback will be called for every closing xml-tag
1008
+ * @private
1009
+ */
1010
+ function onParseTag($data, $tag){
1011
+ switch($tag) {
1012
+ case 'transaction':
1013
+ $this->transactionId = $data;
1014
+ break;
1015
+ case 'payment_url':
1016
+ $this->paymentUrl = $data;
1017
+ break;
1018
+ case 'new_transaction':
1019
+ //finished parsing everything
1020
+ default:
1021
+ break;
1022
+ }
1023
+ }
1024
+
1025
+ /**
1026
+ * after configuration and sending this request
1027
+ * you can use this function to redirect the customer
1028
+ * to the payment form
1029
+ *
1030
+ * @return string url of payment form
1031
+ */
1032
+ function getPaymentUrl() {
1033
+ return $this->paymentUrl;
1034
+ }
1035
+
1036
+ /**
1037
+ * use this id to track the transaction
1038
+ *
1039
+ * @return string transaction id
1040
+ */
1041
+ function getTransactionId() {
1042
+ return $this->transactionId;
1043
+ }
1044
+
1045
+ /**
1046
+ * send this message and get the response
1047
+ *
1048
+ * @return array transactionid=>status
1049
+ */
1050
+ function sendRequest() {
1051
+ $data = $this->_sendMessage($this->toXml());
1052
+ $this->_initParser();
1053
+ $this->_parse($data);
1054
+ $this->xml = $data;
1055
+
1056
+ $this->log(__CLASS__ . ' -> '. $this->formatXmlString($this->toXml()));
1057
+ $this->log(__CLASS__ . ' <- '. $this->formatXmlString($data));
1058
+
1059
+ return $this;
1060
+ }
1061
+
1062
+ /**
1063
+ * generate XML message
1064
+ * @return string
1065
+ */
1066
+ function toXml() {
1067
+ $msg = '<?xml version="1.0" encoding="UTF-8"?>';
1068
+ $msg .= $this->_arrayToXml($this->parameters, 'multipay');
1069
+
1070
+ return $msg;
1071
+ }
1072
+ }
1073
+
1074
+
1075
+ /**
1076
+ * class for refund/rueckbuchung
1077
+ *
1078
+ * Copyright (c) 2010 Payment Network AG
1079
+ *
1080
+ * $Date: 2011-03-10 14:48:12 +0100 (Do, 10 Mrz 2011) $
1081
+ * @version SofortLib 1.1.0 $Id: sofortLib.php 450 2011-03-10 13:48:12Z poser $
1082
+ * @author Payment Network AG http://www.payment-network.com (integration@payment-network.com)
1083
+ *
1084
+ */
1085
+ class SofortLib_Refund extends SofortLib_Abstract
1086
+ {
1087
+ var $response = array(array());
1088
+ var $api = NULL;
1089
+ var $data = array();
1090
+
1091
+ function SofortLib_Refund($apikey) {
1092
+ $this->SofortLib($apikey, 'https://www.sofortueberweisung.de/payment/refunds');
1093
+ }
1094
+
1095
+
1096
+ /**
1097
+ * send this message and get response
1098
+ *
1099
+ * @return array transactionid=>status
1100
+ */
1101
+ function sendRequest() {
1102
+ $data = $this->_sendMessage($this->toXml());
1103
+ $this->_initParser();
1104
+ $this->_parse($data);
1105
+
1106
+ return $this->getStatusArray();
1107
+ }
1108
+
1109
+
1110
+ /**
1111
+ * generate XML message
1112
+ * @return string
1113
+ */
1114
+ function toXml() {
1115
+ $msg = '<?xml version="1.0" encoding="UTF-8"?>';
1116
+ $msg .= '<refunds>';
1117
+
1118
+ if(is_array($this->data)) {
1119
+ foreach($this->data as $refund) {
1120
+ if(is_array($refund)) {
1121
+ $msg .= '<refund>';
1122
+ foreach ($refund as $var => $value) {
1123
+ $msg .= '<'.$var.'>'.$value.'</'.$var.">\n";
1124
+ }
1125
+ $msg .= '</refund>';
1126
+ }
1127
+ }
1128