Dibspw - Version 4.1.5

Version Notes

4.1.5
- Fixed bug with double quoted items names
- Fixed bug with HMAC code
- Added compatibility with compilation mode
- Added instruction for resolving problem with MAC code error

4.1.4
- Added Magento coupons support
- Fixed possible rounding issues
- Removed Mobile Payment Window, now DIBS Payment Window can automatically scale to different screen sizes.

4.1.3
- Removed protected Magento statuses from module configuration page (Closed, Completed)
- Fixed possible problems running extension on Windows-hosted Magento
- Page after cancel operation changed to orders list (instead of empty cart)

4.1.2
- Confirmed compatibility with Magento 1.7.*
- Improved stability by using more low-level Magento API integration
- Improved compatibility with DIBS invoice payments
- Added option to limit payment method usage by countries
- Added Transaction ID to order confirmation mail

4.1.1
- Fixed error on redirect with expired session
- Improved compatibility with DIBS FlexWin Magento extension
- Fixed order statuses bug
- Fixed account parameter bugs
- Fixed layout
- Fixed crash on dibspw_results table remove
- Fixed logo appearance bugs
- Fixed bug with message appearance in inappropriate places
- Added Sort Order option
- A lot of other fixes and improvements

4.1.0
- New module for DIBS Payment Window and Mobile Payment Window integration methods.

Download this release

Release Info

Developer DIBS A/S
Extension Dibspw
Version 4.1.5
Comparing to
See all releases


Code changes from version 4.1.3 to 4.1.5

app/code/community/Dibspw/Dibspw/Model/Dibspw.php CHANGED
@@ -20,7 +20,7 @@
20
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
  */
22
 
23
- require_once str_replace("\\", "/", dirname(__FILE__)) . '/dibs_api/pw/dibs_pw_api.php';
24
 
25
  class Dibspw_Dibspw_Model_Dibspw extends dibs_pw_api {
26
 
20
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
  */
22
 
23
+ require_once Mage::getBaseDir('code').'/community/Dibspw/Dibspw/Model/dibs_api/pw/dibs_pw_api.php';
24
 
25
  class Dibspw_Dibspw_Model_Dibspw extends dibs_pw_api {
26
 
app/code/community/Dibspw/Dibspw/Model/{Mysql4 → Mysql5}/Setup.php RENAMED
File without changes
app/code/community/Dibspw/Dibspw/Model/System/Config/Source/Paymentwindow.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Dibs A/S
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 Dibspw_Dibspw
19
- * @author Dibs A/S
20
- * @copyright Copyright (c) 2010 Dibs A/S. (http://www.dibs.dk/)
21
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
22
- */
23
- class Dibspw_Dibspw_Model_System_Config_Source_Paymentwindow {
24
-
25
- public function toOptionArray() {
26
- return array(
27
- array('value' => 1, 'label' => Mage::helper('adminhtml')->__('Auto')),
28
- array('value' => 2, 'label' => Mage::helper('adminhtml')->__('DIBS Payment Window')),
29
- array('value' => 3, 'label' => Mage::helper('adminhtml')->__('Mobile Payment Window'))
30
- );
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Dibspw/Dibspw/Model/dibs_api/pw/dibs_pw_api.php CHANGED
@@ -1,33 +1,60 @@
1
  <?php
2
- require_once str_replace("\\", "/", dirname(__FILE__)) . '/dibs_pw_helpers_interface.php';
3
- require_once str_replace("\\", "/", dirname(__FILE__)) . '/dibs_pw_helpers_cms.php';
4
- require_once str_replace("\\", "/", dirname(__FILE__)) . '/dibs_pw_helpers.php';
5
 
6
  class dibs_pw_api extends dibs_pw_helpers {
7
 
 
 
 
 
 
8
  private static $sDibsTable = 'dibs_pw_results';
9
-
 
 
 
 
 
10
  private static $aTemplates = array('folder' => 'tmpl',
11
  'marker' => '#',
12
  'autotranslate' => array('lbl','msg', 'sts', 'err'),
13
  'tmpls' => array('error' => 'dibs_pw_error'));
14
-
 
 
 
 
 
15
  private static $sDefaultCurr = array(0 => 'EUR', 1 => '978');
16
 
17
- private static $aFormActions = array(2 => 'https://sat1.dibspayment.com/dibspaymentwindow/entrypoint',
18
- 3 => 'https://mopay.dibspayment.com/');
 
 
 
 
19
 
 
 
 
 
 
20
  private static $aRespFields = array('orderid' => 'orderid', 'status' => 'status',
21
  'testmode' => 'test', 'transaction' => 'transaction',
22
- 'amount' => 'amount','currency' => 'currency',
23
  'fee' => 'fee', 'voucheramount' => 'voucherAmount',
24
- 'paytype' => array(2 => 'cardTypeName', 3 => 'payTypeName'),
25
- 'amountoriginal'=>'amountOriginal',
26
  'validationerrors'=>'validationErrors',
27
- 'capturestatus' => 'captureStatus',
28
- 'actioncode' => array(2 => 'actionCode', 3 => 'approvalCode'),
29
- 'sysmod' => 's_sysmod');
30
 
 
 
 
 
 
31
  private static $aCurrency = array('ADP' => '020','AED' => '784','AFA' => '004','ALL' => '008',
32
  'AMD' => '051','ANG' => '532','AOA' => '973','ARS' => '032',
33
  'AUD' => '036','AWG' => '533','AZM' => '031','BAM' => '977',
@@ -75,7 +102,7 @@ class dibs_pw_api extends dibs_pw_helpers {
75
  /**
76
  * Returns CMS order common information converted to standardized order information objects.
77
  *
78
- * @param mixed $mOrderInfo
79
  * @return object
80
  */
81
  private function api_dibs_commonOrderObject($mOrderInfo) {
@@ -89,7 +116,7 @@ class dibs_pw_api extends dibs_pw_helpers {
89
  /**
90
  * Returns CMS order invoice information converted to standardized order information objects.
91
  *
92
- * @param mixed $mOrderInfo
93
  * @return object
94
  */
95
  private function api_dibs_invoiceOrderObject($mOrderInfo) {
@@ -100,35 +127,23 @@ class dibs_pw_api extends dibs_pw_helpers {
100
  );
101
  }
102
 
103
-
104
- /**
105
- * Returns form action URL of gateway.
106
- *
107
- * @param bool $bResponse
108
- * @return string
109
- */
110
- final public function api_dibs_get_formAction($bResponse = FALSE) {
111
- return self::$aFormActions[$this->api_dibs_get_method($bResponse)];
112
- }
113
-
114
  /**
115
  * Collects API parameters to send in dependence of checkout type. API entry point.
116
  *
117
- * @param mixed $mOrderInfo
118
  * @return array
119
  */
120
  final public function api_dibs_get_requestFields($mOrderInfo) {
 
121
  $oOrder = $this->api_dibs_commonOrderObject($mOrderInfo);
122
  $this->api_dibs_prepareDB($oOrder->order->orderid);
123
- $aData = array('s_pw' => $this->api_dibs_get_method());
124
  $this->api_dibs_commonFields($aData, $oOrder);
125
- if($aData['s_pw'] == 2) $this->api_dibs_invoiceFields($aData, $mOrderInfo);
126
- else $this->api_dibs_mobileFields($aData);
127
  if(count($oOrder->etc) > 0) {
128
  foreach($oOrder->etc as $sKey => $sVal) $aData['s_' . $sKey] = $sVal;
129
  }
130
  array_walk($aData, create_function('&$val', '$val = trim($val);'));
131
- $sMAC = $this->api_dibs_calcMAC($aData, $this->helper_dibs_tools_conf('hmac'));
132
  if(!empty($sMAC)) $aData['MAC'] = $sMAC;
133
 
134
  return $aData;
@@ -137,8 +152,8 @@ class dibs_pw_api extends dibs_pw_helpers {
137
  /**
138
  * Adds to $aData common DIBS integration parameters.
139
  *
140
- * @param array $aData
141
- * @param object $oOrder
142
  */
143
  private function api_dibs_commonFields(&$aData, $oOrder) {
144
  $aData['orderid'] = $oOrder->order->orderid;
@@ -159,24 +174,12 @@ class dibs_pw_api extends dibs_pw_helpers {
159
  $aData['callbackurl'] = $this->helper_dibs_tools_url($aData['callbackurl']);
160
  }
161
  }
162
-
163
- /**
164
- * Adds to $aData parameters specific for Mobile PW integration.
165
- *
166
- * @param array $aData
167
- */
168
- private function api_dibs_mobileFields(&$aData) {
169
- if((string)$this->helper_dibs_tools_conf('voucher') == 'yes') $aData['voucher'] = 1;
170
- if((string)$this->helper_dibs_tools_conf('uniq') == 'yes') {
171
- $aData['uniqueid'] = $aData['orderid'];
172
- }
173
- }
174
 
175
  /**
176
  * Adds Invoice API parameters specific for SAT PW.
177
  *
178
- * @param array $aData
179
- * @param object $oOrder
180
  */
181
  private function api_dibs_invoiceFields(&$aData, $mOrderInfo) {
182
  $oOrder = $this->api_dibs_invoiceOrderObject($mOrderInfo);
@@ -186,11 +189,15 @@ class dibs_pw_api extends dibs_pw_helpers {
186
  }
187
  $oOrder->items[] = $oOrder->ship;
188
  if(isset($oOrder->items) && count($oOrder->items) > 0) {
189
- $aData['oitypes'] = 'QUANTITY;UNITCODE;DESCRIPTION;AMOUNT;ITEMID;' .
190
- (self::$bTaxAmount ? 'VATAMOUNT' : 'VATPERCENT');
191
- $aData['oinames'] = 'Qty;UnitCode;Description;Amount;ItemId;' .
192
- (self::$bTaxAmount ? 'VatAmount' : 'VatPercent');
193
 
 
 
 
 
 
194
  $i = 1;
195
  foreach($oOrder->items as $oItem) {
196
  $iTmpPrice = self::api_dibs_round($oItem->price);
@@ -199,12 +206,12 @@ class dibs_pw_api extends dibs_pw_helpers {
199
  if(empty($sTmpName)) $sTmpName = $oItem->id;
200
 
201
  $aData['oiRow' . $i++] =
202
- self::api_dibs_round($oItem->qty, 3) / 1000 . ";" .
203
- "pcs" . ";" .
204
- self::api_dibs_utf8Fix(str_replace(";","\;",$sTmpName)) . ";" .
205
- $iTmpPrice . ";" .
206
- self::api_dibs_utf8Fix(str_replace(";","\;",$oItem->id)) . ";" .
207
- self::api_dibs_round($oItem->tax);
208
  }
209
  unset($iTmpPrice);
210
  }
@@ -215,26 +222,10 @@ class dibs_pw_api extends dibs_pw_helpers {
215
  if((string)$sDistribType != 'empty') $aData['distributiontype'] = strtoupper($sDistribType);
216
  }
217
 
218
- /**
219
- * Returns integration method ID (2 or 3), specific for currenct transaction.
220
- *
221
- * @param bool $bResp
222
- * @return int
223
- */
224
- final public function api_dibs_get_method($bResp = FALSE) {
225
- if($bResp === TRUE && ($_POST['s_pw'] == 2 || $_POST['s_pw'] == 3)) return $_POST['s_pw'];
226
-
227
- $iPayMethod = $this->helper_dibs_tools_conf("method");
228
- if($iPayMethod != 2 && $iPayMethod != 3) {
229
- return (self::api_dibs_detectMobile() === TRUE) ? 3 : 2;
230
- }
231
- else return $iPayMethod;
232
- }
233
-
234
  /**
235
  * Process DB preparations and adds empty transaction record before payment.
236
  *
237
- * @param int $iOrderId
238
  */
239
  private function api_dibs_prepareDB($iOrderId) {
240
  $this->api_dibs_checkTable();
@@ -284,26 +275,28 @@ class dibs_pw_api extends dibs_pw_helpers {
284
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
285
  );
286
  }
287
-
288
  /**
289
- * Checks returned main fields.
290
  *
291
- * @param mixed $mOrder
292
- * @param bool $bUrlDecode
293
  * @return int
294
  */
295
- final public function api_dibs_checkMainFields($mOrder, $bUrlDecode = TRUE) {
296
- if(!isset($_POST['orderid'])) return 1;
297
- $mOrder = $this->helper_dibs_obj_order($mOrder, TRUE);
298
- if(!$mOrder->orderid) return 2;
299
-
300
- if(!isset($_POST['amount'])) return 3;
 
 
301
  $iAmount = (isset($_POST['voucherAmount']) && $_POST['voucherAmount'] > 0) ?
302
  $_POST['amountOriginal'] : $_POST['amount'];
303
- if(abs((int)$iAmount - (int)self::api_dibs_round($mOrder->amount)) >= 0.01) return 4;
304
- if(!isset($_POST['currency'])) return 5;
305
- if((int)$mOrder->currency != (int)$_POST['currency']) return 6;
306
-
307
  $sHMAC = $this->helper_dibs_tools_conf('hmac');
308
  if(!empty($sHMAC) && self::api_dibs_checkMAC($sHMAC, $bUrlDecode) !== TRUE) return 7;
309
 
@@ -314,28 +307,28 @@ class dibs_pw_api extends dibs_pw_helpers {
314
  * Give fallback verification error page
315
  * if module has no ability to use CMS for error displaying.
316
  *
317
- * @param int $iCode
318
  * @return string
319
  */
320
  public function api_dibs_getFatalErrorPage($iCode) {
321
- return self::api_dibs_renderTemplate(self::$aTemplates['tmpls']['error'],
322
  array('errname_err' => 0,
323
  'errcode_msg' => 'errcode',
324
  'errcode' => $iCode,
325
  'errmsg_msg' => 'errmsg',
326
  'errmsg_err' => $iCode,
327
  'link_toshop' => $this->helper_dibs_obj_urls()->carturl,
328
- 'toshop_msg' => toshop));
329
  }
330
 
331
  /**
332
  * Processes success redirect from payment gateway.
333
  *
334
- * @param mixed $mOrder
335
  * @return int
336
  */
337
- final public function api_dibs_action_success($mOrder) {
338
- $iErr = $this->api_dibs_checkMainFields($mOrder);
339
  if($iErr != 1 && $iErr != 2) {
340
  $this->api_dibs_updateResultRow(array('success_action' => empty($iErr) ? 1 : 0,
341
  'success_error' => $iErr));
@@ -356,10 +349,10 @@ class dibs_pw_api extends dibs_pw_helpers {
356
  /**
357
  * Processes callback from payment gateway.
358
  *
359
- * @param mixed $mOrder
360
  */
361
- final public function api_dibs_action_callback($mOrder) {
362
- $iErr = $this->api_dibs_checkMainFields($mOrder, FALSE);
363
  if(!empty($iErr)) {
364
  if($iErr != 1 && $iErr != 2) {
365
  $this->api_dibs_updateResultRow(array('callback_error' => $iErr));
@@ -374,14 +367,7 @@ class dibs_pw_api extends dibs_pw_helpers {
374
  if(empty($sResult)) {
375
  $aFields = array('callback_action' => 1);
376
  $aResponse = $_POST;
377
- $iPayMethod = $this->api_dibs_get_method(TRUE);
378
- foreach(self::$aRespFields as $sDbKey => $mPostKey) {
379
- if(is_array($mPostKey)) {
380
- $sPostKey = isset($mPostKey[$iPayMethod]) ? $mPostKey[$iPayMethod] : '';
381
- }
382
- else $sPostKey = $mPostKey;
383
- unset($mPostKey);
384
-
385
  if(!empty($sPostKey) && isset($_POST[$sPostKey])) {
386
  unset($aResponse[$sPostKey]);
387
  $aFields[$sDbKey] = $_POST[$sPostKey];
@@ -393,7 +379,7 @@ class dibs_pw_api extends dibs_pw_helpers {
393
 
394
  if(method_exists($this, 'helper_dibs_hook_callback') &&
395
  is_callable(array($this, 'helper_dibs_hook_callback'))) {
396
- $this->helper_dibs_hook_callback($mOrder);
397
  }
398
  }
399
  else $this->api_dibs_updateResultRow(array('callback_error' => 8));
@@ -403,11 +389,11 @@ class dibs_pw_api extends dibs_pw_helpers {
403
  /**
404
  * Updates from array one order row in dibs results table.
405
  *
406
- * @param array $aFields
407
  */
408
  private function api_dibs_updateResultRow($aFields) {
409
  if(isset($_POST['orderid']) && !empty($_POST['orderid'])) {
410
- $sUpdate = "";
411
  foreach($aFields as $sCell => $sVal) {
412
  $sUpdate .= "`" . $sCell . "`=" . "'" . self::api_dibs_sqlEncode($sVal) . "',";
413
  }
@@ -423,14 +409,15 @@ class dibs_pw_api extends dibs_pw_helpers {
423
 
424
  /**
425
  * Simple template loader and renderer. Used to load fallback error template.
 
426
  *
427
- * @param string $sTmplName
428
- * @param array $sParams
429
  * @return string
430
  */
431
- private function api_dibs_renderTemplate($sTmplName, $sParams = array()) {
432
- $sTmpl = file_get_contents(str_replace("\\", "/", dirname(__FILE__)) . "/" .
433
- self::$aTemplates['folder'] . "/" . $sTmplName);
434
  if($sTmpl !== FALSE) {
435
  foreach($sParams as $sKey => $sVal) {
436
  $sValueType = substr($sKey, -3);
@@ -441,7 +428,7 @@ class dibs_pw_api extends dibs_pw_helpers {
441
  $sVal, $sTmpl);
442
  }
443
  }
444
- else $sTmpl = "";
445
 
446
  return $sTmpl;
447
  }
@@ -450,22 +437,23 @@ class dibs_pw_api extends dibs_pw_helpers {
450
  /**
451
  * Calculates MAC for given array of data.
452
  *
453
- * @param array $aData
454
- * @param string $sHMAC
455
- * @param bool $bUrlDecode
456
  * @return string
457
  */
458
  final public static function api_dibs_calcMAC($aData, $sHMAC, $bUrlDecode = FALSE) {
459
- $sMAC = "";
460
  if(!empty($sHMAC)) {
461
- $sData = "";
462
  if(isset($aData['MAC'])) unset($aData['MAC']);
463
  ksort($aData);
464
  foreach($aData as $sKey => $sVal) {
465
- $sData .= "&" . $sKey . "=" . (($bUrlDecode === TRUE) ? urldecode($sVal) : $sVal);
466
  }
467
- $sMAC = hash_hmac("sha256", ltrim($sData, "&"), self::api_dibs_hextostr($sHMAC));
468
  }
 
469
  return $sMAC;
470
  }
471
 
@@ -473,15 +461,24 @@ class dibs_pw_api extends dibs_pw_helpers {
473
  /**
474
  * Compare calculated MAC with MAC from response urldecode response if second parameter is TRUE.
475
  *
476
- * @param string $sHMAC
477
- * @param bool $bUrlDecode
478
  * @return bool
479
  */
480
  final public static function api_dibs_checkMAC($sHMAC, $bUrlDecode = FALSE) {
481
- $_POST['MAC'] = isset($_POST['MAC']) ? $_POST['MAC'] : "";
482
  return ($_POST['MAC'] == self::api_dibs_calcMAC($_POST, $sHMAC, $bUrlDecode)) ? TRUE : FALSE;
483
  }
484
 
 
 
 
 
 
 
 
 
 
485
  /**
486
  * Returns ISO to DIBS currency array.
487
  *
@@ -503,46 +500,47 @@ class dibs_pw_api extends dibs_pw_helpers {
503
  /**
504
  * Gets value by code from currency array. Supports fliped values.
505
  *
506
- * @param string $sCode
507
- * @param bool $bFlip
508
  * @return string
509
  */
510
  final public static function api_dibs_get_currencyValue($sCode, $bFlip = FALSE) {
511
  $aCurrency = ($bFlip === TRUE) ? array_flip(self::api_dibs_get_currencyArray()) :
512
  self::api_dibs_get_currencyArray();
513
  return isset($aCurrency[$sCode]) ? $aCurrency[$sCode] :
514
- $aCurrency[self::$sDefaultCurr[$bFlip === TRUE ? 1 : 0]];
515
  }
516
 
517
  /**
518
  * Convert hex HMAC to string.
519
  *
520
- * @param string $sHex
521
  * @return string
522
  */
523
- private static function api_dibs_hextostr($sHex) {
524
- $sRes = "";
525
- foreach(explode("\n", trim(chunk_split($sHex,2))) as $h) $sRes .= chr(hexdec($h));
526
  return $sRes;
527
  }
528
 
529
  /**
530
  * Replaces sql-service quotes to simple quotes and escapes them by slashes.
531
  *
532
- * @param string $sVal
533
  * @return string
534
  */
535
- public static function api_dibs_sqlEncode($sVal) {
536
- return addslashes(str_replace("`", "'", trim(strip_tags((string)$sVal))));
537
  }
538
 
539
  /**
540
- * Returns integer representation of amont. Saves two signs that are
541
  * after floating point in float number by multiplication by 100.
542
  * E.g.: converts to cents in money context.
543
  * Workarround of float to int casting.
544
  *
545
- * @param float $fNum
 
546
  * @return int
547
  */
548
  public static function api_dibs_round($fNum, $iPrec = 2) {
@@ -553,86 +551,13 @@ class dibs_pw_api extends dibs_pw_helpers {
553
  * Fixes UTF-8 special symbols if encoding of CMS is not UTF-8.
554
  * Main using is for wided latin alphabets.
555
  *
556
- * @param string $sText
557
  * @return string
558
  */
559
  public static function api_dibs_utf8Fix($sText) {
560
- return (mb_detect_encoding($sText) == "UTF-8" && mb_check_encoding($sText, "UTF-8")) ?
561
  $sText : utf8_encode($sText);
562
  }
563
-
564
- /**
565
- * Detects mobile device by user-agent and received headers.
566
- *
567
- * @return bool
568
- */
569
- private static function api_dibs_detectMobile() {
570
- $sUserAgent = strtolower(getenv('HTTP_USER_AGENT'));
571
- $sAccept = strtolower(getenv('HTTP_ACCEPT'));
572
-
573
- if(strpos($sAccept,'text/vnd.wap.wml') !== FALSE ||
574
- strpos($sAccept,'application/vnd.wap.xhtml+xml') !== FALSE ||
575
- isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) return TRUE;
576
-
577
- if(preg_match('/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|' .
578
- 'lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|' .
579
- 'vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|' .
580
- 'samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|' .
581
- 'mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|'.
582
- 'i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|' .
583
- 's302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|' .
584
- 'mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|' .
585
- 'foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|' .
586
- 'me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|' .
587
- 'm50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |' .
588
- 'sonyericsson|samsung|240x|x320vx10|nokia|sony cmd|motorola|up.browser|' .
589
- 'up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|' .
590
- 'psp|treo)/', $sUserAgent)) return TRUE;
591
-
592
- if(in_array(substr($sUserAgent, 0, 4),
593
- array("1207", "3gso", "4thp", "501i", "502i", "503i", "504i", "505i", "506i", "6310",
594
- "6590", "770s", "802s", "a wa", "abac", "acer", "acoo", "acs-", "aiko", "airn",
595
- "alav", "alca", "alco", "amoi", "anex", "anny", "anyw", "aptu", "arch", "argo",
596
- "aste", "asus", "attw", "au-m", "audi", "aur ", "aus ", "avan", "beck", "bell",
597
- "benq", "bilb", "bird", "blac", "blaz", "brew", "brvw", "bumb", "bw-n", "bw-u",
598
- "c55/", "capi", "ccwa", "cdm-", "cell", "chtm", "cldc", "cmd-", "cond", "craw",
599
- "dait", "dall", "dang", "dbte", "dc-s", "devi", "dica", "dmob", "doco", "dopo",
600
- "ds-d", "ds12", "el49", "elai", "eml2", "emul", "eric", "erk0", "esl8", "ez40",
601
- "ez60", "ez70", "ezos", "ezwa", "ezze", "fake", "fetc", "fly-", "fly_", "g-mo",
602
- "g1 u", "g560", "gene", "gf-5", "go.w", "good", "grad", "grun", "haie", "hcit",
603
- "hd-m", "hd-p", "hd-t", "hei-", "hiba", "hipt", "hita", "hp i", "hpip", "hs-c",
604
- "htc ", "htc-", "htc_", "htca", "htcg", "htcp", "htcs", "htct", "http", "huaw",
605
- "hutc", "i-20", "i-go", "i-ma", "i230", "iac", "iac-", "iac/", "ibro", "idea",
606
- "ig01", "ikom", "im1k", "inno", "ipaq", "iris", "jata", "java", "jbro", "jemu",
607
- "jigs", "kddi", "keji", "kgt", "kgt/", "klon", "kpt ", "kwc-", "kyoc", "kyok",
608
- "leno", "lexi", "lg g", "lg-a", "lg-b", "lg-c", "lg-d", "lg-f", "lg-g", "lg-k",
609
- "lg-l", "lg-m", "lg-o", "lg-p", "lg-s", "lg-t", "lg-u", "lg-w", "lg/k", "lg/l",
610
- "lg/u", "lg50", "lg54", "lge-", "lge/", "libw", "lynx", "m-cr", "m1-w", "m3ga",
611
- "m50/", "mate", "maui", "maxo", "mc01", "mc21", "mcca", "medi", "merc", "meri",
612
- "midp", "mio8", "mioa", "mits", "mmef", "mo01", "mo02", "mobi", "mode", "modo",
613
- "mot ", "mot-", "moto", "motv", "mozz", "mt50", "mtp1", "mtv ", "mwbp", "mywa",
614
- "n100", "n101", "n102", "n202", "n203", "n300", "n302", "n500", "n502", "n505",
615
- "n700", "n701", "n710", "nec-", "nem-", "neon", "netf", "newg", "newt", "nok6",
616
- "noki", "nzph", "o2 x", "o2-x", "o2im", "opti", "opwv", "oran", "owg1", "p800",
617
- "palm", "pana", "pand", "pant", "pdxg", "pg-1", "pg-2", "pg-3", "pg-6", "pg-8",
618
- "pg-c", "pg13", "phil", "pire", "play", "pluc", "pn-2", "pock", "port", "pose",
619
- "prox", "psio", "pt-g", "qa-a", "qc-2", "qc-3", "qc-5", "qc-7", "qc07", "qc12",
620
- "qc21", "qc32", "qc60", "qci-", "qtek", "qwap", "r380", "r600", "raks", "rim9",
621
- "rove", "rozo", "s55/", "sage", "sama", "samm", "sams", "sany", "sava", "sc01",
622
- "sch-", "scoo", "scp-", "sdk/", "se47", "sec-", "sec0", "sec1", "semc", "send",
623
- "seri", "sgh-", "shar", "sie-", "siem", "sk-0", "sl45", "slid", "smal", "smar",
624
- "smb3", "smit", "smt5", "soft", "sony", "sp01", "sph-", "spv ", "spv-", "sy01",
625
- "symb", "t-mo", "t218", "t250", "t600", "t610", "t618", "tagt", "talk", "tcl-",
626
- "tdg-", "teli", "telm", "tim-", "topl", "tosh", "treo", "ts70", "tsm-", "tsm3",
627
- "tsm5", "tx-9", "up.b", "upg1", "upsi", "utst", "v400", "v750", "veri", "virg",
628
- "vite", "vk-v", "vk40", "vk50", "vk52", "vk53", "vm40", "voda", "vulc", "vx52",
629
- "vx53", "vx60", "vx61", "vx70", "vx80", "vx81", "vx83", "vx85", "vx98", "w3c ",
630
- "w3c-", "wap-", "wapa", "wapi", "wapj", "wapm", "wapp", "wapr", "waps", "wapt",
631
- "wapu", "wapv", "wapy", "webc", "whit", "wig ", "winc", "winw", "wmlb", "wonu",
632
- "x700", "xda-", "xda2", "xdag", "yas-", "your", "zeto", "zte-"))) return TRUE;
633
-
634
- return FALSE;
635
- }
636
  /** DIBS API TOOLS END **/
637
  }
638
  ?>
1
  <?php
2
+ require_once str_replace('\\', '/', dirname(__FILE__)) . '/dibs_pw_helpers_interface.php';
3
+ require_once str_replace('\\', '/', dirname(__FILE__)) . '/dibs_pw_helpers_cms.php';
4
+ require_once str_replace('\\', '/', dirname(__FILE__)) . '/dibs_pw_helpers.php';
5
 
6
  class dibs_pw_api extends dibs_pw_helpers {
7
 
8
+ /**
9
+ * DIBS responses log table.
10
+ *
11
+ * @var string
12
+ */
13
  private static $sDibsTable = 'dibs_pw_results';
14
+
15
+ /**
16
+ * Settings of module inner template engine.
17
+ *
18
+ * @var array
19
+ */
20
  private static $aTemplates = array('folder' => 'tmpl',
21
  'marker' => '#',
22
  'autotranslate' => array('lbl','msg', 'sts', 'err'),
23
  'tmpls' => array('error' => 'dibs_pw_error'));
24
+
25
+ /**
26
+ * Default currency code (in two ISO formats).
27
+ *
28
+ * @var array
29
+ */
30
  private static $sDefaultCurr = array(0 => 'EUR', 1 => '978');
31
 
32
+ /**
33
+ * DIBS gateway URL.
34
+ *
35
+ * @var string
36
+ */
37
+ private static $sFormAction = 'https://sat1.dibspayment.com/dibspaymentwindow/entrypoint';
38
 
39
+ /**
40
+ * Dictionary of DIBS response to self::$sDibsTable table fields relations.
41
+ *
42
+ * @var array
43
+ */
44
  private static $aRespFields = array('orderid' => 'orderid', 'status' => 'status',
45
  'testmode' => 'test', 'transaction' => 'transaction',
46
+ 'amount' => 'amount', 'currency' => 'currency',
47
  'fee' => 'fee', 'voucheramount' => 'voucherAmount',
48
+ 'paytype' => 'cardTypeName', 'actioncode' => 'actionCode',
49
+ 'amountoriginal'=>'amountOriginal', 'sysmod' => 's_sysmod',
50
  'validationerrors'=>'validationErrors',
51
+ 'capturestatus' => 'captureStatus');
 
 
52
 
53
+ /**
54
+ * Array of currency's two ISO formats relations.
55
+ *
56
+ * @var array
57
+ */
58
  private static $aCurrency = array('ADP' => '020','AED' => '784','AFA' => '004','ALL' => '008',
59
  'AMD' => '051','ANG' => '532','AOA' => '973','ARS' => '032',
60
  'AUD' => '036','AWG' => '533','AZM' => '031','BAM' => '977',
102
  /**
103
  * Returns CMS order common information converted to standardized order information objects.
104
  *
105
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
106
  * @return object
107
  */
108
  private function api_dibs_commonOrderObject($mOrderInfo) {
116
  /**
117
  * Returns CMS order invoice information converted to standardized order information objects.
118
  *
119
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
120
  * @return object
121
  */
122
  private function api_dibs_invoiceOrderObject($mOrderInfo) {
127
  );
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
130
  /**
131
  * Collects API parameters to send in dependence of checkout type. API entry point.
132
  *
133
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
134
  * @return array
135
  */
136
  final public function api_dibs_get_requestFields($mOrderInfo) {
137
+ $aData = array();
138
  $oOrder = $this->api_dibs_commonOrderObject($mOrderInfo);
139
  $this->api_dibs_prepareDB($oOrder->order->orderid);
 
140
  $this->api_dibs_commonFields($aData, $oOrder);
141
+ $this->api_dibs_invoiceFields($aData, $mOrderInfo);
 
142
  if(count($oOrder->etc) > 0) {
143
  foreach($oOrder->etc as $sKey => $sVal) $aData['s_' . $sKey] = $sVal;
144
  }
145
  array_walk($aData, create_function('&$val', '$val = trim($val);'));
146
+ $sMAC = $this->api_dibs_calcMAC($aData, $this->helper_dibs_tools_conf('HMAC'));
147
  if(!empty($sMAC)) $aData['MAC'] = $sMAC;
148
 
149
  return $aData;
152
  /**
153
  * Adds to $aData common DIBS integration parameters.
154
  *
155
+ * @param array $aData Array to fill in by link with DIBS API parameters.
156
+ * @param object $oOrder Formated to object order common information.
157
  */
158
  private function api_dibs_commonFields(&$aData, $oOrder) {
159
  $aData['orderid'] = $oOrder->order->orderid;
174
  $aData['callbackurl'] = $this->helper_dibs_tools_url($aData['callbackurl']);
175
  }
176
  }
 
 
 
 
 
 
 
 
 
 
 
 
177
 
178
  /**
179
  * Adds Invoice API parameters specific for SAT PW.
180
  *
181
+ * @param array $aData Array to fill in by link with DIBS API parameters.
182
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
183
  */
184
  private function api_dibs_invoiceFields(&$aData, $mOrderInfo) {
185
  $oOrder = $this->api_dibs_invoiceOrderObject($mOrderInfo);
189
  }
190
  $oOrder->items[] = $oOrder->ship;
191
  if(isset($oOrder->items) && count($oOrder->items) > 0) {
192
+ $aData['oitypes'] = 'QUANTITY;UNITCODE;DESCRIPTION;AMOUNT;ITEMID';
193
+
194
+ $aData['oinames'] = 'Qty;UnitCode;Description;Amount;ItemId';
 
195
 
196
+ if(isset($oOrder->items[0]->tax)) {
197
+ $aData['oitypes'] .= (self::$bTaxAmount ? ';VATAMOUNT' : ';VATPERCENT');
198
+ $aData['oinames'] .= (self::$bTaxAmount ? ';VatAmount' : ';VatPercent');
199
+ }
200
+
201
  $i = 1;
202
  foreach($oOrder->items as $oItem) {
203
  $iTmpPrice = self::api_dibs_round($oItem->price);
206
  if(empty($sTmpName)) $sTmpName = $oItem->id;
207
 
208
  $aData['oiRow' . $i++] =
209
+ self::api_dibs_round($oItem->qty, 3) / 1000 . ';' .
210
+ 'pcs;' .
211
+ self::api_dibs_utf8Fix(str_replace(';','\;',$sTmpName)) . ';' .
212
+ $iTmpPrice . ';' .
213
+ self::api_dibs_utf8Fix(str_replace(';','\;',$oItem->id)) .
214
+ (isset($oItem->tax) ? ';' . self::api_dibs_round($oItem->tax) : '');
215
  }
216
  unset($iTmpPrice);
217
  }
222
  if((string)$sDistribType != 'empty') $aData['distributiontype'] = strtoupper($sDistribType);
223
  }
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  /**
226
  * Process DB preparations and adds empty transaction record before payment.
227
  *
228
+ * @param int $iOrderId Order ID to insert to self::$sDibsTable table in DB.
229
  */
230
  private function api_dibs_prepareDB($iOrderId) {
231
  $this->api_dibs_checkTable();
275
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
276
  );
277
  }
278
+
279
  /**
280
+ * Checks existance and integrity of main fields, that returned to shop after payment.
281
  *
282
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
283
+ * @param bool $bUrlDecode Flag if urldecode before MAC hash calculation is needed (for success action).
284
  * @return int
285
  */
286
+ final public function api_dibs_checkMainFields($mOrderInfo, $bUrlDecode = TRUE) {
287
+ if(!isset($_POST['orderid']) || empty($_POST['orderid'])) return 1;
288
+ elseif(!isset($_POST['amount'])) return 3;
289
+ elseif(!isset($_POST['currency'])) return 5;
290
+
291
+ $mOrderInfo = $this->helper_dibs_obj_order($mOrderInfo, TRUE);
292
+ if(!isset($mOrderInfo->orderid) || empty($mOrderInfo->orderid)) return 2;
293
+
294
  $iAmount = (isset($_POST['voucherAmount']) && $_POST['voucherAmount'] > 0) ?
295
  $_POST['amountOriginal'] : $_POST['amount'];
296
+ if(abs((int)$iAmount - (int)self::api_dibs_round($mOrderInfo->amount)) >= 0.01) return 4;
297
+
298
+ if((int)$mOrderInfo->currency != (int)$_POST['currency']) return 6;
299
+
300
  $sHMAC = $this->helper_dibs_tools_conf('hmac');
301
  if(!empty($sHMAC) && self::api_dibs_checkMAC($sHMAC, $bUrlDecode) !== TRUE) return 7;
302
 
307
  * Give fallback verification error page
308
  * if module has no ability to use CMS for error displaying.
309
  *
310
+ * @param int $iCode Error code.
311
  * @return string
312
  */
313
  public function api_dibs_getFatalErrorPage($iCode) {
314
+ return $this->api_dibs_renderTemplate(self::$aTemplates['tmpls']['error'],
315
  array('errname_err' => 0,
316
  'errcode_msg' => 'errcode',
317
  'errcode' => $iCode,
318
  'errmsg_msg' => 'errmsg',
319
  'errmsg_err' => $iCode,
320
  'link_toshop' => $this->helper_dibs_obj_urls()->carturl,
321
+ 'toshop_msg' => 'toshop'));
322
  }
323
 
324
  /**
325
  * Processes success redirect from payment gateway.
326
  *
327
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
328
  * @return int
329
  */
330
+ final public function api_dibs_action_success($mOrderInfo) {
331
+ $iErr = $this->api_dibs_checkMainFields($mOrderInfo);
332
  if($iErr != 1 && $iErr != 2) {
333
  $this->api_dibs_updateResultRow(array('success_action' => empty($iErr) ? 1 : 0,
334
  'success_error' => $iErr));
349
  /**
350
  * Processes callback from payment gateway.
351
  *
352
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
353
  */
354
+ final public function api_dibs_action_callback($mOrderInfo) {
355
+ $iErr = $this->api_dibs_checkMainFields($mOrderInfo, FALSE);
356
  if(!empty($iErr)) {
357
  if($iErr != 1 && $iErr != 2) {
358
  $this->api_dibs_updateResultRow(array('callback_error' => $iErr));
367
  if(empty($sResult)) {
368
  $aFields = array('callback_action' => 1);
369
  $aResponse = $_POST;
370
+ foreach(self::$aRespFields as $sDbKey => $sPostKey) {
 
 
 
 
 
 
 
371
  if(!empty($sPostKey) && isset($_POST[$sPostKey])) {
372
  unset($aResponse[$sPostKey]);
373
  $aFields[$sDbKey] = $_POST[$sPostKey];
379
 
380
  if(method_exists($this, 'helper_dibs_hook_callback') &&
381
  is_callable(array($this, 'helper_dibs_hook_callback'))) {
382
+ $this->helper_dibs_hook_callback($mOrderInfo);
383
  }
384
  }
385
  else $this->api_dibs_updateResultRow(array('callback_error' => 8));
389
  /**
390
  * Updates from array one order row in dibs results table.
391
  *
392
+ * @param array $aFields Key-Value array to update order info in self::$sDibsTable table.
393
  */
394
  private function api_dibs_updateResultRow($aFields) {
395
  if(isset($_POST['orderid']) && !empty($_POST['orderid'])) {
396
+ $sUpdate = '';
397
  foreach($aFields as $sCell => $sVal) {
398
  $sUpdate .= "`" . $sCell . "`=" . "'" . self::api_dibs_sqlEncode($sVal) . "',";
399
  }
409
 
410
  /**
411
  * Simple template loader and renderer. Used to load fallback error template.
412
+ * Support "autotranslate" for self::$aTemplates['autotranslate'] text types.
413
  *
414
+ * @param string $sTmplName Name of template to use.
415
+ * @param array $sParams Parameters to replace markers during render.
416
  * @return string
417
  */
418
+ public function api_dibs_renderTemplate($sTmplName, $sParams = array()) {
419
+ $sTmpl = file_get_contents(str_replace('\\', '/', dirname(__FILE__)) . '/' .
420
+ self::$aTemplates['folder'] . '/' . $sTmplName);
421
  if($sTmpl !== FALSE) {
422
  foreach($sParams as $sKey => $sVal) {
423
  $sValueType = substr($sKey, -3);
428
  $sVal, $sTmpl);
429
  }
430
  }
431
+ else $sTmpl = '';
432
 
433
  return $sTmpl;
434
  }
437
  /**
438
  * Calculates MAC for given array of data.
439
  *
440
+ * @param array $aData Array of data to calculate the MAC hash.
441
+ * @param string $sHMAC HMAC key for hash calculation.
442
+ * @param bool $bUrlDecode Flag if urldecode before MAC hash calculation is needed (for success action).
443
  * @return string
444
  */
445
  final public static function api_dibs_calcMAC($aData, $sHMAC, $bUrlDecode = FALSE) {
446
+ $sMAC = '';
447
  if(!empty($sHMAC)) {
448
+ $sData = '';
449
  if(isset($aData['MAC'])) unset($aData['MAC']);
450
  ksort($aData);
451
  foreach($aData as $sKey => $sVal) {
452
+ $sData .= '&' . $sKey . '=' . (($bUrlDecode === TRUE) ? urldecode($sVal) : $sVal);
453
  }
454
+ $sMAC = hash_hmac('sha256', ltrim($sData, '&'), self::api_dibs_hextostr($sHMAC));
455
  }
456
+
457
  return $sMAC;
458
  }
459
 
461
  /**
462
  * Compare calculated MAC with MAC from response urldecode response if second parameter is TRUE.
463
  *
464
+ * @param string $sHMAC HMAC key for hash calculation.
465
+ * @param bool $bUrlDecode Flag if urldecode before MAC hash calculation is needed (for success action).
466
  * @return bool
467
  */
468
  final public static function api_dibs_checkMAC($sHMAC, $bUrlDecode = FALSE) {
469
+ if(!isset($_POST['MAC'])) $_POST['MAC'] = '';
470
  return ($_POST['MAC'] == self::api_dibs_calcMAC($_POST, $sHMAC, $bUrlDecode)) ? TRUE : FALSE;
471
  }
472
 
473
+ /**
474
+ * Returns form action URL of gateway.
475
+ *
476
+ * @return string
477
+ */
478
+ final public function api_dibs_get_formAction() {
479
+ return self::$sFormAction;
480
+ }
481
+
482
  /**
483
  * Returns ISO to DIBS currency array.
484
  *
500
  /**
501
  * Gets value by code from currency array. Supports fliped values.
502
  *
503
+ * @param string $sCode Currency code (its ISO formats from self::$aCurrency depends on $bFlip value)
504
+ * @param bool $bFlip If we need to flip self::$aCurrency array and look in another format.
505
  * @return string
506
  */
507
  final public static function api_dibs_get_currencyValue($sCode, $bFlip = FALSE) {
508
  $aCurrency = ($bFlip === TRUE) ? array_flip(self::api_dibs_get_currencyArray()) :
509
  self::api_dibs_get_currencyArray();
510
  return isset($aCurrency[$sCode]) ? $aCurrency[$sCode] :
511
+ $aCurrency[self::$sDefaultCurr[$bFlip === TRUE ? 1 : 0]];
512
  }
513
 
514
  /**
515
  * Convert hex HMAC to string.
516
  *
517
+ * @param string $sHMAC HMAC key for hash calculation.
518
  * @return string
519
  */
520
+ private static function api_dibs_hextostr($sHMAC) {
521
+ $sRes = '';
522
+ foreach(explode("\n", trim(chunk_split($sHMAC, 2))) as $h) $sRes .= chr(hexdec($h));
523
  return $sRes;
524
  }
525
 
526
  /**
527
  * Replaces sql-service quotes to simple quotes and escapes them by slashes.
528
  *
529
+ * @param string $sValue Value to escape before SQL operation.
530
  * @return string
531
  */
532
+ public static function api_dibs_sqlEncode($sValue) {
533
+ return addslashes(str_replace('`', "'", trim(strip_tags((string)$sValue))));
534
  }
535
 
536
  /**
537
+ * Returns integer representation of amount. Saves two signs that are
538
  * after floating point in float number by multiplication by 100.
539
  * E.g.: converts to cents in money context.
540
  * Workarround of float to int casting.
541
  *
542
+ * @param float $fNum Float number to round safely.
543
+ * @param int $iPrec Precision. Quantity of digits to save after decimal point.
544
  * @return int
545
  */
546
  public static function api_dibs_round($fNum, $iPrec = 2) {
551
  * Fixes UTF-8 special symbols if encoding of CMS is not UTF-8.
552
  * Main using is for wided latin alphabets.
553
  *
554
+ * @param string $sText The text to prepare in UTF-8 if it is not encoded to it yet.
555
  * @return string
556
  */
557
  public static function api_dibs_utf8Fix($sText) {
558
+ return (mb_detect_encoding($sText) == 'UTF-8' && mb_check_encoding($sText, 'UTF-8')) ?
559
  $sText : utf8_encode($sText);
560
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
561
  /** DIBS API TOOLS END **/
562
  }
563
  ?>
app/code/community/Dibspw/Dibspw/Model/dibs_api/pw/dibs_pw_helpers.php CHANGED
@@ -1,13 +1,17 @@
1
  <?php
2
  class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_interface {
3
 
 
 
 
 
 
4
  public static $bTaxAmount = true;
5
 
6
-
7
  /**
8
  * Process write SQL query (insert, update, delete) with build-in CMS ADO engine.
9
  *
10
- * @param string $sQuery
11
  */
12
  function helper_dibs_db_write($sQuery) {
13
  $oWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
@@ -18,8 +22,8 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
18
  * Read single value ($sName) from SQL select result.
19
  * If result with name $sName not found null returned.
20
  *
21
- * @param string $sQuery
22
- * @param string $sName
23
  * @return mixed
24
  */
25
  function helper_dibs_db_read_single($sQuery, $sName) {
@@ -31,8 +35,8 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
31
  /**
32
  * Return settings with CMS method.
33
  *
34
- * @param string $sVar
35
- * @param string $sPrefix
36
  * @return string
37
  */
38
  function helper_dibs_tools_conf($sVar, $sPrefix = 'DIBSPW_') {
@@ -51,7 +55,8 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
51
  /**
52
  * Returns text by key using CMS engine.
53
  *
54
- * @param type $sKey
 
55
  * @return type
56
  */
57
  function helper_dibs_tools_lang($sKey, $sType = 'msg') {
@@ -61,7 +66,7 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
61
  /**
62
  * Get full CMS url for page.
63
  *
64
- * @param string $sLink
65
  * @return string
66
  */
67
  function helper_dibs_tools_url($sLink) {
@@ -71,8 +76,8 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
71
  /**
72
  * Build CMS order information to API object.
73
  *
74
- * @param mixed $mOrderInfo
75
- * @param bool $bResponse
76
  * @return object
77
  */
78
  function helper_dibs_obj_order($mOrderInfo, $bResponse = FALSE) {
@@ -92,7 +97,7 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
92
  /**
93
  * Build CMS each ordered item information to API object.
94
  *
95
- * @param mixed $mOrderInfo
96
  * @return object
97
  */
98
  function helper_dibs_obj_items($mOrderInfo) {
@@ -104,35 +109,58 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
104
  'sku' => $oItem->getSku(),
105
  'price' => $oItem->getPrice(),
106
  'qty' => $oItem->getQtyOrdered(),
107
- 'tax' => $oItem->getTaxAmount() / $oItem->getQtyOrdered()
 
 
 
 
 
 
 
 
 
 
 
 
108
  );
109
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  return $aItems;
111
  }
112
 
113
  /**
114
  * Build CMS shipping information to API object.
115
  *
116
- * @param mixed $mOrderInfo
117
  * @return object
118
  */
119
  function helper_dibs_obj_ship($mOrderInfo) {
120
  return (object)array(
121
  'id' => 'shipping0',
122
- 'name' => 'Shipping Cost',
123
  'sku' => '',
124
- 'price' => isset($mOrderInfo['shipping_amount']) ?
125
- $mOrderInfo['shipping_amount'] : (int)0,
126
  'qty' => 1,
127
- 'tax' => isset($mOrderInfo['shipping_tax_amount']) ?
128
- $mOrderInfo['shipping_tax_amount'] : (int)0
129
  );
130
  }
131
 
132
  /**
133
  * Build CMS customer addresses to API object.
134
  *
135
- * @param mixed $mOrderInfo
136
  * @return object
137
  */
138
  function helper_dibs_obj_addr($mOrderInfo) {
@@ -165,7 +193,7 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
165
  * Returns object with URLs needed for API,
166
  * e.g.: callbackurl, acceptreturnurl, etc.
167
  *
168
- * @param mixed $mOrderInfo
169
  * @return object
170
  */
171
  function helper_dibs_obj_urls($mOrderInfo = null) {
@@ -180,27 +208,32 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
180
  /**
181
  * Returns object with additional information to send with payment.
182
  *
183
- * @param mixed $mOrderInfo
184
  * @return object
185
  */
186
  function helper_dibs_obj_etc($mOrderInfo) {
187
  return (object)array(
188
- 'sysmod' => 'mgn1_4_1_3',
189
  'callbackfix' => $this->helper_dibs_tools_url("Dibspw/Dibspw/callback")
190
  );
191
  }
192
 
 
 
 
 
 
193
  function helper_dibs_hook_callback($oOrder) {
194
- $session = Mage::getSingleton('checkout/session');
195
- $session->setQuoteId($session->getDibspwStandardQuoteId(true));
196
 
197
  if (((int)$this->helper_dibs_tools_conf('sendmailorderconfirmation', '')) == 1) {
198
  $oOrder->sendNewOrderEmail();
199
  }
200
 
201
- $this->removeFromStock();
202
  $this->setOrderStatusAfterPayment();
203
- $session->setQuoteId($session->getDibspwStandardQuoteId(true));
204
  }
205
  }
206
  ?>
1
  <?php
2
  class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_interface {
3
 
4
+ /**
5
+ * Flag if this module uses tax amounts instead of tax percents.
6
+ *
7
+ * @var bool
8
+ */
9
  public static $bTaxAmount = true;
10
 
 
11
  /**
12
  * Process write SQL query (insert, update, delete) with build-in CMS ADO engine.
13
  *
14
+ * @param string $sQuery SQL query string.
15
  */
16
  function helper_dibs_db_write($sQuery) {
17
  $oWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
22
  * Read single value ($sName) from SQL select result.
23
  * If result with name $sName not found null returned.
24
  *
25
+ * @param string $sQuery SQL query string.
26
+ * @param string $sName Name of field to fetch.
27
  * @return mixed
28
  */
29
  function helper_dibs_db_read_single($sQuery, $sName) {
35
  /**
36
  * Return settings with CMS method.
37
  *
38
+ * @param string $sVar Variable name.
39
+ * @param string $sPrefix Variable prefix.
40
  * @return string
41
  */
42
  function helper_dibs_tools_conf($sVar, $sPrefix = 'DIBSPW_') {
55
  /**
56
  * Returns text by key using CMS engine.
57
  *
58
+ * @param type $sKey Key of text node.
59
+ * @param type $sType Type of text node.
60
  * @return type
61
  */
62
  function helper_dibs_tools_lang($sKey, $sType = 'msg') {
66
  /**
67
  * Get full CMS url for page.
68
  *
69
+ * @param string $sLink Link or its part to convert to full CMS-specific url.
70
  * @return string
71
  */
72
  function helper_dibs_tools_url($sLink) {
76
  /**
77
  * Build CMS order information to API object.
78
  *
79
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
80
+ * @param bool $bResponse Flag if it's response call of this method.
81
  * @return object
82
  */
83
  function helper_dibs_obj_order($mOrderInfo, $bResponse = FALSE) {
97
  /**
98
  * Build CMS each ordered item information to API object.
99
  *
100
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
101
  * @return object
102
  */
103
  function helper_dibs_obj_items($mOrderInfo) {
109
  'sku' => $oItem->getSku(),
110
  'price' => $oItem->getPrice(),
111
  'qty' => $oItem->getQtyOrdered(),
112
+ 'tax' => 0
113
+ );
114
+ }
115
+
116
+ $fDiscount = $mOrderInfo->getDiscountAmount();
117
+ if(!empty($fDiscount)) {
118
+ $aItems[] = (object)array(
119
+ 'id' => 'discount0',
120
+ 'name' => $this->helper_dibs_tools_lang('discount_total'),
121
+ 'sku' => '',
122
+ 'price' => $fDiscount,
123
+ 'qty' => 1,
124
+ 'tax' => 0
125
  );
126
  }
127
+
128
+ $fTaxTotal = 0;
129
+ $aTaxes = $mOrderInfo->getFullTaxInfo();
130
+ foreach($aTaxes as $aTax) if(isset($aTax['amount'])) $fTaxTotal += $aTax['amount'];
131
+ $aItems[] = (object)array(
132
+ 'id' => 'tax0',
133
+ 'name' => $this->helper_dibs_tools_lang('tax_total'),
134
+ 'sku' => '',
135
+ 'price' => $fTaxTotal,
136
+ 'qty' => 1,
137
+ 'tax' => 0
138
+ );
139
+
140
  return $aItems;
141
  }
142
 
143
  /**
144
  * Build CMS shipping information to API object.
145
  *
146
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
147
  * @return object
148
  */
149
  function helper_dibs_obj_ship($mOrderInfo) {
150
  return (object)array(
151
  'id' => 'shipping0',
152
+ 'name' => $this->helper_dibs_tools_lang('shipping_total'),
153
  'sku' => '',
154
+ 'price' => isset($mOrderInfo['shipping_amount']) ? $mOrderInfo['shipping_amount'] : 0,
 
155
  'qty' => 1,
156
+ 'tax' => 0
 
157
  );
158
  }
159
 
160
  /**
161
  * Build CMS customer addresses to API object.
162
  *
163
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
164
  * @return object
165
  */
166
  function helper_dibs_obj_addr($mOrderInfo) {
193
  * Returns object with URLs needed for API,
194
  * e.g.: callbackurl, acceptreturnurl, etc.
195
  *
196
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
197
  * @return object
198
  */
199
  function helper_dibs_obj_urls($mOrderInfo = null) {
208
  /**
209
  * Returns object with additional information to send with payment.
210
  *
211
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
212
  * @return object
213
  */
214
  function helper_dibs_obj_etc($mOrderInfo) {
215
  return (object)array(
216
+ 'sysmod' => 'mgn1_4_1_5',
217
  'callbackfix' => $this->helper_dibs_tools_url("Dibspw/Dibspw/callback")
218
  );
219
  }
220
 
221
+ /**
222
+ * Hook that allows to execute CMS-specific action during callback execution.
223
+ *
224
+ * @param mixed $mOrderInfo All order information, needed for DIBS (in shop format).
225
+ */
226
  function helper_dibs_hook_callback($oOrder) {
227
+ $oSession = Mage::getSingleton('checkout/session');
228
+ $oSession->setQuoteId($oSession->getDibspwStandardQuoteId(true));
229
 
230
  if (((int)$this->helper_dibs_tools_conf('sendmailorderconfirmation', '')) == 1) {
231
  $oOrder->sendNewOrderEmail();
232
  }
233
 
234
+ $this->removeFromStock((int)$_POST['orderid']);
235
  $this->setOrderStatusAfterPayment();
236
+ $oSession->setQuoteId($oSession->getDibspwStandardQuoteId(true));
237
  }
238
  }
239
  ?>
app/code/community/Dibspw/Dibspw/Model/dibs_api/pw/dibs_pw_helpers_cms.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  class dibs_pw_helpers_cms extends Mage_Payment_Model_Method_Abstract {
3
  protected $_code = 'Dibspw';
4
- protected $_formBlockType = 'Dibspw_Dibspw_block_form';
5
- protected $_infoBlockType = 'Dibspw_Dibspw_block_info';
6
  protected $_canUseInternal = false;
7
  protected $_canUseForMultishipping = false;
8
 
@@ -126,29 +126,28 @@ class dibs_pw_helpers_cms extends Mage_Payment_Model_Method_Abstract {
126
  $order->save();
127
  }
128
 
129
- // Remove from stock (if used)
130
- public function removeFromStock() {
131
- // Load the session object
132
- $session = Mage::getSingleton('checkout/session');
133
- $session->setDibspwStandardQuoteId($session->getQuoteId());
134
-
135
- // Load the order object
136
- $order = Mage::getModel('sales/order');
137
- $order->loadByIncrementId($_POST['orderid']);
 
138
 
139
- // remove items from stock
140
- // http://www.magentocommerce.com/wiki/groups/132/protx_form_-_subtracting_stock_on_successful_payment
 
141
  if (((int)$this->getConfigData('handlestock')) == 1) {
142
- $items = $order->getAllItems(); // Get all items from the order
143
- if ($items) {
144
- foreach($items as $item) {
145
- $quantity = $item->getQtyOrdered(); // get Qty ordered
146
- $product_id = $item->getProductId(); // get it's ID
147
- // Load the stock for this product
148
- $stock = Mage::getModel('cataloginventory/stock_item')
149
- ->loadByProduct($product_id);
150
- $stock->setQty($stock->getQty()-$quantity); // Set to new Qty
151
- $stock->save(); // Save
152
  continue;
153
  }
154
  }
1
  <?php
2
  class dibs_pw_helpers_cms extends Mage_Payment_Model_Method_Abstract {
3
  protected $_code = 'Dibspw';
4
+ protected $_formBlockType = 'Dibspw_Dibspw_Block_Form';
5
+ protected $_infoBlockType = 'Dibspw_Dibspw_Block_Info';
6
  protected $_canUseInternal = false;
7
  protected $_canUseForMultishipping = false;
8
 
126
  $order->save();
127
  }
128
 
129
+
130
+ /**
131
+ * Removes items from stock, depends on 'handlestock' module configuration option
132
+ * (used for successful payments)
133
+ *
134
+ * http://www.magentocommerce.com/wiki/groups/132/protx_form_-_subtracting_stock_on_successful_payment
135
+ */
136
+ public function removeFromStock($iOrderId) {
137
+ $oSession = Mage::getSingleton('checkout/session');
138
+ $oSession->setDibspwStandardQuoteId($oSession->getQuoteId());
139
 
140
+ $oOrder = Mage::getModel('sales/order');
141
+ $oOrder->loadByIncrementId($iOrderId);
142
+
143
  if (((int)$this->getConfigData('handlestock')) == 1) {
144
+ $oItems = $oOrder->getAllItems();
145
+ if ($oItems) {
146
+ foreach($oItems as $oItem) {
147
+ $oStock = Mage::getModel('cataloginventory/stock_item')
148
+ ->loadByProduct($oItem->getProductId());
149
+ $oStock->setQty($oStock->getQty() - $oItem->getQtyOrdered());
150
+ $oStock->save();
 
 
 
151
  continue;
152
  }
153
  }
app/code/community/Dibspw/Dibspw/controllers/DibspwController.php CHANGED
@@ -28,17 +28,26 @@ class Dibspw_Dibspw_DibspwController extends Mage_Core_Controller_Front_Action {
28
 
29
  private $oDibsModel;
30
 
 
 
 
 
31
  function _construct() {
32
  $this->oDibsModel= Mage::getModel('dibspw/Dibspw');
33
  }
34
 
 
 
 
 
 
35
  public function redirectAction(){
36
- // Load the session object
37
- $session = Mage::getSingleton('checkout/session');
38
- $session->setDibspwQuoteId($session->getQuoteId());
39
 
40
  $oOrder = Mage::getModel('sales/order');
41
- $oOrder->loadByIncrementId($session->getLastRealOrderId());
 
42
  $this->loadLayout();
43
  if($oOrder->getPayment() !== FALSE) {
44
  // Create the POST to DIBS (Inside Magento Checkout)
@@ -47,14 +56,17 @@ class Dibspw_Dibspw_DibspwController extends Mage_Core_Controller_Front_Action {
47
  // Create the POST to DIBS (In Separate "Blank" Window)
48
  // $this->getResponse()->setBody($this->getLayout()->createBlock('Dibspw/redirect')->toHtml());
49
 
50
- // Save order comment
 
51
  foreach($oOrder->getAllStatusHistory() as $oOrderStatusItem) {
52
  $sOrderComment = $oOrderStatusItem->getComment();
53
  break;
54
  }
 
55
  if($sOrderComment != $this->__('DIBSPW_LABEL_3')) {
56
  $oOrder->addStatusToHistory($oOrder->getStatus(), $this->__('DIBSPW_LABEL_3'));
57
  }
 
58
  $oOrder->save();
59
  // Add items back on stock (if used)
60
  $this->addToStock();
@@ -63,54 +75,80 @@ class Dibspw_Dibspw_DibspwController extends Mage_Core_Controller_Front_Action {
63
  $this->renderLayout();
64
  }
65
 
 
 
 
 
 
66
  public function successAction() {
67
- $session = Mage::getSingleton('checkout/session');
68
- $session->setQuoteId($session->getDibspwStandardQuoteId(true));
69
- $oOrder = Mage::getModel('sales/order');
70
 
71
- $iResult = $this->oDibsModel->api_dibs_action_success($oOrder);
72
- if(!empty($iResult)) {
73
- echo $this->oDibsModel->api_dibs_getFatalErrorPage($iResult);
74
- exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
  else {
77
- Mage::app()->getFrontController()->getResponse()->setRedirect(
78
- $this->oDibsModel->helper_dibs_tools_url('checkout/onepage/success')
79
- );
80
  }
81
  }
82
 
 
 
 
 
 
83
  public function callbackAction() {
84
  $oOrder = Mage::getModel('sales/order');
85
  $this->oDibsModel->api_dibs_action_callback($oOrder);
86
  }
87
 
88
  /**
89
- * When a customer cancel payment from dibs.
 
 
90
  */
91
  public function cancelAction() {
92
- $session = Mage::getSingleton('checkout/session');
93
- $session->setQuoteId($session->getDibspwStandardQuoteId(true));
94
- $fields = array();
95
 
96
- // Save order comment
97
  $oOrder = Mage::getModel('sales/order');
98
-
99
- if (isset($_POST['orderid'])) {
100
- $oOrder->loadByIncrementId((int)$_POST['orderid']);
101
  $oOrder->registerCancellation($this->__('DIBSPW_LABEL_20'));
102
  $oOrder->save();
103
-
104
- // Add items back on stock (if used)
105
- $this->oDibsModel->removeFromStock();
106
  $this->oDibsModel->api_dibs_action_cancel();
107
  }
108
- // Give back cart to customer for new attempt to buy
109
  Mage::app()->getFrontController()->getResponse()->setRedirect(
110
  $this->oDibsModel->helper_dibs_tools_url('sales/order/history')
111
  );
112
  }
113
 
 
 
 
114
  protected function _expireAjax(){
115
  if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
116
  $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
@@ -118,39 +156,34 @@ class Dibspw_Dibspw_DibspwController extends Mage_Core_Controller_Front_Action {
118
  }
119
  }
120
 
 
 
 
 
 
 
 
121
  public function addToStock() {
122
- // Load the session object
123
- $session = Mage::getSingleton('checkout/session');
124
- $session->setDibspwStandardQuoteId($session->getQuoteId());
125
 
126
  $oOrder = Mage::getModel('sales/order');
127
- $oOrder->loadByIncrementId($session->getLastRealOrderId());
128
 
129
- // add items back on stock
130
- // Put the order back on stock as it is not yet paid!
131
- // http://www.magentocommerce.com/wiki/groups/132/protx_form_-_subtracting_stock_on_successful_payment
132
-
133
  if (((int)$this->oDibsModel->getConfigData('handlestock')) == 1) {
134
- if(!isset($_SESSION['stock_removed']) ||
135
- $_SESSION['stock_removed'] != $session->getLastRealOrderId()) {
136
- /* Put the stock back on, we don't want it taken off yet */
137
- $items = $oOrder->getAllItems(); // Get all items from the order
138
- if ($items) {
139
- foreach($items as $item) {
140
- $quantity = $item->getQtyOrdered(); // get Qty ordered
141
- $product_id = $item->getProductId(); // get it's ID
142
- // Load the stock for this product
143
- $stock = Mage::getModel('cataloginventory/stock_item')
144
- ->loadByProduct($product_id);
145
- $stock->setQty($stock->getQty()+$quantity); // Set to new Qty
146
- $stock->save(); // Save
147
  continue;
148
  }
149
  }
150
-
151
- // Flag so that stock is only updated once!
152
- $_SESSION['stock_removed'] = $session->getLastRealOrderId();
153
 
 
154
  }
155
  }
156
  }
28
 
29
  private $oDibsModel;
30
 
31
+ /**
32
+ * Constructor aggrigates module's model to controller's field.
33
+ * (not a real constructor, Magento calls it automatically when it's needed)
34
+ */
35
  function _construct() {
36
  $this->oDibsModel= Mage::getModel('dibspw/Dibspw');
37
  }
38
 
39
+ /**
40
+ * Prepares redirect page data, add payment status information to order.
41
+ * Renders view to redirect customer.
42
+ * Adds comment to order history if it's not added before.
43
+ */
44
  public function redirectAction(){
45
+ $oSession = Mage::getSingleton('checkout/session');
46
+ $oSession->setDibspwQuoteId($oSession->getQuoteId());
 
47
 
48
  $oOrder = Mage::getModel('sales/order');
49
+ $oOrder->loadByIncrementId($oSession->getLastRealOrderId());
50
+
51
  $this->loadLayout();
52
  if($oOrder->getPayment() !== FALSE) {
53
  // Create the POST to DIBS (Inside Magento Checkout)
56
  // Create the POST to DIBS (In Separate "Blank" Window)
57
  // $this->getResponse()->setBody($this->getLayout()->createBlock('Dibspw/redirect')->toHtml());
58
 
59
+ // Save order comment if it's not already saved.
60
+ $sOrderComment = "";
61
  foreach($oOrder->getAllStatusHistory() as $oOrderStatusItem) {
62
  $sOrderComment = $oOrderStatusItem->getComment();
63
  break;
64
  }
65
+
66
  if($sOrderComment != $this->__('DIBSPW_LABEL_3')) {
67
  $oOrder->addStatusToHistory($oOrder->getStatus(), $this->__('DIBSPW_LABEL_3'));
68
  }
69
+
70
  $oOrder->save();
71
  // Add items back on stock (if used)
72
  $this->addToStock();
75
  $this->renderLayout();
76
  }
77
 
78
+ /**
79
+ * Processes success action with system API (data check, saving and order update)
80
+ * Redirects customer to appropriate view (Magento success page or order verification error page)
81
+ * Handle stock on success.
82
+ */
83
  public function successAction() {
84
+ $oSession = Mage::getSingleton('checkout/session');
85
+ $oSession->setQuoteId($oSession->getDibspwStandardQuoteId(true));
 
86
 
87
+ $iOrderId = (int)$this->getRequest()->getPost('orderid');
88
+ if(!empty($iOrderId)) {
89
+ $oOrder = Mage::getModel('sales/order');
90
+ $oOrder->loadByIncrementId($iOrderId);
91
+ if(!is_null($oOrder)) {
92
+ $iResult = $this->oDibsModel->api_dibs_action_success($oOrder);
93
+ if(!empty($iResult)) {
94
+ echo $this->oDibsModel->api_dibs_getFatalErrorPage($iResult);
95
+ exit;
96
+ }
97
+ else {
98
+ Mage::app()->getFrontController()->getResponse()->setRedirect(
99
+ $this->oDibsModel->helper_dibs_tools_url('checkout/onepage/success')
100
+ );
101
+ }
102
+ }
103
+ else {
104
+ echo $this->oDibsModel->api_dibs_getFatalErrorPage(2);
105
+ exit;
106
+ }
107
  }
108
  else {
109
+ echo $this->oDibsModel->api_dibs_getFatalErrorPage(1);
110
+ exit;
 
111
  }
112
  }
113
 
114
+ /**
115
+ * Processes server-to-server callback with system API.
116
+ * API checks order data and adds additional information about order to module's transactions
117
+ * log table.
118
+ */
119
  public function callbackAction() {
120
  $oOrder = Mage::getModel('sales/order');
121
  $this->oDibsModel->api_dibs_action_callback($oOrder);
122
  }
123
 
124
  /**
125
+ * Processes order cancelation with Magento API and module's API.
126
+ * sets appropriate status and order history comment.
127
+ * Redirects customer to orders history view.
128
  */
129
  public function cancelAction() {
130
+ $oSession = Mage::getSingleton('checkout/session');
131
+ $oSession->setQuoteId($oSession->getDibspwStandardQuoteId(true));
 
132
 
133
+ $iOrderId = (int)$this->getRequest()->getPost('orderid');
134
  $oOrder = Mage::getModel('sales/order');
135
+ $oOrder->loadByIncrementId($iOrderId);
136
+
137
+ if(!is_null($oOrder)) {
138
  $oOrder->registerCancellation($this->__('DIBSPW_LABEL_20'));
139
  $oOrder->save();
140
+ $this->oDibsModel->removeFromStock($iOrderId);
 
 
141
  $this->oDibsModel->api_dibs_action_cancel();
142
  }
143
+
144
  Mage::app()->getFrontController()->getResponse()->setRedirect(
145
  $this->oDibsModel->helper_dibs_tools_url('sales/order/history')
146
  );
147
  }
148
 
149
+ /**
150
+ * Checks Magento ajax session expiration status, sets appropriate header.
151
+ */
152
  protected function _expireAjax(){
153
  if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
154
  $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
156
  }
157
  }
158
 
159
+ /**
160
+ * Returns items to stock, depends on 'handlestock' module configuration option
161
+ * (needed to fix behavior, when Magento can decrease stock automatically before order is paid)
162
+ *
163
+ * Put the order back on stock as it is not yet paid!
164
+ * http://www.magentocommerce.com/wiki/groups/132/protx_form_-_subtracting_stock_on_successful_payment
165
+ */
166
  public function addToStock() {
167
+ $oSession = Mage::getSingleton('checkout/session');
168
+ $oSession->setDibspwStandardQuoteId($oSession->getQuoteId());
 
169
 
170
  $oOrder = Mage::getModel('sales/order');
171
+ $oOrder->loadByIncrementId($oSession->getLastRealOrderId());
172
 
 
 
 
 
173
  if (((int)$this->oDibsModel->getConfigData('handlestock')) == 1) {
174
+ if($oSession->getData('stock_removed') != $oSession->getLastRealOrderId()) {
175
+ $oItems = $oOrder->getAllItems();
176
+ if ($oItems) {
177
+ foreach($oItems as $oItem) {
178
+ $oStock = Mage::getModel('cataloginventory/stock_item')
179
+ ->loadByProduct($oItem->getProductId());
180
+ $oStock->setQty($oStock->getQty() + $oItem->getQtyOrdered());
181
+ $oStock->save();
 
 
 
 
 
182
  continue;
183
  }
184
  }
 
 
 
185
 
186
+ $oSession->setData('stock_removed', $oSession->getLastRealOrderId());
187
  }
188
  }
189
  }
app/code/community/Dibspw/Dibspw/etc/config.xml CHANGED
@@ -24,7 +24,7 @@
24
  <config>
25
  <modules>
26
  <Dibspw_Dibspw>
27
- <version>4.1.3</version>
28
  <depends>
29
  <Mage_Paygate />
30
  </depends>
@@ -121,11 +121,8 @@
121
  <order_status_after_payment>processing</order_status_after_payment>
122
  <DIBSPW_testmode>1</DIBSPW_testmode>
123
  <title>DIBS Payment Window | Secure Payment Services</title>
124
- <DIBSPW_uniq>no</DIBSPW_uniq>
125
- <DIBSPW_voucher>no</DIBSPW_voucher>
126
  <DIBSPW_fee>no</DIBSPW_fee>
127
  <DIBSPW_paytype>VISA,MC</DIBSPW_paytype>
128
- <DIBSPW_method>2</DIBSPW_method>
129
  <DIBSPW_lang>en_UK</DIBSPW_lang>
130
  <sendmailorderconfirmation>1</sendmailorderconfirmation>
131
  <dibspwlogos>DIBS</dibspwlogos>
@@ -133,6 +130,7 @@
133
  <DIBSPW_distr>empty</DIBSPW_distr>
134
  <sort_order>0</sort_order>
135
  <allowspecific>0</allowspecific>
 
136
  </Dibspw>
137
  </payment>
138
  </default>
24
  <config>
25
  <modules>
26
  <Dibspw_Dibspw>
27
+ <version>4.1.5</version>
28
  <depends>
29
  <Mage_Paygate />
30
  </depends>
121
  <order_status_after_payment>processing</order_status_after_payment>
122
  <DIBSPW_testmode>1</DIBSPW_testmode>
123
  <title>DIBS Payment Window | Secure Payment Services</title>
 
 
124
  <DIBSPW_fee>no</DIBSPW_fee>
125
  <DIBSPW_paytype>VISA,MC</DIBSPW_paytype>
 
126
  <DIBSPW_lang>en_UK</DIBSPW_lang>
127
  <sendmailorderconfirmation>1</sendmailorderconfirmation>
128
  <dibspwlogos>DIBS</dibspwlogos>
130
  <DIBSPW_distr>empty</DIBSPW_distr>
131
  <sort_order>0</sort_order>
132
  <allowspecific>0</allowspecific>
133
+ <min_order_total>0.01</min_order_total>
134
  </Dibspw>
135
  </payment>
136
  </default>
app/code/community/Dibspw/Dibspw/etc/system.xml CHANGED
@@ -63,15 +63,6 @@
63
  <show_in_website>1</show_in_website>
64
  <show_in_store>1</show_in_store>
65
  </DIBSPW_mid>
66
- <DIBSPW_method translate="label">
67
- <label>Payment Window</label>
68
- <frontend_type>select</frontend_type>
69
- <source_model>dibspw/system_config_source_paymentwindow</source_model>
70
- <sort_order>4</sort_order>
71
- <show_in_default>1</show_in_default>
72
- <show_in_website>1</show_in_website>
73
- <show_in_store>1</show_in_store>
74
- </DIBSPW_method>
75
  <DIBSPW_HMAC translate="label">
76
  <label>HMAC Key</label>
77
  <frontend_type>text</frontend_type>
@@ -107,24 +98,6 @@
107
  <show_in_website>1</show_in_website>
108
  <show_in_store>1</show_in_store>
109
  </DIBSPW_capturenow>
110
- <DIBSPW_voucher translate="label">
111
- <label>Voucher Usage (Mobile PW only)</label>
112
- <frontend_type>select</frontend_type>
113
- <source_model>dibspw/System_Config_Source_Dibsyesno</source_model>
114
- <sort_order>9</sort_order>
115
- <show_in_default>1</show_in_default>
116
- <show_in_website>1</show_in_website>
117
- <show_in_store>1</show_in_store>
118
- </DIBSPW_voucher>
119
- <DIBSPW_uniq translate="label">
120
- <label>Unique order ID (Mobile PW only)</label>
121
- <frontend_type>select</frontend_type>
122
- <source_model>dibspw/System_Config_Source_Dibsyesno</source_model>
123
- <sort_order>10</sort_order>
124
- <show_in_default>1</show_in_default>
125
- <show_in_website>1</show_in_website>
126
- <show_in_store>1</show_in_store>
127
- </DIBSPW_uniq>
128
  <DIBSPW_paytype translate="label">
129
  <label>Paytype</label>
130
  <frontend_type>text</frontend_type>
@@ -195,11 +168,27 @@
195
  <show_in_website>1</show_in_website>
196
  <show_in_store>1</show_in_store>
197
  </specificcountry>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  <sendmailorderconfirmation translate="label">
199
  <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>
200
  <frontend_type>select</frontend_type>
201
  <source_model>adminhtml/system_config_source_yesno</source_model>
202
- <sort_order>19</sort_order>
203
  <show_in_default>1</show_in_default>
204
  <show_in_website>1</show_in_website>
205
  <show_in_store>1</show_in_store>
@@ -208,7 +197,7 @@
208
  <label>Which logos to show</label>
209
  <frontend_type>multiselect</frontend_type>
210
  <source_model>dibspw/system_config_source_dibslogos</source_model>
211
- <sort_order>20</sort_order>
212
  <show_in_default>1</show_in_default>
213
  <show_in_website>1</show_in_website>
214
  <show_in_store>1</show_in_store>
@@ -217,7 +206,7 @@
217
  <label>Handle stock. The quantity purchased in stock will at first be decremented as the payment is made.</label>
218
  <frontend_type>select</frontend_type>
219
  <source_model>adminhtml/system_config_source_yesno</source_model>
220
- <sort_order>21</sort_order>
221
  <show_in_default>1</show_in_default>
222
  <show_in_website>1</show_in_website>
223
  <show_in_store>1</show_in_store>
@@ -225,7 +214,7 @@
225
  <sort_order translate="label">
226
  <label>Sort Order</label>
227
  <frontend_type>text</frontend_type>
228
- <sort_order>22</sort_order>
229
  <show_in_default>1</show_in_default>
230
  <show_in_website>1</show_in_website>
231
  <show_in_store>1</show_in_store>
63
  <show_in_website>1</show_in_website>
64
  <show_in_store>1</show_in_store>
65
  </DIBSPW_mid>
 
 
 
 
 
 
 
 
 
66
  <DIBSPW_HMAC translate="label">
67
  <label>HMAC Key</label>
68
  <frontend_type>text</frontend_type>
98
  <show_in_website>1</show_in_website>
99
  <show_in_store>1</show_in_store>
100
  </DIBSPW_capturenow>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  <DIBSPW_paytype translate="label">
102
  <label>Paytype</label>
103
  <frontend_type>text</frontend_type>
168
  <show_in_website>1</show_in_website>
169
  <show_in_store>1</show_in_store>
170
  </specificcountry>
171
+ <min_order_total translate="label">
172
+ <label>Min. order total</label>
173
+ <frontend_type>text</frontend_type>
174
+ <sort_order>19</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>1</show_in_store>
178
+ </min_order_total>
179
+ <max_order_total translate="label">
180
+ <label>Max. order total</label>
181
+ <frontend_type>text</frontend_type>
182
+ <sort_order>20</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>1</show_in_store>
186
+ </max_order_total>
187
  <sendmailorderconfirmation translate="label">
188
  <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>
189
  <frontend_type>select</frontend_type>
190
  <source_model>adminhtml/system_config_source_yesno</source_model>
191
+ <sort_order>21</sort_order>
192
  <show_in_default>1</show_in_default>
193
  <show_in_website>1</show_in_website>
194
  <show_in_store>1</show_in_store>
197
  <label>Which logos to show</label>
198
  <frontend_type>multiselect</frontend_type>
199
  <source_model>dibspw/system_config_source_dibslogos</source_model>
200
+ <sort_order>22</sort_order>
201
  <show_in_default>1</show_in_default>
202
  <show_in_website>1</show_in_website>
203
  <show_in_store>1</show_in_store>
206
  <label>Handle stock. The quantity purchased in stock will at first be decremented as the payment is made.</label>
207
  <frontend_type>select</frontend_type>
208
  <source_model>adminhtml/system_config_source_yesno</source_model>
209
+ <sort_order>23</sort_order>
210
  <show_in_default>1</show_in_default>
211
  <show_in_website>1</show_in_website>
212
  <show_in_store>1</show_in_store>
214
  <sort_order translate="label">
215
  <label>Sort Order</label>
216
  <frontend_type>text</frontend_type>
217
+ <sort_order>24</sort_order>
218
  <show_in_default>1</show_in_default>
219
  <show_in_website>1</show_in_website>
220
  <show_in_store>1</show_in_store>
app/code/community/Dibspw/Dibspw/sql/dibspw_setup/mysql4-upgrade-4.1.2-4.1.3.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Dibs A/S
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 Dibspw_Dibspw
19
- * @author Dibs A/S
20
- * @copyright Copyright (c) 2010 Dibs A/S. (http://www.dibs.dk/)
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
- $sTableName_CoreResource = Mage::getSingleton('core/resource')->getTableName('core_resource');
32
- $sTableName_SalesFlatOrderPayment = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_payment');
33
- $sTablePrefix = Mage::getConfig()->getTablePrefix();
34
- $installer->run("
35
- delete from " . $sTableName_CoreResource . " where code = 'dibspw_setup';
36
- CREATE TABLE IF NOT EXISTS `" . $sTablePrefix . "dibspw_results` (
37
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
38
- `orderid` varchar(100) NOT NULL DEFAULT '',
39
- `status` varchar(10) NOT NULL DEFAULT '0',
40
- `testmode` tinyint(1) unsigned NOT NULL DEFAULT '0',
41
- `transaction` varchar(100) NOT NULL DEFAULT '',
42
- `amount` int(10) unsigned NOT NULL DEFAULT '0',
43
- `currency` smallint(3) unsigned NOT NULL DEFAULT '0',
44
- `fee` int(10) unsigned NOT NULL DEFAULT '0',
45
- `paytype` varchar(32) NOT NULL DEFAULT '',
46
- `voucheramount` int(10) unsigned NOT NULL DEFAULT '0',
47
- `amountoriginal` int(10) unsigned NOT NULL DEFAULT '0',
48
- `ext_info` text,
49
- `validationerrors` text,
50
- `capturestatus` varchar(10) NOT NULL DEFAULT '0',
51
- `actioncode` varchar(20) NOT NULL DEFAULT '',
52
- `success_action` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0 = NotPerformed, 1 = Performed',
53
- `cancel_action` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0 = NotPerformed, 1 = Performed',
54
- `callback_action` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0 = NotPerformed, 1 = Performed',
55
- `success_error` varchar(100) NOT NULL DEFAULT '',
56
- `callback_error` varchar(100) NOT NULL DEFAULT '',
57
- `sysmod` varchar(10) NOT NULL DEFAULT '',
58
- PRIMARY KEY (`id`),
59
- KEY `orderid` (`orderid`)
60
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
61
- UPDATE " . $sTableName_SalesFlatOrderPayment . " SET method='Dibspw' WHERE method='dibspw_standard';
62
- ");
63
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Dibspw/Dibspw/sql/dibspw_setup/{mysql4-install-4.1.3.php → mysql5-install-4.1.5.php} RENAMED
File without changes
app/design/frontend/base/default/template/dibspw/dibspw/redirect.phtml CHANGED
@@ -25,10 +25,10 @@ $oPaymate = Mage::getModel('dibspw/Dibspw');
25
  $aDibsparmeter = $oPaymate->getCheckoutFormFields();
26
  ?>
27
  <h2><?php echo $this->__('DIBSPW_LABEL_24') ?></h2>
28
- <form method="post" id="dibspw-payment" action ="<?php echo $oPaymate->api_dibs_get_formAction() ?>">
29
  <div>
30
  <?php foreach($aDibsparmeter as $sField => $sVal) {?>
31
- <input type="hidden" name="<?php echo $sField ?>" value="<?php echo $sVal ?>" />
32
  <?php } ?>
33
  </div>
34
  </form>
25
  $aDibsparmeter = $oPaymate->getCheckoutFormFields();
26
  ?>
27
  <h2><?php echo $this->__('DIBSPW_LABEL_24') ?></h2>
28
+ <form method="post" id="dibspw-payment" action ="<?php echo dibs_pw_api::api_dibs_get_formAction(); ?>">
29
  <div>
30
  <?php foreach($aDibsparmeter as $sField => $sVal) {?>
31
+ <input type="hidden" name="<?php echo $sField; ?>" value="<?php echo htmlentities($sVal); ?>" />
32
  <?php } ?>
33
  </div>
34
  </form>
app/locale/da_DK/Mage_Dibspw.csv CHANGED
@@ -34,4 +34,7 @@
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
- "dibspw_txt_msg_errmsg", "Error message:"
 
 
 
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
+ "dibspw_txt_msg_errmsg", "Error message:"
38
+ "dibspw_txt_msg_discount_total", "Discount Total"
39
+ "dibspw_txt_msg_shipping_total", "Shipping Total"
40
+ "dibspw_txt_msg_tax_total", "Tax Total"
app/locale/en_US/Mage_Dibspw.csv CHANGED
@@ -34,4 +34,7 @@
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
- "dibspw_txt_msg_errmsg", "Error message:"
 
 
 
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
+ "dibspw_txt_msg_errmsg", "Error message:"
38
+ "dibspw_txt_msg_discount_total", "Discount Total"
39
+ "dibspw_txt_msg_shipping_total", "Shipping Total"
40
+ "dibspw_txt_msg_tax_total", "Tax Total"
app/locale/nb_NO/Mage_Dibspw.csv CHANGED
@@ -34,4 +34,7 @@
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
- "dibspw_txt_msg_errmsg", "Error message:"
 
 
 
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
+ "dibspw_txt_msg_errmsg", "Error message:"
38
+ "dibspw_txt_msg_discount_total", "Discount Total"
39
+ "dibspw_txt_msg_shipping_total", "Shipping Total"
40
+ "dibspw_txt_msg_tax_total", "Tax Total"
app/locale/nn_NO/Mage_Dibspw.csv CHANGED
@@ -34,4 +34,7 @@
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
- "dibspw_txt_msg_errmsg", "Error message:"
 
 
 
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
+ "dibspw_txt_msg_errmsg", "Error message:"
38
+ "dibspw_txt_msg_discount_total", "Discount Total"
39
+ "dibspw_txt_msg_shipping_total", "Shipping Total"
40
+ "dibspw_txt_msg_tax_total", "Tax Total"
app/locale/sv_SE/Mage_Dibspw.csv CHANGED
@@ -34,4 +34,7 @@
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
- "dibspw_txt_msg_errmsg", "Error message:"
 
 
 
34
  "dibspw_txt_err_7", "The fingerprint key does not match."
35
  "dibspw_txt_msg_toshop", "Return to shop"
36
  "dibspw_txt_msg_errcode", "Error code:"
37
+ "dibspw_txt_msg_errmsg", "Error message:"
38
+ "dibspw_txt_msg_discount_total", "Discount Total"
39
+ "dibspw_txt_msg_shipping_total", "Shipping Total"
40
+ "dibspw_txt_msg_tax_total", "Tax Total"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Dibspw</name>
4
- <version>4.1.3</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>
@@ -33,7 +33,20 @@ Card types accepted by the DIBS payment gateway:&#xD;
33
  - Nordea e-betaling&#xD;
34
  &#xD;
35
  A complete list can be found at http://www.dibspayment.com/</description>
36
- <notes>4.1.3&#xD;
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  - Removed protected Magento statuses from module configuration page (Closed, Completed)&#xD;
38
  - Fixed possible problems running extension on Windows-hosted Magento&#xD;
39
  - Page after cancel operation changed to orders list (instead of empty cart)&#xD;
@@ -60,9 +73,9 @@ A complete list can be found at http://www.dibspayment.com/</description>
60
  4.1.0&#xD;
61
  - New module for DIBS Payment Window and Mobile Payment Window integration methods.</notes>
62
  <authors><author><name>DIBS A/S</name><user>niso</user><email>info@dibs.dk</email></author><author><name>DIBS A/S</name><user>dibs</user><email>vlya@dibs.dk</email></author></authors>
63
- <date>2012-05-29</date>
64
- <time>09:12:05</time>
65
- <contents><target name="magecommunity"><dir name="Dibspw"><dir name="Dibspw"><dir name="Block"><file name="Failure.php" hash="17e6a66c34637fac033d3e04c9e6a45e"/><file name="Form.php" hash="ac2155fe9ed943a258118dfb127ea30f"/><file name="Info.php" hash="aac79075c0ac7a5e40951066d905dd81"/><file name="Redirect.php" hash="b67600699025f99eaadb6cc7f27b42b1"/></dir><dir name="Helper"><file name="Data.php" hash="3ac20dd79b0d2e0cc1609f6b65d330c5"/></dir><dir name="Model"><file name="Dibspw.php" hash="0898bd3d28ed17af8ba814db99270369"/><dir name="Mysql4"><file name="Setup.php" hash="1c135886bc8a0794310ec7cb70e04e64"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Dibslogos.php" hash="d6cb9db1bd11f8cb40f79fc20fa9c44d"/><file name="Dibspaytypes.php" hash="7efbab315ad0cbdad7149f38c4a155d5"/><file name="Dibsyesno.php" hash="bd2708b2993a928f07215f09ba500094"/><file name="Lang.php" hash="80bf6fdae3628913d10b46f60608c517"/><file name="Orderstatusafter.php" hash="b2f27bddca028be1769051c5b191f1cc"/><file name="Orderstatusbefore.php" hash="e5ff243f2f310609465310c3719327d3"/><file name="PBBdistribution.php" hash="670ced20a731d657081ab720ad9bbc7a"/><file name="Paymentwindow.php" hash="80f8f2fe024830e81c418b930bca544c"/></dir></dir></dir><dir name="dibs_api"><dir name="pw"><file name="dibs_pw_api.php" hash="e49aac73131e92567e6c60323a6daad5"/><file name="dibs_pw_helpers.php" hash="3129cd863c5598a1780351825e82a851"/><file name="dibs_pw_helpers_cms.php" hash="8cf27737fbb3411c89219f9c6be0b43e"/><file name="dibs_pw_helpers_interface.php" hash="17a79ee1e27fdd1c6590c07133ba8c04"/><dir name="tmpl"><file name="dibs_pw_error" hash="7f82ad3b9f30425d21cc8991d7c90bf5"/></dir></dir></dir></dir><dir name="controllers"><file name="DibspwController.php" hash="56f56627a159bf4b02031906d6cee932"/></dir><dir name="etc"><file name="config.xml" hash="591b2e5136ef3de2c254a661726972e7"/><file name="system.xml" hash="5ed505376ffa018db94d117c888dbe2b"/></dir><dir name="sql"><dir name="dibspw_setup"><file name="mysql4-install-4.1.3.php" hash="0bbcb740b5a1d9d23a5293490224bf70"/><file name="mysql4-upgrade-4.1.2-4.1.3.php" hash="0bbcb740b5a1d9d23a5293490224bf70"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dibspw_Dibspw.xml" hash="7c82595e6638c292f71a0ad5be4ecaf0"/></dir></target><target name="magelocale"><dir name="da_DK"><file name="Mage_Dibspw.csv" hash="0b55bcb08d4458f3632b3a412fb2ddd0"/></dir><dir name="en_US"><file name="Mage_Dibspw.csv" hash="3e594e54c13359360c83654fedb95ca3"/></dir><dir name="nb_NO"><file name="Mage_Dibspw.csv" hash="9f6d270cc121b8d8dcc37f90d8d1f239"/></dir><dir name="nn_NO"><file name="Mage_Dibspw.csv" hash="0cc0358a2be76cbfeac641fc2c87139c"/></dir><dir name="sv_SE"><file name="Mage_Dibspw.csv" hash="193932d6d644cec94d2bd0116cacd3b7"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="dibspw"><dir name="dibspw"><file name="failure.phtml" hash="f5a7ed44946651f7ad4b1beeca7499be"/><file name="form.phtml" hash="c101fa3c34271f92a8276e76310dd98f"/><file name="redirect.phtml" hash="b85fe4f98a059d3048738678299281c6"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="Dibspw"><dir name="Dibspw"><file name="aktia.gif" hash="7afe00b19b4194fa4ffbdf20cdd469c1"/><file name="amex.gif" hash="f35f89ccdcb954e02a07f6c0a29c7b43"/><file name="bax.gif" hash="c315574fd839dae52a1316b6d8b836b6"/><file name="dibs.gif" hash="8b308757472fc5aaaedfefd5c79a2d54"/><file name="din.gif" hash="fabce04659a94993a230285b9a4651e9"/><file name="dk.gif" hash="daa5d5d2c0d541579b0e13aa3cd9d65b"/><file name="dnb.gif" hash="1f616c382b72248334f6aa1ca910003b"/><file name="edk.gif" hash="4485910a0fb40512233c1a59ddd31015"/><file name="elec.gif" hash="e5371ba0da9bb14990d1b8163cedd066"/><file name="elv.gif" hash="3bd20355343bd250a6a704fdbaf9ba62"/><file name="ew.gif" hash="b50385f7d878be6a3834310d1fbc3a1d"/><file name="ffk.gif" hash="d9cd7fa26230a850114b2dc99aea3b22"/><file name="fsb.gif" hash="d6da3e67f8096811c2ad0135b2aad80a"/><file name="git.gif" hash="b70e244f36e7aec94fe3f6373e1ae8d7"/><file name="ing.gif" hash="40f07b266bcd5953bb6c079f7eeaae67"/><file name="jcb.gif" hash="aea8c54e043a75b26887fa1307ad4312"/><file name="jcbsecure.gif" hash="1c687214f79b73d7e99f5011c9c22bce"/><file name="loading.gif" hash="7e99e1159a3686f6aa4f90043c554483"/><file name="mc.gif" hash="2680e078159e5aedb561c3a705801a44"/><file name="mcsecure.gif" hash="730735c1e2d36d9fa3bd6468fa0b1a7d"/><file name="moca.gif" hash="befd2f10976c0ab40333f01fc6db4743"/><file name="mtro.gif" hash="d5df5f7986a21bf5a78b9c7a3656facd"/><file name="oko.gif" hash="1cde3c12036ebd74a643aee2ffb0513a"/><file name="pbb.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pbbtest.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pci.gif" hash="b55a87df550ea6789c17e389604e28e1"/><file name="seb.gif" hash="502b1dbeb81bce51abd1ea149d4dde14"/><file name="shb.gif" hash="0aa7c7fab4133ff4843c0ae73cabe9de"/><file name="solo.gif" hash="17b9be1a06125dcc7d1a6be8fea38dd6"/><file name="val.gif" hash="e62b75eb172934e118a70366baac51ee"/><file name="visa.gif" hash="b61251f8c428aa5dca017c9f374957ef"/><file name="visasecure.gif" hash="517118742fce249485c8eaf6df174764"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="Dibspw"><dir name="Dibspw"><file name="aktia.gif" hash="7afe00b19b4194fa4ffbdf20cdd469c1"/><file name="amex.gif" hash="f35f89ccdcb954e02a07f6c0a29c7b43"/><file name="bax.gif" hash="c315574fd839dae52a1316b6d8b836b6"/><file name="dibs.gif" hash="8b308757472fc5aaaedfefd5c79a2d54"/><file name="din.gif" hash="fabce04659a94993a230285b9a4651e9"/><file name="dk.gif" hash="daa5d5d2c0d541579b0e13aa3cd9d65b"/><file name="dnb.gif" hash="1f616c382b72248334f6aa1ca910003b"/><file name="edk.gif" hash="4485910a0fb40512233c1a59ddd31015"/><file name="elec.gif" hash="e5371ba0da9bb14990d1b8163cedd066"/><file name="elv.gif" hash="3bd20355343bd250a6a704fdbaf9ba62"/><file name="ew.gif" hash="b50385f7d878be6a3834310d1fbc3a1d"/><file name="ffk.gif" hash="d9cd7fa26230a850114b2dc99aea3b22"/><file name="fsb.gif" hash="d6da3e67f8096811c2ad0135b2aad80a"/><file name="git.gif" hash="b70e244f36e7aec94fe3f6373e1ae8d7"/><file name="ing.gif" hash="40f07b266bcd5953bb6c079f7eeaae67"/><file name="jcb.gif" hash="aea8c54e043a75b26887fa1307ad4312"/><file name="jcbsecure.gif" hash="1c687214f79b73d7e99f5011c9c22bce"/><file name="loading.gif" hash="7e99e1159a3686f6aa4f90043c554483"/><file name="mc.gif" hash="2680e078159e5aedb561c3a705801a44"/><file name="mcsecure.gif" hash="730735c1e2d36d9fa3bd6468fa0b1a7d"/><file name="moca.gif" hash="befd2f10976c0ab40333f01fc6db4743"/><file name="mtro.gif" hash="d5df5f7986a21bf5a78b9c7a3656facd"/><file name="oko.gif" hash="1cde3c12036ebd74a643aee2ffb0513a"/><file name="pbb.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pbbtest.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pci.gif" hash="b55a87df550ea6789c17e389604e28e1"/><file name="seb.gif" hash="502b1dbeb81bce51abd1ea149d4dde14"/><file name="shb.gif" hash="0aa7c7fab4133ff4843c0ae73cabe9de"/><file name="solo.gif" hash="17b9be1a06125dcc7d1a6be8fea38dd6"/><file name="val.gif" hash="e62b75eb172934e118a70366baac51ee"/><file name="visa.gif" hash="b61251f8c428aa5dca017c9f374957ef"/><file name="visasecure.gif" hash="517118742fce249485c8eaf6df174764"/></dir></dir></dir></dir></dir></dir></target></contents>
66
  <compatible/>
67
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
68
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Dibspw</name>
4
+ <version>4.1.5</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>
33
  - Nordea e-betaling&#xD;
34
  &#xD;
35
  A complete list can be found at http://www.dibspayment.com/</description>
36
+ <notes>
37
+ 4.1.5&#xD;
38
+ - Fixed bug with double quoted items names&#xD;
39
+ - Fixed bug with HMAC code&#xD;
40
+ - Added compatibility with compilation mode&#xD;
41
+ - Added instruction for resolving problem with MAC code error&#xD;
42
+
43
+ &#xD;
44
+ 4.1.4&#xD;
45
+ - Added Magento coupons support&#xD;
46
+ - Fixed possible rounding issues&#xD;
47
+ - Removed Mobile Payment Window, now DIBS Payment Window can automatically scale to different screen sizes.&#xD;
48
+ &#xD;
49
+ 4.1.3&#xD;
50
  - Removed protected Magento statuses from module configuration page (Closed, Completed)&#xD;
51
  - Fixed possible problems running extension on Windows-hosted Magento&#xD;
52
  - Page after cancel operation changed to orders list (instead of empty cart)&#xD;
73
  4.1.0&#xD;
74
  - New module for DIBS Payment Window and Mobile Payment Window integration methods.</notes>
75
  <authors><author><name>DIBS A/S</name><user>niso</user><email>info@dibs.dk</email></author><author><name>DIBS A/S</name><user>dibs</user><email>vlya@dibs.dk</email></author></authors>
76
+ <date>2012-06-25</date>
77
+ <time>08:03:39</time>
78
+ <contents><target name="magecommunity"><dir name="Dibspw"><dir name="Dibspw"><dir name="Block"><file name="Failure.php" hash="17e6a66c34637fac033d3e04c9e6a45e"/><file name="Form.php" hash="ac2155fe9ed943a258118dfb127ea30f"/><file name="Info.php" hash="aac79075c0ac7a5e40951066d905dd81"/><file name="Redirect.php" hash="b67600699025f99eaadb6cc7f27b42b1"/></dir><dir name="Helper"><file name="Data.php" hash="3ac20dd79b0d2e0cc1609f6b65d330c5"/></dir><dir name="Model"><file name="Dibspw.php" hash="0898bd3d28ed17af8ba814db99270369"/><dir name="Mysql4"><file name="Setup.php" hash="1c135886bc8a0794310ec7cb70e04e64"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Dibslogos.php" hash="d6cb9db1bd11f8cb40f79fc20fa9c44d"/><file name="Dibspaytypes.php" hash="7efbab315ad0cbdad7149f38c4a155d5"/><file name="Dibsyesno.php" hash="bd2708b2993a928f07215f09ba500094"/><file name="Lang.php" hash="80bf6fdae3628913d10b46f60608c517"/><file name="Orderstatusafter.php" hash="b2f27bddca028be1769051c5b191f1cc"/><file name="Orderstatusbefore.php" hash="e5ff243f2f310609465310c3719327d3"/><file name="PBBdistribution.php" hash="670ced20a731d657081ab720ad9bbc7a"/></dir></dir></dir><dir name="dibs_api"><dir name="pw"><file name="dibs_pw_api.php" hash="e86b0c39041f5b58a8faa9fde9b861f1"/><file name="dibs_pw_helpers.php" hash="9acf5ba8a2d79ef198dccce8f07c18ed"/><file name="dibs_pw_helpers_cms.php" hash="55f88efa959ad36f438313e94b3ce90b"/><file name="dibs_pw_helpers_interface.php" hash="17a79ee1e27fdd1c6590c07133ba8c04"/><dir name="tmpl"><file name="dibs_pw_error" hash="7f82ad3b9f30425d21cc8991d7c90bf5"/></dir></dir></dir></dir><dir name="controllers"><file name="DibspwController.php" hash="2d596e8dba502511e5894d5adc04e7d3"/></dir><dir name="etc"><file name="config.xml" hash="215382b0800fc98ee55021e7656517b3"/><file name="system.xml" hash="56269fd456c10d6e491f935d86350707"/></dir><dir name="sql"><dir name="dibspw_setup"><file name="mysql4-install-4.1.4.php" hash="0bbcb740b5a1d9d23a5293490224bf70"/><file name="mysql4-upgrade-4.1.3-4.1.4.php" hash="0bbcb740b5a1d9d23a5293490224bf70"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dibspw_Dibspw.xml" hash="7c82595e6638c292f71a0ad5be4ecaf0"/></dir></target><target name="magelocale"><dir name="da_DK"><file name="Mage_Dibspw.csv" hash="eb361c88a3c24cc13471eadde4637dd3"/></dir><dir name="en_US"><file name="Mage_Dibspw.csv" hash="3acbdcdc0c8b8764786f85b0e9d7ed7c"/></dir><dir name="nb_NO"><file name="Mage_Dibspw.csv" hash="cabb502e57de177d8949e7f90a5310a7"/></dir><dir name="nn_NO"><file name="Mage_Dibspw.csv" hash="eb9fd99ef73be26d112ffbc53ca8dab5"/></dir><dir name="sv_SE"><file name="Mage_Dibspw.csv" hash="a588b3fc332f095788e8a85aa6544ee9"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="dibspw"><dir name="dibspw"><file name="failure.phtml" hash="f5a7ed44946651f7ad4b1beeca7499be"/><file name="form.phtml" hash="c101fa3c34271f92a8276e76310dd98f"/><file name="redirect.phtml" hash="eed6bee864f5e88bd18d52ddfa308a3d"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="Dibspw"><dir name="Dibspw"><file name="aktia.gif" hash="7afe00b19b4194fa4ffbdf20cdd469c1"/><file name="amex.gif" hash="f35f89ccdcb954e02a07f6c0a29c7b43"/><file name="bax.gif" hash="c315574fd839dae52a1316b6d8b836b6"/><file name="dibs.gif" hash="8b308757472fc5aaaedfefd5c79a2d54"/><file name="din.gif" hash="fabce04659a94993a230285b9a4651e9"/><file name="dk.gif" hash="daa5d5d2c0d541579b0e13aa3cd9d65b"/><file name="dnb.gif" hash="1f616c382b72248334f6aa1ca910003b"/><file name="edk.gif" hash="4485910a0fb40512233c1a59ddd31015"/><file name="elec.gif" hash="e5371ba0da9bb14990d1b8163cedd066"/><file name="elv.gif" hash="3bd20355343bd250a6a704fdbaf9ba62"/><file name="ew.gif" hash="b50385f7d878be6a3834310d1fbc3a1d"/><file name="ffk.gif" hash="d9cd7fa26230a850114b2dc99aea3b22"/><file name="fsb.gif" hash="d6da3e67f8096811c2ad0135b2aad80a"/><file name="git.gif" hash="b70e244f36e7aec94fe3f6373e1ae8d7"/><file name="ing.gif" hash="40f07b266bcd5953bb6c079f7eeaae67"/><file name="jcb.gif" hash="aea8c54e043a75b26887fa1307ad4312"/><file name="jcbsecure.gif" hash="1c687214f79b73d7e99f5011c9c22bce"/><file name="loading.gif" hash="7e99e1159a3686f6aa4f90043c554483"/><file name="mc.gif" hash="2680e078159e5aedb561c3a705801a44"/><file name="mcsecure.gif" hash="730735c1e2d36d9fa3bd6468fa0b1a7d"/><file name="moca.gif" hash="befd2f10976c0ab40333f01fc6db4743"/><file name="mtro.gif" hash="d5df5f7986a21bf5a78b9c7a3656facd"/><file name="oko.gif" hash="1cde3c12036ebd74a643aee2ffb0513a"/><file name="pbb.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pbbtest.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pci.gif" hash="b55a87df550ea6789c17e389604e28e1"/><file name="seb.gif" hash="502b1dbeb81bce51abd1ea149d4dde14"/><file name="shb.gif" hash="0aa7c7fab4133ff4843c0ae73cabe9de"/><file name="solo.gif" hash="17b9be1a06125dcc7d1a6be8fea38dd6"/><file name="val.gif" hash="e62b75eb172934e118a70366baac51ee"/><file name="visa.gif" hash="b61251f8c428aa5dca017c9f374957ef"/><file name="visasecure.gif" hash="517118742fce249485c8eaf6df174764"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="Dibspw"><dir name="Dibspw"><file name="aktia.gif" hash="7afe00b19b4194fa4ffbdf20cdd469c1"/><file name="amex.gif" hash="f35f89ccdcb954e02a07f6c0a29c7b43"/><file name="bax.gif" hash="c315574fd839dae52a1316b6d8b836b6"/><file name="dibs.gif" hash="8b308757472fc5aaaedfefd5c79a2d54"/><file name="din.gif" hash="fabce04659a94993a230285b9a4651e9"/><file name="dk.gif" hash="daa5d5d2c0d541579b0e13aa3cd9d65b"/><file name="dnb.gif" hash="1f616c382b72248334f6aa1ca910003b"/><file name="edk.gif" hash="4485910a0fb40512233c1a59ddd31015"/><file name="elec.gif" hash="e5371ba0da9bb14990d1b8163cedd066"/><file name="elv.gif" hash="3bd20355343bd250a6a704fdbaf9ba62"/><file name="ew.gif" hash="b50385f7d878be6a3834310d1fbc3a1d"/><file name="ffk.gif" hash="d9cd7fa26230a850114b2dc99aea3b22"/><file name="fsb.gif" hash="d6da3e67f8096811c2ad0135b2aad80a"/><file name="git.gif" hash="b70e244f36e7aec94fe3f6373e1ae8d7"/><file name="ing.gif" hash="40f07b266bcd5953bb6c079f7eeaae67"/><file name="jcb.gif" hash="aea8c54e043a75b26887fa1307ad4312"/><file name="jcbsecure.gif" hash="1c687214f79b73d7e99f5011c9c22bce"/><file name="loading.gif" hash="7e99e1159a3686f6aa4f90043c554483"/><file name="mc.gif" hash="2680e078159e5aedb561c3a705801a44"/><file name="mcsecure.gif" hash="730735c1e2d36d9fa3bd6468fa0b1a7d"/><file name="moca.gif" hash="befd2f10976c0ab40333f01fc6db4743"/><file name="mtro.gif" hash="d5df5f7986a21bf5a78b9c7a3656facd"/><file name="oko.gif" hash="1cde3c12036ebd74a643aee2ffb0513a"/><file name="pbb.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pbbtest.gif" hash="fff306c0ea2e7568eef562ec3dc6edd8"/><file name="pci.gif" hash="b55a87df550ea6789c17e389604e28e1"/><file name="seb.gif" hash="502b1dbeb81bce51abd1ea149d4dde14"/><file name="shb.gif" hash="0aa7c7fab4133ff4843c0ae73cabe9de"/><file name="solo.gif" hash="17b9be1a06125dcc7d1a6be8fea38dd6"/><file name="val.gif" hash="e62b75eb172934e118a70366baac51ee"/><file name="visa.gif" hash="b61251f8c428aa5dca017c9f374957ef"/><file name="visasecure.gif" hash="517118742fce249485c8eaf6df174764"/></dir></dir></dir></dir></dir></dir></target></contents>
79
  <compatible/>
80
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
81
  </package>