DIBS_Payment_Services - Version 1.0.0.13

Version Notes

1.0.0.13
- Stock subtrackt bug fixed.

1.0.0.12
- Reinstall (upgrade) procedure from version 1.0.0.8 to version 1.0.0.12 added

1.0.0.11
- Irrelevant Mage Core package dependencis removed

1.0.0.10
- API verion numner updated

1.0.0.9
- New directory structure introduced.
- Support fot DIBS PayByBill (PBB) introduced.

1.0.0.8

1.0.0.7
- Minor language update

1.0.0.6
- Fixed currency bug
- Added order information to DIBS payment process

1.0.0.5
- Added extra complete status for order

1.0.0.3
- Added order information to DIBS payment process

1.0.0.2
- Minor language update

1.0.0.1
- Added languages:
Danish, Norwegian, Swedish
- Added support for "Skip accept page"

First release 1.0.0.0

Download this release

Release Info

Developer DIBS AS
Extension DIBS_Payment_Services
Version 1.0.0.13
Comparing to
See all releases


Version 1.0.0.13

Files changed (66) hide show
  1. app/code/community/Dibs/Adminhtml/Block/Sales/Order/View/Tab/Info.php +401 -0
  2. app/code/community/Dibs/Adminhtml/etc/config.xml +34 -0
  3. app/code/community/Dibs/Dibs/Block/Failure.php +34 -0
  4. app/code/community/Dibs/Dibs/Block/Form.php +41 -0
  5. app/code/community/Dibs/Dibs/Block/Redirect.php +41 -0
  6. app/code/community/Dibs/Dibs/Helper/Data.php +36 -0
  7. app/code/community/Dibs/Dibs/Model/Dibs.php +655 -0
  8. app/code/community/Dibs/Dibs/Model/Mysql4/Setup.php +28 -0
  9. app/code/community/Dibs/Dibs/Model/System/Config/Source/Color.php +37 -0
  10. app/code/community/Dibs/Dibs/Model/System/Config/Source/Decorator.php +37 -0
  11. app/code/community/Dibs/Dibs/Model/System/Config/Source/Dibslogos.php +62 -0
  12. app/code/community/Dibs/Dibs/Model/System/Config/Source/Dibspaytypes.php +58 -0
  13. app/code/community/Dibs/Dibs/Model/System/Config/Source/Lang.php +46 -0
  14. app/code/community/Dibs/Dibs/Model/System/Config/Source/Orderstatusafter.php +58 -0
  15. app/code/community/Dibs/Dibs/Model/System/Config/Source/Orderstatusbefore.php +58 -0
  16. app/code/community/Dibs/Dibs/Model/System/Config/Source/PBBdistribution.php +34 -0
  17. app/code/community/Dibs/Dibs/Model/System/Config/Source/Paymentwindow.php +35 -0
  18. app/code/community/Dibs/Dibs/controllers/DibsController.php +574 -0
  19. app/code/community/Dibs/Dibs/etc/config.xml +152 -0
  20. app/code/community/Dibs/Dibs/etc/system.xml +259 -0
  21. app/code/community/Dibs/Dibs/sql/dibs_setup/mysql4-install-1.0.0.12.php +65 -0
  22. app/code/community/Dibs/Dibs/sql/dibs_setup/mysql4-upgrade-1.0.0.8-1.0.0.12.php +65 -0
  23. app/code/community/Dibs/Sales/Block/Order/Info.php +293 -0
  24. app/code/community/Dibs/Sales/Block/Order/Print.php +247 -0
  25. app/code/community/Dibs/Sales/etc/config.xml +35 -0
  26. app/design/frontend/base/default/template/Dibs/Dibs/redirect.phtml +330 -0
  27. app/design/frontend/default/default/template/Dibs/Dibs/form.phtml +188 -0
  28. app/etc/modules/Dibs_All.xml +40 -0
  29. app/etc/modules/dibs.xml +9 -0
  30. app/locale/da_DK/Mage_Dibs.csv +22 -0
  31. app/locale/en_US/Mage_Dibs.csv +22 -0
  32. app/locale/nb_NO/Mage_Dibs.csv +22 -0
  33. app/locale/nn_NO/Mage_Dibs.csv +22 -0
  34. app/locale/sv_SE/Mage_Dibs.csv +22 -0
  35. package.xml +82 -0
  36. skin/frontend/base/default/images/Dibs/Dibs/aktia.gif +0 -0
  37. skin/frontend/base/default/images/Dibs/Dibs/amex.gif +0 -0
  38. skin/frontend/base/default/images/Dibs/Dibs/bankeinzug.gif +0 -0
  39. skin/frontend/base/default/images/Dibs/Dibs/bax.gif +0 -0
  40. skin/frontend/base/default/images/Dibs/Dibs/dankort.gif +0 -0
  41. skin/frontend/base/default/images/Dibs/Dibs/danskenetbetaling.gif +0 -0
  42. skin/frontend/base/default/images/Dibs/Dibs/dibslogo.gif +0 -0
  43. skin/frontend/base/default/images/Dibs/Dibs/diners.gif +0 -0
  44. skin/frontend/base/default/images/Dibs/Dibs/edankort.gif +0 -0
  45. skin/frontend/base/default/images/Dibs/Dibs/ewire.gif +0 -0
  46. skin/frontend/base/default/images/Dibs/Dibs/forbrugforeningen.gif +0 -0
  47. skin/frontend/base/default/images/Dibs/Dibs/getitcard.gif +0 -0
  48. skin/frontend/base/default/images/Dibs/Dibs/ideal.gif +0 -0
  49. skin/frontend/base/default/images/Dibs/Dibs/jcb.gif +0 -0
  50. skin/frontend/base/default/images/Dibs/Dibs/jcbsecure.gif +0 -0
  51. skin/frontend/base/default/images/Dibs/Dibs/loading.gif +0 -0
  52. skin/frontend/base/default/images/Dibs/Dibs/maestro.gif +0 -0
  53. skin/frontend/base/default/images/Dibs/Dibs/mastercard.gif +0 -0
  54. skin/frontend/base/default/images/Dibs/Dibs/mastercardsecurecode.gif +0 -0
  55. skin/frontend/base/default/images/Dibs/Dibs/mobilcash.gif +0 -0
  56. skin/frontend/base/default/images/Dibs/Dibs/nordeasole.gif +0 -0
  57. skin/frontend/base/default/images/Dibs/Dibs/oko.gif +0 -0
  58. skin/frontend/base/default/images/Dibs/Dibs/pbb.gif +0 -0
  59. skin/frontend/base/default/images/Dibs/Dibs/pci.gif +0 -0
  60. skin/frontend/base/default/images/Dibs/Dibs/seb.gif +0 -0
  61. skin/frontend/base/default/images/Dibs/Dibs/shbdirektbetaling.gif +0 -0
  62. skin/frontend/base/default/images/Dibs/Dibs/swedbankdirektbetaling.gif +0 -0
  63. skin/frontend/base/default/images/Dibs/Dibs/valus.gif +0 -0
  64. skin/frontend/base/default/images/Dibs/Dibs/verifiedbyvisa.gif +0 -0
  65. skin/frontend/base/default/images/Dibs/Dibs/visa.gif +0 -0
  66. skin/frontend/base/default/images/Dibs/Dibs/visaelectron.gif +0 -0
app/code/community/Dibs/Adminhtml/Block/Sales/Order/View/Tab/Info.php ADDED
@@ -0,0 +1,401 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * Modifications copyrighted by Dibs AB, (c) 2010.
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Order information tab
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Adminhtml
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Dibs_Adminhtml_Block_Sales_Order_View_Tab_Info
36
+ extends Mage_Adminhtml_Block_Sales_Order_View_Tab_Info
37
+ {
38
+
39
+ protected function PaymentPart($paymentstr){
40
+ $PaymentPartStr = explode(',',$paymentstr,2);
41
+ return $PaymentPartStr[0];
42
+ }
43
+
44
+ /**
45
+ * Retrieve order model instance
46
+ *
47
+ * @return Mage_Sales_Model_Order
48
+ */
49
+ public function getOrder()
50
+ {
51
+ return Mage::registry('current_order');
52
+ }
53
+
54
+ /**
55
+ * Retrieve source model instance
56
+ *
57
+ * @return Mage_Sales_Model_Order
58
+ */
59
+ public function getSource()
60
+ {
61
+ return $this->getOrder();
62
+ }
63
+
64
+ /**
65
+ * Retrieve order totals block settings
66
+ *
67
+ * @return array
68
+ */
69
+ public function getOrderTotalData()
70
+ {
71
+ return array(
72
+ 'can_display_total_due' => true,
73
+ 'can_display_total_paid' => true,
74
+ 'can_display_total_refunded' => true,
75
+ );
76
+ }
77
+
78
+ public function getOrderInfoData()
79
+ {
80
+ return array(
81
+ 'no_use_order_link' => true,
82
+ );
83
+ }
84
+
85
+ public function getTrackingHtml()
86
+ {
87
+ return $this->getChildHtml('order_tracking');
88
+ }
89
+
90
+ public function getItemsHtml()
91
+ {
92
+ return $this->getChildHtml('order_items');
93
+ }
94
+
95
+ /**
96
+ * Retrive giftmessage block html
97
+ *
98
+ * @return string
99
+ */
100
+ public function getGiftmessageHtml()
101
+ {
102
+ return $this->getChildHtml('order_giftmessage');
103
+ }
104
+
105
+ public function getPaymentHtml()
106
+ {
107
+
108
+ $res = $this->getChildHtml('order_payment');
109
+
110
+ $standard = Mage::getModel('dibs/Dibs');
111
+
112
+ //
113
+ // Read info directly from the database
114
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
115
+ $row = $read->fetchRow("select * from dibs_orderdata where orderid = " . $this->getOrder()->getIncrementId());
116
+
117
+ if (empty($row)) { // Pre DIBS-1.0.0.9 ex. DIBS-1.0.0.8 Handeled Order:
118
+ //=====================================================================
119
+ $row = $read->fetchRow("select * from dibs_order_status where orderid = " . $this->getOrder()->getIncrementId());
120
+ if ($row['status'] == '1') {
121
+ //
122
+ // Payment has been made to this order
123
+ $res .= "<br><br>" . "<table border='0' width='100%'>";
124
+ $res .= "<tr><td colspan='2'><b>" . Mage::helper('dibs')->__('DIBS_LABEL_7') . "</b></td></tr>";
125
+
126
+ if ($row['transact'] != '0') {
127
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_8') . "</td>";
128
+ $res .= "<td>" . $row['transact'] . "</td></tr>";
129
+ }
130
+ if ($row['amount'] != '0') {
131
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_9') . "</td>";
132
+ $res .= "<td>" . $this->getOrder()->getOrderCurrencyCode() . "&nbsp;" . number_format(((int)$row['amount']) / 100, 2, ',', ' ') . "</td></tr>";
133
+ }
134
+ if ($row['currency'] != '0') {
135
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_10') . "</td>";
136
+ $res .= "<td>" . $row['currency'] . "</td></tr>";
137
+ }
138
+ if ($row['fee'] != '0') {
139
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_11') . "</td>";
140
+ $res .= "<td>" . $this->getOrder()->getOrderCurrencyCode() . "&nbsp;" . number_format(((int)$row['fee']) / 100, 2, ',', ' ') . "</td></tr>";
141
+ }
142
+ if ($row['paytype'] != '0') {
143
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_12') . "</td>";
144
+ $res .= "<td>" . $this->printLogo($row['paytype']) . "</td></tr>";
145
+ }
146
+ if ($row['cardnomask'] != '0' && $row['cardprefix'] == '0') {
147
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_13') . "</td>";
148
+ $res .= "<td>............" . trim($row['cardnomask'],'X') . "</td></tr>";
149
+ }
150
+ if ($row['cardprefix'] != '0' && $row['cardnomask'] == '0') {
151
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_13') . "</td>";
152
+ $res .= "<td>" . $row['cardprefix'] . "..........</td></tr>";
153
+ }
154
+ if ($row['cardprefix'] != '0' && $row['cardnomask'] != '0') {
155
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_13') . "</td>";
156
+ $res .= "<td>" . $row['cardprefix'] . '......' . trim($row['cardnomask'],'X') . "</td></tr>";
157
+ }
158
+ if ($row['cardexpdate'] != '0') {
159
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_14') . "</td>";
160
+ $res .= "<td>" . substr($row['cardexpdate'],2,2) . " / " . substr($row['cardexpdate'],0,2) . "</td></tr>";
161
+ }
162
+ if ($row['cardcountry'] != '0') {
163
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_15') . "</td>";
164
+ $res .= "<td>" . $row['cardcountry'] . "</td></tr>";
165
+ }
166
+ if ($row['acquirer'] != '0') {
167
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_16') . "</td>";
168
+ $res .= "<td>" . $row['acquirer'] . "</td></tr>";
169
+ }
170
+ if ($row['enrolled'] != '0') {
171
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_17') . "</td>";
172
+ $res .= "<td>" . $row['enrolled'] . "</td></tr>";
173
+ }
174
+ $res .= "</table><br>";
175
+
176
+ $res .= "<a href='https://payment.architrade.com/admin/' target='_blank'>" . Mage::helper('dibs')->__('DIBS_LABEL_18') . "</a>";
177
+ $res .= "<br><br>";
178
+
179
+ } else {
180
+ $res .= "<br>" . Mage::helper('dibs')->__('DIBS_LABEL_19') . "<br>";
181
+ }
182
+ } else { // DIBS-1.0.0.9 Handeled Order:
183
+ //======================================
184
+ if ($row['status'] == '1') {
185
+ //
186
+ // Payment has been made to this order
187
+ $res .= "<br><br>" . "<table border='0' width='100%'>";
188
+ $res .= "<tr><td colspan='2'><b>" . Mage::helper('dibs')->__('DIBS_LABEL_7') . "</b></td></tr>";
189
+
190
+ if ($row['transact'] != '0') {
191
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_8') . "</td>";
192
+ $res .= "<td>" . $row['transact'] . "</td></tr>";
193
+ }
194
+ if ($row['amount'] != '0') {
195
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_9') . "</td>";
196
+ $res .= "<td>" . $this->getOrder()->getOrderCurrencyCode() . "&nbsp;" . number_format(((int)$row['amount']) / 100, 2, ',', ' ') . "</td></tr>";
197
+ }
198
+ if ($row['currency'] != '0') {
199
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_10') . "</td>";
200
+ $res .= "<td>" . $row['currency'] . "</td></tr>";
201
+ }
202
+ if ($row['fee'] != '0') {
203
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_11') . "</td>";
204
+ $res .= "<td>" . $this->getOrder()->getOrderCurrencyCode() . "&nbsp;" . number_format(((int)$row['fee']) / 100, 2, ',', ' ') . "</td></tr>";
205
+ }
206
+ if ($row['paytype'] != '0') {
207
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_12') . "</td>";
208
+ $res .= "<td>" . $this->printLogo($row['paytype']) . "</td></tr>";
209
+ }
210
+ if ($row['cardnomask'] != '0' && $row['cardprefix'] == '0') {
211
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_13') . "</td>";
212
+ $res .= "<td>............" . trim($row['cardnomask'],'X') . "</td></tr>";
213
+ }
214
+ if ($row['cardprefix'] != '0' && $row['cardnomask'] == '0') {
215
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_13') . "</td>";
216
+ $res .= "<td>" . $row['cardprefix'] . "..........</td></tr>";
217
+ }
218
+ if ($row['cardprefix'] != '0' && $row['cardnomask'] != '0') {
219
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_13') . "</td>";
220
+ $res .= "<td>" . $row['cardprefix'] . '......' . trim($row['cardnomask'],'X') . "</td></tr>";
221
+ }
222
+ if ($row['cardexpdate'] != '0') {
223
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_14') . "</td>";
224
+ $res .= "<td>" . substr($row['cardexpdate'],2,2) . " / " . substr($row['cardexpdate'],0,2) . "</td></tr>";
225
+ }
226
+ if ($row['cardcountry'] != '0') {
227
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_15') . "</td>";
228
+ $res .= "<td>" . $row['cardcountry'] . "</td></tr>";
229
+ }
230
+ if ($row['acquirer'] != '0') {
231
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_16') . "</td>";
232
+ $res .= "<td>" . $row['acquirer'] . "</td></tr>";
233
+ }
234
+ if ($row['enrolled'] != '0') {
235
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_17') . "</td>";
236
+ $res .= "<td>" . $row['enrolled'] . "</td></tr>";
237
+ }
238
+ $res .= "</table><br>";
239
+
240
+ $res .= "<a href='https://payment.architrade.com/admin/' target='_blank'>" . Mage::helper('dibs')->__('DIBS_LABEL_18') . "</a>";
241
+ $res .= "<br><br>";
242
+
243
+ } else {
244
+ $res .= "<br>" . Mage::helper('dibs')->__('DIBS_LABEL_19') . "<br>";
245
+ }
246
+ }
247
+
248
+ return $res;
249
+ }
250
+
251
+ public function printLogo($paytype) {
252
+
253
+ switch($this->PaymentPart($paytype)) {
254
+ case 'AMEX': {
255
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/amex.gif') . '" border="0" />'; break;
256
+ }
257
+ case 'AMEX(DK)': {
258
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/amex.gif') . '" border="0" />'; break;
259
+ }
260
+ case 'BAX': {
261
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/bax.gif') . '" border="0" />'; break;
262
+ }
263
+ case 'DIN': {
264
+ $res = $this->getSkinUrl('images/Dibs/Dibs/diners.gif') . '" border="0" />'; break;
265
+ }
266
+ case 'DIN(DK)': {
267
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/diners.gif') . '" border="0" />'; break;
268
+ }
269
+ case 'DK': {
270
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/dankort.gif') . '" border="0" />'; break;
271
+ }
272
+ case 'FFK': {
273
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/forbrugforeningen.gif') . '" border="0" />'; break;
274
+ }
275
+ case 'JCB': {
276
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/jcb.gif') . '" border="0" />'; break;
277
+ }
278
+ case 'MC': {
279
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
280
+ }
281
+ case 'MC(DK)': {
282
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
283
+ }
284
+ case 'MC(SE)': {
285
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
286
+ }
287
+ case 'MTRO': {
288
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
289
+ }
290
+ case 'MTRO(DK)': {
291
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
292
+ }
293
+ case 'MTRO(SE)': {
294
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
295
+ }
296
+ case 'MOCA': {
297
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mobilcash.gif') . '" border="0" />'; break;
298
+ }
299
+ case 'V-DK': {
300
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
301
+ }
302
+ case 'VISA': {
303
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
304
+ }
305
+ case 'VISA(DK)': {
306
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
307
+ }
308
+ case 'VISA(SE)': {
309
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
310
+ }
311
+ case 'ELEC': {
312
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visaelectron.gif') . '" border="0" />'; break;
313
+ }
314
+ case 'AKTIA': {
315
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/aktia.gif') . '" border="0" />'; break;
316
+ }
317
+ case 'DNB': {
318
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/danskenetbetaling.gif') . '" border="0" />'; break;
319
+ }
320
+ case 'EDK': {
321
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/edankort.gif') . '" border="0" />'; break;
322
+ }
323
+ case 'ELV': {
324
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/bankeinzug.gif') . '" border="0" />'; break;
325
+ }
326
+ case 'EW': {
327
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/ewire.gif') . '" border="0" />'; break;
328
+ }
329
+ case 'FSB': {
330
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/swedbankdirektbetaling.gif') . '" border="0" />'; break;
331
+ }
332
+ case 'GIT': {
333
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/getitcard.gif') . '" border="0" />'; break;
334
+ }
335
+ case 'ING': {
336
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/ideal.gif') . '" border="0" />'; break;
337
+ }
338
+ case 'NDB': {
339
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/nordea.gif') . '" border="0" />'; break;
340
+ }
341
+ case 'SEB': {
342
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/seb.gif') . '" border="0" />'; break;
343
+ }
344
+ case 'PBB': {
345
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
346
+ }
347
+ case 'pbb': {
348
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
349
+ }
350
+ case 'PBBTEST': {
351
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
352
+ }
353
+ case 'pbbtest': {
354
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
355
+ }
356
+
357
+ case 'SHB': {
358
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/shbdirektbetaling.gif') . '" border="0" />'; break;
359
+ }
360
+ case 'SOLO': {
361
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/nordea.gif') . '" border="0" />'; break;
362
+ }
363
+ case 'VAL': {
364
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/valus.gif') . '" border="0" />'; break;
365
+ }
366
+ default: {
367
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/dibslogo.gif') . '" border="0" />';
368
+ }
369
+
370
+ }
371
+ return $res;
372
+ }
373
+
374
+ public function getViewUrl($orderId)
375
+ {
376
+ return $this->getUrl('*/*/*', array('order_id'=>$orderId));
377
+ }
378
+
379
+ /**
380
+ * ######################## TAB settings #################################
381
+ */
382
+ public function getTabLabel()
383
+ {
384
+ return Mage::helper('sales')->__('Information');
385
+ }
386
+
387
+ public function getTabTitle()
388
+ {
389
+ return Mage::helper('sales')->__('Order Information');
390
+ }
391
+
392
+ public function canShowTab()
393
+ {
394
+ return true;
395
+ }
396
+
397
+ public function isHidden()
398
+ {
399
+ return false;
400
+ }
401
+ }
app/code/community/Dibs/Adminhtml/etc/config.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+ -->
24
+ <config>
25
+ <global>
26
+ <blocks>
27
+ <adminhtml>
28
+ <rewrite>
29
+ <sales_order_view_tab_info>Dibs_Adminhtml_Block_Sales_Order_View_Tab_Info</sales_order_view_tab_info>
30
+ </rewrite>
31
+ </adminhtml>
32
+ </blocks>
33
+ </global>
34
+ </config>
app/code/community/Dibs/Dibs/Block/Failure.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Mage
22
+ * @package Mage_Core
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * Modifications copyrighted by Dibs AB, (c) 2010.
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Payment Block
30
+ **/
31
+
32
+ class Dibs_Dibs_Block_Failure extends Mage_Core_Block_Template
33
+ {
34
+ }
app/code/community/Dibs/Dibs/Block/Form.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Mage
23
+ * @package Mage_Core
24
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
25
+ * Modifications copyrighted by Dibs AB, (c) 2010.
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Payment Block
31
+ **/
32
+
33
+ class Dibs_Dibs_Block_Form extends Mage_Payment_Block_Form
34
+ {
35
+ protected function _construct()
36
+ {
37
+
38
+ $this->setTemplate('Dibs/Dibs/form.phtml');
39
+ parent::_construct();
40
+ }
41
+ }
app/code/community/Dibs/Dibs/Block/Redirect.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Mage
23
+ * @package Mage_Core
24
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
25
+ * Modifications copyrighted by Dibs AB, (c) 2010.
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ class Dibs_Dibs_Block_Redirect extends Mage_Core_Block_Template
30
+ {
31
+ /**
32
+ * Constructor. Set template.
33
+ */
34
+
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->setTemplate('Dibs/Dibs/redirect.phtml');
39
+ }
40
+
41
+ }
app/code/community/Dibs/Dibs/Helper/Data.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Mage
23
+ * @package Mage_Adminhtml
24
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
25
+ * Modifications copyrighted by Dibs AB, (c) 2010.
26
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27
+ */
28
+
29
+ /**
30
+ * Payment Helper
31
+ **/
32
+
33
+ class Dibs_Dibs_Helper_Data extends Mage_Payment_Helper_Data
34
+ {
35
+
36
+ }
app/code/community/Dibs/Dibs/Model/Dibs.php ADDED
@@ -0,0 +1,655 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dibs AB
4
+ * Dibs Payment Extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Payments & Gateways Extensions
17
+ * @package Dibs_Dibs
18
+ * @author Dibs AB
19
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ /**
24
+ * Payment Model
25
+ **/
26
+
27
+ class Dibs_Dibs_Model_Dibs extends Mage_Payment_Model_Method_Abstract
28
+ {
29
+ const DIBS_FLEXWIN_URL = 'https://payment.architrade.com/paymentweb/start.action';
30
+ const DIBS_PAYMENTWIN_URL = 'https://payment.architrade.com/payment/start.pml';
31
+
32
+ protected $_code = 'Dibs';
33
+ protected $_formBlockType = 'Dibs_Dibs_block_form';
34
+
35
+ //
36
+ // Allowed currency types
37
+ //
38
+ protected $_allowCurrencyCode = array(
39
+ 'ADP','AED','AFA','ALL','AMD','ANG','AOA','ARS','AUD','AWG','AZM','BAM','BBD','BDT','BGL','BGN','BHD','BIF','BMD','BND','BOB',
40
+ 'BOV','BRL','BSD','BTN','BWP','BYR','BZD','CAD','CDF','CHF','CLF','CLP','CNY','COP','CRC','CUP','CVE','CYP','CZK','DJF','DKK',
41
+ 'DOP','DZD','ECS','ECV','EEK','EGP','ERN','ETB','EUR','FJD','FKP','GBP','GEL','GHC','GIP','GMD','GNF','GTQ','GWP','GYD','HKD',
42
+ 'HNL','HRK','HTG','HUF','IDR','ILS','INR','IQD','IRR','ISK','JMD','JOD','JPY','KES','KGS','KHR','KMF','KPW','KRW','KWD','KYD',
43
+ 'KZT','LAK','LBP','LKR','LRD','LSL','LTL','LVL','LYD','MAD','MDL','MGF','MKD','MMK','MNT','MOP','MRO','MTL','MUR','MVR','MWK',
44
+ 'MXN','MXV','MYR','MZM','NAD','NGN','NIO','NOK','NPR','NZD','OMR','PAB','PEN','PGK','PHP','PKR','PLN','PYG','QAR','ROL','RUB',
45
+ 'RUR','RWF','SAR','SBD','SCR','SDD','SEK','SGD','SHP','SIT','SKK','SLL','SOS','SRG','STD','SVC','SYP','SZL','THB','TJS','TMM',
46
+ 'TND','TOP','TPE','TRL','TRY','TTD','TWD','TZS','UAH','UGX','USD','UYU','UZS','VEB','VND','VUV','XAF','XCD','XOF','XPF','YER',
47
+ 'YUM','ZAR','ZMK','ZWD'
48
+ );
49
+
50
+ //
51
+ // Get the correct payment DIBS URL (Flexwin or Payment Window)
52
+ //
53
+ public function getDibsUrl(){
54
+
55
+ if ($this->getConfigData('paymentwindow') == '1') {
56
+ $url = self::DIBS_FLEXWIN_URL;
57
+ } else{
58
+ $url = self::DIBS_PAYMENTWIN_URL;
59
+ }
60
+
61
+ return $url;
62
+ }
63
+
64
+ //
65
+ // Store additional DIBS orderdata in DB table dibs_orderdata.
66
+ // Separate function due to problems with Extension installation
67
+ // not executing installation sql sript. Can be removed in later
68
+ // versions if problem with automatic execution of installtion
69
+ // sql scripts fixed.
70
+ //
71
+ public function storeDIBSorderdata($orderid){
72
+
73
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
74
+
75
+ $write->query("CREATE TABLE if not exists `dibs_orderdata` (
76
+ `orderid` VARCHAR(45) NOT NULL,
77
+ `transact` VARCHAR(50) NOT NULL,
78
+ `status` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = unpaid, 1 = paid',
79
+ `amount` VARCHAR(45) NOT NULL,
80
+ `currency` VARCHAR(45) NOT NULL,
81
+ `paytype` VARCHAR(45) NOT NULL,
82
+ `PBB_customerId` VARCHAR(45) NOT NULL,
83
+ `PBB_deliveryAddress` VARCHAR(45) NOT NULL,
84
+ `PBB_deliveryCountryCode` VARCHAR(45) NOT NULL,
85
+ `PBB_deliveryPostalCode` VARCHAR(45) NOT NULL,
86
+ `PBB_deliveryPostalPlace` VARCHAR(45) NOT NULL,
87
+ `PBB_firstName` VARCHAR(45) NOT NULL,
88
+ `PBB_lastName` VARCHAR(45) NOT NULL,
89
+ `cardnomask` VARCHAR(45) NOT NULL,
90
+ `cardprefix` VARCHAR(45) NOT NULL,
91
+ `cardexpdate` VARCHAR(45) NOT NULL,
92
+ `cardcountry` VARCHAR(45) NOT NULL,
93
+ `acquirer` VARCHAR(45) NOT NULL,
94
+ `enrolled` VARCHAR(45) NOT NULL,
95
+ `fee` VARCHAR(45) NOT NULL,
96
+ `test` VARCHAR(45) NOT NULL,
97
+ `uniqueoid` VARCHAR(45) NOT NULL,
98
+ `approvalcode` VARCHAR(45) NOT NULL,
99
+ `ordercancellation` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed',
100
+ `successaction` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed',
101
+ `callback` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed');");
102
+
103
+ $write->insert('dibs_orderdata', Array('orderid'=>$orderid));
104
+
105
+ }
106
+
107
+ //
108
+ // Convert from Magento currency to DIBS currency
109
+ //
110
+ public function convertToDibsCurrency($curr){
111
+ switch ($curr->getCode())
112
+ {
113
+ case "ADP": return "020";
114
+ case "AED": return "784";
115
+ case "AFA": return "004";
116
+ case "ALL": return "008";
117
+ case "AMD": return "051";
118
+ case "ANG": return "532";
119
+ case "AOA": return "973";
120
+ case "ARS": return "032";
121
+ case "AUD": return "036";
122
+ case "AWG": return "533";
123
+ case "AZM": return "031";
124
+ case "BAM": return "977";
125
+ case "BBD": return "052";
126
+ case "BDT": return "050";
127
+ case "BGL": return "100";
128
+ case "BGN": return "975";
129
+ case "BHD": return "048";
130
+ case "BIF": return "108";
131
+ case "BMD": return "060";
132
+ case "BND": return "096";
133
+ case "BOB": return "068";
134
+ case "BOV": return "984";
135
+ case "BRL": return "986";
136
+ case "BSD": return "044";
137
+ case "BTN": return "064";
138
+ case "BWP": return "072";
139
+ case "BYR": return "974";
140
+ case "BZD": return "084";
141
+ case "CAD": return "124";
142
+ case "CDF": return "976";
143
+ case "CHF": return "756";
144
+ case "CLF": return "990";
145
+ case "CLP": return "152";
146
+ case "CNY": return "156";
147
+ case "COP": return "170";
148
+ case "CRC": return "188";
149
+ case "CUP": return "192";
150
+ case "CVE": return "132";
151
+ case "CYP": return "196";
152
+ case "CZK": return "203";
153
+ case "DJF": return "262";
154
+ case "DKK": return "208";
155
+ case "DOP": return "214";
156
+ case "DZD": return "012";
157
+ case "ECS": return "218";
158
+ case "ECV": return "983";
159
+ case "EEK": return "233";
160
+ case "EGP": return "818";
161
+ case "ERN": return "232";
162
+ case "ETB": return "230";
163
+ case "EUR": return "978";
164
+ case "FJD": return "242";
165
+ case "FKP": return "238";
166
+ case "GBP": return "826";
167
+ case "GEL": return "981";
168
+ case "GHC": return "288";
169
+ case "GIP": return "292";
170
+ case "GMD": return "270";
171
+ case "GNF": return "324";
172
+ case "GTQ": return "320";
173
+ case "GWP": return "624";
174
+ case "GYD": return "328";
175
+ case "HKD": return "344";
176
+ case "HNL": return "340";
177
+ case "HRK": return "191";
178
+ case "HTG": return "332";
179
+ case "HUF": return "348";
180
+ case "IDR": return "360";
181
+ case "ILS": return "376";
182
+ case "INR": return "356";
183
+ case "IQD": return "368";
184
+ case "IRR": return "364";
185
+ case "ISK": return "352";
186
+ case "JMD": return "388";
187
+ case "JOD": return "400";
188
+ case "JPY": return "392";
189
+ case "KES": return "404";
190
+ case "KGS": return "417";
191
+ case "KHR": return "116";
192
+ case "KMF": return "174";
193
+ case "KPW": return "408";
194
+ case "KRW": return "410";
195
+ case "KWD": return "414";
196
+ case "KYD": return "136";
197
+ case "KZT": return "398";
198
+ case "LAK": return "418";
199
+ case "LBP": return "422";
200
+ case "LKR": return "144";
201
+ case "LRD": return "430";
202
+ case "LSL": return "426";
203
+ case "LTL": return "440";
204
+ case "LVL": return "428";
205
+ case "LYD": return "434";
206
+ case "MAD": return "504";
207
+ case "MDL": return "498";
208
+ case "MGF": return "450";
209
+ case "MKD": return "807";
210
+ case "MMK": return "104";
211
+ case "MNT": return "496";
212
+ case "MOP": return "446";
213
+ case "MRO": return "478";
214
+ case "MTL": return "470";
215
+ case "MUR": return "480";
216
+ case "MVR": return "462";
217
+ case "MWK": return "454";
218
+ case "MXN": return "484";
219
+ case "MXV": return "979";
220
+ case "MYR": return "458";
221
+ case "MZM": return "508";
222
+ case "NAD": return "516";
223
+ case "NGN": return "566";
224
+ case "NIO": return "558";
225
+ case "NOK": return "578";
226
+ case "NPR": return "524";
227
+ case "NZD": return "554";
228
+ case "OMR": return "512";
229
+ case "PAB": return "590";
230
+ case "PEN": return "604";
231
+ case "PGK": return "598";
232
+ case "PHP": return "608";
233
+ case "PKR": return "586";
234
+ case "PLN": return "985";
235
+ case "PYG": return "600";
236
+ case "QAR": return "634";
237
+ case "ROL": return "642";
238
+ case "RUB": return "643";
239
+ case "RUR": return "810";
240
+ case "RWF": return "646";
241
+ case "SAR": return "682";
242
+ case "SBD": return "090";
243
+ case "SCR": return "690";
244
+ case "SDD": return "736";
245
+ case "SEK": return "752";
246
+ case "SGD": return "702";
247
+ case "SHP": return "654";
248
+ case "SIT": return "705";
249
+ case "SKK": return "703";
250
+ case "SLL": return "694";
251
+ case "SOS": return "706";
252
+ case "SRG": return "740";
253
+ case "STD": return "678";
254
+ case "SVC": return "222";
255
+ case "SYP": return "760";
256
+ case "SZL": return "748";
257
+ case "THB": return "764";
258
+ case "TJS": return "972";
259
+ case "TMM": return "795";
260
+ case "TND": return "788";
261
+ case "TOP": return "776";
262
+ case "TPE": return "626";
263
+ case "TRL": return "792";
264
+ case "TRY": return "949";
265
+ case "TTD": return "780";
266
+ case "TWD": return "901";
267
+ case "TZS": return "834";
268
+ case "UAH": return "980";
269
+ case "UGX": return "800";
270
+ case "USD": return "840";
271
+ case "UYU": return "858";
272
+ case "UZS": return "860";
273
+ case "VEB": return "862";
274
+ case "VND": return "704";
275
+ case "VUV": return "548";
276
+ case "XAF": return "950";
277
+ case "XCD": return "951";
278
+ case "XOF": return "952";
279
+ case "XPF": return "953";
280
+ case "YER": return "886";
281
+ case "YUM": return "891";
282
+ case "ZAR": return "710";
283
+ case "ZMK": return "894";
284
+ case "ZWD": return "716";
285
+ }
286
+
287
+ return "";
288
+ }
289
+
290
+ /**
291
+ * Get Dibs session namespace
292
+ *
293
+ * @return Dibs_Dibs_Model_Session
294
+ */
295
+ public function getSession(){
296
+ return Mage::getSingleton('Dibs/session');
297
+ }
298
+
299
+ /**
300
+ * Get checkout session namespace
301
+ *
302
+ * @return Mage_Checkout_Model_Session
303
+ */
304
+ public function getCheckout(){
305
+ return Mage::getSingleton('checkout/session');
306
+ }
307
+
308
+ /**
309
+ * Get current quote
310
+ *
311
+ * @return Mage_Sales_Model_Quote
312
+ */
313
+ public function getQuote(){
314
+ return $this->getCheckout()->getQuote();
315
+ }
316
+
317
+ /*validate the currency code is avaialable to use for dibs or not*/
318
+ public function validate(){
319
+ parent::validate();
320
+ $currency_code = $this->getQuote()->getBaseCurrencyCode();
321
+ if (!in_array($currency_code,$this->_allowCurrencyCode)) {
322
+ Mage::throwException(Mage::helper('Dibs')->__('Selected currency code ('.$currency_code.') is not compatabile with Dibs'));
323
+ }
324
+ return $this;
325
+ }
326
+
327
+ public function getCheckoutFormFields(){
328
+
329
+ /* Get Relevant Order Parameters From Shop */
330
+ //-----------------------------------------//
331
+
332
+ $order = Mage::getModel('sales/order');
333
+ $order->loadByIncrementId($this->getCheckout()->getLastRealOrderId());
334
+ // print_r($order->debug());
335
+ // exit();
336
+
337
+ $currency_code = $order->getBaseCurrencyCode();
338
+ $shipping_address = $order->getShippingAddress();
339
+ $billing_address = $order->getBillingAddress();
340
+
341
+ $items = $order->getAllItems();
342
+
343
+ if ($billing_address) {
344
+ $fields ['delivery01.Billing'] = '<b>Billing Address</b>';
345
+ $fields ['delivery02.Firstname'] = $billing_address['firstname'];
346
+ $fields ['delivery03.Lastname'] = $billing_address['lastname'];
347
+ $fields ['delivery04.Street'] = $billing_address['street'];
348
+ $fields ['delivery05.Postcode'] = $billing_address['postcode'];
349
+ $fields ['delivery06.City'] = $billing_address['city'];
350
+ $fields ['delivery07.Region'] = $billing_address['region'];
351
+ $fields ['delivery08.Country'] = $billing_address['country_id'];
352
+ $fields ['delivery09.Telephone'] = $billing_address['telephone'];
353
+ $fields ['delivery10.E-mail'] = $order['customer_email'];
354
+
355
+ }
356
+ if ($shipping_address) {
357
+ $fields ['delivery11.Delivery'] = '<b>Shipping Address</b>';
358
+ $fields ['delivery12.Firstname'] = $shipping_address['firstname'];
359
+ $fields ['delivery13.Lastname'] = $shipping_address['lastname'];
360
+ $fields ['delivery14.Street'] = $shipping_address['street'];
361
+ $fields ['delivery15.Postcode'] = $shipping_address['postcode'];
362
+ $fields ['delivery16.City'] = $shipping_address['city'];
363
+ $fields ['delivery17.Region'] = $shipping_address['region'];
364
+ $fields ['delivery18.Country'] = $shipping_address['country_id'];
365
+ $fields ['delivery19.Telephone'] = $shipping_address['telephone'];
366
+
367
+ }
368
+ if ($items) {
369
+ $fields ['ordline0-1'] = 'ItemID ';
370
+ $fields ['ordline0-2'] = 'ItemDescription ';
371
+ $fields ['ordline0-3'] = 'SKU ';
372
+ $fields ['ordline0-4'] = 'Price ';
373
+ $fields ['ordline0-5'] = 'Tax ';
374
+ $fields ['ordline0-6'] = 'Quantity ';
375
+ $fields ['ordline0-7'] = 'TotalPrice ';
376
+ $i = 1;
377
+ foreach($items as $item) {
378
+ $fields ['ordline'.$i.'-1'] = $item->getProductId();
379
+ $fields ['ordline'.$i.'-2'] = $item->getName();
380
+ $fields ['ordline'.$i.'-3'] = $item->getSku();
381
+ $fields ['ordline'.$i.'-4'] = round($item->getPrice(),2);
382
+ $fields ['ordline'.$i.'-5'] = round($item->getTaxAmount(),2);
383
+ $fields ['ordline'.$i.'-6'] = round ($item->getQtyOrdered());
384
+ $fields ['ordline'.$i.'-7'] = round($item->getQtyOrdered() * ($item->getPrice() + $item->getTaxAmount()),2);
385
+ $i++;
386
+ }
387
+ $fields ['priceinfo1.Shippingmethod'] = $order['shipping_description'];
388
+ $fields ['priceinfo2.Shippingcost'] = round($order['shipping_amount'],2);
389
+ }
390
+
391
+ /* Set Mandatory DIBS Parmeters */
392
+ //===============================//
393
+
394
+ $fields['merchant'] = $this->getConfigData('merchantid');
395
+ //--------------------------------------------------------------//
396
+ $fields['amount'] = $order->getTotalDue() * 100;
397
+ //--------------------------------------------------------//
398
+ $fields['currency'] = $this->convertToDibsCurrency($order->getOrderCurrency());
399
+ //--------------------------------------------------------------------------//
400
+ $fields['orderid'] = $order->getRealOrderId();
401
+ //-----------------------------------------------------//
402
+ $fields['accepturl'] = Mage::getUrl('Dibs/Dibs/success');
403
+ //----------------------------------------------------------------------//
404
+
405
+ // Continue With Adding Relevant DIBS Paramers Depening On Config Values //
406
+ //=======================================================================//
407
+
408
+ $fields['cancelurl'] = Mage::getUrl('Dibs/Dibs/cancel');
409
+ //-------------------------------------------------------------------//
410
+
411
+ $fields['callbackurl'] = Mage::getUrl('Dibs/Dibs/callback');
412
+ //------------------------------------------------------------------------//
413
+
414
+ $uniqueoid = $this->getConfigData('uniqueoid');
415
+ //-------------------------------------------//
416
+ if ( $uniqueoid == '1') {
417
+ $fields['uniqueoid'] = $uniqueoid;
418
+ }
419
+
420
+ $account = $this->getConfigData('account');
421
+ //---------------------------------------//
422
+ if ( $account != '') {
423
+ $fields['account'] = $account;
424
+ }
425
+
426
+ $capturenow = $this->getConfigData('capturenow');
427
+ //---------------------------------------------//
428
+ if ( $capturenow == '1') {
429
+ $fields['capturenow'] = $capturenow;
430
+ }
431
+
432
+ $test_mode = $this->getConfigData('test_mode');
433
+ //-------------------------------------------//
434
+ if ($test_mode == '1') {
435
+ $fields['test'] = "true";
436
+ }
437
+
438
+ $HTTP_COOKIE = getenv('HTTP_COOKIE');
439
+ //---------------------------------//
440
+ if ( $HTTP_COOKIE != '') {
441
+ $fields['HTTP_COOKIE'] = $HTTP_COOKIE;
442
+ }
443
+
444
+ $lang = $this->getConfigData('lang');
445
+ //---------------------------------//
446
+ if ($lang != "auto") {
447
+ $fields['lang'] = $lang;
448
+ } else {
449
+ $dibs_lang_arr= array('da' => 'da','en' => 'en', 'sv' => 'sv', 'nn' => 'no', 'nb' => 'no', 'fi' => 'fi', 'de' => 'de', 'nl' => 'nl', 'fr' => 'fr', 'es' => 'es', 'it' => 'it', 'fo' => 'fo');
450
+ foreach ($dibs_lang_arr as $key => $value) {
451
+ if (substr(Mage::app()->getLocale()->getLocaleCode(),0,2) == $key) {
452
+ $status = true;
453
+ break;
454
+ } else {
455
+ $status = false;
456
+ }
457
+ }
458
+ if ($status) {
459
+ $fields['lang'] = $dibs_lang_arr[substr(Mage::app()->getLocale()->getLocaleCode(),0,2)];
460
+ } else {
461
+ $fields['lang'] = 'en';
462
+ }
463
+ }
464
+
465
+ $color = $this->getConfigData('color');
466
+ //-----------------------------------//
467
+ if ( $color != 'blank') {
468
+ $fields['color'] = $color;
469
+ }
470
+
471
+ $distributionType = $this->getConfigData('distributionType');
472
+ //---------------------------------------------------------//
473
+ if ( $distributionType != '-') {
474
+ $fields['distributionType'] = $distributionType;
475
+ if ($distributionType == 'email'){
476
+ $fields['email'] = $order['customer_email'];
477
+ }
478
+ }
479
+
480
+ $calcfee = $this->getConfigData('calcfee');
481
+ //-----------------------------------//
482
+ if ( $calcfee == '1') {
483
+ $fields['calcfee'] = $calcfee;
484
+ }
485
+
486
+ if ($this->getConfigData('paymentwindow') == '1') { /* Config For FlexWin */
487
+ //========================================================================//
488
+ $skiplastpage = $this->getConfigData('skiplastpage');
489
+ $fields['doNotShowLastPage'] = "true"; /* For PBB at Gothia */
490
+ //----------------------------------------------------------//
491
+ if ( $skiplastpage == '1') {
492
+ $fields['skiplastpage'] = $skiplastpage;
493
+ }
494
+
495
+ $decorator = $this->getConfigData('decorator');
496
+ //--------------------------------------------------//
497
+ if ( $decorator != 'default') {
498
+ $fields['decorator'] = $decorator;
499
+ }
500
+
501
+ $paytype = $this->getConfigData('paytype');
502
+ //--------------------------------------------------//
503
+ if ( $paytype == 'DIBS' || $paytype == '') {
504
+ // $fields['paytype'] = '';
505
+ ;
506
+ } else {
507
+
508
+ $selectedpaytypes = explode(',',$paytype);
509
+
510
+ foreach ($selectedpaytypes as $selectedpaytype){
511
+
512
+ if (($test_mode == '1') && ($selectedpaytype == 'PBB')){
513
+ $paytype = $paytype . ',pbbtest';
514
+ }
515
+ }
516
+
517
+ $fields['paytype'] = $paytype;
518
+ }
519
+
520
+ } elseif ($this->getConfigData('paymentwindow') == '2'){ /* Config For Payment Window */
521
+ //====================================================================================//
522
+ $paytype = $this->getConfigData('paytype');
523
+ //--------------------------------------------------//
524
+ if ( $paytype == 'DIBS' || $paytype == '') {
525
+ // $fields['paytype'] = '';
526
+ ;
527
+ } else {
528
+ $selectedpaytypes = explode(',',$paytype); // Only one Paytype Possible In Payment Window
529
+ $fields['paytype'] = $selectedpaytypes[0];
530
+ if ($fields['paytype'] == 'DIBS') {
531
+ $fields['paytype'] = $selectedpaytypes[1];
532
+ }
533
+ }
534
+
535
+ } else { /* Config Values For Debugging */
536
+ //======================================//
537
+ $paytype = $this->getConfigData('paytype');
538
+ //--------------------------------------------------//
539
+ $selectedpaytypes = explode(',',$paytype); // Only one Paytype Possible In Payment Window
540
+ $fields['paytype'] = $selectedpaytypes[0];
541
+ if ($fields['paytype'] == 'DIBS') {
542
+ $fields['paytype'] = $selectedpaytypes[1];
543
+ }
544
+ }
545
+
546
+ /* Calculate MD5 Checksum If Configuration Present */
547
+ //=================================================//
548
+ $md5key1 = $this->getConfigData('md5key1');
549
+ $md5key2 = $this->getConfigData('md5key2');
550
+ if (($md5key1 != '') && ($md5key2 != '')) {
551
+ $md5key = md5($md5key2 . md5($md5key1 .
552
+ 'merchant=' . $fields['merchant'] .
553
+ '&orderid=' . $fields['orderid'] .
554
+ '&currency=' . $fields['currency'] .
555
+ '&amount=' . $fields['amount']));
556
+ $fields['md5key'] = $md5key;
557
+ }
558
+
559
+ /* Filter Configured Field Array Values Before Sending Field Values To DIBS */
560
+ //==========================================================================//
561
+
562
+ /* $filtered_fields = array();
563
+ foreach ($filtered_fields as $k=>$v) {
564
+ $value = str_replace("&","and",$v);
565
+ $filtered_fields[$k] = $value;
566
+ } */
567
+
568
+ /* echo "<br>DIBS Parameter Fields:<br>";
569
+ echo "=========================<br>";
570
+ foreach ($fields as $k=>$v) {
571
+ // echo $fields[$k] . ": " . $v;
572
+ echo ($k . ": " . $v);
573
+ echo "<br>";
574
+ } */
575
+
576
+ return $fields;
577
+ }
578
+
579
+ /**
580
+ * Using internal pages for input payment data
581
+ *
582
+ * @return bool
583
+ */
584
+ public function canUseInternal()
585
+ {
586
+ return false;
587
+ }
588
+
589
+ /**
590
+ * Using for multiple shipping address
591
+ *
592
+ * @return bool
593
+ */
594
+ public function canUseForMultishipping()
595
+ {
596
+ return false;
597
+ }
598
+
599
+ public function getOrderPlaceRedirectUrl()
600
+ {
601
+ return Mage::getUrl('Dibs/Dibs/redirect');
602
+ }
603
+
604
+ //
605
+ // Calculates if any of the trusted logos are to be shown - in that case return true
606
+ //
607
+ public function showTrustedList() {
608
+ $logoArray = explode(',', $this->getConfigData('dibslogos'));
609
+ foreach($logoArray as $item) {
610
+ if ($item == 'DIBS' ||
611
+ $item == 'VISA_SECURE' ||
612
+ $item == 'MC_SECURE' ||
613
+ $item == 'JCB_SECURE' ||
614
+ $item == 'PCI') {
615
+ return true;
616
+ }
617
+ }
618
+ return false;
619
+ }
620
+
621
+ //
622
+ // Calculates if any of the card logos are to be shown - in that case return true
623
+ //
624
+ public function showCardsList() {
625
+ $logoArray = explode(',', $this->getConfigData('dibslogos'));
626
+ foreach($logoArray as $item) {
627
+ if ($item == 'AMEX' ||
628
+ $item == 'BAX' ||
629
+ $item == 'DIN' ||
630
+ $item == 'DK' ||
631
+ $item == 'FFK' ||
632
+ $item == 'JCB' ||
633
+ $item == 'MC' ||
634
+ $item == 'MTRO' ||
635
+ $item == 'MOCA' ||
636
+ $item == 'VISA' ||
637
+ $item == 'ELEC' ||
638
+ $item == 'AKTIA' ||
639
+ $item == 'DNB' ||
640
+ $item == 'EDK' ||
641
+ $item == 'ELV' ||
642
+ $item == 'EW' ||
643
+ $item == 'FSB' ||
644
+ $item == 'GIT' ||
645
+ $item == 'ING' ||
646
+ $item == 'SEB' ||
647
+ $item == 'SHB' ||
648
+ $item == 'SOLO' ||
649
+ $item == 'VAL') {
650
+ return true;
651
+ }
652
+ }
653
+ return false;
654
+ }
655
+ }
app/code/community/Dibs/Dibs/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
25
+ {
26
+
27
+ }
28
+ ?>
app/code/community/Dibs/Dibs/Model/System/Config/Source/Color.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_Color
25
+ {
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value'=>'blank', 'label'=>Mage::helper('adminhtml')->__('_none_')),
30
+ array('value'=>'sand', 'label'=>Mage::helper('adminhtml')->__('sand')),
31
+ array('value'=>'grey', 'label'=>Mage::helper('adminhtml')->__('grey')),
32
+ array('value'=>'blue', 'label'=>Mage::helper('adminhtml')->__('blue')),
33
+ );
34
+ }
35
+
36
+
37
+ }
app/code/community/Dibs/Dibs/Model/System/Config/Source/Decorator.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_Decorator
25
+ {
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value'=>'default', 'label'=>Mage::helper('adminhtml')->__('default')),
30
+ array('value'=>'basal', 'label'=>Mage::helper('adminhtml')->__('basal')),
31
+ array('value'=>'rich', 'label'=>Mage::helper('adminhtml')->__('rich')),
32
+ array('value'=>'own', 'label'=>Mage::helper('adminhtml')->__('Own decorator')),
33
+ );
34
+ }
35
+
36
+
37
+ }
app/code/community/Dibs/Dibs/Model/System/Config/Source/Dibslogos.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_Dibslogos
25
+ {
26
+
27
+ public function toOptionArray()
28
+ {
29
+ return array(
30
+ array('value'=>'DIBS', 'label'=>Mage::helper('adminhtml')->__('DIBS Standard Logo')),
31
+ array('value'=>'PBB', 'label'=>Mage::helper('adminhtml')->__('DIBS PayByBill Logo')),
32
+ array('value'=>'VISA_SECURE', 'label'=>Mage::helper('adminhtml')->__('Verified by VISA')),
33
+ array('value'=>'MC_SECURE', 'label'=>Mage::helper('adminhtml')->__('MasterCard SecureCode')),
34
+ array('value'=>'JCB_SECURE', 'label'=>Mage::helper('adminhtml')->__('JCB J/Secure')),
35
+ array('value'=>'PCI', 'label'=>Mage::helper('adminhtml')->__('PCI')),
36
+ array('value'=>'MC', 'label'=>Mage::helper('adminhtml')->__('MasterCard')),
37
+ array('value'=>'MTRO', 'label'=>Mage::helper('adminhtml')->__('Maestro')),
38
+ array('value'=>'VISA', 'label'=>Mage::helper('adminhtml')->__('Visa')),
39
+ array('value'=>'ELEC', 'label'=>Mage::helper('adminhtml')->__('Visa Electron')),
40
+ array('value'=>'DIN', 'label'=>Mage::helper('adminhtml')->__('Diners Club')),
41
+ array('value'=>'AMEX', 'label'=>Mage::helper('adminhtml')->__('American Express')),
42
+ array('value'=>'DK', 'label'=>Mage::helper('adminhtml')->__('Dankort')),
43
+ array('value'=>'EDK', 'label'=>Mage::helper('adminhtml')->__('eDankort')),
44
+ array('value'=>'SEB', 'label'=>Mage::helper('adminhtml')->__('SEB Direktbetalning')),
45
+ array('value'=>'SHB', 'label'=>Mage::helper('adminhtml')->__('SHB Direktbetalning')),
46
+ array('value'=>'FSB', 'label'=>Mage::helper('adminhtml')->__('Swedbank Direktbetalning')),
47
+ array('value'=>'SOLO', 'label'=>Mage::helper('adminhtml')->__('Nordea Solo-E betalning')),
48
+ array('value'=>'DNB', 'label'=>Mage::helper('adminhtml')->__('Danske Netbetaling (Danske Bank)')),
49
+ array('value'=>'MOCA', 'label'=>Mage::helper('adminhtml')->__('Mobilcash')),
50
+ array('value'=>'BAX', 'label'=>Mage::helper('adminhtml')->__('BankAxess')),
51
+ array('value'=>'FFK', 'label'=>Mage::helper('adminhtml')->__('Forbrugsforeningen Card')),
52
+ array('value'=>'JCB', 'label'=>Mage::helper('adminhtml')->__('JCB (Japan Credit Bureau)')),
53
+ array('value'=>'AKTIA', 'label'=>Mage::helper('adminhtml')->__('Aktia Web Payment')),
54
+ array('value'=>'ELV', 'label'=>Mage::helper('adminhtml')->__('Bank Einzug (eOLV)')),
55
+ array('value'=>'EW', 'label'=>Mage::helper('adminhtml')->__('eWire')),
56
+ array('value'=>'GIT', 'label'=>Mage::helper('adminhtml')->__('Getitcard')),
57
+ array('value'=>'VAL', 'label'=>Mage::helper('adminhtml')->__('Valus')),
58
+ array('value'=>'ING', 'label'=>Mage::helper('adminhtml')->__('ING iDeal Payment'))
59
+ );
60
+ }
61
+
62
+ }
app/code/community/Dibs/Dibs/Model/System/Config/Source/Dibspaytypes.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_Dibspaytypes
25
+ {
26
+
27
+ public function toOptionArray()
28
+ {
29
+ return array(
30
+ array('value'=>'DIBS', 'label'=>Mage::helper('adminhtml')->__('DIBS Contracted Paytypes')),
31
+ array('value'=>'PBB', 'label'=>Mage::helper('adminhtml')->__('DIBS PayByBill')),
32
+ array('value'=>'MC', 'label'=>Mage::helper('adminhtml')->__('MasterCard')),
33
+ array('value'=>'MTRO', 'label'=>Mage::helper('adminhtml')->__('Maestro')),
34
+ array('value'=>'VISA', 'label'=>Mage::helper('adminhtml')->__('Visa')),
35
+ array('value'=>'ELEC', 'label'=>Mage::helper('adminhtml')->__('Visa Electron')),
36
+ array('value'=>'DIN', 'label'=>Mage::helper('adminhtml')->__('Diners Club')),
37
+ array('value'=>'AMEX', 'label'=>Mage::helper('adminhtml')->__('American Express')),
38
+ array('value'=>'DK', 'label'=>Mage::helper('adminhtml')->__('Dankort')),
39
+ array('value'=>'EDK', 'label'=>Mage::helper('adminhtml')->__('eDankort')),
40
+ array('value'=>'SEB', 'label'=>Mage::helper('adminhtml')->__('SEB Direktbetalning')),
41
+ array('value'=>'SHB', 'label'=>Mage::helper('adminhtml')->__('SHB Direktbetalning')),
42
+ array('value'=>'FSB', 'label'=>Mage::helper('adminhtml')->__('Swedbank Direktbetalning')),
43
+ array('value'=>'SOLO', 'label'=>Mage::helper('adminhtml')->__('Nordea Solo-E betalning')),
44
+ array('value'=>'DNB', 'label'=>Mage::helper('adminhtml')->__('Danske Netbetaling (Danske Bank)')),
45
+ array('value'=>'MOCA', 'label'=>Mage::helper('adminhtml')->__('Mobilcash')),
46
+ array('value'=>'BAX', 'label'=>Mage::helper('adminhtml')->__('BankAxess')),
47
+ array('value'=>'FFK', 'label'=>Mage::helper('adminhtml')->__('Forbrugsforeningen Card')),
48
+ array('value'=>'JCB', 'label'=>Mage::helper('adminhtml')->__('JCB (Japan Credit Bureau)')),
49
+ array('value'=>'AKTIA', 'label'=>Mage::helper('adminhtml')->__('Aktia Web Payment')),
50
+ array('value'=>'ELV', 'label'=>Mage::helper('adminhtml')->__('Bank Einzug (eOLV)')),
51
+ array('value'=>'EW', 'label'=>Mage::helper('adminhtml')->__('eWire')),
52
+ array('value'=>'GIT', 'label'=>Mage::helper('adminhtml')->__('Getitcard')),
53
+ array('value'=>'VAL', 'label'=>Mage::helper('adminhtml')->__('Valus')),
54
+ array('value'=>'ING', 'label'=>Mage::helper('adminhtml')->__('ING iDeal Payment'))
55
+ );
56
+ }
57
+
58
+ }
app/code/community/Dibs/Dibs/Model/System/Config/Source/Lang.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_Lang
25
+ {
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value'=>'auto', 'label'=>Mage::helper('adminhtml')->__('Auto')),
30
+ array('value'=>'da', 'label'=>Mage::helper('adminhtml')->__('Danish')),
31
+ array('value'=>'nl', 'label'=>Mage::helper('adminhtml')->__('Dutch')),
32
+ array('value'=>'en', 'label'=>Mage::helper('adminhtml')->__('English')),
33
+ array('value'=>'fo', 'label'=>Mage::helper('adminhtml')->__('Faroese')),
34
+ array('value'=>'fi', 'label'=>Mage::helper('adminhtml')->__('Finnish')),
35
+ array('value'=>'fr', 'label'=>Mage::helper('adminhtml')->__('French')),
36
+ array('value'=>'de', 'label'=>Mage::helper('adminhtml')->__('German')),
37
+ array('value'=>'it', 'label'=>Mage::helper('adminhtml')->__('Italian')),
38
+ array('value'=>'no', 'label'=>Mage::helper('adminhtml')->__('Norwegian')),
39
+ array('value'=>'pl', 'label'=>Mage::helper('adminhtml')->__('Polish')),
40
+ array('value'=>'es', 'label'=>Mage::helper('adminhtml')->__('Spanish')),
41
+ array('value'=>'sv', 'label'=>Mage::helper('adminhtml')->__('Swedish')),
42
+ );
43
+ }
44
+
45
+
46
+ }
app/code/community/Dibs/Dibs/Model/System/Config/Source/Orderstatusafter.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_Orderstatusafter
25
+ {
26
+ // set null to enable all possible
27
+ protected $_stateStatuses = array(
28
+ // Mage_Sales_Model_Order::STATE_NEW,
29
+ // Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
30
+ Mage_Sales_Model_Order::STATE_PROCESSING,
31
+ // Mage_Sales_Model_Order::STATE_COMPLETE,
32
+ // Mage_Sales_Model_Order::STATE_CLOSED,
33
+ // Mage_Sales_Model_Order::STATE_CANCELED,
34
+ Mage_Sales_Model_Order::STATE_HOLDED,
35
+ );
36
+
37
+ public function toOptionArray()
38
+ {
39
+ if ($this->_stateStatuses) {
40
+ $statuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->_stateStatuses);
41
+ }
42
+ else {
43
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
44
+ }
45
+ $options = array();
46
+ $options[] = array(
47
+ 'value' => '',
48
+ 'label' => Mage::helper('adminhtml')->__('-- Please Select --')
49
+ );
50
+ foreach ($statuses as $code=>$label) {
51
+ $options[] = array(
52
+ 'value' => $code,
53
+ 'label' => $label
54
+ );
55
+ }
56
+ return $options;
57
+ }
58
+ }
app/code/community/Dibs/Dibs/Model/System/Config/Source/Orderstatusbefore.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_Orderstatusbefore
25
+ {
26
+ // set null to enable all possible
27
+ protected $_stateStatuses = array(
28
+ Mage_Sales_Model_Order::STATE_NEW,
29
+ // Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
30
+ Mage_Sales_Model_Order::STATE_PROCESSING,
31
+ // Mage_Sales_Model_Order::STATE_COMPLETE,
32
+ // Mage_Sales_Model_Order::STATE_CLOSED,
33
+ // Mage_Sales_Model_Order::STATE_CANCELED,
34
+ // Mage_Sales_Model_Order::STATE_HOLDED,
35
+ );
36
+
37
+ public function toOptionArray()
38
+ {
39
+ if ($this->_stateStatuses) {
40
+ $statuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->_stateStatuses);
41
+ }
42
+ else {
43
+ $statuses = Mage::getSingleton('sales/order_config')->getStatuses();
44
+ }
45
+ $options = array();
46
+ $options[] = array(
47
+ 'value' => '',
48
+ 'label' => Mage::helper('adminhtml')->__('-- Please Select --')
49
+ );
50
+ foreach ($statuses as $code=>$label) {
51
+ $options[] = array(
52
+ 'value' => $code,
53
+ 'label' => $label
54
+ );
55
+ }
56
+ return $options;
57
+ }
58
+ }
app/code/community/Dibs/Dibs/Model/System/Config/Source/PBBdistribution.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_PBBdistribution
25
+ {
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value'=>'-', 'label'=>Mage::helper('adminhtml')->__('-')),
30
+ array('value'=>'paper', 'label'=>Mage::helper('adminhtml')->__('paper')),
31
+ array('value'=>'email', 'label'=>Mage::helper('adminhtml')->__('email')),
32
+ );
33
+ }
34
+ }
app/code/community/Dibs/Dibs/Model/System/Config/Source/Paymentwindow.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ class Dibs_Dibs_Model_System_Config_Source_Paymentwindow
25
+ {
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value'=>1, 'label'=>Mage::helper('adminhtml')->__('FlexWin')),
30
+ array('value'=>2, 'label'=>Mage::helper('adminhtml')->__('Payment Window')),
31
+ );
32
+ }
33
+
34
+
35
+ }
app/code/community/Dibs/Dibs/controllers/DibsController.php ADDED
@@ -0,0 +1,574 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dibs AB
4
+ * Dibs Payment Extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Payments & Gateways Extensions
17
+ * @package Dibs_Dibs
18
+ * @author Dibs AB
19
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ /**
24
+ * Payment Controller
25
+ **/
26
+
27
+ class Dibs_Dibs_DibsController extends Mage_Core_Controller_Front_Action{
28
+ protected $_order;
29
+ // protected $_callbackAction = false;
30
+
31
+ protected function _expireAjax(){
32
+ if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
33
+ $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
34
+ exit;
35
+ }
36
+ }
37
+
38
+ public function setOrderStatusAfterPayment(){
39
+
40
+ // Load the payment object
41
+ $payment = Mage::getModel('dibs/Dibs');
42
+
43
+ // Load the order object
44
+ $order = Mage::getModel('sales/order');
45
+ $order->loadByIncrementId($_REQUEST['orderid']);
46
+ $order->setState($payment->getConfigData('order_status_after_payment'),true,$this->__('DIBS_LABEL_22'));
47
+ // $order->addStatusToHistory($payment->getConfigData('order_status_after_payment'),$this->__('DIBS_LABEL_22'));
48
+ $order->save();
49
+ }
50
+
51
+ public function addToStock() {
52
+
53
+ // Load the session object
54
+ $session = Mage::getSingleton('checkout/session');
55
+ $session->setDibsStandardQuoteId($session->getQuoteId());
56
+
57
+ // Load the payment object
58
+ $payment = Mage::getModel('dibs/Dibs');
59
+
60
+ // Load the order object
61
+ $order = $this->getOrder ();
62
+
63
+ // add items back on stock
64
+ // Put the order back on stock as it is not yet paid!
65
+ // http://www.magentocommerce.com/wiki/groups/132/protx_form_-_subtracting_stock_on_successful_payment
66
+
67
+ if (((int)$payment->getConfigData('handlestock')) == 1) {
68
+ if(!isset($_SESSION['stock_removed']) || $_SESSION['stock_removed'] != $session->getLastRealOrderId()) {
69
+ /* Put the stock back on, we don't want it taken off yet */
70
+ $items = $order->getAllItems(); // Get all items from the order
71
+ if ($items) {
72
+ foreach($items as $item) {
73
+ $quantity = $item->getQtyOrdered(); // get Qty ordered
74
+ $product_id = $item->getProductId(); // get it's ID
75
+
76
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_id); // Load the stock for this product
77
+ $stock->setQty($stock->getQty()+$quantity); // Set to new Qty
78
+ $stock->save(); // Save
79
+ continue;
80
+ }
81
+ }
82
+
83
+ // Flag so that stock is only updated once!
84
+ $_SESSION['stock_removed'] = $session->getLastRealOrderId();
85
+
86
+ }
87
+ }
88
+ }
89
+
90
+ // Remove from stock (if used)
91
+ public function removeFromStock() {
92
+
93
+ // Load the payment object
94
+ $payment = Mage::getModel('dibs/Dibs');
95
+
96
+ // Load the session object
97
+ $session = Mage::getSingleton('checkout/session');
98
+ $session->setDibsStandardQuoteId($session->getQuoteId());
99
+
100
+ // Load the order object
101
+ $order = Mage::getModel('sales/order');
102
+ $order->loadByIncrementId($_REQUEST['orderid']);
103
+
104
+ // remove items from stock
105
+ // http://www.magentocommerce.com/wiki/groups/132/protx_form_-_subtracting_stock_on_successful_payment
106
+ if (((int)$payment->getConfigData('handlestock')) == 1) {
107
+ $items = $order->getAllItems(); // Get all items from the order
108
+ if ($items) {
109
+ foreach($items as $item) {
110
+ $quantity = $item->getQtyOrdered(); // get Qty ordered
111
+ $product_id = $item->getProductId(); // get it's ID
112
+
113
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_id); // Load the stock for this product
114
+ $stock->setQty($stock->getQty()-$quantity); // Set to new Qty
115
+ $stock->save(); // Save
116
+ continue;
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ public function redirectAction(){
123
+
124
+ // Load the session object
125
+ $session = Mage::getSingleton('checkout/session');
126
+ $session->setDibsQuoteId($session->getQuoteId());
127
+
128
+ // Create the POST to DIBS (Inside Magento Checkout)
129
+ $this->loadLayout();
130
+ $this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('dibs/redirect'));
131
+ $this->renderLayout();
132
+
133
+ // Create the POST to DIBS (In Separate "Blank" Window)
134
+ // $this->getResponse()->setBody($this->getLayout()->createBlock('Dibs/redirect')->toHtml());
135
+
136
+ // Save order comment
137
+ $order = Mage::getModel('sales/order');
138
+ $order->loadByIncrementId($session->getLastRealOrderId());
139
+ $order->addStatusToHistory($order->getStatus(),$this->__('DIBS_LABEL_3'));
140
+ $order->save();
141
+
142
+ // Add items back on stock (if used)
143
+ $this->addToStock();
144
+ }
145
+
146
+ public function getOrder (){
147
+ if ($this->_order == null) {
148
+ $session = Mage::getSingleton('checkout/session');
149
+ $this->_order = Mage::getModel('sales/order');
150
+ $this->_order->loadByIncrementId($session->getLastRealOrderId());
151
+ }
152
+ return $this->_order;
153
+ }
154
+
155
+ /**
156
+ * When a customer cancel payment from dibs.
157
+ */
158
+ public function cancelAction() {
159
+ $session = Mage::getSingleton('checkout/session');
160
+ $session->setQuoteId($session->getDibsStandardQuoteId(true));
161
+ $fields = array();
162
+
163
+ // Save order comment
164
+ $payment = Mage::getModel('dibs/Dibs');
165
+ $order = Mage::getModel('sales/order');
166
+
167
+ if (isset($_REQUEST["orderid"])) {
168
+ $order->loadByIncrementId((int)$_REQUEST["orderid"]);
169
+
170
+ $order->registerCancellation($this->__('DIBS_LABEL_20'));
171
+ $order->save();
172
+
173
+ // Add items back on stock (if used)
174
+ $this->removeFromStock();
175
+
176
+ // Mark in DIBS specific DB table that order cancellation has been performed
177
+ //--------------------------------------------------------------------------
178
+ $fields['ordercancellation'] = '1';
179
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
180
+ $write->update('dibs_orderdata', $fields,'orderid='.$order->getRealOrderId());
181
+ }
182
+
183
+ // Give back cart to customer for new attempt to buy
184
+ $this->_redirect('checkout/cart');
185
+ }
186
+
187
+ public function successAction() {
188
+ $session = Mage::getSingleton('checkout/session');
189
+ $session->setQuoteId($session->getDibsStandardQuoteId(true));
190
+ $order = Mage::getModel('sales/order');
191
+ $payment = Mage::getModel('dibs/Dibs');
192
+ $fields = array();
193
+
194
+ // Check the orderid received from DIBS
195
+ //-------------------------------------
196
+ if (isset($_REQUEST["orderid"])) {
197
+ $order->loadByIncrementId((int)$_REQUEST["orderid"]);
198
+ if($order->getId()) {
199
+ // $fields['orderid'] = $_REQUEST["orderid"];
200
+ } else {
201
+ echo "<h1>A fatal error has occured!</h1>";
202
+ echo "Unknown orderid was returned from DIBS payment gateway!";
203
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/cart') ."')>Return To Shop</button>";
204
+ exit();
205
+ }
206
+ } else {
207
+ echo "<h1>A fatal error has occured!</h1>";
208
+ echo "No orderid was returned from DIBS payment gateway!";
209
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/cart') ."')>Return To Shop</button>";
210
+ exit();
211
+ }
212
+
213
+ // Check the amount received from DIBS
214
+ //------------------------------------
215
+ if (isset($_REQUEST["amount"])) {
216
+ if (abs((int)$_REQUEST["amount"] - ($order->getTotalDue() * 100)) >= 0.01) {
217
+ echo "<h1>A fatal error has occured!</h1>";
218
+ echo "The amount received from DIBS payment gateway differs from original order amount!";
219
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/cart') ."')>Return To Shop</button>";
220
+ exit();
221
+ }
222
+ } else {
223
+ echo "<h1>A fatal error has occured!</h1>";
224
+ echo "No amount was returned from DIBS payment gateway!";
225
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/cart') ."')>Return To Shop</button>";
226
+ exit();
227
+ }
228
+
229
+ // Check the currency received from DIBS
230
+ //------------------------------------
231
+ if (isset($_REQUEST["currency"])) {
232
+ if (((int)$payment->convertToDibsCurrency($order->getOrderCurrency())) != (int)$_REQUEST["currency"]) {
233
+ echo "<h1>A fatal error has occured!</h1>";
234
+ echo "The currency type received from DIBS payment gateway differs from original order currency type!";
235
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/cart') ."')>Return To Shop</button>";
236
+ exit();
237
+ }
238
+ } else {
239
+ echo "<h1>A fatal error has occured!</h1>";
240
+ echo "No currency type was returned from DIBS payment gateway!";
241
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/cart') ."')>Return To Shop</button>";
242
+ exit();
243
+ }
244
+
245
+ // validate md5 if enabled
246
+ //------------------------
247
+ if ($payment->getConfigData('md5key1') != "" && $payment->getConfigData('md5key2') != "") {
248
+ $transact = $_REQUEST["transact"];
249
+ $amount = $order->getTotalDue() * 100;
250
+ $currency = $_REQUEST["currency"];
251
+ $md5key1 = $payment->getConfigData('md5key1');
252
+ $md5key2 = $payment->getConfigData('md5key2');
253
+ $tmp = md5($md5key2.md5($md5key1.'transact='.$transact.'&amount='.$amount.'&currency='.$currency));
254
+
255
+ if ((int)$payment->getConfigData('calcfee') == 1) {
256
+
257
+ // Check the card fee received from DIBS
258
+ //--------------------------------------
259
+ if (isset($_REQUEST["fee"])) {
260
+ $calcfee = $_REQUEST["fee"];
261
+ } else {
262
+ $calcfee = '0';
263
+ }
264
+
265
+ $amount = $_REQUEST["amount"] + $calcfee;
266
+ $tmp = md5($md5key2.md5($md5key1.'transact='.$transact.'&amount='.$amount.'&currency='.$currency));
267
+ }
268
+
269
+ // Validate authkey
270
+ //-----------------
271
+ if ($tmp != $_REQUEST["authkey"]) {
272
+ echo "<h1>A fatal error has occured!</h1>";
273
+ echo "The MD5 key does not match!";
274
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/cart') ."')>Return To Shop</button>";
275
+ exit();
276
+ }
277
+ }
278
+
279
+ // Mark in DIBS specific DB table that sucessaction has been performed
280
+ //--------------------------------------------------------------------
281
+ $fields['successaction'] = '1';
282
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
283
+ $write->update('dibs_orderdata', $fields,'orderid='.$order->getRealOrderId());
284
+
285
+ //redirect the user to shop
286
+ //-------------------------
287
+ $this->_redirect('checkout/onepage/success');
288
+ }
289
+
290
+ public function callbackAction() {
291
+
292
+ $session = Mage::getSingleton('checkout/session');
293
+ $session->setQuoteId($session->getDibsStandardQuoteId(true));
294
+ $order = Mage::getModel('sales/order');
295
+ $payment = Mage::getModel('dibs/Dibs');
296
+ $fields = array();
297
+ $PBBShippingAddress;
298
+
299
+ // Check the orderid received from DIBS
300
+ //-------------------------------------
301
+ if (isset($_REQUEST["orderid"])) {
302
+ $order->loadByIncrementId((int)$_REQUEST["orderid"]);
303
+ if($order->getId()) {
304
+ $fields['orderid'] = $_REQUEST["orderid"];
305
+ } else {
306
+ exit();
307
+ }
308
+ } else {
309
+ exit();
310
+ }
311
+
312
+ $PBBShippingAddress = $order->getShippingAddress();
313
+
314
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
315
+ $order_payment = $read->fetchRow("select status from dibs_orderdata where orderid = '" . $fields['orderid'] . "'");
316
+
317
+ // Verify that order status is 0 => i.e. not payed yet
318
+ //====================================================
319
+ if ($order_payment['status'] == 0) {
320
+
321
+ // Check the amount received from DIBS
322
+ //------------------------------------
323
+ if (isset($_REQUEST["amount"])) {
324
+ if (abs((int)$_REQUEST["amount"] - ($order->getTotalDue() * 100)) >= 0.01) {
325
+ exit();
326
+ } else {
327
+ $fields['amount'] = $_REQUEST["amount"];
328
+ }
329
+ } else {
330
+ exit();
331
+ }
332
+
333
+ // Check the currency received from DIBS
334
+ //------------------------------------
335
+ if (isset($_REQUEST["currency"])) {
336
+ if (((int)$payment->convertToDibsCurrency($order->getOrderCurrency())) != (int)$_REQUEST["currency"]) {
337
+ exit();
338
+ } else {
339
+ $fields['currency'] = $_REQUEST["currency"];
340
+ }
341
+ } else {
342
+ exit();
343
+ }
344
+
345
+ // Check the transaction id received from DIBS
346
+ //--------------------------------------------
347
+ if (isset($_REQUEST["transact"])) {
348
+ $fields['transact'] = $_REQUEST["transact"];
349
+ } else {
350
+ $fields['transact'] = '0';
351
+ }
352
+
353
+ // Check the paytype received from DIBS
354
+ //-------------------------------------
355
+ if (isset($_REQUEST["paytype"])) {
356
+ $fields['paytype'] = $_REQUEST["paytype"];
357
+ } else {
358
+ $fields['paytype'] = '0';
359
+ }
360
+
361
+ // Check if PayByBill (PBB) customerId at Gothia has been recived from DIBS
362
+ //-------------------------------------------------------------------------
363
+ if (isset($_REQUEST["customerId"])) {
364
+ $fields['PBB_customerId'] = $_REQUEST["customerId"];
365
+ } else {
366
+ $fields['PBB_customerId'] = '-';
367
+ }
368
+
369
+ // Check if PBB customer deliveryAddress has been recived from DIBS
370
+ //-----------------------------------------------------------------
371
+ if (isset($_REQUEST["deliveryAddress"])) {
372
+ $fields['PBB_deliveryAddress'] = iconv("ISO-8859-1","UTF-8",$_REQUEST["deliveryAddress"]);
373
+ $PBBShippingAddress->street = iconv("ISO-8859-1","UTF-8",$_REQUEST["deliveryAddress"]);
374
+ } else {
375
+ $fields['PBB_deliveryAddress'] = '-';
376
+ }
377
+
378
+ // Check if PBB customer deliveryCountryCode has been recived from DIBS
379
+ //---------------------------------------------------------------------
380
+ if (isset($_REQUEST["deliveryCountryCode"])) {
381
+ $fields['PBB_deliveryCountryCode'] = iconv("ISO-8859-1","UTF-8",$_REQUEST["deliveryCountryCode"]);
382
+ $PBBShippingAddress->country_id = iconv("ISO-8859-1","UTF-8",$_REQUEST["deliveryCountryCode"]);
383
+ } else {
384
+ $fields['PBB_deliveryCountryCode'] = '-';
385
+ }
386
+
387
+ // Check if PBB customer deliveryPostalCode has been recived from DIBS
388
+ //--------------------------------------------------------------------
389
+ if (isset($_REQUEST["deliveryPostalCode"])) {
390
+ $fields['PBB_deliveryPostalCode'] = iconv("ISO-8859-1","UTF-8",$_REQUEST["deliveryPostalCode"]);
391
+ $PBBShippingAddress->postcode = iconv("ISO-8859-1","UTF-8",$_REQUEST["deliveryPostalCode"]);
392
+ } else {
393
+ $fields['PBB_deliveryPostalCode'] = '-';
394
+ }
395
+
396
+ // Check if PBB customer deliveryPostalPlace has been recived from DIBS
397
+ //---------------------------------------------------------------------
398
+ if (isset($_REQUEST["deliveryPostalPlace"])) {
399
+ $fields['PBB_deliveryPostalPlace'] = iconv("ISO-8859-1","UTF-8",$_REQUEST["deliveryPostalPlace"]);
400
+ $PBBShippingAddress->city = iconv("ISO-8859-1","UTF-8",$_REQUEST["deliveryPostalPlace"]);
401
+ } else {
402
+ $fields['PBB_deliveryPostalPlace'] = '-';
403
+ }
404
+
405
+ // Check if PBB customer firstName has been recived from DIBS
406
+ //-----------------------------------------------------------
407
+ if (isset($_REQUEST["firstName"])) {
408
+ $fields['PBB_firstName'] = iconv("ISO-8859-1","UTF-8",$_REQUEST["firstName"]);
409
+ $PBBShippingAddress->firstname = iconv("ISO-8859-1","UTF-8",$_REQUEST["firstName"]);
410
+ } else {
411
+ $fields['PBB_firstName'] = '-';
412
+ }
413
+
414
+ // Check if PBB customer lastName has been recived from DIBS
415
+ //----------------------------------------------------------
416
+ if (isset($_REQUEST["lastName"])) {
417
+ $fields['PBB_lastName'] = iconv("ISO-8859-1","UTF-8",$_REQUEST["lastName"]);
418
+ $PBBShippingAddress->lastname = iconv("ISO-8859-1","UTF-8",$_REQUEST["lastName"]);
419
+ } else {
420
+ $fields['PBB_lastName'] = '-';
421
+ }
422
+
423
+ // Check the last four card digits received from DIBS
424
+ //----------------------------------------------------
425
+ if (isset($_REQUEST["cardnomask"])) {
426
+ $fields['cardnomask'] = $_REQUEST["cardnomask"];
427
+ } else {
428
+ $fields['cardnomask'] = '0';
429
+ }
430
+
431
+ // Check the card prefix received from DIBS
432
+ //----------------------------------------------------
433
+ if (isset($_REQUEST["cardprefix"])) {
434
+ $fields['cardprefix'] = $_REQUEST["cardprefix"];
435
+ } else {
436
+ $fields['cardprefix'] = '0';
437
+ }
438
+
439
+ // Check the card expiry date received from DIBS
440
+ //----------------------------------------------
441
+ if (isset($_REQUEST["cardexpdate"])) {
442
+ $fields['cardexpdate'] = $_REQUEST["cardexpdate"];
443
+ } else {
444
+ $fields['cardexpdate'] = '0';
445
+ }
446
+
447
+ // Check the card country received from DIBS
448
+ //------------------------------------------
449
+ if (isset($_REQUEST["cardcountry"])) {
450
+ $fields['cardcountry'] = $_REQUEST["cardcountry"];
451
+ } else {
452
+ $fields['cardcountry'] = '0';
453
+ }
454
+
455
+ // Check the card acquirer id received from DIBS
456
+ //----------------------------------------------
457
+ if (isset($_REQUEST["acquirer"])) {
458
+ $fields['acquirer'] = $_REQUEST["acquirer"];
459
+ } else {
460
+ $fields['acquirer'] = '0';
461
+ }
462
+
463
+ // Check the card fee received from DIBS
464
+ //--------------------------------------
465
+ if (isset($_REQUEST["fee"])) {
466
+ $fields['fee'] = $_REQUEST["fee"];
467
+ } else {
468
+ $fields['fee'] = '0';
469
+ }
470
+
471
+ // Check the card enrolled received from DIBS
472
+ //-------------------------------------------
473
+ if (isset($_REQUEST["enrolled"])) {
474
+ $fields['enrolled'] = $_REQUEST["enrolled"];
475
+ } else {
476
+ $fields['enrolled'] = '0';
477
+ }
478
+
479
+ // Check if test order flag received from DIBS
480
+ //---------------------------------------------
481
+ if (isset($_REQUEST["test"])) {
482
+ $fields['test'] = $_REQUEST["test"];
483
+ } else {
484
+ $fields['test'] = '0';
485
+ }
486
+
487
+ // Check if unique orderid flag received from DIBS
488
+ //------------------------------------------------
489
+ if (isset($_REQUEST["uniqueoid"])) {
490
+ $fields['uniqueoid'] = $_REQUEST["uniqueoid"];
491
+ } else {
492
+ $fields['uniqueoid'] = '0';
493
+ }
494
+
495
+ // Check if approvalcode received from DIBS
496
+ //-----------------------------------------
497
+ if (isset($_REQUEST["approvalcode"])) {
498
+ $fields['approvalcode'] = $_REQUEST["approvalcode"];
499
+ } else {
500
+ $fields['approvalcode'] = '0';
501
+ }
502
+
503
+ // validate md5 if enabled
504
+ //------------------------
505
+ if ($payment->getConfigData('md5key1') != "" && $payment->getConfigData('md5key2') != "") {
506
+ $transact = $_REQUEST["transact"];
507
+ $amount = $order->getTotalDue() * 100;
508
+ $currency = $_REQUEST["currency"];
509
+ $md5key1 = $payment->getConfigData('md5key1');
510
+ $md5key2 = $payment->getConfigData('md5key2');
511
+ $tmp = md5($md5key2.md5($md5key1.'transact='.$transact.'&amount='.$amount.'&currency='.$currency));
512
+
513
+ if ((int)$payment->getConfigData('calcfee') == 1) {
514
+ $amount = $_REQUEST["amount"] + $fields['fee'];
515
+ $tmp = md5($md5key2.md5($md5key1.'transact='.$transact.'&amount='.$amount.'&currency='.$currency));
516
+ }
517
+
518
+ // Validate authkey
519
+ //-----------------
520
+ if ($tmp != $_REQUEST["authkey"]) {
521
+ exit();
522
+ }
523
+ }
524
+
525
+ // Mark in DIBS specific DB table that callback has been performed
526
+ //----------------------------------------------------------------
527
+ $fields['callback'] = '1';
528
+
529
+ // Set order status to 1 => i.e. mark it as payed
530
+ //-----------------------------------------------
531
+ $fields['status'] = '1';
532
+
533
+ // Save order => due to possible PBB change of address (OBS! Better logic prefered...)
534
+ //-----------------------------------------------------------------------------------
535
+ $PBBShippingAddress->setOrder($order);
536
+ $PBBShippingAddress->save();
537
+ $order->save();
538
+
539
+ // Send email order confirmation (if enabled).
540
+ //-------------------------------------------
541
+ if (((int)$payment->getConfigData('sendmailorderconfirmation')) == 1) {
542
+ $order->sendNewOrderEmail();
543
+ }
544
+
545
+ // Remove items from stock (if enabled -> payment made)
546
+ //-----------------------------------------------------
547
+ $this->removeFromStock();
548
+ $this->setOrderStatusAfterPayment();
549
+ $session->setQuoteId($session->getDibsStandardQuoteId(true));
550
+
551
+ // Save the updated order into the dibs_orderdata table
552
+ //-----------------------------------------------------
553
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
554
+ $write->update('dibs_orderdata', $fields,'orderid='.$fields['orderid']);
555
+
556
+ /* echo "<h1>Test Of Update DB Table dibs_orderdata performed!</h1>";
557
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/onepage/success') ."')>Return To Shop</button>";
558
+ exit(); */
559
+
560
+ } else {
561
+
562
+ // order status is 1 => i.e already payed
563
+ //=======================================
564
+
565
+ /* echo "<h1>Test Of No Update DB Table dibs_orderdata performed!</h1>";
566
+ echo " <br><br> <button type=\"button\" onclick=window.location.replace('". Mage::getUrl('checkout/onepage/success') ."')>Return To Shop</button>";
567
+ exit(); */
568
+ ;
569
+ }
570
+
571
+ exit();
572
+ }
573
+
574
+ }
app/code/community/Dibs/Dibs/etc/config.xml ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Dibs_Dibs>
27
+ <version>1.0.0.12</version>
28
+ <depends>
29
+ <Mage_Paygate />
30
+ </depends>
31
+ </Dibs_Dibs>
32
+ </modules>
33
+
34
+ <global>
35
+
36
+ <blocks>
37
+ <dibs>
38
+ <class>Dibs_Dibs_Block</class>
39
+ </dibs>
40
+ </blocks>
41
+
42
+ <models>
43
+ <dibs>
44
+ <class>Dibs_Dibs_Model</class>
45
+ <resourceModel>dibs_mysql4</resourceModel>
46
+ </dibs>
47
+ <dibs_mysql4>
48
+ <class>Dibs_Dibs_Model_Mysql4</class>
49
+ <entities>
50
+ <api_debug><table>dibs_api_debug</table></api_debug>
51
+ </entities>
52
+ </dibs_mysql4>
53
+ </models>
54
+
55
+ <helpers>
56
+ <dibs>
57
+ <class>Dibs_Dibs_Helper</class>
58
+ </dibs>
59
+ </helpers>
60
+
61
+ <resources>
62
+ <dibs_setup>
63
+ <setup>
64
+ <module>Dibs_Dibs</module>
65
+ <class>Dibs_Dibs_Model_Mysql4_Setup</class>
66
+ </setup>
67
+
68
+ <connection>
69
+ <use>core_setup</use>
70
+ </connection>
71
+ </dibs_setup>
72
+
73
+ <dibs_write>
74
+ <connection>
75
+ <use>core_write</use>
76
+ </connection>
77
+ </dibs_write>
78
+
79
+ <dibs_read>
80
+ <connection>
81
+ <use>core_read</use>
82
+ </connection>
83
+ </dibs_read>
84
+
85
+ </resources>
86
+ </global>
87
+
88
+ <frontend>
89
+ <routers>
90
+ <Dibs>
91
+ <use>standard</use>
92
+ <args>
93
+ <module>Dibs_Dibs</module>
94
+ <frontName>Dibs</frontName>
95
+ </args>
96
+ </Dibs>
97
+ </routers>
98
+ </frontend>
99
+ <frontend>
100
+ <translate>
101
+ <modules>
102
+ <Mage_Dibs>
103
+ <files>
104
+ <default>Mage_Dibs.csv</default>
105
+ </files>
106
+ </Mage_Dibs>
107
+ </modules>
108
+ </translate>
109
+ </frontend>
110
+ <adminhtml>
111
+ <translate>
112
+ <modules>
113
+ <Mage_Dibs>
114
+ <files>
115
+ <default>Mage_Dibs.csv</default>
116
+ </files>
117
+ </Mage_Dibs>
118
+ </modules>
119
+ </translate>
120
+ </adminhtml>
121
+ <default>
122
+ <payment>
123
+ <Dibs>
124
+ <active>1</active>
125
+ <url_failure>checkout/cart</url_failure>
126
+ <url_accept>checkout/success</url_accept>
127
+ <url_callback>checkout/cart</url_callback>
128
+ <model>dibs/Dibs</model>
129
+ <order_status>2</order_status>
130
+ <order_status_after_payment>2</order_status_after_payment>
131
+ <test_mode>1</test_mode>
132
+ <title>DIBS | Secure Payment Services</title>
133
+ <merchantid>-</merchantid>
134
+ <allowspecific>0</allowspecific>
135
+ <capturenow>0</capturenow>
136
+ <uniqueoid>0</uniqueoid>
137
+ <calcfee>0</calcfee>
138
+ <paytype>DIBS</paytype>
139
+ <paymentwindow>1</paymentwindow>
140
+ <skiplastpage>0</skiplastpage>
141
+ <decorator>default</decorator>
142
+ <color>blank</color>
143
+ <lang>auto</lang>
144
+ <sendmailorderconfirmation>1</sendmailorderconfirmation>
145
+ <dibslogos>DIBS</dibslogos>
146
+ <handlestock>1</handlestock>
147
+ <distributionType>-</distributionType>
148
+ </Dibs>
149
+ </payment>
150
+ </default>
151
+
152
+ </config>
app/code/community/Dibs/Dibs/etc/system.xml ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+ -->
24
+ <config>
25
+ <sections>
26
+ <payment translate="label" module="payment">
27
+ <groups>
28
+ <Dibs translate="label">
29
+ <label>Dibs Payment Module</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>0</show_in_store>
35
+ <fields>
36
+ <active translate="label">
37
+ <label>Enabled</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
+ <sort_order>1</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>0</show_in_store>
44
+ </active>
45
+ <title translate="label">
46
+ <label>Title (Payment method name displayed for customers. Ex: DibsGW) </label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>2</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>0</show_in_store>
52
+ </title>
53
+ <order_status translate="label">
54
+ <label>Order status (Before the payment is made)</label>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>dibs/System_Config_Source_Orderstatusbefore</source_model>
57
+ <sort_order>3</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>0</show_in_store>
61
+ </order_status>
62
+ <order_status_after_payment translate="label">
63
+ <label>New order status (When the payment is made)</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>dibs/System_Config_Source_Orderstatusafter</source_model>
66
+ <sort_order>4</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>0</show_in_store>
70
+ </order_status_after_payment>
71
+ <sort_order translate="label">
72
+ <label>Sort order</label>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>5</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>0</show_in_store>
78
+ </sort_order>
79
+ <allowspecific translate="label">
80
+ <label>Payment from applicable countries</label>
81
+ <frontend_type>allowspecific</frontend_type>
82
+ <sort_order>6</sort_order>
83
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </allowspecific>
88
+ <specificcountry translate="label">
89
+ <label>Payment from Specific countries</label>
90
+ <frontend_type>multiselect</frontend_type>
91
+ <sort_order>7</sort_order>
92
+ <source_model>adminhtml/system_config_source_country</source_model>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </specificcountry>
97
+ <merchantid translate="label">
98
+ <label>DIBS Merchant ID</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>8</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ </merchantid>
105
+ <account translate="label">
106
+ <label>Account</label>
107
+ <frontend_type>text</frontend_type>
108
+ <sort_order>9</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>0</show_in_store>
112
+ </account>
113
+ <test_mode translate="label">
114
+ <label>Test mode</label>
115
+ <frontend_type>select</frontend_type>
116
+ <source_model>adminhtml/system_config_source_yesno</source_model>
117
+ <sort_order>10</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ </test_mode>
122
+ <capturenow translate="label">
123
+ <label>Capture Now</label>
124
+ <frontend_type>select</frontend_type>
125
+ <source_model>adminhtml/system_config_source_yesno</source_model>
126
+ <sort_order>11</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>0</show_in_store>
130
+ </capturenow>
131
+ <uniqueoid translate="label">
132
+ <label>Unique order id</label>
133
+ <frontend_type>select</frontend_type>
134
+ <source_model>adminhtml/system_config_source_yesno</source_model>
135
+ <sort_order>12</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>0</show_in_store>
139
+ </uniqueoid>
140
+ <calcfee translate="label">
141
+ <label>Calc fee</label>
142
+ <frontend_type>select</frontend_type>
143
+ <source_model>adminhtml/system_config_source_yesno</source_model>
144
+ <sort_order>13</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>0</show_in_store>
148
+ </calcfee>
149
+ <md5key1 translate="label">
150
+ <label>MD5 Key1</label>
151
+ <frontend_type>text</frontend_type>
152
+ <sort_order>14</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>0</show_in_store>
156
+ </md5key1>
157
+ <md5key2 translate="label">
158
+ <label>MD5 Key2</label>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>15</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>0</show_in_store>
164
+ </md5key2>
165
+ <paytype translate="label">
166
+ <label>Paytype (Set DIBS for default paytypes)</label>
167
+ <frontend_type>text</frontend_type>
168
+ <sort_order>16</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>0</show_in_store>
172
+ </paytype>
173
+ <paymentwindow translate="label">
174
+ <label>Payment Window or FlexWin</label>
175
+ <frontend_type>select</frontend_type>
176
+ <source_model>dibs/system_config_source_paymentwindow</source_model>
177
+ <sort_order>17</sort_order>
178
+ <show_in_default>2</show_in_default>
179
+ <show_in_website>2</show_in_website>
180
+ <show_in_store>0</show_in_store>
181
+ </paymentwindow>
182
+ <skiplastpage translate="label">
183
+ <label>Skip last page (Only used if FlexWin is selected)</label>
184
+ <frontend_type>select</frontend_type>
185
+ <source_model>adminhtml/system_config_source_yesno</source_model>
186
+ <sort_order>18</sort_order>
187
+ <show_in_default>2</show_in_default>
188
+ <show_in_website>2</show_in_website>
189
+ <show_in_store>0</show_in_store>
190
+ </skiplastpage>
191
+ <decorator translate="label">
192
+ <label>FlexWin Decorator (Only used if FlexWin is selected)</label>
193
+ <frontend_type>select</frontend_type>
194
+ <source_model>dibs/system_config_source_decorator</source_model>
195
+ <sort_order>19</sort_order>
196
+ <show_in_default>2</show_in_default>
197
+ <show_in_website>2</show_in_website>
198
+ <show_in_store>0</show_in_store>
199
+ </decorator>
200
+ <color translate="label">
201
+ <label>FlexWin / Payment Window Color</label>
202
+ <frontend_type>select</frontend_type>
203
+ <source_model>dibs/system_config_source_color</source_model>
204
+ <sort_order>20</sort_order>
205
+ <show_in_default>2</show_in_default>
206
+ <show_in_website>2</show_in_website>
207
+ <show_in_store>0</show_in_store>
208
+ </color>
209
+ <lang translate="label">
210
+ <label>Language used in Payment Window / FlexWin</label>
211
+ <frontend_type>select</frontend_type>
212
+ <source_model>dibs/system_config_source_lang</source_model>
213
+ <sort_order>21</sort_order>
214
+ <show_in_default>2</show_in_default>
215
+ <show_in_website>2</show_in_website>
216
+ <show_in_store>0</show_in_store>
217
+ </lang>
218
+ <sendmailorderconfirmation translate="label">
219
+ <label>Send Email Order Confirmation. Enabling this setting will result in an email confirmation is send to the cardholder as the payment is made.</label>
220
+ <frontend_type>select</frontend_type>
221
+ <source_model>adminhtml/system_config_source_yesno</source_model>
222
+ <sort_order>22</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>0</show_in_store>
226
+ </sendmailorderconfirmation>
227
+ <dibslogos translate="label">
228
+ <label>Which logos to show</label>
229
+ <frontend_type>multiselect</frontend_type>
230
+ <source_model>dibs/system_config_source_dibslogos</source_model>
231
+ <sort_order>23</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>0</show_in_store>
235
+ </dibslogos>
236
+ <handlestock translate="label">
237
+ <label>Handle stock. The quantity purchased in stock will at first be decremented as the payment is made.</label>
238
+ <frontend_type>select</frontend_type>
239
+ <source_model>adminhtml/system_config_source_yesno</source_model>
240
+ <sort_order>24</sort_order>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>0</show_in_store>
244
+ </handlestock>
245
+ <distributionType translate="label">
246
+ <label>Distribution method (Only relevant for PayByBill payment method).</label>
247
+ <frontend_type>select</frontend_type>
248
+ <source_model>dibs/system_config_source_PBBdistribution</source_model>
249
+ <sort_order>25</sort_order>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>1</show_in_website>
252
+ <show_in_store>0</show_in_store>
253
+ </distributionType>
254
+ </fields>
255
+ </Dibs>
256
+ </groups>
257
+ </payment>
258
+ </sections>
259
+ </config>
app/code/community/Dibs/Dibs/sql/dibs_setup/mysql4-install-1.0.0.12.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ /**
25
+ * Payment Model
26
+ **/
27
+
28
+ $installer = $this;
29
+
30
+ $installer->startSetup();
31
+
32
+ $installer->run("
33
+ delete from core_resource where code = 'dibs_setup';
34
+ CREATE TABLE if not exists `dibs_orderdata` (
35
+ `orderid` VARCHAR(45) NOT NULL,
36
+ `transact` VARCHAR(50) NOT NULL,
37
+ `status` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = unpaid, 1 = paid',
38
+ `amount` VARCHAR(45) NOT NULL,
39
+ `currency` VARCHAR(45) NOT NULL,
40
+ `paytype` VARCHAR(45) NOT NULL,
41
+ `PBB_customerId` VARCHAR(45) NOT NULL,
42
+ `PBB_deliveryAddress` VARCHAR(45) NOT NULL,
43
+ `PBB_deliveryCountryCode` VARCHAR(45) NOT NULL,
44
+ `PBB_deliveryPostalCode` VARCHAR(45) NOT NULL,
45
+ `PBB_deliveryPostalPlace` VARCHAR(45) NOT NULL,
46
+ `PBB_firstName` VARCHAR(45) NOT NULL,
47
+ `PBB_lastName` VARCHAR(45) NOT NULL,
48
+ `cardnomask` VARCHAR(45) NOT NULL,
49
+ `cardprefix` VARCHAR(45) NOT NULL,
50
+ `cardexpdate` VARCHAR(45) NOT NULL,
51
+ `cardcountry` VARCHAR(45) NOT NULL,
52
+ `acquirer` VARCHAR(45) NOT NULL,
53
+ `enrolled` VARCHAR(45) NOT NULL,
54
+ `fee` VARCHAR(45) NOT NULL,
55
+ `test` VARCHAR(45) NOT NULL,
56
+ `uniqueoid` VARCHAR(45) NOT NULL,
57
+ `approvalcode` VARCHAR(45) NOT NULL,
58
+ `ordercancellation` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed',
59
+ `successaction` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed',
60
+ `callback` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed'
61
+ );
62
+ UPDATE sales_flat_order_payment SET method='Dibs'WHERE method='dibs_standard';
63
+ ");
64
+
65
+ $installer->endSetup();
app/code/community/Dibs/Dibs/sql/dibs_setup/mysql4-upgrade-1.0.0.8-1.0.0.12.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ /**
25
+ * Payment Model
26
+ **/
27
+
28
+ $installer = $this;
29
+
30
+ $installer->startSetup();
31
+
32
+ $installer->run("
33
+ delete from core_resource where code = 'dibs_setup';
34
+ CREATE TABLE if not exists `dibs_orderdata` (
35
+ `orderid` VARCHAR(45) NOT NULL,
36
+ `transact` VARCHAR(50) NOT NULL,
37
+ `status` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = unpaid, 1 = paid',
38
+ `amount` VARCHAR(45) NOT NULL,
39
+ `currency` VARCHAR(45) NOT NULL,
40
+ `paytype` VARCHAR(45) NOT NULL,
41
+ `PBB_customerId` VARCHAR(45) NOT NULL,
42
+ `PBB_deliveryAddress` VARCHAR(45) NOT NULL,
43
+ `PBB_deliveryCountryCode` VARCHAR(45) NOT NULL,
44
+ `PBB_deliveryPostalCode` VARCHAR(45) NOT NULL,
45
+ `PBB_deliveryPostalPlace` VARCHAR(45) NOT NULL,
46
+ `PBB_firstName` VARCHAR(45) NOT NULL,
47
+ `PBB_lastName` VARCHAR(45) NOT NULL,
48
+ `cardnomask` VARCHAR(45) NOT NULL,
49
+ `cardprefix` VARCHAR(45) NOT NULL,
50
+ `cardexpdate` VARCHAR(45) NOT NULL,
51
+ `cardcountry` VARCHAR(45) NOT NULL,
52
+ `acquirer` VARCHAR(45) NOT NULL,
53
+ `enrolled` VARCHAR(45) NOT NULL,
54
+ `fee` VARCHAR(45) NOT NULL,
55
+ `test` VARCHAR(45) NOT NULL,
56
+ `uniqueoid` VARCHAR(45) NOT NULL,
57
+ `approvalcode` VARCHAR(45) NOT NULL,
58
+ `ordercancellation` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed',
59
+ `successaction` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed',
60
+ `callback` INTEGER UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = NotPerformed, 1 = Performed'
61
+ );
62
+ UPDATE sales_flat_order_payment SET method='Dibs'WHERE method='dibs_standard';
63
+ ");
64
+
65
+ $installer->endSetup();
app/code/community/Dibs/Sales/Block/Order/Info.php ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Mage
22
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
23
+ * Modifications copyrighted by Dibs AB, (c) 2010.
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Invoice view comments form
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Sale
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Dibs_Sales_Block_Order_Info extends Mage_Sales_Block_Order_Info
35
+ {
36
+ protected $_links = array();
37
+
38
+ protected function _construct()
39
+ {
40
+ parent::_construct();
41
+ $this->setTemplate('sales/order/info.phtml');
42
+ }
43
+
44
+ protected function PaymentPart($paymentstr){
45
+ $PaymentPartStr = explode(',',$paymentstr,2);
46
+ return $PaymentPartStr[0];
47
+ }
48
+
49
+ protected function _prepareLayout()
50
+ {
51
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
52
+ $headBlock->setTitle($this->__('Order # %s', $this->getOrder()->getRealOrderId()));
53
+ }
54
+ $this->setChild(
55
+ 'payment_info',
56
+ $this->helper('payment')->getInfoBlock($this->getOrder()->getPayment())
57
+ );
58
+ }
59
+
60
+ public function getPaymentInfoHtml()
61
+ {
62
+
63
+ $res = $this->getChildHtml('payment_info');
64
+ $standard = Mage::getModel('dibs/Dibs');
65
+
66
+ // Read info directly from the database
67
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
68
+ $row = $read->fetchRow("select * from dibs_orderdata where orderid = " . $this->getOrder()->getIncrementId());
69
+
70
+
71
+ if (empty($row)){ // Pre DIBS-1.0.0.9 ex. DIBS-1.0.0.8 Handeled Order:
72
+ //====================================================================
73
+ $row = $read->fetchRow("select * from dibs_order_status where orderid = " . $this->getOrder()->getIncrementId());
74
+ if ($row['status'] == '1') {
75
+ //
76
+ // Payment has been made to this order
77
+ $res .= "<table border='0' width='100%'>";
78
+ if ($row['transact'] != '0') {
79
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_8') . "</td>";
80
+ $res .= "<td>" . $row['transact'] . "</td></tr>";
81
+ }
82
+ if ($row['paytype'] != '0') {
83
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_12') . "</td>";
84
+ $res .= "<td>" . $this->printLogo($row['paytype']) . "</td></tr>";
85
+ }
86
+ if ($row['fee'] != '0') {
87
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_11') . "</td>";
88
+ $res .= "<td>" . $this->getOrder()->getOrderCurrencyCode() . "&nbsp;" . number_format(((int)$row['fee']) / 100, 2, ',', ' ') . "</td></tr>";
89
+ }
90
+ $res .= "</table><br>";
91
+
92
+ } else {
93
+ $res .= "<br>" . Mage::helper('dibs')->__('DIBS_LABEL_19') . "<br>";
94
+ }
95
+ } else { // DIBS-1.0.0.9 Handeled Order:
96
+ //======================================
97
+ if ($row['status'] == '1') {
98
+ //
99
+ // Payment has been made to this order
100
+ $res .= "<table border='0' width='100%'>";
101
+ if ($row['transact'] != '0') {
102
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_8') . "</td>";
103
+ $res .= "<td>" . $row['transact'] . "</td></tr>";
104
+ }
105
+ if ($row['paytype'] != '0') {
106
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_12') . "</td>";
107
+ $res .= "<td>" . $this->printLogo($row['paytype']) . "</td></tr>";
108
+ }
109
+ if ($row['fee'] != '0') {
110
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_11') . "</td>";
111
+ $res .= "<td>" . $this->getOrder()->getOrderCurrencyCode() . "&nbsp;" . number_format(((int)$row['fee']) / 100, 2, ',', ' ') . "</td></tr>";
112
+ }
113
+ $res .= "</table><br>";
114
+
115
+ } else {
116
+ $res .= "<br>" . Mage::helper('dibs')->__('DIBS_LABEL_19') . "<br>";
117
+ }
118
+ }
119
+ return $res;
120
+ }
121
+
122
+ public function printLogo($paytype) {
123
+
124
+ switch($this->PaymentPart($paytype)) {
125
+ case 'AMEX': {
126
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/amex.gif') . '" border="0" />'; break;
127
+ }
128
+ case 'AMEX(DK)': {
129
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/amex.gif') . '" border="0" />'; break;
130
+ }
131
+ case 'BAX': {
132
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/bax.gif') . '" border="0" />'; break;
133
+ }
134
+ case 'DIN': {
135
+ $res = $this->getSkinUrl('images/Dibs/Dibs/diners.gif') . '" border="0" />'; break;
136
+ }
137
+ case 'DIN(DK)': {
138
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/diners.gif') . '" border="0" />'; break;
139
+ }
140
+ case 'DK': {
141
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/dankort.gif') . '" border="0" />'; break;
142
+ }
143
+ case 'FFK': {
144
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/forbrugforeningen.gif') . '" border="0" />'; break;
145
+ }
146
+ case 'JCB': {
147
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/jcb.gif') . '" border="0" />'; break;
148
+ }
149
+ case 'MC': {
150
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
151
+ }
152
+ case 'MC(DK)': {
153
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
154
+ }
155
+ case 'MC(SE)': {
156
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
157
+ }
158
+ case 'MTRO': {
159
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
160
+ }
161
+ case 'MTRO(DK)': {
162
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
163
+ }
164
+ case 'MTRO(SE)': {
165
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
166
+ }
167
+ case 'MOCA': {
168
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mobilcash.gif') . '" border="0" />'; break;
169
+ }
170
+ case 'V-DK': {
171
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
172
+ }
173
+ case 'VISA': {
174
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
175
+ }
176
+ case 'VISA(DK)': {
177
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
178
+ }
179
+ case 'VISA(SE)': {
180
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
181
+ }
182
+ case 'ELEC': {
183
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visaelectron.gif') . '" border="0" />'; break;
184
+ }
185
+ case 'AKTIA': {
186
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/aktia.gif') . '" border="0" />'; break;
187
+ }
188
+ case 'DNB': {
189
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/danskenetbetaling.gif') . '" border="0" />'; break;
190
+ }
191
+ case 'EDK': {
192
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/edankort.gif') . '" border="0" />'; break;
193
+ }
194
+ case 'ELV': {
195
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/bankeinzug.gif') . '" border="0" />'; break;
196
+ }
197
+ case 'EW': {
198
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/ewire.gif') . '" border="0" />'; break;
199
+ }
200
+ case 'FSB': {
201
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/swedbankdirektbetaling.gif') . '" border="0" />'; break;
202
+ }
203
+ case 'GIT': {
204
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/getitcard.gif') . '" border="0" />'; break;
205
+ }
206
+ case 'ING': {
207
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/ideal.gif') . '" border="0" />'; break;
208
+ }
209
+ case 'NDB': {
210
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/nordea.gif') . '" border="0" />'; break;
211
+ }
212
+ case 'PBB': {
213
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
214
+ }
215
+ case 'pbb': {
216
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
217
+ }
218
+ case 'PBBTEST': {
219
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
220
+ }
221
+ case 'pbbtest': {
222
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
223
+ }
224
+ case 'SEB': {
225
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/seb.gif') . '" border="0" />'; break;
226
+ }
227
+ case 'SHB': {
228
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/shbdirektbetaling.gif') . '" border="0" />'; break;
229
+ }
230
+ case 'SOLO': {
231
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/nordea.gif') . '" border="0" />'; break;
232
+ }
233
+ case 'VAL': {
234
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/valus.gif') . '" border="0" />'; break;
235
+ }
236
+ default: {
237
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/dibslogo.gif') . '" border="0" />';
238
+ }
239
+
240
+ }
241
+ return $res;
242
+ }
243
+
244
+ /**
245
+ * Retrieve current order model instance
246
+ *
247
+ * @return Mage_Sales_Model_Order
248
+ */
249
+ public function getOrder()
250
+ {
251
+ return Mage::registry('current_order');
252
+ }
253
+
254
+ public function addLink($name, $path, $label)
255
+ {
256
+ $this->_links[$name] = new Varien_Object(array(
257
+ 'name' => $name,
258
+ 'label' => $label,
259
+ 'url' => empty($path) ? '' : Mage::getUrl($path, array('order_id' => $this->getOrder()->getId()))
260
+ ));
261
+ return $this;
262
+ }
263
+
264
+ public function getLinks()
265
+ {
266
+ $this->checkLinks();
267
+ return $this->_links;
268
+ }
269
+
270
+ private function checkLinks()
271
+ {
272
+ $order = $this->getOrder();
273
+ if (!$order->hasInvoices()) {
274
+ unset($this->_links['invoice']);
275
+ }
276
+ if (!$order->hasShipments()) {
277
+ unset($this->_links['shipment']);
278
+ }
279
+ if (!$order->hasCreditmemos()) {
280
+ unset($this->_links['creditmemo']);
281
+ }
282
+ }
283
+
284
+ public function getReorderUrl($order)
285
+ {
286
+ return $this->getUrl('sales/order/reorder', array('order_id' => $order->getId()));
287
+ }
288
+
289
+ public function getPrintUrl($order)
290
+ {
291
+ return $this->getUrl('sales/order/print', array('order_id' => $order->getId()));
292
+ }
293
+ }
app/code/community/Dibs/Sales/Block/Order/Print.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Mage
22
+ * @package Mage_Sales
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * Modifications copyrighted by Dibs AB, (c) 2010.
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+
28
+ /**
29
+ * Order information for print
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Sales
33
+ */
34
+
35
+ class Dibs_Sales_Block_Order_Print extends Mage_Sales_Block_Order_Print
36
+ {
37
+ protected function _prepareLayout()
38
+ {
39
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
40
+ $headBlock->setTitle($this->__('Print Order # %s', $this->getOrder()->getRealOrderId()));
41
+ }
42
+ $this->setChild(
43
+ 'payment_info',
44
+ $this->helper('payment')->getInfoBlock($this->getOrder()->getPayment())
45
+ );
46
+ }
47
+
48
+ public function getPaymentInfoHtml()
49
+ {
50
+
51
+ $res = $this->getChildHtml('payment_info');
52
+ $standard = Mage::getModel('dibs/Dibs');
53
+
54
+ // Read info directly from the database
55
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
56
+ $row = $read->fetchRow("select * from dibs_orderdata where orderid = " . $this->getOrder()->getIncrementId());
57
+
58
+
59
+ if (empty($row)){ // Pre DIBS-1.0.0.9 ex. DIBS-1.0.0.8 Handeled Order:
60
+ //====================================================================
61
+ $row = $read->fetchRow("select * from dibs_order_status where orderid = " . $this->getOrder()->getIncrementId());
62
+ if ($row['status'] == '1') {
63
+ //
64
+ // Payment has been made to this order
65
+ $res .= "<table border='0' width='100%'>";
66
+ if ($row['transact'] != '0') {
67
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_8') . "</td>";
68
+ $res .= "<td>" . $row['transact'] . "</td></tr>";
69
+ }
70
+ if ($row['paytype'] != '0') {
71
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_12') . "</td>";
72
+ $res .= "<td>" . $this->printLogo($row['paytype']) . "</td></tr>";
73
+ }
74
+ if ($row['fee'] != '0') {
75
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_11') . "</td>";
76
+ $res .= "<td>" . $this->getOrder()->getOrderCurrencyCode() . "&nbsp;" . number_format(((int)$row['fee']) / 100, 2, ',', ' ') . "</td></tr>";
77
+ }
78
+ $res .= "</table><br>";
79
+
80
+ } else {
81
+ $res .= "<br>" . Mage::helper('dibs')->__('DIBS_LABEL_19') . "<br>";
82
+ }
83
+ } else { // DIBS-1.0.0.9 Handeled Order:
84
+ //======================================
85
+ if ($row['status'] == '1') {
86
+ //
87
+ // Payment has been made to this order
88
+ $res .= "<table border='0' width='100%'>";
89
+ if ($row['transact'] != '0') {
90
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_8') . "</td>";
91
+ $res .= "<td>" . $row['transact'] . "</td></tr>";
92
+ }
93
+ if ($row['paytype'] != '0') {
94
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_12') . "</td>";
95
+ $res .= "<td>" . $this->printLogo($row['paytype']) . "</td></tr>";
96
+ }
97
+ if ($row['fee'] != '0') {
98
+ $res .= "<tr><td>" . Mage::helper('dibs')->__('DIBS_LABEL_11') . "</td>";
99
+ $res .= "<td>" . $this->getOrder()->getOrderCurrencyCode() . "&nbsp;" . number_format(((int)$row['fee']) / 100, 2, ',', ' ') . "</td></tr>";
100
+ }
101
+ $res .= "</table><br>";
102
+
103
+ } else {
104
+ $res .= "<br>" . Mage::helper('dibs')->__('DIBS_LABEL_19') . "<br>";
105
+ }
106
+ }
107
+
108
+ return $res;
109
+
110
+ }
111
+
112
+ public function printLogo($paytype) {
113
+
114
+ switch($paytype) {
115
+ case 'AMEX': {
116
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/amex.gif') . '" border="0" />'; break;
117
+ }
118
+ case 'AMEX(DK)': {
119
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/amex.gif') . '" border="0" />'; break;
120
+ }
121
+ case 'BAX': {
122
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/bax.gif') . '" border="0" />'; break;
123
+ }
124
+ case 'DIN': {
125
+ $res = $this->getSkinUrl('images/Dibs/Dibs/diners.gif') . '" border="0" />'; break;
126
+ }
127
+ case 'DIN(DK)': {
128
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/diners.gif') . '" border="0" />'; break;
129
+ }
130
+ case 'DK': {
131
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/dankort.gif') . '" border="0" />'; break;
132
+ }
133
+ case 'FFK': {
134
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/forbrugforeningen.gif') . '" border="0" />'; break;
135
+ }
136
+ case 'JCB': {
137
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/jcb.gif') . '" border="0" />'; break;
138
+ }
139
+ case 'MC': {
140
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
141
+ }
142
+ case 'MC(DK)': {
143
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
144
+ }
145
+ case 'MC(SE)': {
146
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') . '" border="0" />'; break;
147
+ }
148
+ case 'MTRO': {
149
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
150
+ }
151
+ case 'MTRO(DK)': {
152
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
153
+ }
154
+ case 'MTRO(SE)': {
155
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') . '" border="0" />'; break;
156
+ }
157
+ case 'MOCA': {
158
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/mobilcash.gif') . '" border="0" />'; break;
159
+ }
160
+ case 'V-DK': {
161
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
162
+ }
163
+ case 'VISA': {
164
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
165
+ }
166
+ case 'VISA(DK)': {
167
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
168
+ }
169
+ case 'VISA(SE)': {
170
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visa.gif') . '" border="0" />'; break;
171
+ }
172
+ case 'ELEC': {
173
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/visaelectron.gif') . '" border="0" />'; break;
174
+ }
175
+ case 'AKTIA': {
176
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/aktia.gif') . '" border="0" />'; break;
177
+ }
178
+ case 'DNB': {
179
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/danskenetbetaling.gif') . '" border="0" />'; break;
180
+ }
181
+ case 'EDK': {
182
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/edankort.gif') . '" border="0" />'; break;
183
+ }
184
+ case 'ELV': {
185
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/bankeinzug.gif') . '" border="0" />'; break;
186
+ }
187
+ case 'EW': {
188
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/ewire.gif') . '" border="0" />'; break;
189
+ }
190
+ case 'FSB': {
191
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/swedbankdirektbetaling.gif') . '" border="0" />'; break;
192
+ }
193
+ case 'GIT': {
194
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/getitcard.gif') . '" border="0" />'; break;
195
+ }
196
+ case 'ING': {
197
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/ideal.gif') . '" border="0" />'; break;
198
+ }
199
+ case 'NDB': {
200
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/nordea.gif') . '" border="0" />'; break;
201
+ }
202
+ case 'PBB': {
203
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
204
+ }
205
+ case 'pbb': {
206
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
207
+ }
208
+ case 'PBBTEST': {
209
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
210
+ }
211
+ case 'pbbtest': {
212
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') . '" border="0" />'; break;
213
+ }
214
+ case 'SEB': {
215
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/seb.gif') . '" border="0" />'; break;
216
+ }
217
+ case 'SHB': {
218
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/shbdirektbetaling.gif') . '" border="0" />'; break;
219
+ }
220
+ case 'SOLO': {
221
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/nordea.gif') . '" border="0" />'; break;
222
+ }
223
+ case 'VAL': {
224
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/valus.gif') . '" border="0" />'; break;
225
+ }
226
+ default: {
227
+ $res = '<img src="' . $this->getSkinUrl('images/Dibs/Dibs/dibslogo.gif') . '" border="0" />';
228
+ }
229
+
230
+ }
231
+ return $res;
232
+ }
233
+
234
+ public function getOrder()
235
+ {
236
+ return Mage::registry('current_order');
237
+ }
238
+
239
+ protected function _prepareItem(Mage_Core_Block_Abstract $renderer)
240
+ {
241
+ $renderer->setPrintStatus(true);
242
+
243
+ return parent::_prepareItem($renderer);
244
+ }
245
+
246
+ }
247
+
app/code/community/Dibs/Sales/etc/config.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+ -->
24
+ <config>
25
+ <global>
26
+ <blocks>
27
+ <sales>
28
+ <rewrite>
29
+ <order_info>Dibs_Sales_Block_Order_Info</order_info>
30
+ <order_print>Dibs_Sales_Block_Order_Print</order_print>
31
+ </rewrite>
32
+ </sales>
33
+ </blocks>
34
+ </global>
35
+ </config>
app/design/frontend/base/default/template/Dibs/Dibs/redirect.phtml ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_DibsModule
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+ ?>
24
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
25
+ <html xmlns="http://www.w3.org/1999/xhtml">
26
+ <head>
27
+ <title>DIBS Payment</title>
28
+ <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
29
+ <script type="text/javascript">
30
+ function encode(){
31
+ var obj = document.getElementById('structuredOrderInformation');
32
+ var unencoded = obj.value;
33
+ obj.value = encodeURIComponent(unencoded);
34
+ alert ("encode called");
35
+ return true;
36
+ }
37
+ </script>
38
+ </head>
39
+ <!-- <body onload="encode();payment.submit()"> -->
40
+ <!-- <body onload="payment.submit()"> -->
41
+ <body>
42
+
43
+ <h2> You will be redirected to DIBS in a few seconds...</h2>
44
+
45
+ <?php
46
+ $paymate = Mage::getModel('dibs/Dibs');
47
+ $dibsparmeter = $paymate->getCheckoutFormFields();
48
+ $order = Mage::getModel('sales/order')->loadByIncrementId($dibsparmeter['orderid']);
49
+ $orderitems = $order->getAllItems();
50
+ $VerifiedOrderSum = $dibsparmeter['amount'];
51
+ $Delta1 = 0;
52
+ $Delta2 = 0;
53
+ $Delta3 = 0;
54
+ $Delta4 = 0;
55
+
56
+ $i = 1;
57
+
58
+
59
+ /* foreach($orderitems as $orderitem) {
60
+ echo ('<br>' . 'OrderLine: ' . $i . '<br>');
61
+ echo ('================================== <br>');
62
+ echo ('ItemID: ' . $orderitem->getProductId() . '<br>');
63
+ echo ('SKU: ' . $orderitem->getSku() . '<br>');
64
+ echo ('ItemDescription: ' . $orderitem->getName() . '<br>');
65
+ echo ('orderRowNumber: ' . $i . '<br>');
66
+ echo ('price: ' . round($orderitem->getPrice(),2) . '<br>');
67
+ echo ('totprice: ' . round($orderitem->getQtyOrdered() * $orderitem->getPrice(),2) . '<br>');
68
+ echo ('quantity: ' . round($orderitem->getQtyOrdered(),2) . '<br>');
69
+ echo ('unitCode: ' . 'pcs' . '<br>');
70
+ echo ('VATPercent: ' . round($orderitem->getTaxPercent(),2) . '<br>');
71
+ echo ('VATAmount: ' . round(($orderitem->getTaxPercent())*(0.01)*($orderitem->getPrice())) . '<br>');
72
+ $i++;
73
+ }
74
+
75
+ echo ' <br>Orderid Got As DIBS Parameter:<br>';
76
+ echo '===================================<br>';
77
+ echo $dibsparmeter['orderid'] . '<br>';
78
+
79
+ echo ' <br>Order Sum Got As DIBS Parameter:<br>';
80
+ echo '======================================<br>';
81
+ echo $dibsparmeter['amount'] . '<br>';
82
+
83
+ echo ('<ui>');
84
+ echo ('Order Class Methods <br>');
85
+ echo ('------------------- <br>');
86
+ foreach (get_class_methods(get_class($order)) as $method) {
87
+ echo ('<li>' . $method . '</li>');
88
+ }
89
+ echo ('</ui>');
90
+
91
+ exit();
92
+ */
93
+
94
+ // create a new XML document
95
+ $doc = new DomDocument("1.0","UTF-8");
96
+ $doc->preserveWhiteSpace = true;
97
+ $doc->formatOutput = true;
98
+
99
+ // create root node
100
+ $root = $doc->createElement("orderInformation");
101
+ $root = $doc->appendChild($root);
102
+ // $pbbstr = '<orderInformation>' . "\n";
103
+
104
+ // add node and value for orderid
105
+ $occ = $doc->createElement("yourRef");
106
+ $occ = $root->appendChild($occ);
107
+ $value = $doc->createTextNode($dibsparmeter['orderid']);
108
+ $value = $occ->appendChild($value);
109
+ // $pbbstr = $pbbstr . '<yourRef>' . $dibsparmeter['orderid'] . '</yourRef>' . "\n";
110
+
111
+ $i = 1;
112
+ foreach($orderitems as $orderitem) {
113
+ $occ = $doc->createElement("orderItem");
114
+ $occ = $root->appendChild($occ);
115
+ // $pbbstr = $pbbstr . '<orderItem';
116
+
117
+ // add orderItem attributes
118
+ //-------------------------
119
+
120
+ $itemIDattr = $doc->createAttribute("itemID");
121
+ $occ->appendChild($itemIDattr);
122
+ // $itemID = $doc->createTextNode(htmlentities($orderitem->getProductId()));
123
+ $itemID = $doc->createTextNode($orderitem->getProductId());
124
+ $itemIDattr->appendChild($itemID);
125
+ // $pbbstr = $pbbstr . ' itemID="' . htmlentities($orderitem->getProductId()) . '"';
126
+
127
+ $itemdescattr = $doc->createAttribute("itemDescription");
128
+ $occ->appendChild($itemdescattr);
129
+ $itemdesc = $doc->createTextNode($orderitem->getName());
130
+ $itemdescattr->appendChild($itemdesc);
131
+ // $pbbstr = $pbbstr . ' itemDescription="' . htmlentities($orderitem->getName()) . '"';
132
+ $itemcommentattr = $doc->createAttribute("comments");
133
+ $occ->appendChild($itemcommentattr);
134
+ $itemcomment = $doc->createTextNode('SKU: ' . $orderitem->getSku());
135
+ $itemcommentattr->appendChild($itemcomment);
136
+ // $pbbstr = $pbbstr . ' comments="SKU: ' . htmlentities($orderitem->getSku()) . '"';
137
+
138
+ $orderRowNumberattr = $doc->createAttribute("orderRowNumber");
139
+ $occ->appendChild($orderRowNumberattr);
140
+ $orderRowNumber = $doc->createTextNode($i);
141
+ $orderRowNumberattr->appendChild($orderRowNumber);
142
+ // $pbbstr = $pbbstr . ' orderRowNumber="' . $i . '"';
143
+
144
+ $quantityattr = $doc->createAttribute("quantity");
145
+ $occ->appendChild($quantityattr);
146
+ $quantity = $doc->createTextNode(round($orderitem->getQtyOrdered(),2));
147
+ $quantityattr->appendChild($quantity);
148
+ // $pbbstr = $pbbstr . ' quantity="' . round($orderitem->getQtyOrdered(),2) . '"';
149
+
150
+ $priceattr = $doc->createAttribute("price");
151
+ $occ->appendChild($priceattr);
152
+ $price = $doc->createTextNode(100*round($orderitem->getPrice(),2));
153
+ $priceattr->appendChild($price);
154
+ // $pbbstr = $pbbstr . ' price="' . 100*round($orderitem->getPrice(),2) . '"';
155
+ $Delta1 = 100*(round($orderitem->getQtyOrdered(),2))*(round($orderitem->getPrice(),2));
156
+ $VerifiedOrderSum = $VerifiedOrderSum - $Delta1;
157
+
158
+ $unitCodeattr = $doc->createAttribute("unitCode");
159
+ $occ->appendChild($unitCodeattr);
160
+ $unitCode = $doc->createTextNode("pcs");
161
+ $unitCodeattr->appendChild($unitCode);
162
+ // $pbbstr = $pbbstr . ' unitCode="pcs"';
163
+
164
+ $vatattr = $doc->createAttribute("VATAmount");
165
+ $occ->appendChild($vatattr);
166
+ $vatvalue = $doc->createTextNode(100*round(($orderitem->getTaxPercent())*(0.01)*($orderitem->getPrice()),2));
167
+ $vatattr->appendChild($vatvalue);
168
+ // $pbbstr = $pbbstr . ' VATAmount="' . (100*round(($orderitem->getTaxPercent())*(0.01)*($orderitem->getPrice()),2)) . '"';
169
+ $Delta2 = 100*round($orderitem->getQtyOrdered(),2)*(round(($orderitem->getTaxPercent())*(0.01)*($orderitem->getPrice()),2));
170
+ $VerifiedOrderSum = $VerifiedOrderSum - $Delta2;
171
+
172
+ /* $vatattr = $doc->createAttribute("VATPercent");
173
+ $occ->appendChild($vatattr);
174
+ $vatvalue = $doc->createTextNode(round($orderitem->getTaxPercent(),2));
175
+ $vatattr->appendChild($vatvalue);
176
+ // $pbbstr = $pbbstr . ' VATPercent="' . 100*round($orderitem->getTaxPercent(),2) . '"'; */
177
+
178
+ // $pbbstr = $pbbstr . '/>' . "\n";
179
+ $i++;
180
+ }
181
+
182
+ // add Shipping orderItem
183
+ //=======================
184
+ $occ = $doc->createElement("orderItem");
185
+ $occ = $root->appendChild($occ);
186
+ // $pbbstr = $pbbstr . '<orderItem';
187
+
188
+ // add Shipping attributes
189
+ //------------------------
190
+ $itemIDattr = $doc->createAttribute("itemID");
191
+ $occ->appendChild($itemIDattr);
192
+ $itemID = $doc->createTextNode("ShippingCost");
193
+ $itemIDattr->appendChild($itemID);
194
+ // $pbbstr = $pbbstr . ' itemID="ShippingCost"';
195
+
196
+ $itemdescattr = $doc->createAttribute("itemDescription");
197
+ $occ->appendChild($itemdescattr);
198
+ $itemdesc = $doc->createTextNode($order['shipping_description']);
199
+ $itemdescattr->appendChild($itemdesc);
200
+ // $pbbstr = $pbbstr . ' itemDescription="' . htmlentities($order['shipping_description']) . '"';
201
+
202
+ $orderRowNumberattr = $doc->createAttribute("orderRowNumber");
203
+ $occ->appendChild($orderRowNumberattr);
204
+ $orderRowNumber = $doc->createTextNode($i);
205
+ $orderRowNumberattr->appendChild($orderRowNumber);
206
+ // $pbbstr = $pbbstr . ' orderRowNumber="' . $i . '"';
207
+
208
+ $quantityattr = $doc->createAttribute("quantity");
209
+ $occ->appendChild($quantityattr);
210
+ $quantity = $doc->createTextNode(1);
211
+ $quantityattr->appendChild($quantity);
212
+ // $pbbstr = $pbbstr . ' quantity="1"';
213
+
214
+ $priceattr = $doc->createAttribute("price");
215
+ $occ->appendChild($priceattr);
216
+ $price = $doc->createTextNode(100*round($order['shipping_amount'],2));
217
+ $priceattr->appendChild($price);
218
+ // $pbbstr = $pbbstr . ' price="' . 100*round($order['shipping_amount'],2) . '"';
219
+ $Delta3 = 100*round($order['shipping_amount'],2);
220
+ $VerifiedOrderSum = $VerifiedOrderSum - $Delta3;
221
+
222
+ $unitCodeattr = $doc->createAttribute("unitCode");
223
+ $occ->appendChild($unitCodeattr);
224
+ $unitCode = $doc->createTextNode("pcs");
225
+ $unitCodeattr->appendChild($unitCode);
226
+ // $pbbstr = $pbbstr . ' unitCode="pcs"';
227
+
228
+ $vatattr = $doc->createAttribute("VATAmount");
229
+ $occ->appendChild($vatattr);
230
+ $vatvalue = $doc->createTextNode(100*round($order['shipping_tax_amount'],2));
231
+ $vatattr->appendChild($vatvalue);
232
+ // $pbbstr = $pbbstr . ' VATAmount="' . 100*round($order['shipping_tax_amount'],2) . '"';
233
+ $Delta4 = 100*round($order['shipping_tax_amount'],2);
234
+ $VerifiedOrderSum = $VerifiedOrderSum - $Delta4;
235
+
236
+ /*$vatattr = $doc->createAttribute("VATPercent");
237
+ $occ->appendChild($vatattr);
238
+ $vatvalue = $doc->createTextNode("0");
239
+ $vatattr->appendChild($vatvalue);
240
+ */
241
+ // $pbbstr = $pbbstr . ' VATPercent="0"';
242
+
243
+ // $pbbstr = $pbbstr . '/>' . "\n";
244
+
245
+ if ($VerifiedOrderSum >= 0.01 || $VerifiedOrderSum <= -0.01) {
246
+ // add ordersum-compensation orderItem
247
+ //=====================================
248
+
249
+ $occ = $doc->createElement("orderItem");
250
+ $occ = $root->appendChild($occ);
251
+ // $pbbstr = $pbbstr . '<orderItem';
252
+
253
+ // add ordersum-compensation attributes
254
+ //-------------------------------------
255
+ $itemIDattr = $doc->createAttribute("itemID");
256
+ $occ->appendChild($itemIDattr);
257
+ $itemID = $doc->createTextNode("RoundingErrComp");
258
+ $itemIDattr->appendChild($itemID);
259
+ // $pbbstr = $pbbstr . ' itemID="RoundingErrorCompensation"';
260
+
261
+ $itemdescattr = $doc->createAttribute("itemDescription");
262
+ $occ->appendChild($itemdescattr);
263
+ $itemdesc = $doc->createTextNode("Compensation For Rounding Errors");
264
+ $itemdescattr->appendChild($itemdesc);
265
+ // $pbbstr = $pbbstr . ' itemDescription="Compensation For Rounding Errors"';
266
+
267
+ $orderRowNumberattr = $doc->createAttribute("orderRowNumber");
268
+ $occ->appendChild($orderRowNumberattr);
269
+ $i++;
270
+ $orderRowNumber = $doc->createTextNode($i);
271
+ $orderRowNumberattr->appendChild($orderRowNumber);
272
+ // $pbbstr = $pbbstr . ' orderRowNumber="' . $i . '"';
273
+
274
+ $priceattr = $doc->createAttribute("price");
275
+ $occ->appendChild($priceattr);
276
+ $price = $doc->createTextNode(round($VerifiedOrderSum,2));
277
+ $priceattr->appendChild($price);
278
+ // $pbbstr = $pbbstr . ' price="' . round($VerifiedOrderSum,2) . '"';
279
+
280
+ $quantityattr = $doc->createAttribute("quantity");
281
+ $occ->appendChild($quantityattr);
282
+ $quantity = $doc->createTextNode(1);
283
+ $quantityattr->appendChild($quantity);
284
+ // $pbbstr = $pbbstr . ' quantity="1"';
285
+
286
+ $unitCodeattr = $doc->createAttribute("unitCode");
287
+ $occ->appendChild($unitCodeattr);
288
+ $unitCode = $doc->createTextNode("pcs");
289
+ $unitCodeattr->appendChild($unitCode);
290
+ // $pbbstr = $pbbstr . ' unitCode="pcs"';
291
+
292
+ $vatattr = $doc->createAttribute("VATAmount");
293
+ $occ->appendChild($vatattr);
294
+ $vatvalue = $doc->createTextNode(0);
295
+ $vatattr->appendChild($vatvalue);
296
+ // $pbbstr = $pbbstr . ' VATAmount="0"';
297
+
298
+ // $pbbstr = $pbbstr . '/>' . "\n";
299
+
300
+ }
301
+
302
+ // $pbbstr = $pbbstr . '</orderInformation>' . "\n";
303
+
304
+ ?>
305
+
306
+ <form method="post" name="payment" id="payment" action ="<? echo $paymate->getDibsUrl() ?>">
307
+
308
+ <? if (( $paymate->getConfigData('paymentwindow') == '1') || ( $paymate->getConfigData('paymentwindow') == '2' )) {
309
+ // Handle FlexWin Or Payment Window ?>
310
+ <? foreach ($dibsparmeter as $field=>$value) {?> <input type="hidden" name="<? echo $field ?>" value="<? echo $value ?>" /> <?}?>
311
+ <input type="hidden" name="structuredOrderInformation" value="<? echo htmlentities($doc->saveXML($root)) ?>" id="structuredOrderInformation"/>
312
+ <!-- <input type="hidden" name="structuredOrderInformation" value="<? /* echo htmlentities($pbbstr) */ ?>" id="structuredOrderInformation"/> -->
313
+ <? } else { ?>
314
+ <? throw new exception("Exception: Invalid DIBS Payment Metod Called"); ?>
315
+ <? } ?>
316
+
317
+ </form>
318
+
319
+ <?
320
+ // Save the order into the dibs_order_status table
321
+ //=================================================
322
+ $paymate->storeDIBSorderdata($dibsparmeter['orderid']);
323
+ ?>
324
+
325
+ <script type="text/javascript">
326
+ setTimeout("document.getElementById('payment').submit();",1000);
327
+ </script>
328
+
329
+ </body>
330
+ </html>
app/design/frontend/default/default/template/Dibs/Dibs/form.phtml ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_DibsModule
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+
24
+ //
25
+ // Load the Dibs Model
26
+ //
27
+ $paymate = Mage::getModel('dibs/Dibs');
28
+ ?>
29
+ <fieldset class="form-list">
30
+ <?php $_code=$this->getMethodCode() ?>
31
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
32
+ <li>
33
+ <?php echo $this->__('DIBS_LABEL_1'); ?>
34
+ <?php
35
+ if ($paymate->showTrustedList()) {
36
+ ?>
37
+ <br><br>
38
+ <?php
39
+ //
40
+ // Show trusted logos
41
+ //
42
+ $logoArray = explode(',', $paymate->getConfigData('dibslogos'));
43
+ foreach($logoArray as $item) {
44
+ switch ($item) {
45
+ case 'DIBS': {
46
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/dibslogo.gif') ?>" border="0" title="DIBS | Secure Payment Services (www.Dibs.com)" />&nbsp;&nbsp;<?php
47
+ break;
48
+ }
49
+ case 'VISA_SECURE': {
50
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/verifiedbyvisa.gif') ?>" border="0" title="VISA | Verified By Visa (3D Secure)" />&nbsp;&nbsp;<?php
51
+ break;
52
+ }
53
+ case 'MC_SECURE': {
54
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/mastercardsecurecode.gif') ?>" border="0" title="Master Card | SecureCode (3D Secure)" />&nbsp;&nbsp;<?php
55
+ break;
56
+ }
57
+ case 'JCB_SECURE': {
58
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/jcbsecure.gif') ?>" border="0" title="JCB | Japan Credit Bureau (3D Secure)" />&nbsp;&nbsp;<?php
59
+ break;
60
+ }
61
+ case 'PCI': {
62
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/pci.gif') ?>" border="0" title="PCI Compliant" />&nbsp;&nbsp;<?php
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+ if ($paymate->showCardsList()) {
70
+ ?>
71
+ <br><br>
72
+ <?php echo $this->__('DIBS_LABEL_2') ?>
73
+ <br>
74
+ <?php
75
+ //
76
+ // Show card logos
77
+ //
78
+
79
+ $logoArray = explode(',', $paymate->getConfigData('dibslogos'));
80
+ foreach($logoArray as $item) {
81
+ switch ($item) {
82
+ case 'AMEX': {
83
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/amex.gif') ?>" border="0" title="American Express" />&nbsp;&nbsp;<?php
84
+ break;
85
+ }
86
+ case 'BAX': {
87
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/bax.gif') ?>" border="0" title="BankAxess" />&nbsp;&nbsp;<?php
88
+ break;
89
+ }
90
+ case 'DIN': {
91
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/diners.gif') ?>" border="0" title="Diners Club" />&nbsp;&nbsp;<?php
92
+ break;
93
+ }
94
+ case 'DK': {
95
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/dankort.gif') ?>" border="0" title="Dankort" />&nbsp;&nbsp;<?php
96
+ break;
97
+ }
98
+ case 'FFK': {
99
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/forbrugforeningen.gif') ?>" border="0" title="Forbrugsforeningen Card" />&nbsp;&nbsp;<?php
100
+ break;
101
+ }
102
+ case 'JCB': {
103
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/jcb.gif') ?>" border="0" title="JCB (Japan Credit Bureau)" />&nbsp;&nbsp;<?php
104
+ break;
105
+ }
106
+ case 'MC': {
107
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/mastercard.gif') ?>" border="0" title="MasterCard" />&nbsp;&nbsp;<?php
108
+ break;
109
+ }
110
+ case 'MTRO': {
111
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/maestro.gif') ?>" border="0" title="Maestro" />&nbsp;&nbsp;<?php
112
+ break;
113
+ }
114
+ case 'MOCA': {
115
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/mobilcash.gif') ?>" border="0" title="Mobilcash" />&nbsp;&nbsp;<?php
116
+ break;
117
+ }
118
+ case 'PBB': {
119
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') ?>" border="0" title="DIBS PayByBill" />&nbsp;&nbsp;<?php
120
+ break;
121
+ }
122
+ case 'pbbtest': {
123
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/pbb.gif') ?>" border="0" title="DIBS PayByBill" />&nbsp;&nbsp;<?php
124
+ break;
125
+ }
126
+ case 'VISA': {
127
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/visa.gif') ?>" border="0" title="Visa" />&nbsp;&nbsp;<?php
128
+ break;
129
+ }
130
+ case 'ELEC': {
131
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/visaelectron.gif') ?>" border="0" title="Visa Electron" />&nbsp;&nbsp;<?php
132
+ break;
133
+ }
134
+ case 'AKTIA': {
135
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/aktia.gif') ?>" border="0" title="Aktia Web Payment" />&nbsp;&nbsp;<?php
136
+ break;
137
+ }
138
+ case 'DNB': {
139
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/danskenetbetaling.gif') ?>" border="0" title="Danske Netbetaling (Danske Bank)" />&nbsp;&nbsp;<?php
140
+ break;
141
+ }
142
+ case 'EDK': {
143
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/edankort.gif') ?>" border="0" title="eDankort" />&nbsp;&nbsp;<?php
144
+ break;
145
+ }
146
+ case 'ELV': {
147
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/bankeinzug.gif') ?>" border="0" title="Bank Einzug (eOLV)" />&nbsp;&nbsp;<?php
148
+ break;
149
+ }
150
+ case 'EW': {
151
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/ewire.gif') ?>" border="0" title="eWire" />&nbsp;&nbsp;<?php
152
+ break;
153
+ }
154
+ case 'FSB': {
155
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/swedbankdirektbetaling.gif') ?>" border="0" title="Swedbank Direktbetalning" />&nbsp;&nbsp;<?php
156
+ break;
157
+ }
158
+ case 'GIT': {
159
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/getitcard.gif') ?>" border="0" title="Getitcard" />&nbsp;&nbsp;<?php
160
+ break;
161
+ }
162
+ case 'ING': {
163
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/ideal.gif') ?>" border="0" title="ING iDeal Payment" />&nbsp;&nbsp;<?php
164
+ break;
165
+ }
166
+ case 'SEB': {
167
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/seb.gif') ?>" border="0" title="SEB Direktbetalning" />&nbsp;&nbsp;<?php
168
+ break;
169
+ }
170
+ case 'SHB': {
171
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/shbdirektbetaling.gif') ?>" border="0" title="SHB Direktbetalning" />&nbsp;&nbsp;<?php
172
+ break;
173
+ }
174
+ case 'SOLO': {
175
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/nordeasole.gif') ?>" border="0" title="Nordea Solo-E betaling" />&nbsp;&nbsp;<?php
176
+ break;
177
+ }
178
+ case 'VAL': {
179
+ ?><img src="<?php echo $this->getSkinUrl('images/Dibs/Dibs/valus.gif') ?>" border="0" title="Valus" />&nbsp;&nbsp;<?php
180
+ break;
181
+ }
182
+ }
183
+ }
184
+ }
185
+ ?>
186
+ </li>
187
+ </ul>
188
+ </fieldset>
app/etc/modules/Dibs_All.xml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Dibs AB
5
+ * Dibs Payment Extension
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ * If you did not receive a copy of the license and are unable to
14
+ * obtain it through the world-wide-web, please send an email
15
+ * to license@magentocommerce.com so we can send you a copy immediately.
16
+ *
17
+ * @category Payments & Gateways Extensions
18
+ * @package Dibs_Dibs
19
+ * @author Dibs AB
20
+ * @copyright Copyright (c) 2010 Dibs AB. (http://www.Dibs.se)
21
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
+ */
23
+ -->
24
+
25
+ <config>
26
+ <modules>
27
+ <Dibs_Dibs>
28
+ <active>true</active>
29
+ <codePool>community</codePool>
30
+ </Dibs_Dibs>
31
+ <Dibs_Sales>
32
+ <active>true</active>
33
+ <codePool>community</codePool>
34
+ </Dibs_Sales>
35
+ <Dibs_Adminhtml>
36
+ <active>true</active>
37
+ <codePool>community</codePool>
38
+ </Dibs_Adminhtml>
39
+ </modules>
40
+ </config>
app/etc/modules/dibs.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Mage_Dibs>
5
+ <active>false</active>
6
+ <codePool>local</codePool>
7
+ </Mage_Dibs>
8
+ </modules>
9
+ </config>
app/locale/da_DK/Mage_Dibs.csv ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DIBS_LABEL_1","Du har valgt at betale online for din bestilling. N&#229;r du har lagt din ordre vil du blive overf&#248;rt til DIBS betalings system. Her skal du gennemf&#248;re din betaling. N&#229;r ordren er gennemf&#248;rt vil du automatisk blive f&#248;rt tilbage til vores butik."
2
+ "DIBS_LABEL_2","Du kan betale med disse betalingsformer:"
3
+ "DIBS_LABEL_3","Ordren er nu afgivet og betalingen vidrebehandles i DIBS betalings system (www.dibs.dk)"
4
+ "DIBS_LABEL_4","Ordre nummer"
5
+ "DIBS_LABEL_5","Bel&#248;b"
6
+ "DIBS_LABEL_6","Du bliver nu viderestillet til betalingssystemet"
7
+ "DIBS_LABEL_7","DIBS betalings information"
8
+ "DIBS_LABEL_8","Transaction ID:"
9
+ "DIBS_LABEL_9","Bel&#248;b:"
10
+ "DIBS_LABEL_10","Valuta kode:"
11
+ "DIBS_LABEL_11","Gebyr:"
12
+ "DIBS_LABEL_12","Betalingstype:"
13
+ "DIBS_LABEL_13","Kort nummer:"
14
+ "DIBS_LABEL_14","Udl&#248;b:"
15
+ "DIBS_LABEL_15","Land:"
16
+ "DIBS_LABEL_16","Indl&#248;ser:"
17
+ "DIBS_LABEL_17","3-D Secure:"
18
+ "DIBS_LABEL_18","G&#229; til DIBS administrationen og gennemf&#248;r betalingen"
19
+ "DIBS_LABEL_19","Ingen betaling er registreret p&#229; denne ordre"
20
+ "DIBS_LABEL_20","Kortholder har annulleret betalingsforl&#248;bet"
21
+ "DIBS_LABEL_21","'Callback' modtaget fra DIBS Payment Services (www.dibs.dk)"
22
+ "DIBS_LABEL_22","Kortholder returneret til butikken fra DIBS Payment Services (www.dibs.dk)"
app/locale/en_US/Mage_Dibs.csv ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DIBS_LABEL_1","You have chosen to pay for the order online. Once you've completed your order, you will be transferred to the DIBS payment system. Here you need to process your payment. Once payment is completed, you will automatically be returned to our shop."
2
+ "DIBS_LABEL_2","You can pay with the following payment cards:"
3
+ "DIBS_LABEL_3","The order is now placed and payment must now be made in DIBS Payment Solution (www.dibspayment.com)"
4
+ "DIBS_LABEL_4","Order number"
5
+ "DIBS_LABEL_5","Amount"
6
+ "DIBS_LABEL_6","Your are now being redirected to the payment gateway"
7
+ "DIBS_LABEL_7","DIBS Payment Information"
8
+ "DIBS_LABEL_8","Transaction ID:"
9
+ "DIBS_LABEL_9","Amount:"
10
+ "DIBS_LABEL_10","Currency Code:"
11
+ "DIBS_LABEL_11","Fee:"
12
+ "DIBS_LABEL_12","Pay type:"
13
+ "DIBS_LABEL_13","Card number:"
14
+ "DIBS_LABEL_14","Expire:"
15
+ "DIBS_LABEL_15","Country:"
16
+ "DIBS_LABEL_16","Acquirer:"
17
+ "DIBS_LABEL_17","3-D Secure:"
18
+ "DIBS_LABEL_18","Go to DIBS administration and process the payment"
19
+ "DIBS_LABEL_19","There is not registered any payment for this order yet!"
20
+ "DIBS_LABEL_20","Customer has cancelled the payment process - DIBS Payment Services (www.dibspayment.com)"
21
+ "DIBS_LABEL_21","'Callback' received from DIBS Payment Services (www.dibspayment.com)"
22
+ "DIBS_LABEL_22","Customer successfully returned back to store from DIBS Payment Services (www.dibspayment.com)"
app/locale/nb_NO/Mage_Dibs.csv ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DIBS_LABEL_1","Du har valgt &#229; betale ordren online. N&#229r du har fullf&#248;rt din ordre, vil du bli videresendt til DIBS betalingsleverand&#248;r. Her m&#229; du fullf&#248;re din betaling. N&#229;r betaligen er fullf&#248;rt, vil du bli sendt tilbake til v&#229;r butikk."
2
+ "DIBS_LABEL_2","Du kan betale med f&#248;lgende kort:"
3
+ "DIBS_LABEL_3","Ordren er plassert, og betalingen prosesseres av DIBS Payment Services (www.dibs.no)"
4
+ "DIBS_LABEL_4","Ordrenummer"
5
+ "DIBS_LABEL_5","Bel&#248;p"
6
+ "DIBS_LABEL_6","Du blir n&#229; videresendt til betalingsleverand&#248;ren"
7
+ "DIBS_LABEL_7","DIBS Betalingsinformasjon"
8
+ "DIBS_LABEL_8","Transaksjonsnummer:"
9
+ "DIBS_LABEL_9","Bel&#248;p:"
10
+ "DIBS_LABEL_10","Valutakode:"
11
+ "DIBS_LABEL_11","Gebyr:"
12
+ "DIBS_LABEL_12","Betalingstype:"
13
+ "DIBS_LABEL_13","Kortnummer:"
14
+ "DIBS_LABEL_14","Utl&#248;psdato:"
15
+ "DIBS_LABEL_15","Land:"
16
+ "DIBS_LABEL_16","Innl&#248;ser:"
17
+ "DIBS_LABEL_17","3-D Secure:"
18
+ "DIBS_LABEL_18","G&#229; til DIBS Administrasjonen og prosesser betalingen"
19
+ "DIBS_LABEL_19","Det er ikke registrert noen betaling for denne ordren enda!"
20
+ "DIBS_LABEL_20","Kunden har avbrutt betalingsprosessen - DIBS Payment Services (www.dibs.no)"
21
+ "DIBS_LABEL_21","'Callback' mottatt fra DIBS Payment Services (www.dibs.no)"
22
+ "DIBS_LABEL_22","Kunden har returnert vellykket tilbake til butikk fra DIBS Payment Services (www.dibs.no)"
app/locale/nn_NO/Mage_Dibs.csv ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DIBS_LABEL_1","Du har valgt &#229; betale ordren online. N&#229r du har fullf&#248;rt din ordre, vil du bli videresendt til DIBS betalingsleverand&#248;r. Her m&#229; du fullf&#248;re din betaling. N&#229;r betaligen er fullf&#248;rt, vil du bli sendt tilbake til v&#229;r butikk."
2
+ "DIBS_LABEL_2","Du kan betale med f&#248;lgende kort:"
3
+ "DIBS_LABEL_3","Ordren er plassert, og betalingen prosesseres av DIBS Payment Services (www.dibs.no)"
4
+ "DIBS_LABEL_4","Ordrenummer"
5
+ "DIBS_LABEL_5","Bel&#248;p"
6
+ "DIBS_LABEL_6","Du blir n&#229; videresendt til betalingsleverand&#248;ren"
7
+ "DIBS_LABEL_7","DIBS Betalingsinformasjon"
8
+ "DIBS_LABEL_8","Transaksjonsnummer:"
9
+ "DIBS_LABEL_9","Bel&#248;p:"
10
+ "DIBS_LABEL_10","Valutakode:"
11
+ "DIBS_LABEL_11","Gebyr:"
12
+ "DIBS_LABEL_12","Betalingstype:"
13
+ "DIBS_LABEL_13","Kortnummer:"
14
+ "DIBS_LABEL_14","Utl&#248;psdato:"
15
+ "DIBS_LABEL_15","Land:"
16
+ "DIBS_LABEL_16","Innl&#248;ser:"
17
+ "DIBS_LABEL_17","3-D Secure:"
18
+ "DIBS_LABEL_18","G&#229; til DIBS Administrasjonen og prosesser betalingen"
19
+ "DIBS_LABEL_19","Det er ikke registrert noen betaling for denne ordren enda!"
20
+ "DIBS_LABEL_20","Kunden har avbrutt betalingsprosessen - DIBS Payment Services (www.dibs.no)"
21
+ "DIBS_LABEL_21","'Callback' mottatt fra DIBS Payment Services (www.dibs.no)"
22
+ "DIBS_LABEL_22","Kunden har returnert vellykket tilbake til butikk fra DIBS Payment Services (www.dibs.no)"
app/locale/sv_SE/Mage_Dibs.csv ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DIBS_LABEL_1","Du har valt att betala f&#246;r ordern via internet. N&#228;r din order &#228;r avslutad kommer du bli skickad till DIBS betalningssystem. D&#228;r kommer du att beh&#246;va behandla din betalning. N&#228;r betalningen &#228;r genomf&#246;rd kommer du automatiskt att skickad tillbaka till v&#229;r butik."
2
+ "DIBS_LABEL_2","Du kan betala med f&#246;ljande betal/kreditkort:"
3
+ "DIBS_LABEL_3","Ordern har blivit mottagen och betalningen bearbetas av DIBS betalningssystem (www.dibs.se)"
4
+ "DIBS_LABEL_4","Ordernummer"
5
+ "DIBS_LABEL_5","Belopp"
6
+ "DIBS_LABEL_6","Du kommer nu att skickas till betalningssystemet"
7
+ "DIBS_LABEL_7","DIBS Betalningsinformation"
8
+ "DIBS_LABEL_8","TransaktionsID:"
9
+ "DIBS_LABEL_9","Belopp:"
10
+ "DIBS_LABEL_10","Valutakod:"
11
+ "DIBS_LABEL_11","Avgift:"
12
+ "DIBS_LABEL_12","Betals&#228;tt:"
13
+ "DIBS_LABEL_13","Kortnummer:"
14
+ "DIBS_LABEL_14","Utg&#229;ngsdatum:"
15
+ "DIBS_LABEL_15","Land:"
16
+ "DIBS_LABEL_16","Inl&#246;sare:"
17
+ "DIBS_LABEL_17","3-D Secure:"
18
+ "DIBS_LABEL_18","G&#229; till DIBS administrationsgr&#228;nssnitt och behandla betalningen"
19
+ "DIBS_LABEL_19","Det finns ingen registrerad betalning f&#246;r denna order &#228;nnu"
20
+ "DIBS_LABEL_20","Kunden har avbrutit betalningsprocessen - DIBS Payment Services (www.dibs.se)"
21
+ "DIBS_LABEL_21","'Callback' mottagen fr&#229;n DIBS Payment Services (www.dibs.se)"
22
+ "DIBS_LABEL_22","Kunden har kommit tillbaka till butiken fr&#229;n DIBS Payment Services (www.dibs.se)"
package.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>DIBS_Payment_Services</name>
4
+ <version>1.0.0.13</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Accept all types of payments from DIBS - Secure Internet Payment Service Provider.</summary>
10
+ <description>This is the payment gateway module for the DIBS payment gateway - http://www.dibspayment.com&#xD;
11
+ &#xD;
12
+ DIBS Payment Services is the leading Scandinavian Internet service provider.&#xD;
13
+ &#xD;
14
+ Security and credibility are important keywords to companies handling payment transactions. Hence, DIBS has achieved VISA/MasterCard PCI certification and devotes its efforts to constantly enhancing its security solutions.&#xD;
15
+ &#xD;
16
+ Card types accepted by the DIBS payment gateway:&#xD;
17
+ - Dankort&#xD;
18
+ - VISA/Dankort&#xD;
19
+ - VISA&#xD;
20
+ - VISA Electron&#xD;
21
+ - MasterCard&#xD;
22
+ - Maestro&#xD;
23
+ - JCB&#xD;
24
+ - Diners&#xD;
25
+ - American Express&#xD;
26
+ - Forbrugsforeningen&#xD;
27
+ - eWire&#xD;
28
+ - VISA 3D Secure&#xD;
29
+ - MaserCard 3D secure&#xD;
30
+ - JCB 3D secure&#xD;
31
+ - Danske Bank e-betaling&#xD;
32
+ - Nordea e-betaling&#xD;
33
+ &#xD;
34
+ A complete list can be found at http://www.dibspayment.com/</description>
35
+ <notes>1.0.0.13&#xD;
36
+ - Stock subtrackt bug fixed.&#xD;
37
+ &#xD;
38
+ 1.0.0.12&#xD;
39
+ - Reinstall (upgrade) procedure from version 1.0.0.8 to version 1.0.0.12 added&#xD;
40
+ &#xD;
41
+ 1.0.0.11&#xD;
42
+ - Irrelevant Mage Core package dependencis removed&#xD;
43
+ &#xD;
44
+ 1.0.0.10&#xD;
45
+ - API verion numner updated&#xD;
46
+ &#xD;
47
+ 1.0.0.9&#xD;
48
+ - New directory structure introduced.&#xD;
49
+ - Support fot DIBS PayByBill (PBB) introduced. &#xD;
50
+ &#xD;
51
+ 1.0.0.8&#xD;
52
+ &#xD;
53
+ 1.0.0.7&#xD;
54
+ - Minor language update&#xD;
55
+ &#xD;
56
+ 1.0.0.6&#xD;
57
+ - Fixed currency bug&#xD;
58
+ - Added order information to DIBS payment process&#xD;
59
+ &#xD;
60
+ 1.0.0.5&#xD;
61
+ - Added extra complete status for order&#xD;
62
+ &#xD;
63
+ 1.0.0.3&#xD;
64
+ - Added order information to DIBS payment process&#xD;
65
+ &#xD;
66
+ 1.0.0.2&#xD;
67
+ - Minor language update&#xD;
68
+ &#xD;
69
+ 1.0.0.1&#xD;
70
+ - Added languages:&#xD;
71
+ Danish, Norwegian, Swedish&#xD;
72
+ - Added support for &amp;quot;Skip accept page&amp;quot;&#xD;
73
+ &#xD;
74
+ First release 1.0.0.0&#xD;
75
+ </notes>
76
+ <authors><author><name>DIBS AS</name><user>dibs</user><email>plugins@dibs.dk</email></author></authors>
77
+ <date>2011-05-29</date>
78
+ <time>10:18:07</time>
79
+ <contents><target name="magecommunity"><dir name="Dibs"><dir name="Dibs"><dir name="Block"><file name="Failure.php" hash="a51d2f863af52576268359cfdcc580c6"/><file name="Form.php" hash="2467ed70dd2d84428e356d3d98af4322"/><file name="Redirect.php" hash="f7385034e2613651446fcafb09ff046c"/></dir><dir name="Helper"><file name="Data.php" hash="d19455fd0d29a45044d6631c9bf89098"/></dir><dir name="Model"><file name="Dibs.php" hash="aa247dd81dba08486c887e9ee438f96e"/><dir name="Mysql4"><file name="Setup.php" hash="7f3da0e93a27676336e6b0851dd597c8"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Color.php" hash="edf79958954270e38c5ac245a8b74427"/><file name="Decorator.php" hash="e79ca450a21493a60648dc0fed51067c"/><file name="Dibslogos.php" hash="c359122a6363c8e4de68cfd00784a8f9"/><file name="Dibspaytypes.php" hash="61cb22e5917f82f963548c45b29e1a79"/><file name="Lang.php" hash="55412c1a13bc04d67ca29f7fe3446e44"/><file name="Orderstatusafter.php" hash="c3e1b54fb7e6e6aaa981ca7527e6398e"/><file name="Orderstatusbefore.php" hash="d29b0992304865e94e3502bf82649521"/><file name="PBBdistribution.php" hash="e65ae224326117dc963c7a99345f9250"/><file name="Paymentwindow.php" hash="3a30a2c69a0bb8c6ceb8f051b46ba28b"/></dir></dir></dir></dir><dir name="controllers"><file name="DibsController.php" hash="289f9770a50e8ba739bbd8760ba3de39"/></dir><dir name="etc"><file name="config.xml" hash="ca0b52c2e595e729bc8feb154679ac8a"/><file name="system.xml" hash="2d12e06ff1eb6129fa386761a9820ad8"/></dir><dir name="sql"><dir name="dibs_setup"><file name="mysql4-install-1.0.0.12.php" hash="d1b8f03d56a657106a72b24cbec43a8e"/><file name="mysql4-upgrade-1.0.0.8-1.0.0.12.php" hash="d1b8f03d56a657106a72b24cbec43a8e"/></dir></dir></dir><dir name="Sales"><dir name="Block"><dir name="Order"><file name="Info.php" hash="41525e93aef7e343dec38bd3300fd3ea"/><file name="Print.php" hash="4033f5e0c24e16c374e148de6945ba8a"/></dir></dir><dir name="etc"><file name="config.xml" hash="38fdaa75cbbc48471d781f69af409a85"/></dir></dir><dir name="Adminhtml"><dir name="Block"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Info.php" hash="22d0a5829eb8f8521d72f8216dd43c9a"/></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="48d01b7c123c85a96f22ba6605379037"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="Dibs"><dir name="Dibs"><file name="aktia.gif" hash="7afe00b19b4194fa4ffbdf20cdd469c1"/><file name="amex.gif" hash="f35f89ccdcb954e02a07f6c0a29c7b43"/><file name="bankeinzug.gif" hash="3bd20355343bd250a6a704fdbaf9ba62"/><file name="bax.gif" hash="c315574fd839dae52a1316b6d8b836b6"/><file name="dankort.gif" hash="daa5d5d2c0d541579b0e13aa3cd9d65b"/><file name="danskenetbetaling.gif" hash="1f616c382b72248334f6aa1ca910003b"/><file name="dibslogo.gif" hash="8b308757472fc5aaaedfefd5c79a2d54"/><file name="diners.gif" hash="fabce04659a94993a230285b9a4651e9"/><file name="edankort.gif" hash="4485910a0fb40512233c1a59ddd31015"/><file name="ewire.gif" hash="b50385f7d878be6a3834310d1fbc3a1d"/><file name="forbrugforeningen.gif" hash="d9cd7fa26230a850114b2dc99aea3b22"/><file name="getitcard.gif" hash="b70e244f36e7aec94fe3f6373e1ae8d7"/><file name="ideal.gif" hash="40f07b266bcd5953bb6c079f7eeaae67"/><file name="jcb.gif" hash="aea8c54e043a75b26887fa1307ad4312"/><file name="jcbsecure.gif" hash="1c687214f79b73d7e99f5011c9c22bce"/><file name="loading.gif" hash="7e99e1159a3686f6aa4f90043c554483"/><file name="maestro.gif" hash="d5df5f7986a21bf5a78b9c7a3656facd"/><file name="mastercard.gif" hash="2680e078159e5aedb561c3a705801a44"/><file name="mastercardsecurecode.gif" hash="730735c1e2d36d9fa3bd6468fa0b1a7d"/><file name="mobilcash.gif" hash="befd2f10976c0ab40333f01fc6db4743"/><file name="nordeasole.gif" hash="17b9be1a06125dcc7d1a6be8fea38dd6"/><file name="oko.gif" hash="1cde3c12036ebd74a643aee2ffb0513a"/><file name="pbb.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pci.gif" hash="b55a87df550ea6789c17e389604e28e1"/><file name="seb.gif" hash="502b1dbeb81bce51abd1ea149d4dde14"/><file name="shbdirektbetaling.gif" hash="0aa7c7fab4133ff4843c0ae73cabe9de"/><file name="swedbankdirektbetaling.gif" hash="d6da3e67f8096811c2ad0135b2aad80a"/><file name="valus.gif" hash="e62b75eb172934e118a70366baac51ee"/><file name="verifiedbyvisa.gif" hash="517118742fce249485c8eaf6df174764"/><file name="visa.gif" hash="b61251f8c428aa5dca017c9f374957ef"/><file name="visaelectron.gif" hash="e5371ba0da9bb14990d1b8163cedd066"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="Dibs"><dir name="Dibs"><file name="form.phtml" hash="5d56aa58c8acc84a199351c38a8d4a59"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="Dibs"><dir name="Dibs"><file name="redirect.phtml" hash="89469d16c73b4f153ba85ec404a75d7e"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="da_DK"><file name="Mage_Dibs.csv" hash="7cda20048f8781104d60b6d4663a9291"/></dir><dir name="en_US"><file name="Mage_Dibs.csv" hash="3c87618730f4635447e3b295525c1bb0"/></dir><dir name="nb_NO"><file name="Mage_Dibs.csv" hash="19ff9d72c131dd0f6195b250115551c1"/></dir><dir name="nn_NO"><file name="Mage_Dibs.csv" hash="19ff9d72c131dd0f6195b250115551c1"/></dir><dir name="sv_SE"><file name="Mage_Dibs.csv" hash="8c94d4e9d93431536ddcc353ee00394a"/></dir></target><target name="mageetc"><dir name="modules"><file name="Dibs_All.xml" hash="142ce82fc582db443fcb5ecffea76ee9"/><file name="dibs.xml" hash="1f962e09c309330bfd44a367039e8d1b"/></dir></target></contents>
80
+ <compatible/>
81
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
82
+ </package>
skin/frontend/base/default/images/Dibs/Dibs/aktia.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/amex.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/bankeinzug.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/bax.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/dankort.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/danskenetbetaling.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/dibslogo.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/diners.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/edankort.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/ewire.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/forbrugforeningen.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/getitcard.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/ideal.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/jcb.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/jcbsecure.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/loading.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/maestro.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/mastercard.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/mastercardsecurecode.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/mobilcash.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/nordeasole.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/oko.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/pbb.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/pci.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/seb.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/shbdirektbetaling.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/swedbankdirektbetaling.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/valus.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/verifiedbyvisa.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/visa.gif ADDED
Binary file
skin/frontend/base/default/images/Dibs/Dibs/visaelectron.gif ADDED
Binary file