Trollweb_Dibs - Version 1.1.0

Version Notes

Download this release

Release Info

Developer Roy Andre Tollefsen
Extension Trollweb_Dibs
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.2 to 1.1.0

Files changed (26) hide show
  1. app/code/community/Trollweb/Dibs/Block/Dibspw/Form.php +33 -33
  2. app/code/community/Trollweb/Dibs/Block/Dibspw/PaymentInfo.php +44 -44
  3. app/code/community/Trollweb/Dibs/Block/Dibspw/Redirect.php +131 -129
  4. app/code/community/Trollweb/Dibs/Helper/Data.php +137 -137
  5. app/code/community/Trollweb/Dibs/Helper/Dibspw.php +25 -25
  6. app/code/community/Trollweb/Dibs/Model/Dibspw.php +268 -234
  7. app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Request.php +215 -202
  8. app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Result.php +23 -23
  9. app/code/community/Trollweb/Dibs/Model/Dibspw/Callback.php +144 -132
  10. app/code/community/Trollweb/Dibs/Model/Dibspw/Cart.php +148 -147
  11. app/code/community/Trollweb/Dibs/Model/Dibspw/Info.php +94 -94
  12. app/code/community/Trollweb/Dibs/Model/Dibspw/Observer.php +73 -64
  13. app/code/community/Trollweb/Dibs/Model/Source/Paymentaction.php +29 -29
  14. app/code/community/Trollweb/Dibs/Model/System/Serial.php +0 -15
  15. app/code/community/Trollweb/Dibs/controllers/DibspwController.php +73 -73
  16. app/code/community/Trollweb/Dibs/controllers/IndexController.php +0 -8
  17. app/code/community/Trollweb/Dibs/etc/config.xml +150 -142
  18. app/code/community/Trollweb/Dibs/etc/system.xml +176 -185
  19. app/design/adminhtml/default/default/template/dibs/dibspw/form.phtml +10 -10
  20. app/design/adminhtml/default/default/template/dibs/dibspw/paymentinfo.phtml +19 -19
  21. app/design/frontend/base/default/layout/Trollweb_Dibs.xml +4 -0
  22. app/design/frontend/base/default/template/dibs/dibspw/form.phtml +12 -12
  23. app/design/frontend/base/default/template/dibs/dibspw/paymentinfo.phtml +19 -19
  24. app/etc/modules/Trollweb_Dibs.xml +12 -12
  25. app/locale/nb_NO/Trollweb_Dibs.csv +44 -44
  26. package.xml +1 -17
app/code/community/Trollweb/Dibs/Block/Dibspw/Form.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Block_Dibspw_Form extends Mage_Payment_Block_Form
21
- {
22
- protected function _construct() {
23
- $this->setTemplate('dibs/dibspw/form.phtml');
24
- parent::_construct();
25
- }
26
-
27
- protected function getLogoUrl() {
28
- return $this->getSkinUrl('images/trollweb/dibs/logos/'.$this->getMethod()->getLogo());
29
- }
30
-
31
- protected function getRedirectText() {
32
- return $this->getMethod()->getRedirectText();
33
- }
34
  }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Block_Dibspw_Form extends Mage_Payment_Block_Form
21
+ {
22
+ protected function _construct() {
23
+ $this->setTemplate('dibs/dibspw/form.phtml');
24
+ parent::_construct();
25
+ }
26
+
27
+ protected function getLogoUrl() {
28
+ return $this->getSkinUrl('images/trollweb/dibs/logos/'.$this->getMethod()->getLogo());
29
+ }
30
+
31
+ protected function getRedirectText() {
32
+ return $this->getMethod()->getRedirectText();
33
+ }
34
  }
app/code/community/Trollweb/Dibs/Block/Dibspw/PaymentInfo.php CHANGED
@@ -1,45 +1,45 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Block_Dibspw_PaymentInfo extends Mage_Payment_Block_Info
21
- {
22
- protected function _construct() {
23
- parent::_construct();
24
- $this->setTemplate('dibs/dibspw/paymentinfo.phtml');
25
- }
26
-
27
- protected function getLogoUrl() {
28
- return $this->getSkinUrl('images/trollweb/dibs/logos/'.$this->getMethod()->getLogo());
29
- }
30
-
31
- protected function _prepareSpecificInformation($transport = null) {
32
- $transport = parent::_prepareSpecificInformation($transport);
33
- $payment = $this->getInfo();
34
- $dibsInfo = Mage::getModel('dibs/dibspw_info');
35
- if (!$this->getIsSecureMode()) {
36
- $info = $dibsInfo->getPaymentInfo($payment);
37
- } else {
38
- $info = $dibsInfo->getPublicPaymentInfo($payment);
39
- }
40
- if (!$dibsInfo->hasTransaction()) {
41
- return $transport;
42
- }
43
- return $transport->addData($info);
44
- }
45
  }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Block_Dibspw_PaymentInfo extends Mage_Payment_Block_Info
21
+ {
22
+ protected function _construct() {
23
+ parent::_construct();
24
+ $this->setTemplate('dibs/dibspw/paymentinfo.phtml');
25
+ }
26
+
27
+ protected function getLogoUrl() {
28
+ return $this->getSkinUrl('images/trollweb/dibs/logos/'.$this->getMethod()->getLogo());
29
+ }
30
+
31
+ protected function _prepareSpecificInformation($transport = null) {
32
+ $transport = parent::_prepareSpecificInformation($transport);
33
+ $payment = $this->getInfo();
34
+ $dibsInfo = Mage::getModel('dibs/dibspw_info');
35
+ if (!$this->getIsSecureMode()) {
36
+ $info = $dibsInfo->getPaymentInfo($payment);
37
+ } else {
38
+ $info = $dibsInfo->getPublicPaymentInfo($payment);
39
+ }
40
+ if (!$dibsInfo->hasTransaction()) {
41
+ return $transport;
42
+ }
43
+ return $transport->addData($info);
44
+ }
45
  }
app/code/community/Trollweb/Dibs/Block/Dibspw/Redirect.php CHANGED
@@ -1,130 +1,132 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Block_Dibspw_Redirect extends Mage_Core_Block_Abstract
21
- {
22
- protected $_form;
23
-
24
- public function initRequest() {
25
- $hdibs = Mage::helper('dibs');
26
- $dibspw = Mage::getModel('dibs/dibspw');
27
-
28
- $merchant = $dibspw->getConfigData('merchant');
29
-
30
- $order = $dibspw->getOrder();
31
-
32
- $dibsRequest = array();
33
-
34
- $isOrderVirtual = $order->getIsVirtual();
35
-
36
- if ($order->getBillingAddress()->getId()) {
37
- $billingAddress = $order->getBillingAddress();
38
- }
39
- if (!$isOrderVirtual AND $order->getShippingAddress()->getId()) {
40
- $shippingAddress = $order->getShippingAddress();
41
- }
42
-
43
- $optionalFields = $dibspw->getConfigData('optional_fields');
44
- if (!empty($optionalFields)) {
45
- $optionalFields = explode(',', $optionalFields);
46
- }
47
-
48
- $dibsRequest['merchant'] = $merchant;
49
- $dibsRequest['amount'] = sprintf("%0.0f",$order->getBaseGrandTotal()*100);
50
- $dibsRequest['orderId'] = $order->getIncrementId();
51
- $dibsRequest['currency'] = $hdibs->getCurrenyCode($order->getBaseCurrencyCode());
52
- $dibsRequest['acceptReturnUrl'] = Mage::getUrl('dibs/dibspw/accept', array('_secure'=>true));
53
- $dibsRequest['cancelReturnUrl'] = Mage::getUrl('dibs/dibspw/cancel', array('_secure'=>true));
54
- $dibsRequest['callbackUrl'] = Mage::getUrl('dibs/dibspw/callback', array('_secure'=>true)); //"http://enterprise.bjorneirik.trolldev.no/callback.php";
55
-
56
- if (isset($billingAddress) AND in_array('billing', $optionalFields)) {
57
- $dibsRequest['billingFirstName'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($billingAddress->getFirstname()));
58
- $dibsRequest['billingLastName'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($billingAddress->getLastname()));
59
- $dibsRequest['billingAddress'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($hdibs->escapeBreakline($billingAddress->getStreetFull())));
60
- $dibsRequest['billingPostalCode'] = $billingAddress->getPostcode();
61
- $dibsRequest['billingPostalPlace'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($billingAddress->getCity()));
62
- $dibsRequest['billingEmail'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($billingAddress->getEmail()));
63
- $dibsRequest['billingMobile'] = $billingAddress->getTelephone();
64
- }
65
- if (isset($shippingAddress)AND in_array('shipping', $optionalFields)) {
66
- $dibsRequest['shippingFirstName'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($shippingAddress->getFirstname()));
67
- $dibsRequest['shippingLastName'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($shippingAddress->getLastname()));
68
- $dibsRequest['shippingAddress'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($hdibs->escapeBreakline($shippingAddress->getStreetFull())));
69
- $dibsRequest['shippingPostalCode'] = $shippingAddress->getPostcode();
70
- $dibsRequest['shippingPostalPlace'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($shippingAddress->getCity()));
71
- }
72
-
73
- $dibsRequest['language'] = $dibspw->getConfigData('language');
74
-
75
- if ($hdibs->validateCcTypes($dibspw->getConfigData('cctypes'))) {
76
- $dibsRequest['payType'] = $dibspw->getConfigData('cctypes');
77
- }
78
-
79
- $dibsRequest['test'] = $dibspw->getConfigData('test_mode');
80
-
81
- if (in_array('cart', $optionalFields)) {
82
- $cart = Mage::getModel('dibs/dibspw_cart');
83
- $cartItems = $cart->setMageOrder($order)
84
- ->addItems()
85
- ->addShippingItem()
86
- ->getItems();
87
- $dibsRequest['oiTypes'] = $cart->getTypes();
88
- $dibsRequest['oiNames'] = $cart->getNames();
89
-
90
- $rowCount = 1;
91
- foreach ($cartItems as $item) {
92
- $dibsRequest['oiRow'.$rowCount] = $cart->formatCartItem($item);
93
- $rowCount++;
94
- }
95
- }
96
-
97
- // Calculate the MAC for the form key-values to be posted to DIBS.
98
- $dibsRequest['MAC'] = $hdibs->calcMAC($dibsRequest, $dibspw->getConfigData('mac_key'));
99
-
100
- $this->_form = $this->getForm($dibsRequest);
101
-
102
- return $this;
103
- }
104
-
105
- public function getForm($dibsRequest) {
106
- $form = new Varien_Data_Form();
107
- $form->setId('dibs_dibspw_checkout')
108
- ->setAction(Trollweb_Dibs_Model_Dibspw::HTTP_REQUEST_URL)
109
- ->setMethod('POST')
110
- ->setUseContainer(true);
111
-
112
- foreach ($dibsRequest as $name => $value) {
113
- $form->addField($name,'hidden', array("name"=>$name, "value"=>$value));
114
- }
115
-
116
- $form->removeField('form_key');
117
-
118
- return $form;
119
- }
120
-
121
- protected function _toHtml() {
122
- $html = '<html><body>';
123
- $html.= $this->__('You will be redirected to Dibs in a few seconds.');
124
- $html.= $this->_form->toHtml();
125
- $html.= '<script type="text/javascript">document.getElementById("dibs_dibspw_checkout").submit();</script>';
126
- $html.= '</body></html>';
127
-
128
- return $html;
129
- }
 
 
130
  }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Block_Dibspw_Redirect extends Mage_Core_Block_Abstract
21
+ {
22
+ protected $_form;
23
+
24
+ public function initRequest() {
25
+ $hdibs = Mage::helper('dibs');
26
+ $dibspw = Mage::getModel('dibs/dibspw');
27
+
28
+ $merchant = $dibspw->getConfigData('merchant');
29
+
30
+ $order = $dibspw->getOrder();
31
+
32
+ $dibsRequest = array();
33
+
34
+ $isOrderVirtual = $order->getIsVirtual();
35
+
36
+ if ($order->getBillingAddress()->getId()) {
37
+ $billingAddress = $order->getBillingAddress();
38
+ }
39
+ if (!$isOrderVirtual AND $order->getShippingAddress()->getId()) {
40
+ $shippingAddress = $order->getShippingAddress();
41
+ }
42
+
43
+ $optionalFields = $dibspw->getConfigData('optional_fields');
44
+ if (!empty($optionalFields)) {
45
+ $optionalFields = explode(',', $optionalFields);
46
+ }
47
+
48
+ $dibsRequest['merchant'] = $merchant;
49
+ $dibsRequest['amount'] = sprintf("%0.0f",$order->getBaseGrandTotal()*100);
50
+ $dibsRequest['orderId'] = $order->getIncrementId();
51
+ $dibsRequest['currency'] = $hdibs->getCurrenyCode($order->getBaseCurrencyCode());
52
+ $dibsRequest['acceptReturnUrl'] = Mage::getUrl('dibs/dibspw/accept', array('_secure'=>true));
53
+ $dibsRequest['cancelReturnUrl'] = Mage::getUrl('dibs/dibspw/cancel', array('_secure'=>true));
54
+ $dibsRequest['callbackUrl'] = Mage::getUrl('dibs/dibspw/callback', array('_secure'=>true)); //"http://enterprise.bjorneirik.trolldev.no/callback.php";
55
+
56
+ if (isset($billingAddress) AND (is_array($optionalFields) AND in_array('billing', $optionalFields))) {
57
+ $dibsRequest['billingFirstName'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($billingAddress->getFirstname()));
58
+ $dibsRequest['billingLastName'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($billingAddress->getLastname()));
59
+ $dibsRequest['billingAddress'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($hdibs->escapeBreakline($billingAddress->getStreetFull())));
60
+ $dibsRequest['billingPostalCode'] = $billingAddress->getPostcode();
61
+ $dibsRequest['billingPostalPlace'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($billingAddress->getCity()));
62
+ $dibsRequest['billingEmail'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($billingAddress->getEmail()));
63
+ $dibsRequest['billingMobile'] = $billingAddress->getTelephone();
64
+ }
65
+ if (isset($shippingAddress) AND (is_array($optionalFields) AND in_array('shipping', $optionalFields))) {
66
+ $dibsRequest['shippingFirstName'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($shippingAddress->getFirstname()));
67
+ $dibsRequest['shippingLastName'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($shippingAddress->getLastname()));
68
+ $dibsRequest['shippingAddress'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($hdibs->escapeBreakline($shippingAddress->getStreetFull())));
69
+ $dibsRequest['shippingPostalCode'] = $shippingAddress->getPostcode();
70
+ $dibsRequest['shippingPostalPlace'] = $hdibs->utf8Encoding($hdibs->escapeDelimiter($shippingAddress->getCity()));
71
+ }
72
+
73
+ $dibsRequest['language'] = $dibspw->getConfigData('language');
74
+
75
+ if ($hdibs->validateCcTypes($dibspw->getConfigData('cctypes'))) {
76
+ $dibsRequest['payType'] = $dibspw->getConfigData('cctypes');
77
+ }
78
+
79
+ if ($dibspw->getConfigData('test_mode')) {
80
+ $dibsRequest['test'] = 1;
81
+ }
82
+
83
+ if (is_array($optionalFields) AND in_array('cart', $optionalFields)) {
84
+ $cart = Mage::getModel('dibs/dibspw_cart');
85
+ $cartItems = $cart->setMageOrder($order)
86
+ ->addItems()
87
+ ->addShippingItem()
88
+ ->getItems();
89
+ $dibsRequest['oiTypes'] = $cart->getTypes();
90
+ $dibsRequest['oiNames'] = $cart->getNames();
91
+
92
+ $rowCount = 1;
93
+ foreach ($cartItems as $item) {
94
+ $dibsRequest['oiRow'.$rowCount] = $cart->formatCartItem($item);
95
+ $rowCount++;
96
+ }
97
+ }
98
+
99
+ // Calculate the MAC for the form key-values to be posted to DIBS.
100
+ $dibsRequest['MAC'] = $hdibs->calcMAC($dibsRequest, $dibspw->getConfigData('mac_key'));
101
+
102
+ $this->_form = $this->getForm($dibsRequest);
103
+
104
+ return $this;
105
+ }
106
+
107
+ public function getForm($dibsRequest) {
108
+ $form = new Varien_Data_Form();
109
+ $form->setId('dibs_dibspw_checkout')
110
+ ->setAction(Trollweb_Dibs_Model_Dibspw::HTTP_REQUEST_URL)
111
+ ->setMethod('POST')
112
+ ->setUseContainer(true);
113
+
114
+ foreach ($dibsRequest as $name => $value) {
115
+ $form->addField($name,'hidden', array("name"=>$name, "value"=>$value));
116
+ }
117
+
118
+ $form->removeField('form_key');
119
+
120
+ return $form;
121
+ }
122
+
123
+ protected function _toHtml() {
124
+ $html = '<html><body>';
125
+ $html.= $this->__('You will be redirected to Dibs in a few seconds.');
126
+ $html.= $this->_form->toHtml();
127
+ $html.= '<script type="text/javascript">document.getElementById("dibs_dibspw_checkout").submit();</script>';
128
+ $html.= '</body></html>';
129
+
130
+ return $html;
131
+ }
132
  }
app/code/community/Trollweb/Dibs/Helper/Data.php CHANGED
@@ -1,137 +1,137 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Helper_Data extends Mage_Core_Helper_Abstract
21
- {
22
- public $dibsCurrency = array(
23
- 'DKK' => '208',
24
- 'EUR' => '978',
25
- 'USD' => '840',
26
- 'GBP' => '826',
27
- 'SEK' => '752',
28
- 'AUD' => '036',
29
- 'CAD' => '124',
30
- 'ISK' => '352',
31
- 'JPY' => '392',
32
- 'NZD' => '554',
33
- 'NOK' => '578',
34
- 'CHF' => '756',
35
- 'TRY' => '949',
36
- );
37
-
38
- public function getConfigData($path, $store_id = null) {
39
- return Mage::getStoreConfig('dibs/'.$path, $store_id);
40
- }
41
-
42
- public function validateCcTypes($ccTypes) {
43
- $val = preg_match('/^[a-zA-Z0-9\(\)\s,_-]+$/', $ccTypes);
44
- return $val;
45
- }
46
-
47
- public function escapeDelimiter($data) {
48
- $replacement = "\\".Trollweb_Dibs_Model_Dibspw_Cart::DELIMITER;
49
- return str_replace(Trollweb_Dibs_Model_Dibspw_Cart::DELIMITER, $replacement, $data);
50
- }
51
-
52
- public function escapeBreakline($str) {
53
- return str_replace("\n", " ", $str);
54
- }
55
-
56
- public function utf8Encoding($str) {
57
- return (mb_detect_encoding($str, 'UTF-8', true) && mb_check_encoding($str, 'UTF-8')) ? $str : utf8_encode($str);
58
- }
59
-
60
- public function getCurrenyCode($code) {
61
-
62
- return ($this->dibsCurrency[strtoupper($code)])?$this->dibsCurrency[strtoupper($code)]:'';
63
- }
64
-
65
- public function getCurrenyName($code) {
66
- $dibsCurrency = array_flip($this->dibsCurrency);
67
- return ($dibsCurrency[strtoupper($code)])?$dibsCurrency[strtoupper($code)]:'';
68
- }
69
-
70
- /**
71
- * Calculates MAC for given array of data.
72
- *
73
- * @param array $aData Array of data to calculate the MAC hash.
74
- * @param string $sHMAC HMAC key for hash calculation.
75
- * @param bool $bUrlDecode Flag if urldecode before MAC hash calculation is needed (for success action).
76
- * @return string
77
- */
78
- public function calcMAC($aData, $sHMAC, $bUrlDecode = FALSE) {
79
- $sMAC = '';
80
- if(!empty($sHMAC)) {
81
- $sData = '';
82
- if(isset($aData['MAC'])) unset($aData['MAC']);
83
- ksort($aData);
84
- foreach($aData as $sKey => $sVal) {
85
- $sData .= '&' . $sKey . '=' . (($bUrlDecode === TRUE) ? urldecode($sVal) : $sVal);
86
- }
87
-
88
- $sMAC = hash_hmac('sha256', ltrim($sData, '&'), $this->hextostr($sHMAC));
89
- }
90
- return $sMAC;
91
- }
92
-
93
- /**
94
- * Convert hex HMAC to string.
95
- *
96
- * @param string $sHMAC HMAC key for hash calculation.
97
- * @return string
98
- */
99
- private function hextostr($sHMAC) {
100
- $sRes = '';
101
- foreach(explode("\n", trim(chunk_split($sHMAC, 2))) as $h) $sRes .= chr(hexdec($h));
102
- return $sRes;
103
- }
104
-
105
- /**
106
- * Compare calculated MAC with MAC from response urldecode response if second parameter is TRUE.
107
- *
108
- * @param string $sHMAC
109
- * @param bool $bUrlDecode
110
- * @return bool
111
- */
112
- public function checkMAC($post, $sHMAC, $bUrlDecode = FALSE) {
113
- $post['MAC'] = isset($post['MAC']) ? $post['MAC'] : "";
114
- return ($post['MAC'] == $this->calcMAC($post, $sHMAC, $bUrlDecode)) ? TRUE : FALSE;
115
- }
116
-
117
- public function dibsLog($msg, $sendMail = FALSE, $onFile = false, $onLine = false) {
118
- if ($onFile) {
119
- $msg .= ' in '.$onFile;
120
- }
121
- if ($onLine) {
122
- $msg .= ' on line '.$onLine;
123
- }
124
- Mage::log($msg, null, 'trollweb_dibs.log');
125
- }
126
-
127
- public function getLogos() {
128
- return array(
129
- 'green.jpg' => 'Green',
130
- 'blue.jpg' => 'Blue',
131
- 'yellow.jpg' => 'Yellow',
132
- 'red.jpg' => 'Red',
133
- 'grey.jpg' => 'Grey',
134
- 'black.jpg' => 'Black',
135
- );
136
- }
137
- }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Helper_Data extends Mage_Core_Helper_Abstract
21
+ {
22
+ public $dibsCurrency = array(
23
+ 'DKK' => '208',
24
+ 'EUR' => '978',
25
+ 'USD' => '840',
26
+ 'GBP' => '826',
27
+ 'SEK' => '752',
28
+ 'AUD' => '036',
29
+ 'CAD' => '124',
30
+ 'ISK' => '352',
31
+ 'JPY' => '392',
32
+ 'NZD' => '554',
33
+ 'NOK' => '578',
34
+ 'CHF' => '756',
35
+ 'TRY' => '949',
36
+ );
37
+
38
+ public function getConfigData($path, $store_id = null) {
39
+ return Mage::getStoreConfig('dibs/'.$path, $store_id);
40
+ }
41
+
42
+ public function validateCcTypes($ccTypes) {
43
+ $val = preg_match('/^[a-zA-Z0-9\(\)\s,_-]+$/', $ccTypes);
44
+ return $val;
45
+ }
46
+
47
+ public function escapeDelimiter($data) {
48
+ $replacement = "\\".Trollweb_Dibs_Model_Dibspw_Cart::DELIMITER;
49
+ return str_replace(Trollweb_Dibs_Model_Dibspw_Cart::DELIMITER, $replacement, $data);
50
+ }
51
+
52
+ public function escapeBreakline($str) {
53
+ return str_replace("\n", " ", $str);
54
+ }
55
+
56
+ public function utf8Encoding($str) {
57
+ return (mb_detect_encoding($str, 'UTF-8', true) && mb_check_encoding($str, 'UTF-8')) ? $str : utf8_encode($str);
58
+ }
59
+
60
+ public function getCurrenyCode($code) {
61
+
62
+ return ($this->dibsCurrency[strtoupper($code)])?$this->dibsCurrency[strtoupper($code)]:'';
63
+ }
64
+
65
+ public function getCurrenyName($code) {
66
+ $dibsCurrency = array_flip($this->dibsCurrency);
67
+ return ($dibsCurrency[strtoupper($code)])?$dibsCurrency[strtoupper($code)]:'';
68
+ }
69
+
70
+ /**
71
+ * Calculates MAC for given array of data.
72
+ *
73
+ * @param array $aData Array of data to calculate the MAC hash.
74
+ * @param string $sHMAC HMAC key for hash calculation.
75
+ * @param bool $bUrlDecode Flag if urldecode before MAC hash calculation is needed (for success action).
76
+ * @return string
77
+ */
78
+ public function calcMAC($aData, $sHMAC, $bUrlDecode = FALSE) {
79
+ $sMAC = '';
80
+ if(!empty($sHMAC)) {
81
+ $sData = '';
82
+ if(isset($aData['MAC'])) unset($aData['MAC']);
83
+ ksort($aData);
84
+ foreach($aData as $sKey => $sVal) {
85
+ $sData .= '&' . $sKey . '=' . (($bUrlDecode === TRUE) ? urldecode($sVal) : $sVal);
86
+ }
87
+
88
+ $sMAC = hash_hmac('sha256', ltrim($sData, '&'), $this->hextostr($sHMAC));
89
+ }
90
+ return $sMAC;
91
+ }
92
+
93
+ /**
94
+ * Convert hex HMAC to string.
95
+ *
96
+ * @param string $sHMAC HMAC key for hash calculation.
97
+ * @return string
98
+ */
99
+ private function hextostr($sHMAC) {
100
+ $sRes = '';
101
+ foreach(explode("\n", trim(chunk_split($sHMAC, 2))) as $h) $sRes .= chr(hexdec($h));
102
+ return $sRes;
103
+ }
104
+
105
+ /**
106
+ * Compare calculated MAC with MAC from response urldecode response if second parameter is TRUE.
107
+ *
108
+ * @param string $sHMAC
109
+ * @param bool $bUrlDecode
110
+ * @return bool
111
+ */
112
+ public function checkMAC($post, $sHMAC, $bUrlDecode = FALSE) {
113
+ $post['MAC'] = isset($post['MAC']) ? $post['MAC'] : "";
114
+ return ($post['MAC'] == $this->calcMAC($post, $sHMAC, $bUrlDecode)) ? TRUE : FALSE;
115
+ }
116
+
117
+ public function dibsLog($msg, $sendMail = FALSE, $onFile = false, $onLine = false) {
118
+ if ($onFile) {
119
+ $msg .= ' in '.$onFile;
120
+ }
121
+ if ($onLine) {
122
+ $msg .= ' on line '.$onLine;
123
+ }
124
+ Mage::log($msg, null, 'trollweb_dibs.log');
125
+ }
126
+
127
+ public function getLogos() {
128
+ return array(
129
+ 'green.jpg' => 'Green',
130
+ 'blue.jpg' => 'Blue',
131
+ 'yellow.jpg' => 'Yellow',
132
+ 'red.jpg' => 'Red',
133
+ 'grey.jpg' => 'Grey',
134
+ 'black.jpg' => 'Black',
135
+ );
136
+ }
137
+ }
app/code/community/Trollweb/Dibs/Helper/Dibspw.php CHANGED
@@ -1,25 +1,25 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Helper_Dibspw extends Trollweb_Dibs_Helper_Data
21
- {
22
- public function getConfigData($path, $store_id = null) {
23
- return Mage::getStoreConfig('payment/dibspw/'.$path, $store_id);
24
- }
25
- }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Helper_Dibspw extends Trollweb_Dibs_Helper_Data
21
+ {
22
+ public function getConfigData($path, $store_id = null) {
23
+ return Mage::getStoreConfig('payment/dibspw/'.$path, $store_id);
24
+ }
25
+ }
app/code/community/Trollweb/Dibs/Model/Dibspw.php CHANGED
@@ -1,235 +1,269 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Model_Dibspw extends Mage_Payment_Model_Method_Abstract
21
- {
22
- protected $_infoBlockType = 'dibs/dibspw_paymentInfo';
23
- protected $_formBlockType = 'dibs/dibspw_form';
24
-
25
- const HTTP_REQUEST_URL = 'https://sat1.dibspayment.com/dibspaymentwindow/entrypoint';
26
-
27
- const ORDER_STATUS_PENDING = 'pending_dibs';
28
- const ORDER_STATUS_DECLINED = 'declined_dibs';
29
-
30
- const CALLBACK_STATUS_ACCEPTED = 'ACCEPTED';
31
- const CALLBACK_STATUS_ACCEPT = 'ACCEPT';
32
- const CALLBACK_STATUS_PENDING = 'PENDING';
33
- const CALLBACK_STATUS_CANCELLED = 'CANCELLED';
34
- const CALLBACK_STATUS_DECLINED = 'DECLINED';
35
- const CALLBACK_STATUS_DECLINE = 'DECLINE';
36
- const CALLBACK_STATUS_ERROR = 'ERROR';
37
-
38
- const INFO_TRANSACTION_ID = 'dibs_transaction_id';
39
- const INFO_STATUS = 'dibs_status';
40
- const INFO_ACQUIRER = 'dibs_acquirer';
41
- const INFO_ACTION_CODE = 'dibs_action_code';
42
- const INFO_MAC = 'dibs_mac';
43
- const INFO_MERCHANT_ID = 'dibs_merchant_id';
44
- const INFO_DATE = 'dibs_date';
45
- const INFO_CURRENCY = 'dibs_currency';
46
-
47
-
48
- protected $_oiRow = array();
49
-
50
- protected $_code = 'dibspw';
51
- protected $_canReviewPayment = true;
52
- protected $_isGateway = true;
53
- protected $_canAuthorize = true;
54
- protected $_canCapture = true;
55
- protected $_canCapturePartial = true;
56
- protected $_canRefund = true;
57
- protected $_canRefundInvoicePartial = true;
58
- protected $_canVoid = true;
59
- protected $_canUseInternal = false;
60
- protected $_canUseCheckout = true;
61
- protected $_canUseForMultishipping = false;
62
- protected $_canSaveCc = false;
63
- protected $_isInitializeNeeded = true;
64
-
65
- public function authorize(Varien_Object $payment, $amount) {
66
- return $this;
67
- }
68
-
69
- public function capture(Varien_Object $payment, $amount) {
70
- $hdibs = Mage::helper('dibs');
71
-
72
- if (!$payment->getAdditionalInformation(self::INFO_TRANSACTION_ID)) {
73
- Mage::throwException($hdibs->__('Could not find transaction id.'));
74
- }
75
- $dibsTransactionId = $payment->getAdditionalInformation(self::INFO_TRANSACTION_ID);
76
-
77
- $amount = (sprintf("%0.0f",$amount*100));
78
-
79
- $request = Mage::getModel('dibs/dibspw_api_request')
80
- ->initRequest()
81
- ->buildCaptureRequest($payment, $amount);
82
- $result = $request->send();
83
-
84
- $declineReason = $result->getData('declineReason')?$result->getData('declineReason'):'Unknown';
85
- switch ($result->getStatus()) {
86
- case self::CALLBACK_STATUS_ACCEPT:
87
- $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_APPROVED);
88
- if (!$payment->getParentTransactionId() || $dibsTransactionId != $payment->getParentTransactionId()) {
89
- $payment->setTransactionId($dibsTransactionId);
90
- }
91
- break;
92
- case self::CALLBACK_STATUS_DECLINE:
93
- $hdibs->dibsLog('Payment capturing was delined. Order ID: '. $payment->getOrder()->getId(). ' DIBS Reason: '.$declineReason);
94
- Mage::throwException($hdibs->__('Payment capturing was delined, try again or capture offline and manually run capture in DIBS Admin panel'));
95
- break;
96
- case self::CALLBACK_STATUS_ERROR:
97
- $hdibs->dibsLog('Payment capturing error. Order ID: '. $payment->getOrder()->getId(). ' DIBS Reason: '.$declineReason);
98
- Mage::throwException($hdibs->__('Payment capturing was delined, try again or capture offline and manually run capture in DIBS Admin panel'));
99
- break;
100
- default:
101
- $hdibs->dibsLog('Payment capturing error (unknown). Order ID: '. $payment->getOrder()->getId(). ' DIBS Reason: '.$declineReason);
102
- Mage::throwException($hdibs->__('Error capturing payment, try again or capture offline and manually run capture in DIBS Admin panel'));
103
- break;
104
- }
105
- return $this;
106
- }
107
-
108
- public function refund(Varien_Object $payment, $amount) {
109
- $hdibs = Mage::helper('dibs');
110
-
111
- $amount = sprintf("%0.0f",$amount*100);
112
- $dibsTransactionId = $payment->getAdditionalInformation(self::INFO_TRANSACTION_ID);
113
-
114
- $request = Mage::getModel('dibs/dibspw_api_request')
115
- ->initRequest()
116
- ->buildRefundRequest($payment, $amount);
117
- $result = $request->send();
118
-
119
- $declineReason = $result->getData('declineReason')?$result->getData('declineReason'):'Unknown';
120
- switch ($result->getStatus()) {
121
- case self::CALLBACK_STATUS_ACCEPT:
122
- $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_APPROVED);
123
- break;
124
- case self::CALLBACK_STATUS_DECLINE:
125
- $hdibs->dibsLog('Payment declined. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
126
- $this->_getSession()->addError($hdibs->__('Refund was declined by DIBS. Use DIBS Admin panel to manually refund this transaction'));
127
- break;
128
- case self::CALLBACK_STATUS_ERROR:
129
- $hdibs->dibsLog('Payment refund error. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
130
- $this->_getSession()->addError($hdibs->__('Unable to refund DIBS transaction. Use DIBS Admin panel to manually refund this transaction'));
131
- break;
132
- default:
133
- $hdibs->dibsLog('Payment refund (unknown) error. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
134
- $this->_getSession()->addError($hdibs->__('Unable to refund DIBS transaction. Use DIBS Admin panel to manually refund this transaction'));
135
- break;
136
- }
137
- return $this;
138
- }
139
-
140
- public function cancel(Varien_Object $payment) {
141
- $hdibs = Mage::helper('dibs');
142
-
143
- $dibsTransactionId = $payment->getAdditionalInformation(self::INFO_TRANSACTION_ID);
144
-
145
- $request = Mage::getModel('dibs/dibspw_api_request')
146
- ->initRequest()
147
- ->buildCancelRequest($payment)
148
- ->validateData();
149
- if($request === false) {
150
- return $this;
151
- }
152
- $result = $request->send();
153
-
154
- $declineReason = $result->getData('declineReason')?$result->getData('declineReason'):'Unknown';
155
- switch ($result->getStatus()) {
156
- case self::CALLBACK_STATUS_ACCEPT:
157
- $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_VOID);
158
- break;
159
- case self::CALLBACK_STATUS_DECLINE:
160
- $hdibs->dibsLog('Payment cancel declined. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
161
- $this->_getSession()->addError($hdibs->__('Unable to cancel DIBS transaction. Use DIBS Admin panel to manually cancel this transaction'));
162
- break;
163
- case self::CALLBACK_STATUS_ERROR:
164
- $hdibs->dibsLog('Payment cancel error. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
165
- $this->_getSession()->addError($hdibs->__('Unable to cancel DIBS transaction. Use DIBS Admin panel to manually cancel this transaction'));
166
- break;
167
- default:
168
- $hdibs->dibsLog('Payment cancel (unknown) error. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
169
- $this->_getSession()->addError($hdibs->__('Unable to cancel DIBS transaction. Use DIBS Admin panel to manually cancel this transaction'));
170
- break;
171
- }
172
- return $this;
173
- }
174
-
175
- public function initialize($paymentAction, $stateObject) {
176
- $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
177
- $stateObject->setState($state);
178
- $stateObject->setStatus(self::ORDER_STATUS_PENDING);
179
- }
180
-
181
- public function getCheckout() {
182
- return Mage::getSingleton('checkout/session');
183
- }
184
-
185
- public function acceptPayment(Mage_Payment_Model_Info $payment) {
186
- parent::acceptPayment($payment);
187
- return true;
188
- }
189
-
190
- public function denyPayment(Mage_Payment_Model_Info $payment) {
191
- parent::acceptPayment($payment);
192
- return true;
193
- }
194
-
195
- public function getRequest() {
196
- $request = Mage::getModel('dibs/dibspw_api_request');
197
- return $request;
198
- }
199
-
200
- public function getOrder() {
201
- $orderId = $this->getCheckout()->getLastOrderId();
202
- $order = Mage::getModel('sales/order')->load($orderId);
203
-
204
- return $order;
205
- }
206
-
207
- public function getRedirectText() {
208
- return $this->getConfigData('redirect_text');
209
- }
210
-
211
- public function getLogo() {
212
- return $this->getConfigData('dibs_logo');
213
- }
214
-
215
- public function getDibsRequestUrl() {
216
- return Trollweb_Dibs_Model_Dibspw::HTTP_REQUEST_URL;
217
- }
218
-
219
- public function getOrderPlaceRedirectUrl() {
220
- return Mage::getUrl('dibs/dibspw/redirect', array('_secure' => true));
221
- }
222
-
223
- protected function _getSession() {
224
- return Mage::getSingleton('adminhtml/session');
225
- }
226
-
227
- public function getTitle() {
228
- if (!$this->getRequest()->setRegCode($this->getConfigData('regcode'))->validate()) {
229
- return base64_decode('VW5saWNlbnNlZCB2ZXJzaW9uIG9mIERJQlM=');
230
- }
231
- else {
232
- return $this->getConfigData('title');
233
- }
234
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Model_Dibspw extends Mage_Payment_Model_Method_Abstract
21
+ {
22
+ protected $_infoBlockType = 'dibs/dibspw_paymentInfo';
23
+ protected $_formBlockType = 'dibs/dibspw_form';
24
+
25
+ const HTTP_REQUEST_URL = 'https://sat1.dibspayment.com/dibspaymentwindow/entrypoint';
26
+
27
+ const ORDER_STATUS_PENDING = 'pending_dibs';
28
+ const ORDER_STATUS_DECLINED = 'declined_dibs';
29
+
30
+ const CALLBACK_STATUS_ACCEPTED = 'ACCEPTED';
31
+ const CALLBACK_STATUS_ACCEPT = 'ACCEPT';
32
+ const CALLBACK_STATUS_PENDING = 'PENDING';
33
+ const CALLBACK_STATUS_CANCELLED = 'CANCELLED';
34
+ const CALLBACK_STATUS_DECLINED = 'DECLINED';
35
+ const CALLBACK_STATUS_DECLINE = 'DECLINE';
36
+ const CALLBACK_STATUS_ERROR = 'ERROR';
37
+
38
+ const INFO_TRANSACTION_ID = 'dibs_transaction_id';
39
+ const INFO_STATUS = 'dibs_status';
40
+ const INFO_ACQUIRER = 'dibs_acquirer';
41
+ const INFO_ACTION_CODE = 'dibs_action_code';
42
+ const INFO_MAC = 'dibs_mac';
43
+ const INFO_MERCHANT_ID = 'dibs_merchant_id';
44
+ const INFO_DATE = 'dibs_date';
45
+ const INFO_CURRENCY = 'dibs_currency';
46
+
47
+
48
+ protected $_oiRow = array();
49
+
50
+ protected $_code = 'dibspw';
51
+ protected $_canReviewPayment = true;
52
+ protected $_isGateway = true;
53
+ protected $_canAuthorize = true;
54
+ protected $_canCapture = true;
55
+ protected $_canCapturePartial = true;
56
+ protected $_canRefund = true;
57
+ protected $_canRefundInvoicePartial = true;
58
+ protected $_canVoid = true;
59
+ protected $_canUseInternal = false;
60
+ protected $_canUseCheckout = true;
61
+ protected $_canUseForMultishipping = false;
62
+ protected $_canSaveCc = false;
63
+ protected $_isInitializeNeeded = true;
64
+
65
+ public function authorize(Varien_Object $payment, $amount) {
66
+ return $this;
67
+ }
68
+
69
+ public function capture(Varien_Object $payment, $amount) {
70
+ $hdibs = Mage::helper('dibs');
71
+
72
+ if (!$payment->getAdditionalInformation(self::INFO_TRANSACTION_ID)) {
73
+ Mage::throwException($hdibs->__('Could not find transaction id.'));
74
+ }
75
+ $dibsTransactionId = $payment->getAdditionalInformation(self::INFO_TRANSACTION_ID);
76
+
77
+ $amount = (sprintf("%0.0f",$amount*100));
78
+
79
+ $request = Mage::getModel('dibs/dibspw_api_request')
80
+ ->initRequest()
81
+ ->buildCaptureRequest($payment, $amount);
82
+ $result = $request->send();
83
+
84
+ $declineReason = $result->getData('declineReason')?$result->getData('declineReason'):'Unknown';
85
+ switch ($result->getStatus()) {
86
+ case self::CALLBACK_STATUS_ACCEPT:
87
+ case self::CALLBACK_STATUS_PENDING:
88
+ $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_APPROVED);
89
+ if (!$payment->getParentTransactionId() || $dibsTransactionId != $payment->getParentTransactionId()) {
90
+ $payment->setTransactionId($dibsTransactionId);
91
+ }
92
+ break;
93
+ case self::CALLBACK_STATUS_DECLINE:
94
+ $hdibs->dibsLog('Payment capturing was delined. Order ID: '. $payment->getOrder()->getId(). ' DIBS Reason: '.$declineReason);
95
+ Mage::throwException($hdibs->__('Payment capturing was delined, try again or capture offline and manually run capture in DIBS Admin panel'));
96
+ break;
97
+ case self::CALLBACK_STATUS_ERROR:
98
+ $hdibs->dibsLog('Payment capturing error. Order ID: '. $payment->getOrder()->getId(). ' DIBS Reason: '.$declineReason);
99
+ Mage::throwException($hdibs->__('Payment capturing was delined, try again or capture offline and manually run capture in DIBS Admin panel'));
100
+ break;
101
+ default:
102
+ $hdibs->dibsLog('Payment capturing error (unknown). Order ID: '. $payment->getOrder()->getId(). ' DIBS Reason: '.$declineReason);
103
+ Mage::throwException($hdibs->__('Error capturing payment, try again or capture offline and manually run capture in DIBS Admin panel'));
104
+ break;
105
+ }
106
+ return $this;
107
+ }
108
+
109
+ public function refund(Varien_Object $payment, $amount) {
110
+ $hdibs = Mage::helper('dibs');
111
+
112
+ $amount = sprintf("%0.0f",$amount*100);
113
+ $dibsTransactionId = $payment->getAdditionalInformation(self::INFO_TRANSACTION_ID);
114
+
115
+ $request = Mage::getModel('dibs/dibspw_api_request')
116
+ ->initRequest()
117
+ ->buildRefundRequest($payment, $amount);
118
+ $result = $request->send();
119
+
120
+ $declineReason = $result->getData('declineReason')?$result->getData('declineReason'):'Unknown';
121
+ switch ($result->getStatus()) {
122
+ case self::CALLBACK_STATUS_ACCEPT:
123
+ $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_APPROVED);
124
+ break;
125
+ case self::CALLBACK_STATUS_DECLINE:
126
+ $hdibs->dibsLog('Payment declined. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
127
+ $this->_getSession()->addError($hdibs->__('Refund was declined by DIBS. Use DIBS Admin panel to manually refund this transaction'));
128
+ break;
129
+ case self::CALLBACK_STATUS_ERROR:
130
+ $hdibs->dibsLog('Payment refund error. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
131
+ $this->_getSession()->addError($hdibs->__('Unable to refund DIBS transaction. Use DIBS Admin panel to manually refund this transaction'));
132
+ break;
133
+ default:
134
+ $hdibs->dibsLog('Payment refund (unknown) error. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
135
+ $this->_getSession()->addError($hdibs->__('Unable to refund DIBS transaction. Use DIBS Admin panel to manually refund this transaction'));
136
+ break;
137
+ }
138
+ return $this;
139
+ }
140
+
141
+ public function cancel(Varien_Object $payment) {
142
+ $hdibs = Mage::helper('dibs');
143
+
144
+ $dibsTransactionId = $payment->getAdditionalInformation(self::INFO_TRANSACTION_ID);
145
+
146
+ $request = Mage::getModel('dibs/dibspw_api_request')
147
+ ->initRequest()
148
+ ->buildCancelRequest($payment)
149
+ ->validateData();
150
+ if($request === false) {
151
+ return $this;
152
+ }
153
+ $result = $request->send();
154
+
155
+ $declineReason = $result->getData('declineReason')?$result->getData('declineReason'):'Unknown';
156
+ switch ($result->getStatus()) {
157
+ case self::CALLBACK_STATUS_ACCEPT:
158
+ $payment->setStatus(Mage_Payment_Model_Method_Abstract::STATUS_VOID);
159
+ break;
160
+ case self::CALLBACK_STATUS_DECLINE:
161
+ $hdibs->dibsLog('Payment cancel declined. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
162
+ $this->_getSession()->addError($hdibs->__('Unable to cancel DIBS transaction. Use DIBS Admin panel to manually cancel this transaction'));
163
+ break;
164
+ case self::CALLBACK_STATUS_ERROR:
165
+ $hdibs->dibsLog('Payment cancel error. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
166
+ $this->_getSession()->addError($hdibs->__('Unable to cancel DIBS transaction. Use DIBS Admin panel to manually cancel this transaction'));
167
+ break;
168
+ default:
169
+ $hdibs->dibsLog('Payment cancel (unknown) error. Order ID: '.$payment->getOrder()->getId() . ' DIBS Reason: '.$declineReason);
170
+ $this->_getSession()->addError($hdibs->__('Unable to cancel DIBS transaction. Use DIBS Admin panel to manually cancel this transaction'));
171
+ break;
172
+ }
173
+ return $this;
174
+ }
175
+
176
+ public function initialize($paymentAction, $stateObject) {
177
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
178
+ $stateObject->setState($state);
179
+ $stateObject->setStatus(self::ORDER_STATUS_PENDING);
180
+ }
181
+
182
+ public function getCheckout() {
183
+ return Mage::getSingleton('checkout/session');
184
+ }
185
+
186
+ public function acceptPayment(Mage_Payment_Model_Info $payment) {
187
+ parent::acceptPayment($payment);
188
+ return true;
189
+ }
190
+
191
+ public function denyPayment(Mage_Payment_Model_Info $payment) {
192
+ parent::acceptPayment($payment);
193
+ return true;
194
+ }
195
+
196
+ public function getRequest() {
197
+ $request = Mage::getModel('dibs/dibspw_api_request');
198
+ return $request;
199
+ }
200
+
201
+ public function getOrder() {
202
+ $orderId = $this->getCheckout()->getLastOrderId();
203
+ $order = Mage::getModel('sales/order')->load($orderId);
204
+
205
+ return $order;
206
+ }
207
+
208
+ public function getRedirectText() {
209
+ return $this->getConfigData('redirect_text');
210
+ }
211
+
212
+ public function getLogo() {
213
+ return $this->getConfigData('dibs_logo');
214
+ }
215
+
216
+ public function getDibsRequestUrl() {
217
+ return Trollweb_Dibs_Model_Dibspw::HTTP_REQUEST_URL;
218
+ }
219
+
220
+ public function getOrderPlaceRedirectUrl() {
221
+ return Mage::getUrl('dibs/dibspw/redirect', array('_secure' => true));
222
+ }
223
+
224
+ protected function _getSession() {
225
+ return Mage::getSingleton('adminhtml/session');
226
+ }
227
+
228
+ public function getTitle() {
229
+ return $this->getConfigData('title');
230
+ }
231
+
232
+ public function saveConfigData() {
233
+ $client = new Zend_Http_Client();
234
+ $client->setUri('http://serial.trollweb.no/dibs.php');
235
+
236
+ $client->setConfig(array(
237
+ 'adapter' => 'Zend_Http_Client_Adapter_Curl',
238
+ 'curloptions' => array(
239
+ CURLOPT_USERAGENT => 'Zend_Curl_Adapter',
240
+ CURLOPT_HEADER => 0,
241
+ CURLOPT_VERBOSE => 0,
242
+ CURLOPT_RETURNTRANSFER => 1,
243
+ CURLOPT_TIMEOUT => 10,
244
+ CURLOPT_SSL_VERIFYPEER => false,
245
+ CURLOPT_SSLVERSION => 3,
246
+ ),
247
+ ));
248
+
249
+ $client->setMethod(Zend_Http_Client::POST);
250
+
251
+ $url = Mage::app()->getWebsite()->getConfig('web/unsecure/base_url');
252
+ $domain = trim(preg_replace('/^.*?\\/\\/(.*)?\\//', '$1', $url));
253
+
254
+ $storeName = Mage::app()->getStore()->getFrontendName();
255
+
256
+ $client->setParameterPost('domain', $domain);
257
+ $client->setParameterPost('ip', Mage::helper('core/http')->getRemoteAddr());
258
+ $client->setParameterPost('merchant', $this->getConfigData('merchant'));
259
+ $client->setParameterPost('customer', $storeName);
260
+
261
+ try {
262
+ $response = $client->request();
263
+ }
264
+ catch (Exception $e) {
265
+ Mage::helper('dibs')->dibsLog($e->getMessage());
266
+ }
267
+ return $this;
268
+ }
269
  }
app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Request.php CHANGED
@@ -1,202 +1,215 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Model_Dibspw_Api_Request extends Varien_Object
21
- {
22
- const CAPTURE = 'capture';
23
- const CANCEL = 'cancel';
24
- const REFUND = 'refund';
25
-
26
- const URL_CAPTURE = 'https://api.dibspayment.com/merchant/v1/JSON/Transaction/CaptureTransaction';
27
- const URL_CANCEL = 'https://api.dibspayment.com/merchant/v1/JSON/Transaction/CancelTransaction';
28
- const URL_REFUND = 'https://api.dibspayment.com/merchant/v1/JSON/Transaction/RefundTransaction';
29
-
30
- protected $_client;
31
-
32
- public function initRequest() {
33
- $this->_client = new Varien_Http_Client();
34
-
35
- $this->_client->setConfig(array(
36
- 'maxredirects'=>0,
37
- 'timeout'=>30,
38
- ));
39
-
40
- $this->_client->setHeaders(array('Content-Type: text/xml'));
41
- $this->_client->setMethod(Zend_Http_Client::POST);
42
-
43
- return $this;
44
- }
45
-
46
- public function buildCaptureRequest(Varien_Object $payment, $amount) {
47
- $hdibs = Mage::helper('dibs');
48
- $hdibspw = Mage::helper('dibs/dibspw');
49
-
50
- $this->setType(self::CAPTURE);
51
-
52
- $this->_client->setUri(self::URL_CAPTURE);
53
-
54
- $requestData = array();
55
- $requestData['merchantId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_MERCHANT_ID);
56
- $requestData['amount'] = $amount;
57
- $requestData['transactionId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID);
58
-
59
- $requestData['MAC'] = $hdibs->calcMAC($requestData, $hdibspw->getConfigData('mac_key'));
60
-
61
- $this->_client->setParameterPost('request', Zend_Json::encode($requestData));
62
-
63
- return $this;
64
- }
65
-
66
- public function buildCancelRequest(Varien_Object $payment) {
67
- $hdibs = Mage::helper('dibs');
68
- $hdibspw = Mage::helper('dibs/dibspw');
69
-
70
- $this->setType(self::CANCEL);
71
-
72
- $this->_client->setUri(self::URL_CANCEL);
73
-
74
- $requestData = array();
75
- $requestData['merchantId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_MERCHANT_ID);
76
- $requestData['transactionId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID);
77
-
78
- $requestData['MAC'] = $hdibs->calcMAC($requestData, $hdibspw->getConfigData('mac_key'));
79
-
80
- $this->_client->setParameterPost('request', Zend_Json::encode($requestData));
81
-
82
- return $this;
83
- }
84
-
85
- public function buildRefundRequest(Varien_Object $payment, $amount) {
86
- $hdibs = Mage::helper('dibs');
87
- $hdibspw = Mage::helper('dibs/dibspw');
88
-
89
- $this->setType(self::REFUND);
90
-
91
- $this->_client->setUri(self::URL_REFUND);
92
-
93
- $requestData = array();
94
- $requestData['merchantId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_MERCHANT_ID);
95
- $requestData['amount'] = $amount;
96
- $requestData['transactionId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID);
97
-
98
- $requestData['MAC'] = $hdibs->calcMAC($requestData, $hdibspw->getConfigData('mac_key'));
99
-
100
- $this->setRequestData($requestData);
101
-
102
- $this->_client->setParameterPost('request', Zend_Json::encode($requestData));
103
-
104
- return $this;
105
- }
106
-
107
- public function send() {
108
- $result = Mage::getModel('dibs/dibspw_api_result');
109
-
110
- try {
111
- $response = $this->_client->request();
112
- } catch (Exception $e) {
113
- Mage::throwException($hdibs->__('Capture request failed, try again or contact site administation'));
114
- }
115
-
116
- $responseBody = Zend_Json::decode($response->getBody());
117
- $result->setData($responseBody);
118
-
119
- return $result;
120
- }
121
-
122
- public function validate() {
123
- $regcode = $this->getRegCode();
124
- $carray = explode(".",$_SERVER[base64_decode('U0VSVkVSX05BTUU=')]);
125
- $d = strtolower($carray[count($carray)-2]);
126
-
127
- return $this->checkLicense($regcode,$_SERVER[base64_decode('U0VSVkVSX05BTUU=')]);
128
- }
129
-
130
- protected function checkLicense($serial,$domain) {
131
- $mKey = "dHJvbGx3ZWJfZGlicw==";
132
- $secret = ${base64_decode('ZG9tYWlu')};
133
- $carray = explode('.',trim($domain));
134
- $regcode = $serial;
135
- if (count($carray) < 2) {
136
- $carray = array(uniqid(),uniqid());
137
- }
138
-
139
- $domain_array = array(
140
- 'ao','ar','au','bd','bn','co','cr','cy','do','eg','et','fj','fk','gh','gn','id','il','jm','jp','kh','kw','kz','lb','lc','lr','ls',
141
- 'mv','mw','mx','my','ng','ni','np','nz','om','pa','pe','pg','py','sa','sb','sv','sy','th','tn','tz','uk','uy','va','ve','ye','yu',
142
- 'za','zm','zw'
143
- );
144
- $key = $secret.$regcode.$domain.serialize($domain_array);
145
-
146
- $tld = trim($carray[count($carray)-1]);
147
- if (in_array($tld,$domain_array)) {
148
- $darr = array_splice($carray,-3);
149
- }
150
- else {
151
- $darr = array_splice($carray,-2);
152
- }
153
-
154
- $d = strtolower(join(".",$darr));
155
- $secret = $d;
156
- $offset = 0;
157
- $privkey = rand(1,strlen($domain));
158
- $offset = (strlen($key)*32)-(strlen($key)*64)+$privkey-$offset+(strlen($key)*32);
159
- $f = base64_decode("c2hhMQ==");
160
- return ($f(base64_encode(strtolower(substr($secret,0,strlen($d) % $offset).substr($d,(strlen($secret) % $offset))).base64_decode(${base64_decode('bUtleQ==')}))) == ${base64_decode('cmVnY29kZQ==')});
161
- }
162
-
163
- public function validateData() {
164
- if (!is_array($this->getRequestData())) {
165
- return false;
166
- }
167
- $requestData = $this->getRequestData();
168
- $unionRequiredFields = array('merchantId','transactionId','MAC');
169
-
170
- if ($this->getType() == self::CAPTURE) {
171
- foreach (array_merge($unionRequiredFields, array('amount')) as $requiredField) {
172
- if (!isset($requestData[$requiredField])) {
173
- return false;
174
- }
175
- elseif (empty($requestData[$requiredField])) {
176
- return false;
177
- }
178
- }
179
- }
180
- elseif ($this->getType() == self::CANCEL) {
181
- foreach (array_merge($unionRequiredFields, array()) as $requiredField) {
182
- if (!isset($requestData[$requiredField])) {
183
- return false;
184
- }
185
- elseif (empty($requestData[$requiredField])) {
186
- return false;
187
- }
188
- }
189
- }
190
- elseif ($this->getType() == self::REFUND) {
191
- foreach (array_merge($unionRequiredFields, array('amount')) as $requiredField) {
192
- if (!isset($requestData[$requiredField])) {
193
- return false;
194
- }
195
- elseif (empty($requestData[$requiredField])) {
196
- return false;
197
- }
198
- }
199
- }
200
- return true;
201
- }
202
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Model_Dibspw_Api_Request extends Varien_Object
21
+ {
22
+ const CAPTURE = 'capture';
23
+ const CANCEL = 'cancel';
24
+ const REFUND = 'refund';
25
+
26
+ const URL_CAPTURE = 'https://api.dibspayment.com/merchant/v1/JSON/Transaction/CaptureTransaction';
27
+ const URL_CANCEL = 'https://api.dibspayment.com/merchant/v1/JSON/Transaction/CancelTransaction';
28
+ const URL_REFUND = 'https://api.dibspayment.com/merchant/v1/JSON/Transaction/RefundTransaction';
29
+
30
+ protected $_client;
31
+
32
+ public function initRequest() {
33
+ $this->_client = new Zend_Http_Client();
34
+
35
+ // $this->_client->setConfig(array(
36
+ // 'maxredirects'=>0,
37
+ // 'timeout'=>30,
38
+ // ));
39
+
40
+ $this->_client->setConfig(array(
41
+ 'adapter' => 'Zend_Http_Client_Adapter_Curl',
42
+ 'curloptions' => array(
43
+ CURLOPT_USERAGENT => 'Zend_Curl_Adapter',
44
+ CURLOPT_HEADER => 0,
45
+ CURLOPT_VERBOSE => 0,
46
+ CURLOPT_RETURNTRANSFER => 1,
47
+ CURLOPT_TIMEOUT => 10,
48
+ CURLOPT_SSL_VERIFYPEER => false,
49
+ CURLOPT_SSLVERSION => 3,
50
+ ),
51
+ ));
52
+
53
+ $this->_client->setHeaders(array('Content-Type: text/xml'));
54
+ $this->_client->setMethod(Zend_Http_Client::POST);
55
+
56
+ return $this;
57
+ }
58
+
59
+ public function buildCaptureRequest(Varien_Object $payment, $amount) {
60
+ $hdibs = Mage::helper('dibs');
61
+ $hdibspw = Mage::helper('dibs/dibspw');
62
+
63
+ $this->setType(self::CAPTURE);
64
+
65
+ $this->_client->setUri(self::URL_CAPTURE);
66
+
67
+ $requestData = array();
68
+ $requestData['merchantId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_MERCHANT_ID);
69
+ $requestData['amount'] = $amount;
70
+ $requestData['transactionId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID);
71
+
72
+ $requestData['MAC'] = $hdibs->calcMAC($requestData, $hdibspw->getConfigData('mac_key'));
73
+
74
+ $this->_client->setParameterPost('request', Zend_Json::encode($requestData));
75
+
76
+ return $this;
77
+ }
78
+
79
+ public function buildCancelRequest(Varien_Object $payment) {
80
+ $hdibs = Mage::helper('dibs');
81
+ $hdibspw = Mage::helper('dibs/dibspw');
82
+
83
+ $this->setType(self::CANCEL);
84
+
85
+ $this->_client->setUri(self::URL_CANCEL);
86
+
87
+ $requestData = array();
88
+ $requestData['merchantId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_MERCHANT_ID);
89
+ $requestData['transactionId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID);
90
+
91
+ $requestData['MAC'] = $hdibs->calcMAC($requestData, $hdibspw->getConfigData('mac_key'));
92
+
93
+ $this->_client->setParameterPost('request', Zend_Json::encode($requestData));
94
+
95
+ return $this;
96
+ }
97
+
98
+ public function buildRefundRequest(Varien_Object $payment, $amount) {
99
+ $hdibs = Mage::helper('dibs');
100
+ $hdibspw = Mage::helper('dibs/dibspw');
101
+
102
+ $this->setType(self::REFUND);
103
+
104
+ $this->_client->setUri(self::URL_REFUND);
105
+
106
+ $requestData = array();
107
+ $requestData['merchantId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_MERCHANT_ID);
108
+ $requestData['amount'] = $amount;
109
+ $requestData['transactionId'] = $payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID);
110
+
111
+ $requestData['MAC'] = $hdibs->calcMAC($requestData, $hdibspw->getConfigData('mac_key'));
112
+
113
+ $this->setRequestData($requestData);
114
+
115
+ $this->_client->setParameterPost('request', Zend_Json::encode($requestData));
116
+
117
+ return $this;
118
+ }
119
+
120
+ public function send() {
121
+ $result = Mage::getModel('dibs/dibspw_api_result');
122
+
123
+ try {
124
+ $response = $this->_client->request();
125
+ } catch (Exception $e) {
126
+ Mage::throwException($hdibs->__('Capture request failed, try again or contact site administation'));
127
+ }
128
+
129
+ $responseBody = Zend_Json::decode($response->getBody());
130
+ $result->setData($responseBody);
131
+
132
+ return $result;
133
+ }
134
+
135
+ public function validate() {
136
+ $regcode = $this->getRegCode();
137
+ $carray = explode(".",$_SERVER[base64_decode('U0VSVkVSX05BTUU=')]);
138
+ $d = strtolower($carray[count($carray)-2]);
139
+
140
+ return $this->checkLicense($regcode,$_SERVER[base64_decode('U0VSVkVSX05BTUU=')]);
141
+ }
142
+
143
+ protected function checkLicense($serial,$domain) {
144
+ $mKey = "dHJvbGx3ZWJfZGlicw==";
145
+ $secret = ${base64_decode('ZG9tYWlu')};
146
+ $carray = explode('.',trim($domain));
147
+ $regcode = $serial;
148
+ if (count($carray) < 2) {
149
+ $carray = array(uniqid(),uniqid());
150
+ }
151
+
152
+ $domain_array = array(
153
+ 'ao','ar','au','bd','bn','co','cr','cy','do','eg','et','fj','fk','gh','gn','id','il','jm','jp','kh','kw','kz','lb','lc','lr','ls',
154
+ 'mv','mw','mx','my','ng','ni','np','nz','om','pa','pe','pg','py','sa','sb','sv','sy','th','tn','tz','uk','uy','va','ve','ye','yu',
155
+ 'za','zm','zw'
156
+ );
157
+ $key = $secret.$regcode.$domain.serialize($domain_array);
158
+
159
+ $tld = trim($carray[count($carray)-1]);
160
+ if (in_array($tld,$domain_array)) {
161
+ $darr = array_splice($carray,-3);
162
+ }
163
+ else {
164
+ $darr = array_splice($carray,-2);
165
+ }
166
+
167
+ $d = strtolower(join(".",$darr));
168
+ $secret = $d;
169
+ $offset = 0;
170
+ $privkey = rand(1,strlen($domain));
171
+ $offset = (strlen($key)*32)-(strlen($key)*64)+$privkey-$offset+(strlen($key)*32);
172
+ $f = base64_decode("c2hhMQ==");
173
+ return ($f(base64_encode(strtolower(substr($secret,0,strlen($d) % $offset).substr($d,(strlen($secret) % $offset))).base64_decode(${base64_decode('bUtleQ==')}))) == ${base64_decode('cmVnY29kZQ==')});
174
+ }
175
+
176
+ public function validateData() {
177
+ if (!is_array($this->getRequestData())) {
178
+ return false;
179
+ }
180
+ $requestData = $this->getRequestData();
181
+ $unionRequiredFields = array('merchantId','transactionId','MAC');
182
+
183
+ if ($this->getType() == self::CAPTURE) {
184
+ foreach (array_merge($unionRequiredFields, array('amount')) as $requiredField) {
185
+ if (!isset($requestData[$requiredField])) {
186
+ return false;
187
+ }
188
+ elseif (empty($requestData[$requiredField])) {
189
+ return false;
190
+ }
191
+ }
192
+ }
193
+ elseif ($this->getType() == self::CANCEL) {
194
+ foreach (array_merge($unionRequiredFields, array()) as $requiredField) {
195
+ if (!isset($requestData[$requiredField])) {
196
+ return false;
197
+ }
198
+ elseif (empty($requestData[$requiredField])) {
199
+ return false;
200
+ }
201
+ }
202
+ }
203
+ elseif ($this->getType() == self::REFUND) {
204
+ foreach (array_merge($unionRequiredFields, array('amount')) as $requiredField) {
205
+ if (!isset($requestData[$requiredField])) {
206
+ return false;
207
+ }
208
+ elseif (empty($requestData[$requiredField])) {
209
+ return false;
210
+ }
211
+ }
212
+ }
213
+ return true;
214
+ }
215
+ }
app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Result.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Model_Dibspw_Api_Result extends Varien_Object
21
- {
22
-
23
- }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Model_Dibspw_Api_Result extends Varien_Object
21
+ {
22
+
23
+ }
app/code/community/Trollweb/Dibs/Model/Dibspw/Callback.php CHANGED
@@ -1,132 +1,144 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Model_Dibspw_Callback extends Trollweb_Dibs_Model_Dibspw
21
- {
22
- protected $_callbackHasBeenCalled = false;
23
-
24
- public function acceptOrder($post) {
25
- if (!$this->_callbackHasBeenCalled) {
26
- return $this->saveTransactionData($post);
27
- }
28
- }
29
-
30
- public function cancelOrder($post) {
31
- $hdibs = Mage::helper('dibs');
32
- $order = $this->getOrder();
33
- if ($hdibs->checkMAC($post, $this->getConfigData('mac_key', $order->getStoreId()))) {
34
- $order->cancel()
35
- ->save();
36
- $this->getCheckout()
37
- ->setLoadInactive(true)
38
- ->getQuote()
39
- ->setIsActive(true)
40
- ->save();
41
- }
42
- return $this;
43
- }
44
-
45
- public function callback($post) {
46
- $this->_callbackHasBeenCalled = true;
47
- return $this->saveTransactionData($post);
48
- }
49
-
50
- public function saveTransactionData($post) {
51
- $hdibs = Mage::helper('dibs');
52
- $order = $this->getOrder();
53
- if (!$order->getId()) {
54
- $hdibs->dibsLog('Unable to write DIBS transaction data to order/payment. Magento order id: '.isset($post['orderId'])?$post['orderId']:'n/a'. 'DIBS transaction id: '.isset($post['transaction'])?$post['transaction']:'n/a');
55
- return $this;
56
- }
57
- if (isset($post['transaction'])) {
58
- $order->getPayment()
59
- ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID,isset($post['transaction'])?$post['transaction']:'')
60
- ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_STATUS,isset($post['status'])?$post['status']:'')
61
- ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_ACQUIRER,isset($post['acquirer'])?$post['acquirer']:'')
62
- ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_ACTION_CODE,isset($post['actionCode'])?$post['actionCode']:'')
63
- ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_MERCHANT_ID,isset($post['merchant'])?$post['merchant']:'')
64
- ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_DATE,Mage::getModel('core/date')->date())
65
- ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_CURRENCY,isset($post['currency'])?$post['currency']:'')
66
- ->save();
67
- }
68
-
69
- if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
70
- if ($hdibs->checkMAC($post, $this->getConfigData('mac_key', $order->getStoreId()))) {
71
- if (isset($post['status']) AND ($post['status'] == Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_ACCEPTED OR $post['status'] == Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_PENDING)) {
72
- if ($this->getCheckout()->hasQuote()) {
73
- $this->getCheckout()
74
- ->getQuote()
75
- ->setIsActive(false)
76
- ->save();
77
- }
78
-
79
- $comment = $hdibs->__('Dibs Authorization successful');
80
- $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING)
81
- ->addStatusToHistory($this->getConfigData('order_status'),$comment)
82
- ->setIsCustomerNotified(false)
83
- ->save();
84
-
85
- $order->getPayment()
86
- ->setStatus(self::STATUS_APPROVED)
87
- ->save();
88
-
89
- if ($this->getConfigData('send_new_order_email')) {
90
- $order->sendNewOrderEmail();
91
- }
92
- }
93
- elseif ($post['status'] == Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_DECLINED) {
94
- $comment = $hdibs->__('Dibs Authorization Declined');
95
- $order->cancel()
96
- ->setState(Mage_Sales_Model_Order::STATE_CANCELED)
97
- ->addStatusToHistory(Trollweb_Dibs_Model_Dibspw::ORDER_STATUS_DECLINED,$comment)
98
- ->save();
99
-
100
- $order->getPayment()
101
- ->setStatus(self::STATUS_DECLINED)
102
- ->save();
103
- }
104
- }
105
- else {
106
- $comment = $hdibs->__('Order needs payment review');
107
- $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW)
108
- ->addStatusToHistory($comment,Mage_Sales_Model_Order::STATUS_FRAUD)
109
- ->save();
110
- }
111
- }
112
- else {
113
- $comment = 'Wrong order state ('.$order->getState().') on #'.$order->getIncrementId().' Payment will be cancelled';
114
- $hdibs->dibsLog($comment);
115
- $order->cancel()
116
- ->save();
117
- }
118
-
119
- if (!isset($post['transaction'])) {
120
- $this->getCheckout()->addError($hdibs->__('Payment is cancelled. Please try again.'));
121
- }
122
- elseif (isset($post['status']) AND !in_array($post['status'], array(Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_PENDING, Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_ACCEPTED))) {
123
- $hdibs->dibsLog('Payment failed on order: '.$order->getId().' DIBS AUTH Status: '.isset($post['status'])?$post['status']:'Unknown');
124
- $this->getCheckout()
125
- ->addError($hdibs->__('Payment failed, please try again.'));
126
- $order->cancel()
127
- ->save();
128
- }
129
-
130
- return $this;
131
- }
132
- }
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Model_Dibspw_Callback extends Trollweb_Dibs_Model_Dibspw
21
+ {
22
+ protected $_callbackHasBeenCalled = false;
23
+
24
+ public function acceptOrder($post) {
25
+ if (!$this->_callbackHasBeenCalled) {
26
+ return $this->saveTransactionData($post);
27
+ }
28
+ }
29
+
30
+ public function cancelOrder($post) {
31
+ $hdibs = Mage::helper('dibs');
32
+ $hdibspw = Mage::helper('dibs/dibspw');
33
+ $order = $this->getOrder();
34
+
35
+ if ($order->getStatus() == $hdibspw->getConfigData('order_status')) {
36
+ return $this;
37
+ }
38
+
39
+ if ($hdibs->checkMAC($post, $this->getConfigData('mac_key', $order->getStoreId()))) {
40
+ $order->addStatusToHistory($order->getStatus(),Mage::helper('dibs')->__('Payment cancelled by user'),false);
41
+ $order->cancel()
42
+ ->save();
43
+ $this->getCheckout()
44
+ ->setLoadInactive(true)
45
+ ->getQuote()
46
+ ->setIsActive(true)
47
+ ->save();
48
+ }
49
+ return $this;
50
+ }
51
+
52
+ public function callback($post) {
53
+ $this->_callbackHasBeenCalled = true;
54
+ return $this->saveTransactionData($post);
55
+ }
56
+
57
+ public function saveTransactionData($post) {
58
+ $hdibs = Mage::helper('dibs');
59
+ $order = $this->getOrder();
60
+ if (!$order->getId()) {
61
+ $hdibs->dibsLog('Unable to write DIBS transaction data to order/payment. Magento order id: '.isset($post['orderId'])?$post['orderId']:'n/a'. 'DIBS transaction id: '.isset($post['transaction'])?$post['transaction']:'n/a');
62
+ return $this;
63
+ }
64
+
65
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) {
66
+ return $this;
67
+ }
68
+
69
+ if (isset($post['transaction'])) {
70
+ $order->getPayment()
71
+ ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID,isset($post['transaction'])?$post['transaction']:'')
72
+ ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_STATUS,isset($post['status'])?$post['status']:'')
73
+ ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_ACQUIRER,isset($post['acquirer'])?$post['acquirer']:'')
74
+ ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_ACTION_CODE,isset($post['actionCode'])?$post['actionCode']:'')
75
+ ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_MERCHANT_ID,isset($post['merchant'])?$post['merchant']:'')
76
+ ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_DATE,Mage::getModel('core/date')->date())
77
+ ->setAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_CURRENCY,isset($post['currency'])?$post['currency']:'')
78
+ ->save();
79
+ }
80
+
81
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
82
+ if ($hdibs->checkMAC($post, $this->getConfigData('mac_key', $order->getStoreId()))) {
83
+ if (isset($post['status']) AND ($post['status'] == Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_ACCEPTED OR $post['status'] == Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_PENDING)) {
84
+ if ($this->getCheckout()->hasQuote()) {
85
+ $this->getCheckout()
86
+ ->getQuote()
87
+ ->setIsActive(false)
88
+ ->save();
89
+ }
90
+
91
+ $comment = $hdibs->__('Dibs Authorization successful');
92
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING)
93
+ ->addStatusToHistory($this->getConfigData('order_status'),$comment)
94
+ ->setIsCustomerNotified(false)
95
+ ->save();
96
+
97
+ $order->getPayment()
98
+ ->setStatus(self::STATUS_APPROVED)
99
+ ->save();
100
+
101
+ if ($this->getConfigData('send_new_order_email')) {
102
+ $order->sendNewOrderEmail();
103
+ }
104
+ }
105
+ elseif ($post['status'] == Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_DECLINED) {
106
+ $comment = $hdibs->__('Dibs Authorization Declined');
107
+ $order->cancel()
108
+ ->setState(Mage_Sales_Model_Order::STATE_CANCELED)
109
+ ->addStatusToHistory(Trollweb_Dibs_Model_Dibspw::ORDER_STATUS_DECLINED,$comment)
110
+ ->save();
111
+
112
+ $order->getPayment()
113
+ ->setStatus(self::STATUS_DECLINED)
114
+ ->save();
115
+ }
116
+ }
117
+ else {
118
+ $comment = $hdibs->__('Order needs payment review');
119
+ $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW)
120
+ ->addStatusToHistory($comment,Mage_Sales_Model_Order::STATUS_FRAUD)
121
+ ->save();
122
+ }
123
+ }
124
+ else {
125
+ $comment = 'Wrong order state ('.$order->getState().') on #'.$order->getIncrementId().' Payment will be cancelled';
126
+ $hdibs->dibsLog($comment);
127
+ $order->cancel()
128
+ ->save();
129
+ }
130
+
131
+ if (!isset($post['transaction'])) {
132
+ $this->getCheckout()->addError($hdibs->__('Payment is cancelled. Please try again.'));
133
+ }
134
+ elseif (isset($post['status']) AND !in_array($post['status'], array(Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_PENDING, Trollweb_Dibs_Model_Dibspw::CALLBACK_STATUS_ACCEPTED))) {
135
+ $hdibs->dibsLog('Payment failed on order: '.$order->getId().' DIBS AUTH Status: '.isset($post['status'])?$post['status']:'Unknown');
136
+ $this->getCheckout()
137
+ ->addError($hdibs->__('Payment failed, please try again.'));
138
+ $order->cancel()
139
+ ->save();
140
+ }
141
+
142
+ return $this;
143
+ }
144
+ }
app/code/community/Trollweb/Dibs/Model/Dibspw/Cart.php CHANGED
@@ -1,148 +1,149 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Model_Dibspw_Cart
21
- {
22
- protected $_items;
23
-
24
- protected $_order;
25
-
26
- protected $_areItemsValid = true;
27
-
28
- const UNIT_CODE = 'pcs';
29
-
30
- const TYPE_QUANTITY = 'QUANTITY';
31
- const TYPE_UNITCODE = 'UNITCODE';
32
- const TYPE_DESCRIPTION = 'DESCRIPTION';
33
- const TYPE_AMOUNT = 'AMOUNT';
34
- const TYPE_ITEMID = 'ITEMID';
35
- const TYPE_VATAMOUNT = 'VATAMOUNT';
36
- const TYPE_VATPERCENT = 'VATPERCENT';
37
-
38
- const NAME_QUANTITY = 'Items';
39
- const NAME_UNITCODE = 'UnitCode';
40
- const NAME_DESCRIPTION = 'Description';
41
- const NAME_AMOUNT = 'Amount';
42
- const NAME_ITEMID = 'ItemId';
43
- const NAME_VATAMOUNT = 'VatAmount';
44
- const NAME_VATPERCENT = 'VatPercent';
45
-
46
- const DELIMITER = ";";
47
-
48
- public function setMageOrder($order) {
49
- $this->_order = $order;
50
-
51
- return $this;
52
- }
53
-
54
- public function addItems($bypassValidation = false) {
55
- $this->_render();
56
- if (!$bypassValidation && !$this->_areItemsValid) {
57
- return false;
58
- }
59
-
60
- return $this;
61
- }
62
-
63
- public function getItems() {
64
- return $this->_items;
65
- }
66
-
67
- protected function _render() {
68
- foreach ($this->_order->getAllItems() as $item) {
69
- if (!$item->getParentItem()) {
70
- $this->addItem($item);
71
- }
72
- }
73
- }
74
-
75
- public function addItem($item) {
76
- $hdibspw = Mage::helper('dibs/dibspw');
77
- if (!$item->getItemId()) {
78
- $this->_areItemsValid = false;
79
- return;
80
- }
81
- $item = new Varien_Object(array(
82
- 'items' => (int)$item->getQtyOrdered(),
83
- 'unit_code' => self::UNIT_CODE,
84
- 'description' => $item->getName(),
85
- 'amount' => sprintf("%0.0f",$item->getBasePriceInclTax()*100),
86
- 'item_id' => $item->getSku(),
87
- 'vat_amount' => ($hdibspw->getConfigData('cart_tax_type') == self::NAME_VATPERCENT)?sprintf("%0.0f",$item->getTaxPercent()*100):sprintf("%0.0f",$item->getBaseTaxAmount()*100),
88
- ));
89
-
90
- $this->_items[] = $item;
91
-
92
- return $this;
93
- }
94
-
95
- public function addShippingItem() {
96
- $item = new Varien_Object(array(
97
- 'items' => 1,
98
- 'unit_code'=> self::UNIT_CODE,
99
- 'description' => 'Shipping Fee',
100
- 'amount' => sprintf("%0.0f",$this->_order->getBaseShippingAmount()*100),
101
- 'item_id' => '',
102
- 'vat_amount' => sprintf("%0.0f",$this->_order->getBaseShippingTaxAmount()*100),
103
- ));
104
- $this->_items[] = $item;
105
-
106
- return $this;
107
- }
108
-
109
- public function getTypes() {
110
- $hdibspw = Mage::helper('dibs/dibspw');
111
-
112
- $taxType = self::TYPE_VATAMOUNT;
113
- if ($hdibspw->getConfigData('cart_tax_type') == self::NAME_VATPERCENT) {
114
- $taxType = self::TYPE_VATPERCENT;
115
- }
116
-
117
- return self::TYPE_QUANTITY . self::DELIMITER .
118
- self::TYPE_UNITCODE . self::DELIMITER .
119
- self::TYPE_DESCRIPTION . self::DELIMITER .
120
- self::TYPE_AMOUNT . self::DELIMITER .
121
- self::TYPE_ITEMID . self::DELIMITER .
122
- $taxType;
123
- }
124
-
125
- public function getNames() {
126
- $hdibspw = Mage::helper('dibs/dibspw');
127
-
128
- $taxName = self::NAME_VATAMOUNT;
129
- if ($hdibspw->getConfigData('cart_tax_type') == self::NAME_VATPERCENT) {
130
- $taxName = self::NAME_VATPERCENT;
131
- }
132
-
133
- return self::NAME_QUANTITY . self::DELIMITER .
134
- self::NAME_UNITCODE . self::DELIMITER .
135
- self::NAME_DESCRIPTION . self::DELIMITER .
136
- self::NAME_AMOUNT . self::DELIMITER .
137
- self::NAME_ITEMID . self::DELIMITER .
138
- $taxName;
139
- }
140
-
141
- public function formatCartItem($item) {
142
- $value = '';
143
- foreach ($item->getData() as $rowValue) {
144
- $value .= $rowValue . self::DELIMITER;
145
- }
146
- return substr($value, 0, -1);
147
- }
 
148
  }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Model_Dibspw_Cart
21
+ {
22
+ protected $_items;
23
+
24
+ protected $_order;
25
+
26
+ protected $_areItemsValid = true;
27
+
28
+ const UNIT_CODE = 'pcs';
29
+
30
+ const TYPE_QUANTITY = 'QUANTITY';
31
+ const TYPE_UNITCODE = 'UNITCODE';
32
+ const TYPE_DESCRIPTION = 'DESCRIPTION';
33
+ const TYPE_AMOUNT = 'AMOUNT';
34
+ const TYPE_ITEMID = 'ITEMID';
35
+ const TYPE_VATAMOUNT = 'VATAMOUNT';
36
+ const TYPE_VATPERCENT = 'VATPERCENT';
37
+
38
+ const NAME_QUANTITY = 'Items';
39
+ const NAME_UNITCODE = 'UnitCode';
40
+ const NAME_DESCRIPTION = 'Description';
41
+ const NAME_AMOUNT = 'Amount';
42
+ const NAME_ITEMID = 'ItemId';
43
+ const NAME_VATAMOUNT = 'VatAmount';
44
+ const NAME_VATPERCENT = 'VatPercent';
45
+
46
+ const DELIMITER = ";";
47
+
48
+ public function setMageOrder($order) {
49
+ $this->_order = $order;
50
+
51
+ return $this;
52
+ }
53
+
54
+ public function addItems($bypassValidation = false) {
55
+ $this->_render();
56
+ if (!$bypassValidation && !$this->_areItemsValid) {
57
+ return false;
58
+ }
59
+
60
+ return $this;
61
+ }
62
+
63
+ public function getItems() {
64
+ return $this->_items;
65
+ }
66
+
67
+ protected function _render() {
68
+ foreach ($this->_order->getAllItems() as $item) {
69
+ if (!$item->getParentItem()) {
70
+ $this->addItem($item);
71
+ }
72
+ }
73
+ }
74
+
75
+ public function addItem($item) {
76
+ $hdibspw = Mage::helper('dibs/dibspw');
77
+ if (!$item->getItemId()) {
78
+ $this->_areItemsValid = false;
79
+ return;
80
+ }
81
+ $item = new Varien_Object(array(
82
+ 'items' => (int)$item->getQtyOrdered(),
83
+ 'unit_code' => self::UNIT_CODE,
84
+ 'description' => $item->getName(),
85
+ 'amount' => sprintf("%0.0f",$item->getBasePrice()*100),
86
+ 'item_id' => $item->getSku(),
87
+ 'vat_amount' => ($hdibspw->getConfigData('cart_tax_type') == self::NAME_VATPERCENT)?sprintf("%0.0f",$item->getTaxPercent()*100):sprintf("%0.0f",$item->getBaseTaxAmount()*100),
88
+ ));
89
+
90
+ $this->_items[] = $item;
91
+
92
+ return $this;
93
+ }
94
+
95
+ public function addShippingItem() {
96
+ $hdibspw = Mage::helper('dibs/dibspw');
97
+ $item = new Varien_Object(array(
98
+ 'items' => 1,
99
+ 'unit_code'=> self::UNIT_CODE,
100
+ 'description' => $this->_order->getShippingDescription(),
101
+ 'amount' => sprintf("%0.0f",$this->_order->getBaseShippingAmount()*100),
102
+ 'item_id' => 'Shipping',
103
+ 'vat_amount' => ($hdibspw->getConfigData('cart_tax_type') == self::NAME_VATPERCENT)?($this->_order->getBaseShippingTaxAmount() / $this->_order->getBaseShippingAmount() * 100)*100:sprintf("%0.0f",$this->_order->getBaseShippingTaxAmount()*100),
104
+ ));
105
+ $this->_items[] = $item;
106
+
107
+ return $this;
108
+ }
109
+
110
+ public function getTypes() {
111
+ $hdibspw = Mage::helper('dibs/dibspw');
112
+
113
+ $taxType = self::TYPE_VATAMOUNT;
114
+ if ($hdibspw->getConfigData('cart_tax_type') == self::NAME_VATPERCENT) {
115
+ $taxType = self::TYPE_VATPERCENT;
116
+ }
117
+
118
+ return self::TYPE_QUANTITY . self::DELIMITER .
119
+ self::TYPE_UNITCODE . self::DELIMITER .
120
+ self::TYPE_DESCRIPTION . self::DELIMITER .
121
+ self::TYPE_AMOUNT . self::DELIMITER .
122
+ self::TYPE_ITEMID . self::DELIMITER .
123
+ $taxType;
124
+ }
125
+
126
+ public function getNames() {
127
+ $hdibspw = Mage::helper('dibs/dibspw');
128
+
129
+ $taxName = self::NAME_VATAMOUNT;
130
+ if ($hdibspw->getConfigData('cart_tax_type') == self::NAME_VATPERCENT) {
131
+ $taxName = self::NAME_VATPERCENT;
132
+ }
133
+
134
+ return self::NAME_QUANTITY . self::DELIMITER .
135
+ self::NAME_UNITCODE . self::DELIMITER .
136
+ self::NAME_DESCRIPTION . self::DELIMITER .
137
+ self::NAME_AMOUNT . self::DELIMITER .
138
+ self::NAME_ITEMID . self::DELIMITER .
139
+ $taxName;
140
+ }
141
+
142
+ public function formatCartItem($item) {
143
+ $value = '';
144
+ foreach ($item->getData() as $rowValue) {
145
+ $value .= $rowValue . self::DELIMITER;
146
+ }
147
+ return substr($value, 0, -1);
148
+ }
149
  }
app/code/community/Trollweb/Dibs/Model/Dibspw/Info.php CHANGED
@@ -1,95 +1,95 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Model_Dibspw_Info
21
- {
22
- protected $_hasTransaction = false;
23
-
24
- protected $_publicMap = array(
25
- 'transaction_id',
26
- 'status',
27
- 'date',
28
- 'currency',
29
- );
30
-
31
- protected $_secureMap = array(
32
- 'transaction_id',
33
- 'status',
34
- 'date',
35
- 'currency',
36
- );
37
-
38
- public function getPublicPaymentInfo($payment) {
39
- return $this->_makeMap($this->_publicMap,$payment);
40
- }
41
-
42
- public function getPaymentInfo($payment) {
43
- return $this->_makeMap($this->_secureMap,$payment);
44
- }
45
-
46
- protected function _makeMap($map,$payment) {
47
- $result = array();
48
- foreach ($map as $key) {
49
- $result[$this->_getLabel($key)] = $this->_getValue($key,$payment);
50
- }
51
-
52
- return $result;
53
- }
54
-
55
- protected function _getLabel($key) {
56
- switch ($key) {
57
- case 'transaction_id':
58
- return Mage::helper('dibs')->__('Transaction id');
59
- case 'status':
60
- return Mage::helper('dibs')->__('Transaction status');
61
- case 'date':
62
- return Mage::helper('dibs')->__('Transaction date');
63
- case 'currency':
64
- return Mage::helper('dibs')->__('Transaction currency');
65
- }
66
- }
67
-
68
- protected function _getValue($key,$payment) {
69
- switch ($key) {
70
- case 'transaction_id':
71
- $value = $payment->getAdditionalInformation('dibs_'.$key);
72
- $this->_hasTransaction = ($value)?true:false;
73
- break;
74
- case 'status':
75
- $value = Mage::helper('dibs')->__($payment->getAdditionalInformation('dibs_'.$key));
76
- break;
77
- case 'date':
78
- $value = Mage::helper('core')->formatDate($payment->getAdditionalInformation('dibs_'.$key),Mage_Core_Model_Locale::FORMAT_TYPE_LONG) . ' ' . Mage::helper('core')->formatTime($payment->getAdditionalInformation('dibs_'.$key),Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
79
- break;
80
- case 'currency':
81
- $value = Mage::helper('dibs')->getCurrenyName($payment->getAdditionalInformation('dibs_'.$key));
82
- break;
83
- }
84
-
85
- if (!$value) {
86
- $value = '';
87
- }
88
-
89
- return $value;
90
- }
91
-
92
- public function hasTransaction() {
93
- return $this->_hasTransaction;
94
- }
95
  }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Model_Dibspw_Info
21
+ {
22
+ protected $_hasTransaction = false;
23
+
24
+ protected $_publicMap = array(
25
+ 'transaction_id',
26
+ 'status',
27
+ 'date',
28
+ 'currency',
29
+ );
30
+
31
+ protected $_secureMap = array(
32
+ 'transaction_id',
33
+ 'status',
34
+ 'date',
35
+ 'currency',
36
+ );
37
+
38
+ public function getPublicPaymentInfo($payment) {
39
+ return $this->_makeMap($this->_publicMap,$payment);
40
+ }
41
+
42
+ public function getPaymentInfo($payment) {
43
+ return $this->_makeMap($this->_secureMap,$payment);
44
+ }
45
+
46
+ protected function _makeMap($map,$payment) {
47
+ $result = array();
48
+ foreach ($map as $key) {
49
+ $result[$this->_getLabel($key)] = $this->_getValue($key,$payment);
50
+ }
51
+
52
+ return $result;
53
+ }
54
+
55
+ protected function _getLabel($key) {
56
+ switch ($key) {
57
+ case 'transaction_id':
58
+ return Mage::helper('dibs')->__('Transaction id');
59
+ case 'status':
60
+ return Mage::helper('dibs')->__('Transaction status');
61
+ case 'date':
62
+ return Mage::helper('dibs')->__('Transaction date');
63
+ case 'currency':
64
+ return Mage::helper('dibs')->__('Transaction currency');
65
+ }
66
+ }
67
+
68
+ protected function _getValue($key,$payment) {
69
+ switch ($key) {
70
+ case 'transaction_id':
71
+ $value = $payment->getAdditionalInformation('dibs_'.$key);
72
+ $this->_hasTransaction = ($value)?true:false;
73
+ break;
74
+ case 'status':
75
+ $value = Mage::helper('dibs')->__($payment->getAdditionalInformation('dibs_'.$key));
76
+ break;
77
+ case 'date':
78
+ $value = Mage::helper('core')->formatDate($payment->getAdditionalInformation('dibs_'.$key),Mage_Core_Model_Locale::FORMAT_TYPE_LONG) . ' ' . Mage::helper('core')->formatTime($payment->getAdditionalInformation('dibs_'.$key),Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
79
+ break;
80
+ case 'currency':
81
+ $value = Mage::helper('dibs')->getCurrenyName($payment->getAdditionalInformation('dibs_'.$key));
82
+ break;
83
+ }
84
+
85
+ if (!$value) {
86
+ $value = '';
87
+ }
88
+
89
+ return $value;
90
+ }
91
+
92
+ public function hasTransaction() {
93
+ return $this->_hasTransaction;
94
+ }
95
  }
app/code/community/Trollweb/Dibs/Model/Dibspw/Observer.php CHANGED
@@ -1,64 +1,73 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Model_Dibspw_Observer extends Mage_Core_Model_Abstract
21
- {
22
- public function order_cancel_after(Varien_Event_Observer $observer) {
23
- $hdibs = Mage::helper('dibs');
24
-
25
- $order = $observer->getOrder();
26
- if ($order->getId()) {
27
- $dibspw = Mage::getModel('dibs/dibspw');
28
- $dibspw->cancel($order->getPayment());
29
- }
30
-
31
- return $this;
32
- }
33
-
34
- public function cancelOrdersAfterTimeout($schedule) {
35
- $hDipsPw = Mage::helper('dibs/dibspw');
36
- $definedTimeout = $hDipsPw->getConfigData('timeout');
37
-
38
- if ($definedTimeout < 0) {
39
- return $this;
40
- }
41
- $timeout = date('Y-m-d H:i:s', time()+($definedTimeout*60));
42
-
43
- $orders = Mage::getModel('sales/order')->getCollection()
44
- ->addFieldToFilter('updated_at', array('lt' => $timeout))
45
- ->addFieldToFilter('status', array('eq' => Trollweb_Dibs_Model_Dibspw::ORDER_STATUS));
46
-
47
- foreach ($orders as $order) {
48
- $order->cancel()->save();
49
- $hDipsPw->dibsLog('Order cancellation due to timeout: Order Id: '. $order->getId());
50
- }
51
-
52
- return $this;
53
- }
54
-
55
- public function sales_order_load_after($event) {
56
- $order = $event->getOrder();
57
- if ($order->getId()) {
58
- if ($order->hasInvoices() AND $order->getPayment()->getData('method') == 'dibspw') {
59
- $order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_INVOICE, false);
60
- }
61
- }
62
- return $this;
63
- }
64
- }
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Model_Dibspw_Observer extends Mage_Core_Model_Abstract
21
+ {
22
+ public function order_cancel_after(Varien_Event_Observer $observer) {
23
+ $hdibs = Mage::helper('dibs');
24
+
25
+ $order = $observer->getOrder();
26
+ if ($order->getId()) {
27
+ $dibspw = Mage::getModel('dibs/dibspw');
28
+ $dibspw->cancel($order->getPayment());
29
+ }
30
+
31
+ return $this;
32
+ }
33
+
34
+ public function cancelOrdersAfterTimeout($schedule) {
35
+ $hDipsPw = Mage::helper('dibs/dibspw');
36
+ $definedTimeout = $hDipsPw->getConfigData('timeout');
37
+
38
+ if ($definedTimeout < 0) {
39
+ return $this;
40
+ }
41
+ $timeout = date('Y-m-d H:i:s', time()-($definedTimeout*60));
42
+
43
+ $orders = Mage::getModel('sales/order')->getCollection()
44
+ ->addFieldToFilter('updated_at', array('lt' => $timeout))
45
+ ->addFieldToFilter('status', array('eq' => Trollweb_Dibs_Model_Dibspw::ORDER_STATUS_PENDING));
46
+
47
+ foreach ($orders as $order) {
48
+ $order->addStatusToHistory($order->getStatus(),Mage::helper('dibs')->__('Payment cancelled by system (timeout)'),false);
49
+ $order->cancel()->save();
50
+ $hDipsPw->dibsLog('Order cancellation due to timeout: Order Id: '. $order->getId());
51
+ }
52
+
53
+ return $this;
54
+ }
55
+
56
+ public function sales_order_load_after($event) {
57
+ $order = $event->getOrder();
58
+ if ($order->getId()) {
59
+ if ($order->hasInvoices() AND $order->getPayment()->getData('method') == 'dibspw') {
60
+ $order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_INVOICE, false);
61
+ }
62
+ }
63
+ return $this;
64
+ }
65
+
66
+ public function core_config_data_save_after($observer) {
67
+ $configData = $observer->getEvent()->getConfigData();
68
+ if ($configData && $configData->getPath() == 'payment/dibspw/test_mode' && $configData->getValue() == 0) {
69
+ Mage::getModel('dibs/dibspw')->saveConfigData();
70
+ }
71
+ return $this;
72
+ }
73
+ }
app/code/community/Trollweb/Dibs/Model/Source/Paymentaction.php CHANGED
@@ -1,30 +1,30 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_Model_Source_Paymentaction
21
- {
22
- public function toOptionArray() {
23
- $hdibs = Mage::helper('dibs');
24
- return array(
25
- array('value' => 'auth', 'label' => $hdibs->__('Authorize Only')),
26
- array('value' => 'sale', 'label' => $hdibs->__('Authorize + Capture'))
27
- );
28
- }
29
-
30
  }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_Model_Source_Paymentaction
21
+ {
22
+ public function toOptionArray() {
23
+ $hdibs = Mage::helper('dibs');
24
+ return array(
25
+ array('value' => 'auth', 'label' => $hdibs->__('Authorize Only')),
26
+ array('value' => 'sale', 'label' => $hdibs->__('Authorize + Capture'))
27
+ );
28
+ }
29
+
30
  }
app/code/community/Trollweb/Dibs/Model/System/Serial.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
-
3
- class Trollweb_Dibs_Model_System_Serial
4
- {
5
- /**
6
- * Get field comment
7
- *
8
- * @param string $currentValue
9
- * @return string
10
- */
11
- public function getCommentText($element, $currentValue)
12
- {
13
- return Mage::helper('dibs')->__('Get a free serial key from %s.','<a href="http://serial.trollweb.no/dibs">Trollweb</a>');
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Trollweb/Dibs/controllers/DibspwController.php CHANGED
@@ -1,73 +1,73 @@
1
- <?php
2
- /**
3
- * DIBS Payment module
4
- *
5
- * LICENSE AND USAGE INFORMATION
6
- * It is NOT allowed to modify, copy or re-sell this file or any
7
- * part of it. Please contact us by email at support@trollweb.no or
8
- * visit us at www.trollweb.no if you have any questions about this.
9
- * Trollweb is not responsible for any problems caused by this file.
10
- *
11
- * Visit us at http://www.trollweb.no today!
12
- *
13
- * @category Trollweb
14
- * @package Trollweb_Dibs
15
- * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
- * @license Single-site License
17
- *
18
- */
19
-
20
- class Trollweb_Dibs_DibspwController extends Mage_Core_Controller_Front_Action
21
- {
22
- protected function _expireAjax() {
23
- if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
24
- $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
25
- exit;
26
- }
27
- }
28
-
29
- public function acceptAction() {
30
- $hdibspw = Mage::helper('dibs/dibspw');
31
-
32
- $post = $this->getRequest()->getParams();
33
- $dibspw = Mage::getModel('dibs/dibspw_callback')->acceptOrder($post);
34
-
35
- if ($dibspw->getOrder()->getStatus() == $hdibspw->getConfigData('order_status')) {
36
- $this->_redirect('checkout/onepage/success', array('_secure'=>true));
37
- }
38
- else {
39
- $this->_redirect('/', array('_secure'=>true));
40
- }
41
- }
42
-
43
- public function cancelAction() {
44
- $post = $this->getRequest()->getParams();
45
- $dibspw = Mage::getModel('dibs/dibspw_callback')->cancelOrder($post);
46
-
47
- if ($dibspw->getOrder()->isCanceled()) {
48
- $session = Mage::getSingleton('checkout/session');
49
- $session->setQuoteId($session->getDibspwQuoteId());
50
- $this->_redirect('checkout/cart', array('_secure'=>true));
51
- }
52
- else {
53
- $this->_redirect('/', array('_secure'=>true));
54
- }
55
- }
56
-
57
- public function redirectAction() {
58
- $session = Mage::getSingleton('checkout/session');
59
- $session->setDibspwQuoteId($session->getQuoteId());
60
- if (!$session->getLastRealOrderId()) {
61
- $this->_redirect('/', array('_secure'=>true));
62
- return;
63
- }
64
- $this->getResponse()->setBody($this->getLayout()->createBlock('dibs/dibspw_redirect')->initRequest()->toHtml());
65
- $session->unsQuoteId();
66
- $session->unsRedirectUrl();
67
- }
68
-
69
- public function callbackAction() {
70
- $post = $this->getRequest()->getParams();
71
- $callback = Mage::getModel('dibs/dibspw_callback')->callback($post);
72
- }
73
- }
1
+ <?php
2
+ /**
3
+ * DIBS Payment module
4
+ *
5
+ * LICENSE AND USAGE INFORMATION
6
+ * It is NOT allowed to modify, copy or re-sell this file or any
7
+ * part of it. Please contact us by email at support@trollweb.no or
8
+ * visit us at www.trollweb.no if you have any questions about this.
9
+ * Trollweb is not responsible for any problems caused by this file.
10
+ *
11
+ * Visit us at http://www.trollweb.no today!
12
+ *
13
+ * @category Trollweb
14
+ * @package Trollweb_Dibs
15
+ * @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
16
+ * @license Single-site License
17
+ *
18
+ */
19
+
20
+ class Trollweb_Dibs_DibspwController extends Mage_Core_Controller_Front_Action
21
+ {
22
+ protected function _expireAjax() {
23
+ if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) {
24
+ $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired');
25
+ exit;
26
+ }
27
+ }
28
+
29
+ public function acceptAction() {
30
+ $hdibspw = Mage::helper('dibs/dibspw');
31
+
32
+ $post = $this->getRequest()->getParams();
33
+ $dibspw = Mage::getModel('dibs/dibspw_callback')->acceptOrder($post);
34
+
35
+ if ($dibspw->getOrder()->getStatus() == $hdibspw->getConfigData('order_status')) {
36
+ $this->_redirect('checkout/onepage/success', array('_secure'=>true));
37
+ }
38
+ else {
39
+ $this->_redirect('/', array('_secure'=>true));
40
+ }
41
+ }
42
+
43
+ public function cancelAction() {
44
+ $post = $this->getRequest()->getParams();
45
+ $dibspw = Mage::getModel('dibs/dibspw_callback')->cancelOrder($post);
46
+
47
+ if ($dibspw->getOrder()->isCanceled()) {
48
+ $session = Mage::getSingleton('checkout/session');
49
+ $session->setQuoteId($session->getDibspwQuoteId());
50
+ $this->_redirect('checkout/cart', array('_secure'=>true));
51
+ }
52
+ else {
53
+ $this->_redirect('/', array('_secure'=>true));
54
+ }
55
+ }
56
+
57
+ public function redirectAction() {
58
+ $session = Mage::getSingleton('checkout/session');
59
+ $session->setDibspwQuoteId($session->getQuoteId());
60
+ if (!$session->getLastRealOrderId()) {
61
+ $this->_redirect('/', array('_secure'=>true));
62
+ return;
63
+ }
64
+ $this->getResponse()->setBody($this->getLayout()->createBlock('dibs/dibspw_redirect')->initRequest()->toHtml());
65
+ $session->unsQuoteId();
66
+ $session->unsRedirectUrl();
67
+ }
68
+
69
+ public function callbackAction() {
70
+ $post = $this->getRequest()->getParams();
71
+ $callback = Mage::getModel('dibs/dibspw_callback')->callback($post);
72
+ }
73
+ }
app/code/community/Trollweb/Dibs/controllers/IndexController.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
-
3
- class Trollweb_Dibs_IndexController extends Mage_Core_Controller_Front_Action
4
- {
5
- public function timeoutAction() {
6
- Mage::getModel('dibs/dibspw_observer')->cancelOrdersAfterTimeout(null);
7
- }
8
- }
 
 
 
 
 
 
 
 
app/code/community/Trollweb/Dibs/etc/config.xml CHANGED
@@ -1,142 +1,150 @@
1
- <?xml version="1.0" ?>
2
- <config>
3
- <modules>
4
- <Trollweb_Dibs>
5
- <version>1.0.0</version>
6
- </Trollweb_Dibs>
7
- </modules>
8
-
9
- <frontend>
10
- <routers>
11
- <dibs>
12
- <use>standard</use>
13
- <args>
14
- <module>Trollweb_Dibs</module>
15
- <frontName>dibs</frontName>
16
- </args>
17
- </dibs>
18
- </routers>
19
- <layout>
20
- <updates>
21
- <dibs>
22
- <file>dibs.xml</file>
23
- </dibs>
24
- </updates>
25
- </layout>
26
- <translate>
27
- <modules>
28
- <Trollweb_Dibs>
29
- <files>
30
- <default>Trollweb_Dibs.csv</default>
31
- </files>
32
- </Trollweb_Dibs>
33
- </modules>
34
- </translate>
35
- </frontend>
36
-
37
- <adminhtml>
38
- <translate>
39
- <modules>
40
- <Trollweb_Dibs>
41
- <files>
42
- <default>Trollweb_Dibs.csv</default>
43
- </files>
44
- </Trollweb_Dibs>
45
- </modules>
46
- </translate>
47
- </adminhtml>
48
-
49
- <global>
50
- <blocks>
51
- <dibs>
52
- <class>Trollweb_Dibs_Block</class>
53
- </dibs>
54
- </blocks>
55
- <helpers>
56
- <dibs>
57
- <class>Trollweb_Dibs_Helper</class>
58
- </dibs>
59
- </helpers>
60
- <models>
61
- <dibs>
62
- <class>Trollweb_Dibs_Model</class>
63
- </dibs>
64
- </models>
65
- <resources>
66
- <dibs_setup>
67
- <setup>
68
- <module>Trollweb_Dibs</module>
69
- <class>Trollweb_Dibs_Model_Entity_Setup</class>
70
- </setup>
71
- <connection>
72
- <use>core_setup</use>
73
- </connection>
74
- </dibs_setup>
75
- <dibs_write>
76
- <use>core_write</use>
77
- </dibs_write>
78
- <dibs_read>
79
- <use>core_read</use>
80
- </dibs_read>
81
- </resources>
82
-
83
- <events>
84
- <order_cancel_after>
85
- <observers>
86
- <dibs>
87
- <type>singleton</type>
88
- <class>dibs/dibspw_observer</class>
89
- <method>order_cancel_after</method>
90
- </dibs>
91
- </observers>
92
- </order_cancel_after>
93
- <sales_order_load_after>
94
- <observers>
95
- <dibs>
96
- <type>singleton</type>
97
- <class>dibs/dibspw_observer</class>
98
- <method>sales_order_load_after</method>
99
- </dibs>
100
- </observers>
101
- </sales_order_load_after>
102
- </events>
103
- </global>
104
-
105
- <default>
106
- <payment>
107
- <dibspw>
108
- <active>1</active>
109
- <model>dibs/dibspw</model>
110
- <order_status>pending_dibs</order_status>
111
- <title>DIBS</title>
112
- <cctypes>AMEX,VISA,MC,DIN</cctypes>
113
- <payment_action>authorize</payment_action>
114
- <allowspecific>0</allowspecific>
115
- <redirect_text>Du vil bli sendt til en sikker side hos Dibs for inntasting av kredittkort-detaljene dine når du har fullført bestillingen.</redirect_text>
116
- <dibs_logo>blue.jpg</dibs_logo>
117
- <test_mode>1</test_mode>
118
- <cart_tax_type>VATAMOUNT</cart_tax_type>
119
- <language>nb_NO</language>
120
- <mac_key backend_model="adminhtml/system_config_backend_encrypted" />
121
- <send_new_order_email>1</send_new_order_email>
122
- <debug>0</debug>
123
- <timeout>-1</timeout>
124
- </dibspw>
125
- </payment>
126
- </default>
127
-
128
- <crontab>
129
- <jobs>
130
- <dibspw_timeout>
131
- <schedule>
132
- <cron_expr>*/10 0 * * *</cron_expr>
133
- </schedule>
134
- <run>
135
- <model>dibs/dibspw_observer::cancelOrdersAfterTimeout
136
- </model>
137
- </run>
138
- </dibspw_timeout>
139
- </jobs>
140
- </crontab>
141
-
142
- </config>
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <modules>
4
+ <Trollweb_Dibs>
5
+ <version>1.1.0</version>
6
+ </Trollweb_Dibs>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <routers>
11
+ <dibs>
12
+ <use>standard</use>
13
+ <args>
14
+ <module>Trollweb_Dibs</module>
15
+ <frontName>dibs</frontName>
16
+ </args>
17
+ </dibs>
18
+ </routers>
19
+ <layout>
20
+ <updates>
21
+ <dibs>
22
+ <file>dibs.xml</file>
23
+ </dibs>
24
+ </updates>
25
+ </layout>
26
+ <translate>
27
+ <modules>
28
+ <Trollweb_Dibs>
29
+ <files>
30
+ <default>Trollweb_Dibs.csv</default>
31
+ </files>
32
+ </Trollweb_Dibs>
33
+ </modules>
34
+ </translate>
35
+ </frontend>
36
+
37
+ <adminhtml>
38
+ <translate>
39
+ <modules>
40
+ <Trollweb_Dibs>
41
+ <files>
42
+ <default>Trollweb_Dibs.csv</default>
43
+ </files>
44
+ </Trollweb_Dibs>
45
+ </modules>
46
+ </translate>
47
+ </adminhtml>
48
+
49
+ <global>
50
+ <blocks>
51
+ <dibs>
52
+ <class>Trollweb_Dibs_Block</class>
53
+ </dibs>
54
+ </blocks>
55
+ <helpers>
56
+ <dibs>
57
+ <class>Trollweb_Dibs_Helper</class>
58
+ </dibs>
59
+ </helpers>
60
+ <models>
61
+ <dibs>
62
+ <class>Trollweb_Dibs_Model</class>
63
+ </dibs>
64
+ </models>
65
+ <resources>
66
+ <dibs_setup>
67
+ <setup>
68
+ <module>Trollweb_Dibs</module>
69
+ <class>Trollweb_Dibs_Model_Entity_Setup</class>
70
+ </setup>
71
+ <connection>
72
+ <use>core_setup</use>
73
+ </connection>
74
+ </dibs_setup>
75
+ <dibs_write>
76
+ <use>core_write</use>
77
+ </dibs_write>
78
+ <dibs_read>
79
+ <use>core_read</use>
80
+ </dibs_read>
81
+ </resources>
82
+
83
+ <events>
84
+ <order_cancel_after>
85
+ <observers>
86
+ <dibs>
87
+ <type>singleton</type>
88
+ <class>dibs/dibspw_observer</class>
89
+ <method>order_cancel_after</method>
90
+ </dibs>
91
+ </observers>
92
+ </order_cancel_after>
93
+ <sales_order_load_after>
94
+ <observers>
95
+ <dibs>
96
+ <type>singleton</type>
97
+ <class>dibs/dibspw_observer</class>
98
+ <method>sales_order_load_after</method>
99
+ </dibs>
100
+ </observers>
101
+ </sales_order_load_after>
102
+ <core_config_data_save_after>
103
+ <observers>
104
+ <dibs>
105
+ <class>dibs/dibspw_observer</class>
106
+ <method>core_config_data_save_after</method>
107
+ </dibs>
108
+ </observers>
109
+ </core_config_data_save_after>
110
+ </events>
111
+ </global>
112
+
113
+ <default>
114
+ <payment>
115
+ <dibspw>
116
+ <active>1</active>
117
+ <model>dibs/dibspw</model>
118
+ <order_status>processing</order_status>
119
+ <title>DIBS</title>
120
+ <cctypes>AMEX,VISA,MC,DIN</cctypes>
121
+ <payment_action>authorize</payment_action>
122
+ <allowspecific>0</allowspecific>
123
+ <redirect_text>Du vil bli sendt til en sikker side hos Dibs for inntasting av kredittkort-detaljene dine når du har fullført bestillingen.</redirect_text>
124
+ <dibs_logo>blue.jpg</dibs_logo>
125
+ <test_mode>1</test_mode>
126
+ <cart_tax_type>VATAMOUNT</cart_tax_type>
127
+ <language>nb_NO</language>
128
+ <mac_key backend_model="adminhtml/system_config_backend_encrypted" />
129
+ <send_new_order_email>1</send_new_order_email>
130
+ <debug>0</debug>
131
+ <timeout>-1</timeout>
132
+ </dibspw>
133
+ </payment>
134
+ </default>
135
+
136
+ <crontab>
137
+ <jobs>
138
+ <dibspw_timeout>
139
+ <schedule>
140
+ <cron_expr>*/10 * * * *</cron_expr>
141
+ </schedule>
142
+ <run>
143
+ <model>dibs/dibspw_observer::cancelOrdersAfterTimeout
144
+ </model>
145
+ </run>
146
+ </dibspw_timeout>
147
+ </jobs>
148
+ </crontab>
149
+
150
+ </config>
app/code/community/Trollweb/Dibs/etc/system.xml CHANGED
@@ -1,186 +1,177 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <sections>
4
- <payment>
5
- <groups>
6
- <dibspw translate="label" module="dibs">
7
- <label>DIBS</label>
8
- <sort_order>1000</sort_order>
9
- <show_in_default>1</show_in_default>
10
- <show_in_website>1</show_in_website>
11
- <show_in_store>0</show_in_store>
12
- <fields>
13
- <active translate="label">
14
- <label>Enabled</label>
15
- <frontend_type>select</frontend_type>
16
- <source_model>adminhtml/system_config_source_yesno</source_model>
17
- <sort_order>10</sort_order>
18
- <show_in_default>1</show_in_default>
19
- <show_in_website>1</show_in_website>
20
- <show_in_store>1</show_in_store>
21
- </active>
22
- <title translate="label">
23
- <label>Title</label>
24
- <frontend_type>text</frontend_type>
25
- <sort_order>20</sort_order>
26
- <show_in_default>1</show_in_default>
27
- <show_in_website>1</show_in_website>
28
- <show_in_store>1</show_in_store>
29
- </title>
30
- <merchant>
31
- <label>Merchant</label>
32
- <frontend_type>text</frontend_type>
33
- <sort_order>30</sort_order>
34
- <show_in_default>1</show_in_default>
35
- <show_in_website>1</show_in_website>
36
- <show_in_store>1</show_in_store>
37
- </merchant>
38
- <mac_key translate="label">
39
- <label>HMAC key</label>
40
- <frontend_type>obscure</frontend_type>
41
- <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
42
- <sort_order>40</sort_order>
43
- <show_in_default>1</show_in_default>
44
- <show_in_website>1</show_in_website>
45
- <show_in_store>1</show_in_store>
46
- <comment><![CDATA[Enter your HMAC key. Can be found in DIBS Administration panel, under Integration -> HMAC keys.]]></comment>
47
- </mac_key>
48
- <redirect_text translate="label">
49
- <label>Info text</label>
50
- <frontend_type>textarea</frontend_type>
51
- <sort_order>50</sort_order>
52
- <show_in_default>1</show_in_default>
53
- <show_in_website>1</show_in_website>
54
- <show_in_store>1</show_in_store>
55
- <comment><![CDATA[Informational text under the Dibs payment method option.]]></comment>
56
- </redirect_text>
57
- <dibs_logo translate="label">
58
- <label>Logo</label>
59
- <frontend_type>select</frontend_type>
60
- <source_model>dibs/source_logo</source_model>
61
- <sort_order>60</sort_order>
62
- <show_in_default>1</show_in_default>
63
- <show_in_website>1</show_in_website>
64
- <show_in_store>1</show_in_store>
65
- </dibs_logo>
66
- <regcode>
67
- <label>Serial</label>
68
- <frontend_type>text</frontend_type>
69
- <sort_order>70</sort_order>
70
- <show_in_default>1</show_in_default>
71
- <show_in_website>1</show_in_website>
72
- <show_in_store>1</show_in_store>
73
- <comment><model>dibs/system_serial</model></comment>
74
- </regcode>
75
- <cctypes translate="label">
76
- <label>Credit Card Types</label>
77
- <frontend_type>multiselect</frontend_type>
78
- <source_model>dibs/source_cctype</source_model>
79
- <sort_order>80</sort_order>
80
- <show_in_default>1</show_in_default>
81
- <show_in_website>1</show_in_website>
82
- <show_in_store>1</show_in_store>
83
- <can_be_empty>1</can_be_empty>
84
- </cctypes>
85
- <payment_action translate="label">
86
- <label>Payment Action</label>
87
- <frontend_type>select</frontend_type>
88
- <source_model>dibs/source_paymentaction</source_model>
89
- <sort_order>90</sort_order>
90
- <show_in_default>1</show_in_default>
91
- <show_in_website>1</show_in_website>
92
- <show_in_store>1</show_in_store>
93
- </payment_action>
94
- <order_status translate="label">
95
- <label>New order status</label>
96
- <frontend_type>select</frontend_type>
97
- <source_model>adminhtml/system_config_source_order_status</source_model>
98
- <sort_order>100</sort_order>
99
- <show_in_default>1</show_in_default>
100
- <show_in_website>1</show_in_website>
101
- <show_in_store>1</show_in_store>
102
- <comment><![CDATA[New order status after authorization approved.]]></comment>
103
- </order_status>
104
- <send_new_order_email>
105
- <label>Send new order email</label>
106
- <frontend_type>select</frontend_type>
107
- <source_model>adminhtml/system_config_source_yesno</source_model>
108
- <sort_order>110</sort_order>
109
- <show_in_default>1</show_in_default>
110
- <show_in_website>1</show_in_website>
111
- <show_in_store>1</show_in_store>
112
- <comment><![CDATA[Send email to customer on authorization approved.]]></comment>
113
- </send_new_order_email>
114
- <timeout>
115
- <label>Cancel 'pending' orders after</label>
116
- <frontend_type>select</frontend_type>
117
- <source_model>dibs/source_timeout</source_model>
118
- <sort_order>120</sort_order>
119
- <show_in_default>1</show_in_default>
120
- <show_in_website>1</show_in_website>
121
- <show_in_store>1</show_in_store>
122
- <comment><![CDATA[Pending orders can be automatically canceled after a pre-defined timeout.]]></comment>
123
- </timeout>
124
- <optional_fields>
125
- <label>Optional details</label>
126
- <frontend_type>multiselect</frontend_type>
127
- <source_model>dibs/source_optionalfields</source_model>
128
- <sort_order>130</sort_order>
129
- <show_in_default>1</show_in_default>
130
- <show_in_website>1</show_in_website>
131
- <show_in_store>1</show_in_store>
132
- <can_be_empty>1</can_be_empty>
133
- <comment><![CDATA[Send additional checkout details to Dibs.]]></comment>
134
- </optional_fields>
135
- <cart_tax_type translate="label">
136
- <label>Order item VAT type</label>
137
- <frontend_type>select</frontend_type>
138
- <source_model>dibs/source_taxtype</source_model>
139
- <sort_order>140</sort_order>
140
- <show_in_default>1</show_in_default>
141
- <show_in_website>1</show_in_website>
142
- <show_in_store>1</show_in_store>
143
- <comment><![CDATA[Show VAT value in percent or amount.]]></comment>
144
- </cart_tax_type>
145
- <language>
146
- <label>Payment window language</label>
147
- <frontend_type>select</frontend_type>
148
- <source_model>dibs/source_language</source_model>
149
- <sort_order>150</sort_order>
150
- <show_in_default>1</show_in_default>
151
- <show_in_website>1</show_in_website>
152
- <show_in_store>1</show_in_store>
153
- </language>
154
- <sort_order translate="label">
155
- <label>Sort order</label>
156
- <frontend_type>text</frontend_type>
157
- <sort_order>160</sort_order>
158
- <show_in_default>1</show_in_default>
159
- <show_in_website>1</show_in_website>
160
- <show_in_store>1</show_in_store>
161
- <comment><![CDATA[Select sorting order og payment method.]]></comment>
162
- </sort_order>
163
- <test_mode translate="label">
164
- <label>Test mode</label>
165
- <frontend_type>select</frontend_type>
166
- <source_model>adminhtml/system_config_source_yesno</source_model>
167
- <sort_order>170</sort_order>
168
- <show_in_default>1</show_in_default>
169
- <show_in_website>1</show_in_website>
170
- <show_in_store>1</show_in_store>
171
- </test_mode>
172
- <debug>
173
- <label>Debug mode</label>
174
- <frontend_type>select</frontend_type>
175
- <source_model>adminhtml/system_config_source_yesno</source_model>
176
- <sort_order>180</sort_order>
177
- <show_in_default>1</show_in_default>
178
- <show_in_website>1</show_in_website>
179
- <show_in_store>1</show_in_store>
180
- </debug>
181
- </fields>
182
- </dibspw>
183
- </groups>
184
- </payment>
185
- </sections>
186
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <dibspw translate="label" module="dibs">
7
+ <label>DIBS</label>
8
+ <sort_order>1000</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <fields>
13
+ <active translate="label">
14
+ <label>Enabled</label>
15
+ <frontend_type>select</frontend_type>
16
+ <source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>10</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ </active>
22
+ <title translate="label">
23
+ <label>Title</label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>20</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </title>
30
+ <merchant>
31
+ <label>Merchant</label>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>30</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </merchant>
38
+ <mac_key translate="label">
39
+ <label>HMAC key</label>
40
+ <frontend_type>obscure</frontend_type>
41
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
42
+ <sort_order>40</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <comment><![CDATA[Enter your HMAC key. Can be found in DIBS Administration panel, under Integration -> HMAC keys.]]></comment>
47
+ </mac_key>
48
+ <redirect_text translate="label">
49
+ <label>Info text</label>
50
+ <frontend_type>textarea</frontend_type>
51
+ <sort_order>50</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment><![CDATA[Informational text under the Dibs payment method option.]]></comment>
56
+ </redirect_text>
57
+ <dibs_logo translate="label">
58
+ <label>Logo</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>dibs/source_logo</source_model>
61
+ <sort_order>60</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </dibs_logo>
66
+ <cctypes translate="label">
67
+ <label>Credit Card Types</label>
68
+ <frontend_type>multiselect</frontend_type>
69
+ <source_model>dibs/source_cctype</source_model>
70
+ <sort_order>80</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
+ <can_be_empty>1</can_be_empty>
75
+ </cctypes>
76
+ <payment_action translate="label">
77
+ <label>Payment Action</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>dibs/source_paymentaction</source_model>
80
+ <sort_order>90</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </payment_action>
85
+ <order_status translate="label">
86
+ <label>New order status</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>adminhtml/system_config_source_order_status</source_model>
89
+ <sort_order>100</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ <comment><![CDATA[New order status after authorization approved.]]></comment>
94
+ </order_status>
95
+ <send_new_order_email>
96
+ <label>Send new order email</label>
97
+ <frontend_type>select</frontend_type>
98
+ <source_model>adminhtml/system_config_source_yesno</source_model>
99
+ <sort_order>110</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ <comment><![CDATA[Send email to customer on authorization approved.]]></comment>
104
+ </send_new_order_email>
105
+ <timeout>
106
+ <label>Cancel 'pending' orders after</label>
107
+ <frontend_type>select</frontend_type>
108
+ <source_model>dibs/source_timeout</source_model>
109
+ <sort_order>120</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ <comment><![CDATA[Pending orders can be automatically canceled after a pre-defined timeout.]]></comment>
114
+ </timeout>
115
+ <optional_fields>
116
+ <label>Optional details</label>
117
+ <frontend_type>multiselect</frontend_type>
118
+ <source_model>dibs/source_optionalfields</source_model>
119
+ <sort_order>130</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ <can_be_empty>1</can_be_empty>
124
+ <comment><![CDATA[Send additional checkout details to Dibs.]]></comment>
125
+ </optional_fields>
126
+ <cart_tax_type translate="label">
127
+ <label>Order item VAT type</label>
128
+ <frontend_type>select</frontend_type>
129
+ <source_model>dibs/source_taxtype</source_model>
130
+ <sort_order>140</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ <comment><![CDATA[Show VAT value in percent or amount.]]></comment>
135
+ </cart_tax_type>
136
+ <language>
137
+ <label>Payment window language</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>dibs/source_language</source_model>
140
+ <sort_order>150</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </language>
145
+ <sort_order translate="label">
146
+ <label>Sort order</label>
147
+ <frontend_type>text</frontend_type>
148
+ <sort_order>160</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ <comment><![CDATA[Select sorting order og payment method.]]></comment>
153
+ </sort_order>
154
+ <test_mode translate="label">
155
+ <label>Test mode</label>
156
+ <frontend_type>select</frontend_type>
157
+ <source_model>adminhtml/system_config_source_yesno</source_model>
158
+ <sort_order>170</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </test_mode>
163
+ <debug>
164
+ <label>Debug mode</label>
165
+ <frontend_type>select</frontend_type>
166
+ <source_model>adminhtml/system_config_source_yesno</source_model>
167
+ <sort_order>180</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </debug>
172
+ </fields>
173
+ </dibspw>
174
+ </groups>
175
+ </payment>
176
+ </sections>
 
 
 
 
 
 
 
 
 
177
  </config>
app/design/adminhtml/default/default/template/dibs/dibspw/form.phtml CHANGED
@@ -1,11 +1,11 @@
1
- <fieldset class="form-list">
2
- <?php $_code=$this->getMethodCode() ?>
3
- <?php $logoUrl = $this->getMethod()->getLogoUrl(); ?>
4
- <img alt="logo" src="<?php echo $logoUrl; ?>" />
5
- <ul id="payment_form_<?php echo $_code ?>" style="display:none">
6
- <li>
7
- <br />
8
- <?php echo $this->getRedirectText(); ?>
9
- </li>
10
- </ul>
11
  </fieldset>
1
+ <fieldset class="form-list">
2
+ <?php $_code=$this->getMethodCode() ?>
3
+ <?php $logoUrl = $this->getMethod()->getLogoUrl(); ?>
4
+ <img alt="logo" src="<?php echo $logoUrl; ?>" />
5
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
6
+ <li>
7
+ <br />
8
+ <?php echo $this->getRedirectText(); ?>
9
+ </li>
10
+ </ul>
11
  </fieldset>
app/design/adminhtml/default/default/template/dibs/dibspw/paymentinfo.phtml CHANGED
@@ -1,20 +1,20 @@
1
- <?php $logoUrl = $this->getMethod()->getLogoUrl(); ?>
2
- <p>
3
- <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
4
- <?php if (!empty($logoUrl)): ?>
5
- <br />
6
- <img alt="logo" src="<?php echo $logoUrl; ?>" />
7
- <?php endif;?>
8
- </p>
9
- <?php if ($_specificInfo = $this->getSpecificInformation()):?>
10
- <table>
11
- <tbody>
12
- <?php foreach ($_specificInfo as $_label => $_value):?>
13
- <tr>
14
- <th><?php echo $this->escapeHtml($_label)?>:</th>
15
- <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
16
- </tr>
17
- <?php endforeach; ?>
18
- </tbody>
19
- </table>
20
  <?php endif;?>
1
+ <?php $logoUrl = $this->getMethod()->getLogoUrl(); ?>
2
+ <p>
3
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
4
+ <?php if (!empty($logoUrl)): ?>
5
+ <br />
6
+ <img alt="logo" src="<?php echo $logoUrl; ?>" />
7
+ <?php endif;?>
8
+ </p>
9
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
10
+ <table>
11
+ <tbody>
12
+ <?php foreach ($_specificInfo as $_label => $_value):?>
13
+ <tr>
14
+ <th><?php echo $this->escapeHtml($_label)?>:</th>
15
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
16
+ </tr>
17
+ <?php endforeach; ?>
18
+ </tbody>
19
+ </table>
20
  <?php endif;?>
app/design/frontend/base/default/layout/Trollweb_Dibs.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+ </layout>
app/design/frontend/base/default/template/dibs/dibspw/form.phtml CHANGED
@@ -1,13 +1,13 @@
1
- <fieldset class="form-list">
2
- <?php $logoUrl = $this->getLogoUrl() ?>
3
- <?php if (!empty($logoUrl)): ?>
4
- <img src="<?php echo $logoUrl ?>" />
5
- <?php endif;?>
6
- <?php $_code=$this->getMethodCode() ?>
7
- <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
- <li>
9
- <br />
10
- <?php echo $this->getRedirectText(); ?>
11
- </li>
12
- </ul>
13
  </fieldset>
1
+ <fieldset class="form-list">
2
+ <?php $logoUrl = $this->getLogoUrl() ?>
3
+ <?php if (!empty($logoUrl)): ?>
4
+ <img src="<?php echo $logoUrl ?>" />
5
+ <?php endif;?>
6
+ <?php $_code=$this->getMethodCode() ?>
7
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
+ <li>
9
+ <br />
10
+ <?php echo $this->getRedirectText(); ?>
11
+ </li>
12
+ </ul>
13
  </fieldset>
app/design/frontend/base/default/template/dibs/dibspw/paymentinfo.phtml CHANGED
@@ -1,20 +1,20 @@
1
- <?php $logoUrl = $this->getLogoUrl(); ?>
2
- <p>
3
- <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
4
- <?php if (!empty($logoUrl)): ?>
5
- <br />
6
- <img alt="logo" src="<?php echo $logoUrl; ?>" />
7
- <?php endif;?>
8
- </p>
9
- <?php if ($_specificInfo = $this->getSpecificInformation()):?>
10
- <table>
11
- <tbody>
12
- <?php foreach ($_specificInfo as $_label => $_value):?>
13
- <tr>
14
- <th><?php echo $this->escapeHtml($_label)?>:</th>
15
- <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
16
- </tr>
17
- <?php endforeach; ?>
18
- </tbody>
19
- </table>
20
  <?php endif;?>
1
+ <?php $logoUrl = $this->getLogoUrl(); ?>
2
+ <p>
3
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
4
+ <?php if (!empty($logoUrl)): ?>
5
+ <br />
6
+ <img alt="logo" src="<?php echo $logoUrl; ?>" />
7
+ <?php endif;?>
8
+ </p>
9
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
10
+ <table>
11
+ <tbody>
12
+ <?php foreach ($_specificInfo as $_label => $_value):?>
13
+ <tr>
14
+ <th><?php echo $this->escapeHtml($_label)?>:</th>
15
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
16
+ </tr>
17
+ <?php endforeach; ?>
18
+ </tbody>
19
+ </table>
20
  <?php endif;?>
app/etc/modules/Trollweb_Dibs.xml CHANGED
@@ -1,12 +1,12 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Trollweb_Dibs>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <depends>
8
- <Mage_Payment />
9
- </depends>
10
- </Trollweb_Dibs>
11
- </modules>
12
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Trollweb_Dibs>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Trollweb_Dibs>
11
+ </modules>
12
+ </config>
app/locale/nb_NO/Trollweb_Dibs.csv CHANGED
@@ -1,44 +1,44 @@
1
- "HMAC key","HMAC nøkkel"
2
- "Regcode","Registreringskode"
3
- "Enter your HMAC key. Can be found in DIBS Administration panel, under Integration -> HMAC keys.","Fyll inn din HMAC nøkkel, denne kan du finne i DIBS Administrasjonspanel under Integrasion -> HMAC nøkler."
4
- "Informational text under the Dibs payment method option.","Meldingstekst som kunden ser når han eller hun velger betalingsalternativet Dibs."
5
- "Info text","Utvidet infotekst"
6
- "New order status","Ny ordre status"
7
- "You will be redirected to Dibs in a few seconds.","Du vil bli videreført til DIBS betalingsvindu on noen sekunder."
8
- "Billing details","Faktura-adresse"
9
- "Shipping details","Leverings-adresse"
10
- "Cart details","Handekurv detaljer"
11
- "Select sorting order og payment method.","Ønsket sortering i Betalingsmetoder-feltet på utsjekkingssiden i nettbutikken. Aktuelt dersom du tilbyr flere betalingsalternativer og ønsker å plassere DIBS betalingsvalget i en angitt rekkefølge."
12
- "Sort order","Sortering av betalingsmetode"
13
- "Authorize Only","Bare godkjenn"
14
- "Authorize + Capture","Godkjenn og motta betaling"
15
- "Dibs Authorization successful","Dibs autorisasjon vellykket"
16
- "Dibs Authorization Declined","Dibs autorisasjon mislyktes"
17
- "Send new order email","Send ny ordre epost"
18
- "Send email to customer on authorization approved.","Send epost til kunden ved autorisasjon av kort."
19
- "New order status after authorization approved.","Ny status etter autorisasjon."
20
- "Optional details","Valgfrie ordredetaljer"
21
- "Send additional checkout details to Dibs.","Valgfrie ordredetaljer som skal sendes til DIBS betalingsvindu."
22
- "Order item VAT type","Moms format på varelinje"
23
- "Show VAT value in percent or amount.","Vis momsverdien som prosent eller verdi."
24
- "Payment window language","Språk på betalingsvindu"
25
- "Test mode","Testmodus"
26
- "Debug mode","Feilsøkingsmodus"
27
- "Capture request failed, try again or contact site administation","Trekk ble ikke fullført, prøv igjen eller kontakt side administrator"
28
- "Order needs payment review","Ordren trenger manuell godkjenning"
29
- "Payment is cancelled. Please try again.","Betalingen ble ikke gjennomført, vennligst prøv igjen"
30
- "Could not find transaction id.","Trekk ble ikke gjennomført, pga. manglende (DIBS) transaksjons ID"
31
- "Payment capturing was delined, try again or capture offline and manually run capture in DIBS Admin panel","Trekk ble avvist av DIBS, prøv igjen eller trekk 'offline' og behandle transaksjonen manuelt i DIBS Adminpanel"
32
- "Error capturing payment, try again or capture offline and manually run capture in DIBS Admin panel","Trekk feilet hos DIBS, prøv igjen eller trekk 'offline' og behandle transaksjonen manuelt i DIBS Adminpanel"
33
- "Refund was declined by DIBS. Use DIBS Admin panel to manually refund this transaction","Kreditering ble avvist av DIBS, prøv igjen eller behandle transaksjonen manuelt i DIBS Adminpanel"
34
- "Unable to refund DIBS transaction. Use DIBS Admin panel to manually refund this transaction","Kreditering feilet hos DIBS, prøv igjen eller behandle transaksjonen manuelt i DIBS Adminpanel"
35
- "Unable to cancel DIBS transaction. Use DIBS Admin panel to manually cancel this transaction","Kansellering feilet hos DIBS, prøv igjen eller behandle transaksjonen manuelt i DIBS Adminpanel"
36
- "Billing details","Fakturaadressedetaljer"
37
- "Shipping details","Leveringsadressedetaljer"
38
- "Cart details","Varelinjedetaljer"
39
- "Payment failed, please try again.","Betalingen feilet, vennligst prøv igjen"
40
- "%s hour","%s timer"
41
- "Cancel 'pending' orders after","Avbryt 'Pending Dibs' ordre"
42
- "Pending orders can be automatically canceled after a pre-defined timeout.","Ordre med status 'Pending Dibs' vil bli kansellert etter denne pre-definerte tiden."
43
- "Get a free serial key from %s.","Få en gratis produktnøkkel fra %s."
44
- "Serial","Produktnøkkel"
1
+ "HMAC key","HMAC nøkkel"
2
+ "Regcode","Registreringskode"
3
+ "Enter your HMAC key. Can be found in DIBS Administration panel, under Integration -> HMAC keys.","Fyll inn din HMAC nøkkel, denne kan du finne i DIBS Administrasjonspanel under Integrasion -> HMAC nøkler."
4
+ "Informational text under the Dibs payment method option.","Meldingstekst som kunden ser når han eller hun velger betalingsalternativet Dibs."
5
+ "Info text","Utvidet infotekst"
6
+ "New order status","Ny ordre status"
7
+ "You will be redirected to Dibs in a few seconds.","Du vil bli videreført til DIBS betalingsvindu on noen sekunder."
8
+ "Billing details","Faktura-adresse"
9
+ "Shipping details","Leverings-adresse"
10
+ "Cart details","Handekurv detaljer"
11
+ "Select sorting order og payment method.","Ønsket sortering i Betalingsmetoder-feltet på utsjekkingssiden i nettbutikken. Aktuelt dersom du tilbyr flere betalingsalternativer og ønsker å plassere DIBS betalingsvalget i en angitt rekkefølge."
12
+ "Sort order","Sortering av betalingsmetode"
13
+ "Authorize Only","Bare godkjenn"
14
+ "Authorize + Capture","Godkjenn og motta betaling"
15
+ "Dibs Authorization successful","Dibs autorisasjon vellykket"
16
+ "Dibs Authorization Declined","Dibs autorisasjon mislyktes"
17
+ "Send new order email","Send ny ordre epost"
18
+ "Send email to customer on authorization approved.","Send epost til kunden ved autorisasjon av kort."
19
+ "New order status after authorization approved.","Ny status etter autorisasjon."
20
+ "Optional details","Valgfrie ordredetaljer"
21
+ "Send additional checkout details to Dibs.","Valgfrie ordredetaljer som skal sendes til DIBS betalingsvindu."
22
+ "Order item VAT type","Moms format på varelinje"
23
+ "Show VAT value in percent or amount.","Vis momsverdien som prosent eller verdi."
24
+ "Payment window language","Språk på betalingsvindu"
25
+ "Test mode","Testmodus"
26
+ "Debug mode","Feilsøkingsmodus"
27
+ "Capture request failed, try again or contact site administation","Trekk ble ikke fullført, prøv igjen eller kontakt side administrator"
28
+ "Order needs payment review","Ordren trenger manuell godkjenning"
29
+ "Payment is cancelled. Please try again.","Betalingen ble ikke gjennomført, vennligst prøv igjen"
30
+ "Could not find transaction id.","Trekk ble ikke gjennomført, pga. manglende (DIBS) transaksjons ID"
31
+ "Payment capturing was delined, try again or capture offline and manually run capture in DIBS Admin panel","Trekk ble avvist av DIBS, prøv igjen eller trekk 'offline' og behandle transaksjonen manuelt i DIBS Adminpanel"
32
+ "Error capturing payment, try again or capture offline and manually run capture in DIBS Admin panel","Trekk feilet hos DIBS, prøv igjen eller trekk 'offline' og behandle transaksjonen manuelt i DIBS Adminpanel"
33
+ "Refund was declined by DIBS. Use DIBS Admin panel to manually refund this transaction","Kreditering ble avvist av DIBS, prøv igjen eller behandle transaksjonen manuelt i DIBS Adminpanel"
34
+ "Unable to refund DIBS transaction. Use DIBS Admin panel to manually refund this transaction","Kreditering feilet hos DIBS, prøv igjen eller behandle transaksjonen manuelt i DIBS Adminpanel"
35
+ "Unable to cancel DIBS transaction. Use DIBS Admin panel to manually cancel this transaction","Kansellering feilet hos DIBS, prøv igjen eller behandle transaksjonen manuelt i DIBS Adminpanel"
36
+ "Billing details","Fakturaadressedetaljer"
37
+ "Shipping details","Leveringsadressedetaljer"
38
+ "Cart details","Varelinjedetaljer"
39
+ "Payment failed, please try again.","Betalingen feilet, vennligst prøv igjen"
40
+ "%s hour","%s timer"
41
+ "Cancel 'pending' orders after","Avbryt 'Pending Dibs' ordre"
42
+ "Pending orders can be automatically canceled after a pre-defined timeout.","Ordre med status 'Pending Dibs' vil bli kansellert etter denne pre-definerte tiden."
43
+ "Get a free serial key from %s.","Få en gratis produktnøkkel fra %s."
44
+ "Serial","Produktnøkkel"
package.xml CHANGED
@@ -1,18 +1,2 @@
1
  <?xml version="1.0"?>
2
- <package>
3
- <name>Trollweb_Dibs</name>
4
- <version>1.0.2</version>
5
- <stability>stable</stability>
6
- <license uri="http://www.trollweb.no">Single-site License</license>
7
- <channel>community</channel>
8
- <extends/>
9
- <summary>The official DIBS Payment module for Magento, developed and supported by Trollweb Solutions.</summary>
10
- <description>The DIBS module from Magento by Trollweb is the only one backed and supported by both DIBS and Trollweb, a leading Magento Payments module developer based in Norway and Sweden.</description>
11
- <notes>Initial Release of the official DIBS Payment module for Magento.</notes>
12
- <authors><author><name>Roy Andre Tollefsen</name><user>royandre</user><email>royandre@trollweb.no</email></author></authors>
13
- <date>2013-03-07</date>
14
- <time>09:31:37</time>
15
- <contents><target name="magecommunity"><dir name="Trollweb"><dir name="Dibs"><dir name="Block"><dir name="Dibspw"><file name="Form.php" hash="732737f2851f9a9cbe9c3504f082773c"/><file name="PaymentInfo.php" hash="6da5d7e19fb9b253ce00bf2d318a6a25"/><file name="Redirect.php" hash="555aaa399bdcbdb8dd220dbbe4a2b52f"/></dir></dir><dir name="Helper"><file name="Data.php" hash="0a66b6f5eb1a38cb4c346f14c090917d"/><file name="Dibspw.php" hash="b072c5f50109d18fe940a7cdecfa63d2"/></dir><dir name="Model"><dir name="Dibspw"><dir name="Api"><file name="Request.php" hash="21e78a3e7a970ac00404324fdf068f57"/><file name="Result.php" hash="6ad98f9c8184df594283dac028b9e993"/></dir><file name="Callback.php" hash="6da01d8de6cd54d1888ec3573745bb2b"/><file name="Cart.php" hash="9898f262da3ffacdf0d36de4e382a601"/><file name="Info.php" hash="f212f2ee59dae5bfe778566cbbdd1a1a"/><file name="Observer.php" hash="622376979c8f1baa77c8cbe5c97cec89"/></dir><file name="Dibspw.php" hash="58c51691ca82283b6da436f318852487"/><dir name="Entity"><file name="Setup.php" hash="dd96c07255111a38551e39c24fb5547a"/></dir><dir name="Source"><file name="Cctype.php" hash="3f0858b5e684913986e535061861d686"/><file name="Language.php" hash="184def3e555e907192bb8f07e25d89cf"/><file name="Logo.php" hash="c2c7af61b1f948ba22cad9eb42ebe80e"/><file name="Optionalfields.php" hash="0cec2194ae4f379ccd8cfb480aa9a039"/><file name="Paymentaction.php" hash="bececf75eafb7e75e21117f6964e61e5"/><file name="Taxtype.php" hash="ee6e703a882b3836672a77a0b1a8dc87"/><file name="Timeout.php" hash="3611d291b6660aa217d5ae95fc808197"/></dir><dir name="System"><file name="Serial.php" hash="9b3d6070bd040120cf156a939875f07e"/></dir></dir><dir name="controllers"><file name="DibspwController.php" hash="d732bc70bf661a33ccc2b7dc38186843"/><file name="IndexController.php" hash="fe9f98b379b52d3d3a18a768b60498a1"/></dir><dir name="data"><dir name="dibs_setup"><file name="data-install-1.0.0.php" hash="1f912cf1bd9bbea0c8b3f17dad844b4a"/></dir></dir><dir name="etc"><file name="config.xml" hash="051da7e24a0a4332b4be910f9eb66048"/><file name="system.xml" hash="c30ce2763c34ce7f260861b6322f2437"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="dibs"><dir name="dibspw"><file name="form.phtml" hash="8fe66b9acef361c671b793f67d3ca16b"/><file name="paymentinfo.phtml" hash="5ad298506a747c8e64d4c22a8916b0d6"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="dibs"><dir name="dibspw"><file name="form.phtml" hash="c21ade9ab48fdea5bb922b2294b9bcec"/><file name="paymentinfo.phtml" hash="19b7bb1fa02705955eea8130037520f7"/><file name="redirect.phtml" hash="fee8316fdd05846e8b8aef45ab45490f"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Trollweb_Dibs.xml" hash="7d6fddf28cfa7b1126f2e5358708f3c5"/></dir></target><target name="magelocale"><dir><dir name="nb_NO"><file name="Trollweb_Dibs.csv" hash="b7be92e4268af189fd037357cd510f3f"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="trollweb"><dir name="dibs"><dir name="logos"><file name="black.jpg" hash="55dccedd53a923983891869509f68a27"/><file name="blue.jpg" hash="dbe53239b14c5900ab0cc0a9c3c9f9f1"/><file name="green.jpg" hash="c95d2aad8fbb780137dfc8dacc087fa6"/><file name="grey.jpg" hash="99db51b92759e228f01866d71baf3467"/><file name="red.jpg" hash="1c36abdf7e2a2f0d9701ac45517dc55b"/><file name="yellow.jpg" hash="22b3fdfb251a317d48b8cd216d081387"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="trollweb"><dir name="dibs"><dir name="logos"><file name="black.jpg" hash="55dccedd53a923983891869509f68a27"/><file name="blue.jpg" hash="dbe53239b14c5900ab0cc0a9c3c9f9f1"/><file name="green.jpg" hash="c95d2aad8fbb780137dfc8dacc087fa6"/><file name="grey.jpg" hash="99db51b92759e228f01866d71baf3467"/><file name="red.jpg" hash="1c36abdf7e2a2f0d9701ac45517dc55b"/><file name="yellow.jpg" hash="22b3fdfb251a317d48b8cd216d081387"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
16
- <compatible/>
17
- <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
18
- </package>
1
  <?xml version="1.0"?>
2
+ <package><name>Trollweb_Dibs</name><version>1.1.0</version><stability>stable</stability><license>MIT</license><channel>community</channel><extends></extends><summary></summary><description></description><notes></notes><authors><author><name>Roy Andre Tollefsen</name><user>royandre</user><email>royandre@trollweb.no</email></author></authors><date>2013-12-04</date><time>6:11:45</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="locale"><dir name="nb_NO"><file name="Trollweb_Dibs.csv" hash="60ca9c9a98f3090b0a7292f1e6b28e0c"/></dir></dir><dir name="code"><dir name="community"><dir name="Trollweb"><dir name="Dibs"><dir name="Model"><file name="Dibspw.php" hash="ec9eb923e7b25290c6d2ffa150f71d61"/><dir name="Dibspw"><file name="Callback.php" hash="eefcc77909a6bb99498bde6ae0b7ca4e"/><file name="Cart.php" hash="7ba1ea5ebe6cb0b445fb68926f49a085"/><file name="Info.php" hash="9ad8989469563cfe53d3b6cf68d9d506"/><file name="Observer.php" hash="13786b0fec2163667002f5c729c317df"/><dir name="Api"><file name="Request.php" hash="b6c30369b523d0972c5735c8006f525d"/><file name="Result.php" hash="780ab87ac1a6bbdca01b92a217dc942e"/></dir></dir><dir name="Source"><file name="Cctype.php" hash="3f0858b5e684913986e535061861d686"/><file name="Language.php" hash="184def3e555e907192bb8f07e25d89cf"/><file name="Logo.php" hash="c2c7af61b1f948ba22cad9eb42ebe80e"/><file name="Optionalfields.php" hash="0cec2194ae4f379ccd8cfb480aa9a039"/><file name="Paymentaction.php" hash="e05da7ebf55a36810310f9a0dc162c47"/><file name="Taxtype.php" hash="ee6e703a882b3836672a77a0b1a8dc87"/><file name="Timeout.php" hash="3611d291b6660aa217d5ae95fc808197"/></dir><dir name="Entity"><file name="Setup.php" hash="dd96c07255111a38551e39c24fb5547a"/></dir></dir><dir name="data"><dir name="dibs_setup"><file name="data-install-1.0.0.php" hash="1f912cf1bd9bbea0c8b3f17dad844b4a"/></dir></dir><dir name="controllers"><file name="DibspwController.php" hash="d4fcbfc62ee5fd95c5cfdd2523c25d18"/></dir><dir name="Helper"><file name="Data.php" hash="3b4b7e914788a8016230b2ee3c9fe245"/><file name="Dibspw.php" hash="81e727dae8f6d169f5f174cf3c4a5342"/></dir><dir name="Block"><dir name="Dibspw"><file name="Form.php" hash="641369fcf543c94db1acc4c6ac2d1e60"/><file name="PaymentInfo.php" hash="25d502159a8b4783a9272ef0c029c180"/><file name="Redirect.php" hash="09e8f5f7db800c08c807a1816e929cdd"/></dir></dir><dir name="etc"><file name="config.xml" hash="dfe99d9ed5a12da5daec6bddd04a8b2a"/><file name="system.xml" hash="c6b6b76f6a2afe7df5ca1bb20cb62232"/></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Trollweb_Dibs.xml" hash="912239830f55c9b627038a19b8023e88"/></dir><dir name="template"><dir name="dibs"><dir name="dibspw"><file name="form.phtml" hash="26a735053ff7e74bde5d3c019a479b2d"/><file name="paymentinfo.phtml" hash="ea322fca27fd523ea3f820f9d49b9be1"/><file name="redirect.phtml" hash="fee8316fdd05846e8b8aef45ab45490f"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="dibs"><dir name="dibspw"><file name="form.phtml" hash="5739f81ca605856a9e7bd79915d4c1ca"/><file name="paymentinfo.phtml" hash="9b38da3623d46b6a8a246aab530d9dc0"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Trollweb_Dibs.xml" hash="85fed3975d75a1d3ca9aaf73ad839b76"/></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="trollweb"><dir name="dibs"><dir name="logos"><file name="black.jpg" hash="55dccedd53a923983891869509f68a27"/><file name="blue.jpg" hash="dbe53239b14c5900ab0cc0a9c3c9f9f1"/><file name="green.jpg" hash="c95d2aad8fbb780137dfc8dacc087fa6"/><file name="grey.jpg" hash="99db51b92759e228f01866d71baf3467"/><file name="red.jpg" hash="1c36abdf7e2a2f0d9701ac45517dc55b"/><file name="yellow.jpg" hash="22b3fdfb251a317d48b8cd216d081387"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="trollweb"><dir name="dibs"><dir name="logos"><file name="black.jpg" hash="55dccedd53a923983891869509f68a27"/><file name="blue.jpg" hash="dbe53239b14c5900ab0cc0a9c3c9f9f1"/><file name="green.jpg" hash="c95d2aad8fbb780137dfc8dacc087fa6"/><file name="grey.jpg" hash="99db51b92759e228f01866d71baf3467"/><file name="red.jpg" hash="1c36abdf7e2a2f0d9701ac45517dc55b"/><file name="yellow.jpg" hash="22b3fdfb251a317d48b8cd216d081387"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents></package>