Version Notes
Initial Release of the official DIBS Payment module for Magento.
Download this release
Release Info
Developer | Roy Andre Tollefsen |
Extension | Trollweb_Dibs |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- app/code/community/Trollweb/Dibs/Block/Dibspw/Form.php +34 -0
- app/code/community/Trollweb/Dibs/Block/Dibspw/PaymentInfo.php +45 -0
- app/code/community/Trollweb/Dibs/Block/Dibspw/Redirect.php +130 -0
- app/code/community/Trollweb/Dibs/Helper/Data.php +137 -0
- app/code/community/Trollweb/Dibs/Helper/Dibspw.php +25 -0
- app/code/community/Trollweb/Dibs/Model/Dibspw.php +235 -0
- app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Request.php +202 -0
- app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Result.php +23 -0
- app/code/community/Trollweb/Dibs/Model/Dibspw/Callback.php +132 -0
- app/code/community/Trollweb/Dibs/Model/Dibspw/Cart.php +148 -0
- app/code/community/Trollweb/Dibs/Model/Dibspw/Info.php +95 -0
- app/code/community/Trollweb/Dibs/Model/Dibspw/Observer.php +64 -0
- app/code/community/Trollweb/Dibs/Model/Entity/Setup.php +23 -0
- app/code/community/Trollweb/Dibs/Model/Source/Cctype.php +115 -0
- app/code/community/Trollweb/Dibs/Model/Source/Language.php +40 -0
- app/code/community/Trollweb/Dibs/Model/Source/Logo.php +31 -0
- app/code/community/Trollweb/Dibs/Model/Source/Optionalfields.php +38 -0
- app/code/community/Trollweb/Dibs/Model/Source/Paymentaction.php +30 -0
- app/code/community/Trollweb/Dibs/Model/Source/Taxtype.php +37 -0
- app/code/community/Trollweb/Dibs/Model/Source/Timeout.php +49 -0
- app/code/community/Trollweb/Dibs/Model/System/Serial.php +15 -0
- app/code/community/Trollweb/Dibs/controllers/DibspwController.php +73 -0
- app/code/community/Trollweb/Dibs/controllers/IndexController.php +8 -0
- app/code/community/Trollweb/Dibs/data/dibs_setup/data-install-1.0.0.php +47 -0
- app/code/community/Trollweb/Dibs/etc/config.xml +142 -0
- app/code/community/Trollweb/Dibs/etc/system.xml +186 -0
- app/design/adminhtml/default/default/template/dibs/dibspw/form.phtml +10 -10
- app/design/adminhtml/default/default/template/dibs/dibspw/paymentinfo.phtml +19 -19
- app/design/frontend/base/default/template/dibs/dibspw/form.phtml +12 -12
- app/design/frontend/base/default/template/dibs/dibspw/paymentinfo.phtml +19 -19
- app/etc/modules/Trollweb_Dibs.xml +12 -12
- app/locale/nb_NO/Trollweb_Dibs.csv +44 -42
- package.xml +5 -5
app/code/community/Trollweb/Dibs/Block/Dibspw/Form.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Trollweb/Dibs/Block/Dibspw/PaymentInfo.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Trollweb/Dibs/Block/Dibspw/Redirect.php
ADDED
@@ -0,0 +1,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 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 |
+
}
|
app/code/community/Trollweb/Dibs/Helper/Data.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Trollweb/Dibs/Helper/Dibspw.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Dibspw.php
ADDED
@@ -0,0 +1,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 |
+
$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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Request.php
ADDED
@@ -0,0 +1,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 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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Result.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Callback.php
ADDED
@@ -0,0 +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_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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Cart.php
ADDED
@@ -0,0 +1,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->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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Info.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Observer.php
ADDED
@@ -0,0 +1,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));
|
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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Entity/Setup.php
ADDED
@@ -0,0 +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_Entity_Setup extends Mage_Eav_Model_Entity_Setup
|
21 |
+
{
|
22 |
+
|
23 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Source/Cctype.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Cctype
|
21 |
+
{
|
22 |
+
public function toOptionArray() {
|
23 |
+
$options = array();
|
24 |
+
foreach ($this->getCcTypes() as $code => $name) {
|
25 |
+
$options[] = array(
|
26 |
+
'value' => $code,
|
27 |
+
'label' => $name
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
return $options;
|
32 |
+
}
|
33 |
+
|
34 |
+
private function getCcTypes() {
|
35 |
+
return array(
|
36 |
+
'MC'=>'Mastercard',
|
37 |
+
'VISA'=>'VISA',
|
38 |
+
'AMEX'=>'American Express',
|
39 |
+
'DIN'=>'Diners Club',
|
40 |
+
'AAK'=>'Århus city kort',
|
41 |
+
'ACCEPT'=>'Accept card',
|
42 |
+
'ACK'=>'Albertslund Centrum Kundekort',
|
43 |
+
'AKK'=>'Apollo-/Kuonikonto',
|
44 |
+
'AMEX'=>'American Express',
|
45 |
+
'AMEX(DK)'=>'American Express (Danish card)',
|
46 |
+
'AMEX(SE)'=>'American Express (Swedishcard)',
|
47 |
+
'BHBC'=>'Bauhaus Best card',
|
48 |
+
'CCK'=>'Computer City Customer Card',
|
49 |
+
'DAELLS'=>'Daells Bolighus Kundekort',
|
50 |
+
'DIN(DK)'=>'Diners Club (Danish card)',
|
51 |
+
'DK'=>'Dankort',
|
52 |
+
'ELEC'=>'VISA Electron',
|
53 |
+
'EWORLD'=>'Electronic World Credit Card',
|
54 |
+
'FCC'=>'Ford Credit Card',
|
55 |
+
'FCK'=>'Frederiksberg Centret Kundekort',
|
56 |
+
'FFK'=>'Forbrugsforeningen Card',
|
57 |
+
'FINX(SE)'=>'Finax (SE)',
|
58 |
+
'FISC'=>'Fields Shoppingcard',
|
59 |
+
'FLEGCARD'=>'Fleggard kort',
|
60 |
+
'FSC'=>'Fisketorvet Shopping Card',
|
61 |
+
'GIT'=>'Getitcard',
|
62 |
+
'GSC'=>'Glostrup Shopping Card',
|
63 |
+
'GRA'=>'Graphium',
|
64 |
+
'HEME'=>'Hemtex faktura',
|
65 |
+
'HEMP'=>'Hemtex personalkort',
|
66 |
+
'HEMTX'=>'Hemtex clubkort',
|
67 |
+
'HMK'=>'HM Konto (Hennes og Mauritz)',
|
68 |
+
'HNYBORG'=>'Harald Nyborg',
|
69 |
+
'HSC'=>'Hillerød Shopping Card',
|
70 |
+
'HTX'=>'Hydro Texaco',
|
71 |
+
'IBC'=>'Inspiration Best Card',
|
72 |
+
'IKEA'=>'IKEA kort',
|
73 |
+
'ISHBY'=>'Sparbank Vestkort',
|
74 |
+
'JCB'=>'JCB (Japan Credit Bureau)',
|
75 |
+
'JEM_FIX'=>'Jem&Fix Kundekort',
|
76 |
+
'KAUPBK'=>'Kaupthing Bankkort',
|
77 |
+
'LFBBK'=>'LänsförsäkringarBank Bankkort',
|
78 |
+
'LIC(DK)'=>'Lærernes IndkøbsCentral (Denmark)',
|
79 |
+
'LIC(SE)'=>'Lærernes IndkøbsCentral (Sweden)',
|
80 |
+
'LOPLUS'=>'LO Plus Guldkort',
|
81 |
+
'MC(DK)'=>'Mastercard (Danish card)',
|
82 |
+
'MC(SE)'=>'Mastercard (Swedish card)',
|
83 |
+
'MC(YX)'=>'YX Mastercard',
|
84 |
+
'MEDM'=>'Medmera',
|
85 |
+
'MERLIN'=>'Merlin Kreditkort',
|
86 |
+
'MTRO'=>'Maestro',
|
87 |
+
'MTRO(DK)'=>'Maestro (DK)',
|
88 |
+
'MTRO(UK)'=>'Maestro (UK)',
|
89 |
+
'MTRO(SOLO)'=>'Solo',
|
90 |
+
'MTRO(SE)'=>'Maestro (SE)',
|
91 |
+
'MYHC'=>'My Holiday Card',
|
92 |
+
'NSBK'=>'Nordea Bankkort',
|
93 |
+
'OESBK'=>'Östgöta EnskildaBankkort',
|
94 |
+
'PayPal'=>'Paypal',
|
95 |
+
'Q8SK'=>'Q8 ServiceKort',
|
96 |
+
'REB'=>'Resurs Bank',
|
97 |
+
'REMCARD'=>'Remember Card',
|
98 |
+
'ROEDCEN'=>'Rødovre Centerkort',
|
99 |
+
'SBSBK'=>'Skandiabanken Bankkort',
|
100 |
+
'SEB_KOBK'=>'SEB Köpkort',
|
101 |
+
'SEBSBK'=>'SEB Bankkort',
|
102 |
+
'SHB'=>'HandelsbankenKöpkort',
|
103 |
+
'SILV_ERHV'=>'Silvan Konto Erhverv',
|
104 |
+
'SILV_PRIV'=>'Silvan Konto Privat',
|
105 |
+
'STARTOUR'=>'Star Tour',
|
106 |
+
'TLK'=>'Tæppeland',
|
107 |
+
'TUBC'=>'Toys R Us - BestCard',
|
108 |
+
'V(DK)'=>'VISA-Dankort',
|
109 |
+
'VEKO'=>'VEKO Finans',
|
110 |
+
'VISA(DK)'=>'VISA (DK)',
|
111 |
+
'VISA(SE)'=>'VISA (SE)',
|
112 |
+
'WOCO'=>'Wonderful Copenhagen Card'
|
113 |
+
);
|
114 |
+
}
|
115 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Source/Language.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Language
|
21 |
+
{
|
22 |
+
public function toOptionArray() {
|
23 |
+
$arr = array();
|
24 |
+
foreach ($this->getLanguages() as $k=>$v) {
|
25 |
+
$arr[] = array('value'=>$k, 'label'=>$v);
|
26 |
+
}
|
27 |
+
return $arr;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getLanguages() {
|
31 |
+
$hdibs = Mage::helper('dibs');
|
32 |
+
return array(
|
33 |
+
'en_US' => 'English (US)',
|
34 |
+
'en_GB' => 'English (GB)',
|
35 |
+
'da_DK' => 'Danish',
|
36 |
+
'sv_SE' => 'Swedish',
|
37 |
+
'nb_NO' => 'Norwegian (Bokmål)',
|
38 |
+
);
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Source/Logo.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Logo
|
21 |
+
{
|
22 |
+
public function toOptionArray() {
|
23 |
+
$hDips = Mage::helper('dibs');
|
24 |
+
|
25 |
+
$arr = array();
|
26 |
+
foreach ($hDips->getLogos() as $k=>$v) {
|
27 |
+
$arr[] = array('value'=>$k, 'label'=>$v);
|
28 |
+
}
|
29 |
+
return $arr;
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Source/Optionalfields.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Optionalfields
|
21 |
+
{
|
22 |
+
public function toOptionArray() {
|
23 |
+
$arr = array();
|
24 |
+
foreach ($this->getOptionalfields() as $k=>$v) {
|
25 |
+
$arr[] = array('label'=>$k, 'value'=>$v);
|
26 |
+
}
|
27 |
+
return $arr;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getOptionalfields() {
|
31 |
+
$hdibs = Mage::helper('dibs');
|
32 |
+
return array(
|
33 |
+
$hdibs->__('Billing details') => 'billing',
|
34 |
+
$hdibs->__('Shipping details') => 'shipping',
|
35 |
+
$hdibs->__('Cart details') => 'cart',
|
36 |
+
);
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Source/Paymentaction.php
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Source/Taxtype.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Taxtype
|
21 |
+
{
|
22 |
+
public function toOptionArray() {
|
23 |
+
$arr = array();
|
24 |
+
foreach ($this->getTaxTypes() as $k=>$v) {
|
25 |
+
$arr[] = array('value'=>$v, 'label'=>$k);
|
26 |
+
}
|
27 |
+
return $arr;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getTaxTypes() {
|
31 |
+
$hdibs = Mage::helper('dibs');
|
32 |
+
return array(
|
33 |
+
$hdibs->__(Trollweb_Dibs_Model_Dibspw_Cart::NAME_VATAMOUNT) => Trollweb_Dibs_Model_Dibspw_Cart::NAME_VATAMOUNT,
|
34 |
+
$hdibs->__(Trollweb_Dibs_Model_Dibspw_Cart::NAME_VATPERCENT) => Trollweb_Dibs_Model_Dibspw_Cart::NAME_VATPERCENT,
|
35 |
+
);
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Trollweb/Dibs/Model/Source/Timeout.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Timeout
|
21 |
+
{
|
22 |
+
public function toOptionArray() {
|
23 |
+
$options = array();
|
24 |
+
foreach ($this->getTimes() as $time => $label) {
|
25 |
+
$options[] = array(
|
26 |
+
'value' => $time,
|
27 |
+
'label' => $label
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
return $options;
|
32 |
+
}
|
33 |
+
|
34 |
+
private function getTimes() {
|
35 |
+
$hDibs = Mage::helper('dibs');
|
36 |
+
return array(
|
37 |
+
-1 => $hDibs->__('Never'),
|
38 |
+
30 => $hDibs->__('%s hour', '0,5'),
|
39 |
+
60 => $hDibs->__('%s hour', '1'),
|
40 |
+
90 => $hDibs->__('%s hour', '1,5'),
|
41 |
+
120 => $hDibs->__('%s hour', '2'),
|
42 |
+
240 => $hDibs->__('%s hour', '4'),
|
43 |
+
480 => $hDibs->__('%s hour', '8'),
|
44 |
+
960 => $hDibs->__('%s hour', '16'),
|
45 |
+
1440 => $hDibs->__('%s day', '1'),
|
46 |
+
2880 => $hDibs->__('%s days', '2'),
|
47 |
+
);
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Trollweb/Dibs/Model/System/Serial.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +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 |
+
}
|
app/code/community/Trollweb/Dibs/controllers/IndexController.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/data/dibs_setup/data-install-1.0.0.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
/** @var $installer Mage_Sales_Model_Entity_Setup */
|
21 |
+
$installer = $this;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Install order statuses from config
|
25 |
+
*/
|
26 |
+
$data = array(
|
27 |
+
array(
|
28 |
+
'status' => 'pending_dibs',
|
29 |
+
'label' => 'Pending dibs'
|
30 |
+
),
|
31 |
+
array(
|
32 |
+
'status' => 'declined_dibs',
|
33 |
+
'label' => 'Declined dibs'
|
34 |
+
),
|
35 |
+
);
|
36 |
+
|
37 |
+
foreach ($statuses as $code => $info) {
|
38 |
+
$data[] = array(
|
39 |
+
'status' => $code,
|
40 |
+
'label' => $info['label']
|
41 |
+
);
|
42 |
+
}
|
43 |
+
$installer->getConnection()->insertArray(
|
44 |
+
$installer->getTable('sales/order_status'),
|
45 |
+
array('status', 'label'),
|
46 |
+
$data
|
47 |
+
);
|
app/code/community/Trollweb/Dibs/etc/config.xml
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
app/code/community/Trollweb/Dibs/etc/system.xml
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
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/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,42 +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."
|
|
|
|
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,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Trollweb_Dibs</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.trollweb.no">Single-site License</license>
|
7 |
<channel>community</channel>
|
@@ -9,10 +9,10 @@
|
|
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>
|
13 |
-
<date>2013-03-
|
14 |
-
<time>
|
15 |
-
<contents><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="
|
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>
|
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>
|
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>
|