Dibspw - Version 4.1.9

Version Notes

4.1.9
- bugfixing release
4.1.8
- added support of Bundle Products
4.1.7
- utf encoding fixed
4.1.6
- 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.5
-Development


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.9
Comparing to
See all releases


Code changes from version 4.1.8 to 4.1.9

app/code/community/Dibspw/Dibspw/Model/Dibspw.php CHANGED
@@ -31,7 +31,7 @@ class Dibspw_Dibspw_Model_Dibspw extends dibs_pw_api {
31
  parent::validate();
32
  $sCurrencyCode = Mage::getSingleton('checkout/session')->getQuote()->getBaseCurrencyCode();
33
  if (!array_key_exists($sCurrencyCode, dibs_pw_api::api_dibs_get_currencyArray())) {
34
- Mage::throwException(Mage::helper('Dibspw')->__('Selected currency code (' .
35
  $sCurrencyCode . ') is not compatabile with Dibs'));
36
  }
37
  return $this;
31
  parent::validate();
32
  $sCurrencyCode = Mage::getSingleton('checkout/session')->getQuote()->getBaseCurrencyCode();
33
  if (!array_key_exists($sCurrencyCode, dibs_pw_api::api_dibs_get_currencyArray())) {
34
+ Mage::throwException(Mage::helper('dibspw')->__('Selected currency code (' .
35
  $sCurrencyCode . ') is not compatabile with Dibs'));
36
  }
37
  return $this;
app/code/community/Dibspw/Dibspw/Model/dibs_api/pw/dibs_pw_api.php CHANGED
@@ -51,53 +51,57 @@ class dibs_pw_api extends dibs_pw_helpers {
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',
61
- 'BBD' => '052','BDT' => '050','BGL' => '100','BGN' => '975',
62
- 'BHD' => '048','BIF' => '108','BMD' => '060','BND' => '096',
63
- 'BOB' => '068','BOV' => '984','BRL' => '986','BSD' => '044',
64
- 'BTN' => '064','BWP' => '072','BYR' => '974','BZD' => '084',
65
- 'CAD' => '124','CDF' => '976','CHF' => '756','CLF' => '990',
66
- 'CLP' => '152','CNY' => '156','COP' => '170','CRC' => '188',
67
- 'CUP' => '192','CVE' => '132','CYP' => '196','CZK' => '203',
68
- 'DJF' => '262','DKK' => '208','DOP' => '214','DZD' => '012',
69
- 'ECS' => '218','ECV' => '983','EEK' => '233','EGP' => '818',
70
- 'ERN' => '232','ETB' => '230','EUR' => '978','FJD' => '242',
71
- 'FKP' => '238','GBP' => '826','GEL' => '981','GHC' => '288',
72
- 'GIP' => '292','GMD' => '270','GNF' => '324','GTQ' => '320',
73
- 'GWP' => '624','GYD' => '328','HKD' => '344','HNL' => '340',
74
- 'HRK' => '191','HTG' => '332','HUF' => '348','IDR' => '360',
75
- 'ILS' => '376','INR' => '356','IQD' => '368','IRR' => '364',
76
- 'ISK' => '352','JMD' => '388','JOD' => '400','JPY' => '392',
77
- 'KES' => '404','KGS' => '417','KHR' => '116','KMF' => '174',
78
- 'KPW' => '408','KRW' => '410','KWD' => '414','KYD' => '136',
79
- 'KZT' => '398','LAK' => '418','LBP' => '422','LKR' => '144',
80
- 'LRD' => '430','LSL' => '426','LTL' => '440','LVL' => '428',
81
- 'LYD' => '434','MAD' => '504','MDL' => '498','MGF' => '450',
82
- 'MKD' => '807','MMK' => '104','MNT' => '496','MOP' => '446',
83
- 'MRO' => '478','MTL' => '470','MUR' => '480','MVR' => '462',
84
- 'MWK' => '454','MXN' => '484','MXV' => '979','MYR' => '458',
85
- 'MZM' => '508','NAD' => '516','NGN' => '566','NIO' => '558',
86
- 'NOK' => '578','NPR' => '524','NZD' => '554','OMR' => '512',
87
- 'PAB' => '590','PEN' => '604','PGK' => '598','PHP' => '608',
88
- 'PKR' => '586','PLN' => '985','PYG' => '600','QAR' => '634',
89
- 'ROL' => '642','RUB' => '643','RUR' => '810','RWF' => '646',
90
- 'SAR' => '682','SBD' => '090','SCR' => '690','SDD' => '736',
91
- 'SEK' => '752','SGD' => '702','SHP' => '654','SIT' => '705',
92
- 'SKK' => '703','SLL' => '694','SOS' => '706','SRG' => '740',
93
- 'STD' => '678','SVC' => '222','SYP' => '760','SZL' => '748',
94
- 'THB' => '764','TJS' => '972','TMM' => '795','TND' => '788',
95
- 'TOP' => '776','TPE' => '626','TRL' => '792','TRY' => '949',
96
- 'TTD' => '780','TWD' => '901','TZS' => '834','UAH' => '980',
97
- 'UGX' => '800','USD' => '840','UYU' => '858','UZS' => '860',
98
- 'VEB' => '862','VND' => '704','VUV' => '548','XAF' => '950',
99
- 'XCD' => '951','XOF' => '952','XPF' => '953','YER' => '886',
100
- 'YUM' => '891','ZAR' => '710','ZMK' => '894','ZWD' => '716');
 
 
 
 
101
 
102
  /**
103
  * Returns CMS order common information converted to standardized order information objects.
@@ -142,7 +146,6 @@ class dibs_pw_api extends dibs_pw_helpers {
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
 
@@ -156,9 +159,10 @@ class dibs_pw_api extends dibs_pw_helpers {
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;
160
- $aData['merchant'] = $this->helper_dibs_tools_conf('mid');
161
- $aData['amount'] = self::api_dibs_round($oOrder->order->amount);
 
162
  $aData['currency'] = $oOrder->order->currency;
163
  $aData['language'] = $this->helper_dibs_tools_conf('lang');
164
  if((string)$this->helper_dibs_tools_conf('fee') == 'yes') $aData['addfee'] = 1;
@@ -184,25 +188,20 @@ class dibs_pw_api extends dibs_pw_helpers {
184
  private function api_dibs_invoiceFields(&$aData, $mOrderInfo) {
185
  $oOrder = $this->api_dibs_invoiceOrderObject($mOrderInfo);
186
  foreach($oOrder->addr as $sKey => $sVal) {
187
- //$sVal = trim($sVal);
188
- //if(!empty($sVal)) $aData[$sKey] = self::api_dibs_utf8Fix($sVal);
189
  $aData[$sKey] = $sVal;
190
-
191
  }
 
192
  $oOrder->items[] = $oOrder->ship;
193
  if(isset($oOrder->items) && count($oOrder->items) > 0) {
194
  $aData['oitypes'] = 'QUANTITY;UNITCODE;DESCRIPTION;AMOUNT;ITEMID';
195
-
196
  $aData['oinames'] = 'Qty;UnitCode;Description;Amount;ItemId';
197
-
198
  if(isset($oOrder->items[0]->tax)) {
199
  $aData['oitypes'] .= (self::$bTaxAmount ? ';VATAMOUNT' : ';VATPERCENT');
200
  $aData['oinames'] .= (self::$bTaxAmount ? ';VatAmount' : ';VatPercent');
201
  }
202
-
203
  $i = 1;
204
  foreach($oOrder->items as $oItem) {
205
- $iTmpPrice = self::api_dibs_round($oItem->price);
206
  if(!empty($iTmpPrice)) {
207
  $sTmpName = !empty($oItem->name) ? $oItem->name : $oItem->sku;
208
  if(empty($sTmpName)) $sTmpName = $oItem->id;
@@ -295,7 +294,7 @@ class dibs_pw_api extends dibs_pw_helpers {
295
 
296
  $iAmount = (isset($_POST['voucherAmount']) && $_POST['voucherAmount'] > 0) ?
297
  $_POST['amountOriginal'] : $_POST['amount'];
298
- if(abs((int)$iAmount - (int)self::api_dibs_round($mOrderInfo->amount)) >= 0.01) return 4;
299
 
300
  if((int)$mOrderInfo->currency != (int)$_POST['currency']) return 6;
301
 
@@ -454,19 +453,6 @@ class dibs_pw_api extends dibs_pw_helpers {
454
  foreach($aData as $sKey => $sVal) {
455
  $sData .= '&' . $sKey . '=' . (($bUrlDecode === TRUE) ? urldecode($sVal) : $sVal);
456
  }
457
-
458
-
459
- $str="";
460
- $str .= "array(";
461
-
462
- foreach( $tData as $k=>$v ){
463
- $str .= '"'.$k.'" =>'.'"'.$v.'"'.',';
464
- }
465
- $str .= ")";
466
- $fl = fopen("D:\\itwillbegood.txt" ,"w+");
467
- fputs( $fl, $str);
468
-
469
-
470
  $sMAC = hash_hmac('sha256', ltrim($sData, '&'), self::api_dibs_hextostr($sHMAC));
471
  }
472
 
@@ -491,7 +477,7 @@ class dibs_pw_api extends dibs_pw_helpers {
491
  *
492
  * @return string
493
  */
494
- final public function api_dibs_get_formAction() {
495
  return self::$sFormAction;
496
  }
497
 
@@ -520,13 +506,15 @@ class dibs_pw_api extends dibs_pw_helpers {
520
  * @param bool $bFlip If we need to flip self::$aCurrency array and look in another format.
521
  * @return string
522
  */
523
- final public static function api_dibs_get_currencyValue($sCode, $bFlip = FALSE) {
524
- $aCurrency = ($bFlip === TRUE) ? array_flip(self::api_dibs_get_currencyArray()) :
525
- self::api_dibs_get_currencyArray();
526
- return isset($aCurrency[$sCode]) ? $aCurrency[$sCode] :
527
- $aCurrency[self::$sDefaultCurr[$bFlip === TRUE ? 1 : 0]];
 
528
  }
529
 
 
530
  /**
531
  * Convert hex HMAC to string.
532
  *
51
  'capturestatus' => 'captureStatus');
52
 
53
  /**
54
+ * Array of currency's with of digits after the decimal separator.
55
  *
56
  * @var array
57
  */
58
+
59
+ private static $aCurrency = array(
60
+ 'AFA'=>array('004',2),'ALL'=>array('008',2),'AMD'=>array('051',2),'ANG'=>array('532',2),
61
+ 'AOA'=>array('973',2),'ARS'=>array('032',2),'AUD'=>array('036',2),'AWG'=>array('533',2),
62
+ 'BAM'=>array('977',2),'BBD'=>array('052',2),'BDT'=>array('050',2),'BGN'=>array('975',2),
63
+ 'BHD'=>array('048',3),'BIF'=>array('108',0),'BMD'=>array('060',2),'BND'=>array('096',2),
64
+ 'BOB'=>array('068',2),'BRL'=>array('986',2),'BSD'=>array('044',2),'BTN'=>array('064',2),
65
+ 'BWP'=>array('072',2),'BYR'=>array('974',0),'BZD'=>array('084',2),'CAD'=>array('124',2),
66
+ 'CDF'=>array('976',2),'CHF'=>array('756',2),'CLP'=>array('152',0),'CNY'=>array('156',2),
67
+ 'COP'=>array('170',2),'CRC'=>array('188',2),'CUP'=>array('192',2),'CVE'=>array('132',2),
68
+ 'CZK'=>array('203',2),'DJF'=>array('262',0),'DKK'=>array('208',2),'DOP'=>array('214',2),
69
+ 'DZD'=>array('012',2),'EGP'=>array('818',2),'ERN'=>array('232',2),'ETB'=>array('230',2),
70
+ 'EUR'=>array('978',2),'FJD'=>array('242',2),'FKP'=>array('238',2),'GBP'=>array('826',2),
71
+ 'GEL'=>array('981',2),'GIP'=>array('292',2),'GMD'=>array('270',2),'GNF'=>array('324',0),
72
+ 'GTQ'=>array('320',2),'GYD'=>array('328',2),'HKD'=>array('344',2),'HNL'=>array('340',2),
73
+ 'HRK'=>array('191',2),'HTG'=>array('332',2),'HUF'=>array('348',2),'IDR'=>array('360',2),
74
+ 'ILS'=>array('376',2),'INR'=>array('356',2),'IQD'=>array('368',3),'IRR'=>array('364',2),
75
+ 'ISK'=>array('352',0),'JMD'=>array('388',2),'JOD'=>array('400',3),'JPY'=>array('392',0),
76
+ 'KES'=>array('404',2),'KGS'=>array('417',2),'KHR'=>array('116',2),'KMF'=>array('174',0),
77
+ 'KPW'=>array('408',2),'KRW'=>array('410',0),'KWD'=>array('414',3),'KYD'=>array('136',2),
78
+ 'KZT'=>array('398',2),'LAK'=>array('418',2),'LBP'=>array('422',2),'LKR'=>array('144',2),
79
+ 'LRD'=>array('430',2),'LSL'=>array('426',2),'LTL'=>array('440',2),'LVL'=>array('428',2),
80
+ 'LYD'=>array('434',3),'MAD'=>array('504',2),'MDL'=>array('498',2),'MKD'=>array('807',2),
81
+ 'MMK'=>array('104',2),'MNT'=>array('496',2),'MOP'=>array('446',2),'MRO'=>array('478',0),
82
+ 'MUR'=>array('480',2),'MVR'=>array('462',2),'MWK'=>array('454',2),'MXN'=>array('484',2),
83
+ 'MYR'=>array('458',2),'NAD'=>array('516',2),'NGN'=>array('566',2),'NIO'=>array('558',2),
84
+ 'NOK'=>array('578',2),'NPR'=>array('524',2),'NZD'=>array('554',2),'OMR'=>array('512',3),
85
+ 'PAB'=>array('590',2),'PEN'=>array('604',2),'PGK'=>array('598',2),'PHP'=>array('608',2),
86
+ 'PKR'=>array('586',2),'PLN'=>array('985',2),'PYG'=>array('600',0),'QAR'=>array('634',2),
87
+ 'RUB'=>array('643',2),'RWF'=>array('646',0),'SAR'=>array('682',2),'SBD'=>array('090',2),
88
+ 'SCR'=>array('690',2),'SEK'=>array('752',2),'SGD'=>array('702',2),'SHP'=>array('654',2),
89
+ 'SLL'=>array('694',2),'SOS'=>array('706',2),'STD'=>array('678',2),'SVC'=>array('222',2),
90
+ 'SYP'=>array('760',2),'SZL'=>array('748',2),'THB'=>array('764',2),'TJS'=>array('972',2),
91
+ 'TND'=>array('788',3),'TOP'=>array('776',2),'TRY'=>array('949',2),'TTD'=>array('780',2),
92
+ 'TWD'=>array('901',2),'TZS'=>array('834',2),'UAH'=>array('980',2),'UGX'=>array('800',2),
93
+ 'USD'=>array('840',2),'UYU'=>array('858',2),'UZS'=>array('860',2),'VND'=>array('704',0),
94
+ 'VUV'=>array('548',0),'XAF'=>array('950',0),'XCD'=>array('951',2),'XOF'=>array('952',0),
95
+ 'XPF'=>array('953',0),'YER'=>array('886',2),'ZAR'=>array('710',2),'ZMK'=>array('894',2),
96
+ 'ADP'=>array('020',0),'AZM'=>array('031',0),'BGL'=>array('100',2),'BOV'=>array('984',2),
97
+ 'CLF'=>array('990',0),'CYP'=>array('196',2),'ECS'=>array('218',0),'ECV'=>array('983',0),
98
+ 'EEK'=>array('233',2),'GHC'=>array('288',0),'GWP'=>array('624',2),'MGF'=>array('450',0),
99
+ 'MTL'=>array('470',2),'MXV'=>array('979',2),'MZM'=>array('508',0),'ROL'=>array('642',2),
100
+ 'RUR'=>array('810',2),'SDD'=>array('736',0),'SIT'=>array('705',1),'SKK'=>array('703',1),
101
+ 'SRG'=>array('740',2),'TMM'=>array('795',0),'TPE'=>array('626',2),'TRL'=>array('792',0),
102
+ 'VEB'=>array('862',2),'YUM'=>array('891',2),'ZWD'=>array('716',2));
103
+
104
+
105
 
106
  /**
107
  * Returns CMS order common information converted to standardized order information objects.
146
  if(count($oOrder->etc) > 0) {
147
  foreach($oOrder->etc as $sKey => $sVal) $aData['s_' . $sKey] = $sVal;
148
  }
 
149
  $sMAC = $this->api_dibs_calcMAC($aData, $this->helper_dibs_tools_conf('HMAC'));
150
  if(!empty($sMAC)) $aData['MAC'] = $sMAC;
151
 
159
  * @param object $oOrder Formated to object order common information.
160
  */
161
  private function api_dibs_commonFields(&$aData, $oOrder) {
162
+ self::$sDefaultCurr = $oOrder->order->currency;
163
+ $aData['orderid'] = $oOrder->order->orderid;
164
+ $aData['merchant'] = $this->helper_dibs_tools_conf('mid');
165
+ $aData['amount'] = self::api_dibs_round($oOrder->order->amount, dibs_pw_api::api_dibs_get_currencyMinValue( $oOrder->order->currency ));
166
  $aData['currency'] = $oOrder->order->currency;
167
  $aData['language'] = $this->helper_dibs_tools_conf('lang');
168
  if((string)$this->helper_dibs_tools_conf('fee') == 'yes') $aData['addfee'] = 1;
188
  private function api_dibs_invoiceFields(&$aData, $mOrderInfo) {
189
  $oOrder = $this->api_dibs_invoiceOrderObject($mOrderInfo);
190
  foreach($oOrder->addr as $sKey => $sVal) {
 
 
191
  $aData[$sKey] = $sVal;
 
192
  }
193
+
194
  $oOrder->items[] = $oOrder->ship;
195
  if(isset($oOrder->items) && count($oOrder->items) > 0) {
196
  $aData['oitypes'] = 'QUANTITY;UNITCODE;DESCRIPTION;AMOUNT;ITEMID';
 
197
  $aData['oinames'] = 'Qty;UnitCode;Description;Amount;ItemId';
 
198
  if(isset($oOrder->items[0]->tax)) {
199
  $aData['oitypes'] .= (self::$bTaxAmount ? ';VATAMOUNT' : ';VATPERCENT');
200
  $aData['oinames'] .= (self::$bTaxAmount ? ';VatAmount' : ';VatPercent');
201
  }
 
202
  $i = 1;
203
  foreach($oOrder->items as $oItem) {
204
+ $iTmpPrice = self::api_dibs_round($oItem->price, dibs_pw_api::api_dibs_get_currencyMinValue( self::$sDefaultCurr ));
205
  if(!empty($iTmpPrice)) {
206
  $sTmpName = !empty($oItem->name) ? $oItem->name : $oItem->sku;
207
  if(empty($sTmpName)) $sTmpName = $oItem->id;
294
 
295
  $iAmount = (isset($_POST['voucherAmount']) && $_POST['voucherAmount'] > 0) ?
296
  $_POST['amountOriginal'] : $_POST['amount'];
297
+ if(abs((int)$iAmount - (int)self::api_dibs_round($mOrderInfo->amount, dibs_pw_api::api_dibs_get_currencyMinValue( $_POST['currency'] ) )) >= 0.01) return 4;
298
 
299
  if((int)$mOrderInfo->currency != (int)$_POST['currency']) return 6;
300
 
453
  foreach($aData as $sKey => $sVal) {
454
  $sData .= '&' . $sKey . '=' . (($bUrlDecode === TRUE) ? urldecode($sVal) : $sVal);
455
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  $sMAC = hash_hmac('sha256', ltrim($sData, '&'), self::api_dibs_hextostr($sHMAC));
457
  }
458
 
477
  *
478
  * @return string
479
  */
480
+ final public static function api_dibs_get_formAction() {
481
  return self::$sFormAction;
482
  }
483
 
506
  * @param bool $bFlip If we need to flip self::$aCurrency array and look in another format.
507
  * @return string
508
  */
509
+ final public static function api_dibs_get_currencyMinValue($sCode) {
510
+
511
+ $minValue = isset(dibs_pw_api::$aCurrency[$sCode]) ? dibs_pw_api::$aCurrency[$sCode][1] : 2;
512
+ return $minValue;
513
+
514
+
515
  }
516
 
517
+
518
  /**
519
  * Convert hex HMAC to string.
520
  *
app/code/community/Dibspw/Dibspw/Model/dibs_api/pw/dibs_pw_helpers.php CHANGED
@@ -84,14 +84,13 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
84
  if($bResponse === TRUE) {
85
  $mOrderInfo->loadByIncrementId((int)$_POST['orderid']);
86
  }
87
-
88
  return (object)array(
89
  'orderid' => $mOrderInfo->getRealOrderId(),
90
  'amount' => $mOrderInfo->getTotalDue(),
91
- 'currency' => $this->api_dibs_get_currencyValue(
92
- $mOrderInfo->getOrderCurrency()->getCode()
93
- )
94
- );
95
  }
96
 
97
  /**
@@ -106,13 +105,11 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
106
  if($this->helper_dibs_tools_conf('bundle') == 'yes') {
107
  $spitBundle = true;
108
  }
109
-
110
  foreach($mOrderInfo->getAllItems() as $oItem) {
111
-
112
- // Exclude bundel or not
113
- if($spitBundle == false && $oItem->getParentItem() OR
114
- ($spitBundle == true && $oItem->getChildrenItems())) continue;
115
-
116
 
117
  $aItems[] = (object)array(
118
  'id' => $oItem->getProductId(),
@@ -123,20 +120,8 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
123
  'tax' => 0
124
  );
125
 
126
-
127
- //!$oItem->getParentItem()
128
- //getChildrenItems()
129
- //var_dump($oItem);
130
  }
131
 
132
-
133
- //var_dump($mOrderInfo->getAllItems());
134
-
135
- //echo $this->helper_dibs_tools_conf('bundle');
136
-
137
- //exit;
138
-
139
-
140
  $fDiscount = $mOrderInfo->getDiscountAmount();
141
  if(!empty($fDiscount)) {
142
  $aItems[] = (object)array(
@@ -152,6 +137,11 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
152
  $fTaxTotal = 0;
153
  $aTaxes = $mOrderInfo->getFullTaxInfo();
154
  foreach($aTaxes as $aTax) if(isset($aTax['amount'])) $fTaxTotal += $aTax['amount'];
 
 
 
 
 
155
  $aItems[] = (object)array(
156
  'id' => 'tax0',
157
  'name' => $this->helper_dibs_tools_lang('tax_total'),
@@ -162,6 +152,7 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
162
  );
163
 
164
  return $aItems;
 
165
  }
166
 
167
  /**
@@ -190,7 +181,9 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
190
  function helper_dibs_obj_addr($mOrderInfo) {
191
  $aShipping = $mOrderInfo->getShippingAddress();
192
  $aBilling = $mOrderInfo->getBillingAddress();
193
-
 
 
194
  return (object)array(
195
  'shippingfirstname' => $aShipping['firstname'],
196
  'shippinglastname' => $aShipping['lastname'],
@@ -199,7 +192,6 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
199
  'shippingaddress2' => $aShipping['street'],
200
  'shippingaddress' => $aShipping['country_id'] . " " .
201
  $aShipping['region'],
202
-
203
  'billingfirstname' => $aBilling['firstname'],
204
  'billinglastname' => $aBilling['lastname'],
205
  'billingpostalcode' => $aBilling['postcode'],
@@ -207,7 +199,6 @@ class dibs_pw_helpers extends dibs_pw_helpers_cms implements dibs_pw_helpers_int
207
  'billingaddress2' => $aBilling['street'],
208
  'billingaddress' => $aBilling['country_id'] . " " .
209
  $aBilling['region'],
210
-
211
  'billingmobile' => $aBilling['telephone'],
212
  'billingemail' => $mOrderInfo['customer_email']
213
  );
84
  if($bResponse === TRUE) {
85
  $mOrderInfo->loadByIncrementId((int)$_POST['orderid']);
86
  }
87
+
88
  return (object)array(
89
  'orderid' => $mOrderInfo->getRealOrderId(),
90
  'amount' => $mOrderInfo->getTotalDue(),
91
+ 'currency' => $mOrderInfo->getOrderCurrency()->getCode()
92
+
93
+ );
 
94
  }
95
 
96
  /**
105
  if($this->helper_dibs_tools_conf('bundle') == 'yes') {
106
  $spitBundle = true;
107
  }
108
+
109
  foreach($mOrderInfo->getAllItems() as $oItem) {
110
+
111
+ // Just exclude chilren from bundle products
112
+ if($oItem->getParentItem()) continue;
 
 
113
 
114
  $aItems[] = (object)array(
115
  'id' => $oItem->getProductId(),
120
  'tax' => 0
121
  );
122
 
 
 
 
 
123
  }
124
 
 
 
 
 
 
 
 
 
125
  $fDiscount = $mOrderInfo->getDiscountAmount();
126
  if(!empty($fDiscount)) {
127
  $aItems[] = (object)array(
137
  $fTaxTotal = 0;
138
  $aTaxes = $mOrderInfo->getFullTaxInfo();
139
  foreach($aTaxes as $aTax) if(isset($aTax['amount'])) $fTaxTotal += $aTax['amount'];
140
+
141
+ // Add HiddenTaxAmount to whole Tax amount if we calculate Tax After Discount to avoid amount errors.
142
+ if( (bool)Mage::getStoreConfig('tax/calculation/apply_after_discount', null) ) {
143
+ $fTaxTotal += $mOrderInfo->getHiddenTaxAmount();
144
+ }
145
  $aItems[] = (object)array(
146
  'id' => 'tax0',
147
  'name' => $this->helper_dibs_tools_lang('tax_total'),
152
  );
153
 
154
  return $aItems;
155
+
156
  }
157
 
158
  /**
181
  function helper_dibs_obj_addr($mOrderInfo) {
182
  $aShipping = $mOrderInfo->getShippingAddress();
183
  $aBilling = $mOrderInfo->getBillingAddress();
184
+
185
+ $aShipping['street'] = str_replace("\n", " ", $aShipping['street']);
186
+ $aBilling['street'] = str_replace("\n", " ", $aBilling['street']);
187
  return (object)array(
188
  'shippingfirstname' => $aShipping['firstname'],
189
  'shippinglastname' => $aShipping['lastname'],
192
  'shippingaddress2' => $aShipping['street'],
193
  'shippingaddress' => $aShipping['country_id'] . " " .
194
  $aShipping['region'],
 
195
  'billingfirstname' => $aBilling['firstname'],
196
  'billinglastname' => $aBilling['lastname'],
197
  'billingpostalcode' => $aBilling['postcode'],
199
  'billingaddress2' => $aBilling['street'],
200
  'billingaddress' => $aBilling['country_id'] . " " .
201
  $aBilling['region'],
 
202
  'billingmobile' => $aBilling['telephone'],
203
  'billingemail' => $mOrderInfo['customer_email']
204
  );
app/code/community/Dibspw/Dibspw/etc/config.xml CHANGED
@@ -24,7 +24,7 @@
24
  <config>
25
  <modules>
26
  <Dibspw_Dibspw>
27
- <version>4.1.8</version>
28
  <depends>
29
  <Mage_Paygate />
30
  </depends>
24
  <config>
25
  <modules>
26
  <Dibspw_Dibspw>
27
+ <version>4.1.9</version>
28
  <depends>
29
  <Mage_Paygate />
30
  </depends>
app/code/community/Dibspw/Dibspw/etc/system.xml CHANGED
@@ -132,15 +132,6 @@
132
  <show_in_website>1</show_in_website>
133
  <show_in_store>1</show_in_store>
134
  </DIBSPW_distr>
135
- <DIBSPW_bundle translate="label">
136
- <label>Show bunle products separetly (in Payment Window)</label>
137
- <frontend_type>select</frontend_type>
138
- <source_model>dibspw/System_Config_Source_Dibsyesno</source_model>
139
- <show_in_default>1</show_in_default>
140
- <sort_order>15</sort_order>
141
- <show_in_website>1</show_in_website>
142
- <show_in_store>1</show_in_store>
143
- </DIBSPW_bundle>
144
  <order_status translate="label">
145
  <label>New order status (Before the payment is made)</label>
146
  <frontend_type>select</frontend_type>
132
  <show_in_website>1</show_in_website>
133
  <show_in_store>1</show_in_store>
134
  </DIBSPW_distr>
 
 
 
 
 
 
 
 
 
135
  <order_status translate="label">
136
  <label>New order status (Before the payment is made)</label>
137
  <frontend_type>select</frontend_type>
app/code/community/Dibspw/Dibspw/sql/dibspw_setup/{mysql4-install-4.1.8.php → mysql4-install-4.1.9.php} RENAMED
File without changes
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Dibspw</name>
4
- <version>4.1.8</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -31,7 +31,9 @@ Card types accepted by the DIBS payment gateway: &#xD;
31
  - Danske Bank e-betaling &#xD;
32
  - Nordea e-betaling &#xD;
33
  A complete list can be found at http://www.dibspayment.com/</description>
34
- <notes>4.1.8 &#xD;
 
 
35
  - added support of Bundle Products &#xD;
36
  4.1.7 &#xD;
37
  - utf encoding fixed &#xD;
@@ -78,9 +80,9 @@ A complete list can be found at http://www.dibspayment.com/</description>
78
  4.1.0 &#xD;
79
  - New module for DIBS Payment Window and Mobile Payment Window integration methods </notes>
80
  <authors><author><name>DIBS A/S</name><user>niso</user><email>info@dibs.dk</email></author></authors>
81
- <date>2012-11-12</date>
82
- <time>10:27:49</time>
83
- <contents><target name="mageskin"><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><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="6ecf62e39409117281008d9601b2bbc2"/><dir name="Mysql4"><file name="Setup.php" hash="1c135886bc8a0794310ec7cb70e04e64"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Bundle.php" hash="d41d8cd98f00b204e9800998ecf8427e"/><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="d72e962e565221e4164838c0977ce688"/><file name="dibs_pw_helpers.php" hash="4f26edce47e94bcc7f5caaaa05013bb2"/><file name="dibs_pw_helpers_cms.php" hash="6289c67d4a6f26edb0695c80f58f576c"/><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="e42fb9af2d3c20a78d9a65a6859f13cf"/><file name="system.xml" hash="582cf64ff04200e5e2bba6d25cdc9767"/></dir><dir name="sql"><dir name="dibspw_setup"><file name="mysql4-install-4.1.8.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="en_US"><file name="Mage_Dibspw.csv" hash="3acbdcdc0c8b8764786f85b0e9d7ed7c"/></dir><dir name="nb_NO"><file name="Mage_Dibspw.csv" hash="cabb502e57de177d8949e7f90a5310a7"/><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="28e2ab33b1394bc721208a06deccb785"/></dir></dir></dir></dir></dir></dir></target></contents>
84
  <compatible/>
85
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
86
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Dibspw</name>
4
+ <version>4.1.9</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
31
  - Danske Bank e-betaling &#xD;
32
  - Nordea e-betaling &#xD;
33
  A complete list can be found at http://www.dibspayment.com/</description>
34
+ <notes>4.1.9&#xD;
35
+ - bugfixing release&#xD;
36
+ 4.1.8 &#xD;
37
  - added support of Bundle Products &#xD;
38
  4.1.7 &#xD;
39
  - utf encoding fixed &#xD;
80
  4.1.0 &#xD;
81
  - New module for DIBS Payment Window and Mobile Payment Window integration methods </notes>
82
  <authors><author><name>DIBS A/S</name><user>niso</user><email>info@dibs.dk</email></author></authors>
83
+ <date>2012-12-19</date>
84
+ <time>16:55:23</time>
85
+ <contents><target name="mageskin"><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><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="3d43225fe5268bad9b9247facecb391e"/><dir name="Mysql4"><file name="Setup.php" hash="1c135886bc8a0794310ec7cb70e04e64"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Bundle.php" hash="d41d8cd98f00b204e9800998ecf8427e"/><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="5dc1384ab24437d8981061a93f99f4b3"/><file name="dibs_pw_helpers.php" hash="43d715a6b9bf550388ddd4d1624a7ee7"/><file name="dibs_pw_helpers_cms.php" hash="6289c67d4a6f26edb0695c80f58f576c"/><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="1d8b27eaf53ec6efdf65cbbb71a10ac6"/><file name="system.xml" hash="56269fd456c10d6e491f935d86350707"/></dir><dir name="sql"><dir name="dibspw_setup"><file name="mysql4-install-4.1.9.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="en_US"><file name="Mage_Dibspw.csv" hash="3acbdcdc0c8b8764786f85b0e9d7ed7c"/></dir><dir name="nb_NO"><file name="Mage_Dibspw.csv" hash="cabb502e57de177d8949e7f90a5310a7"/><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="28e2ab33b1394bc721208a06deccb785"/></dir></dir></dir></dir></dir></dir></target></contents>
86
  <compatible/>
87
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
88
  </package>