Version Notes
Fully tested in Cardnet sandbox.
Download this release
Release Info
Developer | VirtualPayer |
Extension | VirtualPayer_Cardnet |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/VirtualPayer/Cardnet/Block/Adminhtml/Cardnet.php +12 -0
- app/code/local/VirtualPayer/Cardnet/Block/Adminhtml/Cardnet/Grid.php +114 -0
- app/code/local/VirtualPayer/Cardnet/Block/Redirect/Error.php +28 -0
- app/code/local/VirtualPayer/Cardnet/Block/Redirect/Form.php +26 -0
- app/code/local/VirtualPayer/Cardnet/Block/Redirect/Redirect.php +278 -0
- app/code/local/VirtualPayer/Cardnet/Block/Redirect/Success.php +29 -0
- app/code/local/VirtualPayer/Cardnet/Helper/Data.php +55 -0
- app/code/local/VirtualPayer/Cardnet/Model/Cardnet.php +10 -0
- app/code/local/VirtualPayer/Cardnet/Model/Mysql4/Cardnet.php +9 -0
- app/code/local/VirtualPayer/Cardnet/Model/Mysql4/Cardnet/Collection.php +10 -0
- app/code/local/VirtualPayer/Cardnet/Model/Redirect.php +283 -0
- app/code/local/VirtualPayer/Cardnet/Model/Setup.php +38 -0
- app/code/local/VirtualPayer/Cardnet/Model/Source/Cctype.php +22 -0
- app/code/local/VirtualPayer/Cardnet/Model/Source/Currency.php +33 -0
- app/code/local/VirtualPayer/Cardnet/Model/Source/OrderStatus.php +26 -0
- app/code/local/VirtualPayer/Cardnet/Model/Source/PaymentAction.php +33 -0
- app/code/local/VirtualPayer/Cardnet/Model/Source/PaymentMode.php +29 -0
- app/code/local/VirtualPayer/Cardnet/controllers/Adminhtml/CardnetController.php +271 -0
- app/code/local/VirtualPayer/Cardnet/controllers/RedirectController.php +130 -0
- app/code/local/VirtualPayer/Cardnet/controllers/ResponseController.php +64 -0
- app/code/local/VirtualPayer/Cardnet/etc/config.xml +162 -0
- app/code/local/VirtualPayer/Cardnet/etc/system.xml +142 -0
- app/code/local/VirtualPayer/Cardnet/sql/cardnet_setup/mysql4-install-0.1.0.php +41 -0
- app/design/adminhtml/default/default/layout/cardnet.xml +8 -0
- app/design/frontend/base/default/layout/cardnet.xml +21 -0
- app/design/frontend/base/default/template/cardnet/redirect/failure.phtml +9 -0
- app/design/frontend/base/default/template/cardnet/redirect/form.phtml +26 -0
- app/design/frontend/base/default/template/cardnet/redirect/success.phtml +9 -0
- app/etc/modules/VirtualPayer_Cardnet.xml +28 -0
- package.xml +20 -0
app/code/local/VirtualPayer/Cardnet/Block/Adminhtml/Cardnet.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class VirtualPayer_Cardnet_Block_Adminhtml_Cardnet extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_cardnet';
|
7 |
+
$this->_blockGroup = 'cardnet';
|
8 |
+
$this->_headerText = Mage::helper('cardnet')->__('Cardnet Transactions');
|
9 |
+
parent::__construct();
|
10 |
+
$this->_removeButton('add');
|
11 |
+
}
|
12 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Block/Adminhtml/Cardnet/Grid.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class VirtualPayer_Cardnet_Block_Adminhtml_Cardnet_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('cardnetGrid');
|
8 |
+
$this->setDefaultSort('timestamp');
|
9 |
+
$this->setDefaultDir('DESC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareCollection()
|
14 |
+
{
|
15 |
+
$collection = Mage::getModel('cardnet/cardnet')->getCollection();
|
16 |
+
$this->setCollection($collection);
|
17 |
+
return parent::_prepareCollection();
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Return Current work store
|
22 |
+
*
|
23 |
+
* @return Mage_Core_Model_Store
|
24 |
+
*/
|
25 |
+
protected function _getStore()
|
26 |
+
{
|
27 |
+
return Mage::app()->getStore();
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _prepareColumns()
|
31 |
+
{
|
32 |
+
|
33 |
+
$this->addColumn('order_id', array(
|
34 |
+
'header' => Mage::helper('cardnet')->__('Order ID'),
|
35 |
+
'index' => 'order_id',
|
36 |
+
));
|
37 |
+
|
38 |
+
$this->addColumn('timestamp', array(
|
39 |
+
'header' => Mage::helper('cardnet')->__('Timestamp'),
|
40 |
+
'type' => 'datetime',
|
41 |
+
'index' => 'timestamp',
|
42 |
+
));
|
43 |
+
|
44 |
+
|
45 |
+
$this->addColumn('oid', array(
|
46 |
+
'header' => Mage::helper('cardnet')->__('cardnet Order ID'),
|
47 |
+
'index' => 'oid',
|
48 |
+
));
|
49 |
+
|
50 |
+
$this->addColumn('status', array(
|
51 |
+
'header' => Mage::helper('cardnet')->__('Status'),
|
52 |
+
'index' => 'status',
|
53 |
+
'width' => '50px',
|
54 |
+
|
55 |
+
));
|
56 |
+
|
57 |
+
$this->addColumn('fail_reason', array(
|
58 |
+
'header' => Mage::helper('cardnet')->__('Fail Reason'),
|
59 |
+
'index' => 'fail_reason',
|
60 |
+
));
|
61 |
+
|
62 |
+
$this->addColumn('cardnumber', array(
|
63 |
+
'header' => Mage::helper('cardnet')->__('Card Number'),
|
64 |
+
'index' => 'cardnumber',
|
65 |
+
));
|
66 |
+
|
67 |
+
$this->addColumn('currency', array(
|
68 |
+
'header' => Mage::helper('cardnet')->__('Currency'),
|
69 |
+
'index' => 'currency',
|
70 |
+
'width' => '50px',
|
71 |
+
));
|
72 |
+
|
73 |
+
$this->addColumn('refnumber', array(
|
74 |
+
'header' => Mage::helper('cardnet')->__('Referance Number'),
|
75 |
+
'index' => 'refnumber',
|
76 |
+
));
|
77 |
+
|
78 |
+
$this->addColumn('chargetotal', array(
|
79 |
+
'header' => Mage::helper('cardnet')->__('Amount'),
|
80 |
+
'index' => 'chargetotal',
|
81 |
+
));
|
82 |
+
|
83 |
+
$this->addColumn('paymentMethod', array(
|
84 |
+
'header' => Mage::helper('cardnet')->__('Payment Method'),
|
85 |
+
'index' => 'paymentMethod',
|
86 |
+
));
|
87 |
+
|
88 |
+
$this->addColumn('processor_response_code', array(
|
89 |
+
'header' => Mage::helper('cardnet')->__('Response Code'),
|
90 |
+
'index' => 'processor_response_code',
|
91 |
+
));
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('cardnet')->__('CSV'));
|
96 |
+
$this->addExportType('*/*/exportXml', Mage::helper('cardnet')->__('XML'));
|
97 |
+
|
98 |
+
return parent::_prepareColumns();
|
99 |
+
}
|
100 |
+
|
101 |
+
protected function _prepareMassaction()
|
102 |
+
{
|
103 |
+
$this->setMassactionIdField('cardnet_id');
|
104 |
+
$this->getMassactionBlock()->setFormFieldName('cardnet');
|
105 |
+
|
106 |
+
return $this;
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getRowUrl($row)
|
110 |
+
{
|
111 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
112 |
+
}
|
113 |
+
|
114 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Block/Redirect/Error.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Block_Redirect_Error extends Mage_Core_Block_Abstract
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
protected function _toHtml()
|
22 |
+
{
|
23 |
+
$html = '<script type="text/javascript">window.location = "' . Mage::getBaseUrl() . 'cardnet/redirect/failure' . '"</script>';
|
24 |
+
return $html;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
?>
|
app/code/local/VirtualPayer/Cardnet/Block/Redirect/Form.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Block_Redirect_Form extends Mage_Payment_Block_Form
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
protected function _construct()
|
22 |
+
{
|
23 |
+
$this->setTemplate('cardnet/redirect/form.phtml');
|
24 |
+
parent::_construct();
|
25 |
+
}
|
26 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Block/Redirect/Redirect.php
ADDED
@@ -0,0 +1,278 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Block_Redirect_Redirect extends Mage_Core_Block_Abstract
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
protected function _toHtml()
|
22 |
+
{
|
23 |
+
$currency_map = array (
|
24 |
+
'ADP' => 20,
|
25 |
+
'AED' => 784,
|
26 |
+
'AFN' => 971,
|
27 |
+
'ALL' => 8,
|
28 |
+
'AMD' => 51,
|
29 |
+
'ANG' => 532,
|
30 |
+
'AOA' => 973,
|
31 |
+
'ARS' => 32,
|
32 |
+
'ATS' => 40,
|
33 |
+
'AUD' => 36,
|
34 |
+
'AWG' => 533,
|
35 |
+
'AZN' => 31,
|
36 |
+
'BAM' => 977,
|
37 |
+
'BBD' => 52,
|
38 |
+
'BDT' => 50,
|
39 |
+
'BEF' => 56,
|
40 |
+
'BGL' => 100,
|
41 |
+
'BGN' => 975,
|
42 |
+
'BHD' => 48,
|
43 |
+
'BIF' => 108,
|
44 |
+
'BMD' => 60,
|
45 |
+
'BND' => 96,
|
46 |
+
'BOB' => 68,
|
47 |
+
'BOV' => 984,
|
48 |
+
'BRL' => 986,
|
49 |
+
'BSD' => 44,
|
50 |
+
'BTN' => 64,
|
51 |
+
'BWP' => 72,
|
52 |
+
'BYR' => 974,
|
53 |
+
'BZD' => 84,
|
54 |
+
'CAD' => 124,
|
55 |
+
'CDF' => 976,
|
56 |
+
'CHF' => 756,
|
57 |
+
'CLF' => 990,
|
58 |
+
'CLP' => 152,
|
59 |
+
'CNY' => 156,
|
60 |
+
'COP' => 170,
|
61 |
+
'CRC' => 188,
|
62 |
+
'CSD' => 891,
|
63 |
+
'CUP' => 192,
|
64 |
+
'CVE' => 132,
|
65 |
+
'CZK' => 203,
|
66 |
+
'DEM' => 280,
|
67 |
+
'DJF' => 262,
|
68 |
+
'DKK' => 208,
|
69 |
+
'DOP' => 214,
|
70 |
+
'DZD' => 12,
|
71 |
+
'EEK' => 233,
|
72 |
+
'EGP' => 818,
|
73 |
+
'ERN' => 232,
|
74 |
+
'ESP' => 724,
|
75 |
+
'ETB' => 230,
|
76 |
+
'EUR' => 978,
|
77 |
+
'FIM' => 246,
|
78 |
+
'FJD' => 242,
|
79 |
+
'FKP' => 238,
|
80 |
+
'FRF' => 250,
|
81 |
+
'GBP' => 826,
|
82 |
+
'GEL' => 981,
|
83 |
+
'GHC' => 288,
|
84 |
+
'GIP' => 292,
|
85 |
+
'GMD' => 270,
|
86 |
+
'GNF' => 324,
|
87 |
+
'GRD' => 300,
|
88 |
+
'GTQ' => 320,
|
89 |
+
'GWP' => 624,
|
90 |
+
'GYD' => 328,
|
91 |
+
'HKD' => 344,
|
92 |
+
'HNL' => 340,
|
93 |
+
'HRK' => 191,
|
94 |
+
'HTG' => 332,
|
95 |
+
'HUF' => 348,
|
96 |
+
'IDR' => 360,
|
97 |
+
'IEP' => 372,
|
98 |
+
'ILS' => 376,
|
99 |
+
'INR' => 356,
|
100 |
+
'IQD' => 368,
|
101 |
+
'IRR' => 364,
|
102 |
+
'ISK' => 352,
|
103 |
+
'ITL' => 380,
|
104 |
+
'JMD' => 388,
|
105 |
+
'JOD' => 400,
|
106 |
+
'JPY' => 392,
|
107 |
+
'KES' => 404,
|
108 |
+
'KGS' => 417,
|
109 |
+
'KHR' => 116,
|
110 |
+
'KMF' => 174,
|
111 |
+
'KPW' => 408,
|
112 |
+
'KRW' => 410,
|
113 |
+
'KWD' => 414,
|
114 |
+
'KYD' => 136,
|
115 |
+
'KZT' => 398,
|
116 |
+
'LAK' => 418,
|
117 |
+
'LBP' => 422,
|
118 |
+
'LKR' => 144,
|
119 |
+
'LRD' => 430,
|
120 |
+
'LTL' => 440,
|
121 |
+
'LUF' => 442,
|
122 |
+
'LVL' => 428,
|
123 |
+
'LYD' => 434,
|
124 |
+
'MAD' => 504,
|
125 |
+
'MDL' => 498,
|
126 |
+
'MGF' => 450,
|
127 |
+
'MKD' => 807,
|
128 |
+
'MMK' => 104,
|
129 |
+
'MNT' => 496,
|
130 |
+
'MOP' => 446,
|
131 |
+
'MRO' => 478,
|
132 |
+
'MTL' => 470,
|
133 |
+
'MUR' => 480,
|
134 |
+
'MVR' => 462,
|
135 |
+
'MWK' => 454,
|
136 |
+
'MXN' => 484,
|
137 |
+
'MXV' => 979,
|
138 |
+
'MYR' => 458,
|
139 |
+
'MZM' => 508,
|
140 |
+
'NAD' => 516,
|
141 |
+
'NGN' => 566,
|
142 |
+
'NIO' => 558,
|
143 |
+
'NLG' => 528,
|
144 |
+
'NOK' => 578,
|
145 |
+
'NPR' => 524,
|
146 |
+
'NZD' => 554,
|
147 |
+
'OMR' => 512,
|
148 |
+
'PAB' => 590,
|
149 |
+
'PEN' => 604,
|
150 |
+
'PGK' => 598,
|
151 |
+
'PHP' => 608,
|
152 |
+
'PKR' => 586,
|
153 |
+
'PLN' => 985,
|
154 |
+
'PTE' => 620,
|
155 |
+
'PYG' => 600,
|
156 |
+
'QAR' => 634,
|
157 |
+
'ROL' => 642,
|
158 |
+
'RUB' => 643,
|
159 |
+
'RUR' => 810,
|
160 |
+
'RWF' => 646,
|
161 |
+
'SAR' => 682,
|
162 |
+
'SBD' => 90,
|
163 |
+
'SCR' => 690,
|
164 |
+
'SDD' => 736,
|
165 |
+
'SDG' => 938,
|
166 |
+
'SEK' => 752,
|
167 |
+
'SGD' => 702,
|
168 |
+
'SHP' => 654,
|
169 |
+
'SIT' => 705,
|
170 |
+
'SKK' => 703,
|
171 |
+
'SLL' => 694,
|
172 |
+
'SOS' => 706,
|
173 |
+
'SRG' => 740,
|
174 |
+
'STD' => 678,
|
175 |
+
'SVC' => 222,
|
176 |
+
'SYP' => 760,
|
177 |
+
'SZL' => 748,
|
178 |
+
'THB' => 764,
|
179 |
+
'TJS' => 972,
|
180 |
+
'TMM' => 795,
|
181 |
+
'TND' => 788,
|
182 |
+
'TOP' => 776,
|
183 |
+
'TRY' => 949,
|
184 |
+
'TTD' => 780,
|
185 |
+
'TWD' => 901,
|
186 |
+
'TZS' => 834,
|
187 |
+
'UAH' => 980,
|
188 |
+
'UGX' => 800,
|
189 |
+
'USD' => 840,
|
190 |
+
'USN' => 997,
|
191 |
+
'USS' => 998,
|
192 |
+
'UYU' => 858,
|
193 |
+
'UZS' => 860,
|
194 |
+
'VEB' => 862,
|
195 |
+
'VEF' => 937,
|
196 |
+
'VND' => 704,
|
197 |
+
'VUV' => 548,
|
198 |
+
'WST' => 882,
|
199 |
+
'XAF' => 950,
|
200 |
+
'XCD' => 951,
|
201 |
+
'XOF' => 952,
|
202 |
+
'XPF' => 953,
|
203 |
+
'YER' => 886,
|
204 |
+
'ZAR' => 710,
|
205 |
+
'ZMK' => 894,
|
206 |
+
'ZWD' => 716
|
207 |
+
);
|
208 |
+
|
209 |
+
$timestamp = $orderid = $currency = $sha1hash = '';
|
210 |
+
|
211 |
+
|
212 |
+
$redirect = Mage::getModel('cardnet/redirect');
|
213 |
+
|
214 |
+
$dateTime = date("Y:m:d-H:i:s");
|
215 |
+
$timestamp = strftime("%Y%m%d%H%M%S");
|
216 |
+
|
217 |
+
$auction= $redirect->getCardnetUrl();
|
218 |
+
if($redirect->getConfigData('test'))
|
219 |
+
$auction = $redirect->getCardnetTestUrl();
|
220 |
+
|
221 |
+
$form = new Varien_Data_Form();
|
222 |
+
$form->setAction($auction)
|
223 |
+
->setId('cardnet_redirect_checkout')
|
224 |
+
->setName('cardnet_redirect_checkout')
|
225 |
+
->setMethod('POST')
|
226 |
+
->setUseContainer(true);
|
227 |
+
|
228 |
+
|
229 |
+
$orderid = $redirect->getCheckout()->getLastRealOrderId();
|
230 |
+
$order = Mage::getModel('sales/order');
|
231 |
+
$order->loadByIncrementId($orderid);
|
232 |
+
|
233 |
+
if($redirect->getConfigData('currency') == 'display'){
|
234 |
+
$currency = $redirect->getQuote()->getStore()->getCurrentCurrency();
|
235 |
+
$amount = $order->getGrandTotal();
|
236 |
+
}else{
|
237 |
+
$currency = $order->getBaseCurrencyCode();
|
238 |
+
$amount = $order->getBaseGrandTotal();
|
239 |
+
}
|
240 |
+
$currency=$currency_map[$currency];
|
241 |
+
|
242 |
+
$storeid = $redirect->getConfigData('storeid');
|
243 |
+
$secret = $redirect->getConfigData('sharedsecret');
|
244 |
+
|
245 |
+
|
246 |
+
$stringToHash = $storeid . $dateTime . $amount . $currency . $secret;
|
247 |
+
$ascii = bin2hex($stringToHash);
|
248 |
+
$sha1hash = sha1($ascii);
|
249 |
+
|
250 |
+
|
251 |
+
$form->addField('txntype', 'hidden', array('name'=>'txntype', 'value'=>'sale'));
|
252 |
+
$form->addField('oid', 'hidden', array('name'=>'oid', 'value'=>$orderid));
|
253 |
+
$form->addField('timezone', 'hidden', array('name'=>'timezone', 'value'=>date(T)));
|
254 |
+
$form->addField('txndatetime', 'hidden', array('name'=>'txndatetime', 'value'=>$dateTime));
|
255 |
+
$form->addField('hash', 'hidden', array('name'=>'hash', 'value'=>$sha1hash));
|
256 |
+
$form->addField('storename', 'hidden', array('name'=>'storename', 'value'=>$storeid));
|
257 |
+
$form->addField('mode', 'hidden', array('name'=>'mode', 'value'=>'payonly'));
|
258 |
+
$form->addField('responseSuccessURL', 'hidden', array('name'=>'responseSuccessURL', 'value'=>$redirect->getSuccessUrl()));
|
259 |
+
$form->addField('responseFailURL', 'hidden', array('name'=>'responseFailURL', 'value'=>$redirect->getCancelUrl()));
|
260 |
+
$form->addField('chargetotal', 'hidden', array('name'=>'chargetotal', 'value'=>$amount));
|
261 |
+
$form->addField('currency', 'hidden', array('name'=>'currency', 'value'=>$currency));
|
262 |
+
|
263 |
+
$html = '<html><body>';
|
264 |
+
$html.= Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('cardnet_redirect')->toHtml();
|
265 |
+
$html.= $form->toHtml();
|
266 |
+
$html.= '<script type="text/javascript">document.getElementById("cardnet_redirect_checkout").submit();</script>';
|
267 |
+
$html.= '</body></html>';
|
268 |
+
|
269 |
+
|
270 |
+
|
271 |
+
|
272 |
+
if($redirect->getConfigData('debug')){
|
273 |
+
Mage::log($html);
|
274 |
+
}
|
275 |
+
|
276 |
+
return $html;
|
277 |
+
}
|
278 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Block/Redirect/Success.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Block_Redirect_Success extends Mage_Core_Block_Abstract
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
protected function _toHtml()
|
22 |
+
{
|
23 |
+
$html = '<script type="text/javascript">window.location = "' . Mage::getBaseUrl() . 'cardnet/redirect/success' . '"</script>';
|
24 |
+
|
25 |
+
return $html;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
?>
|
app/code/local/VirtualPayer/Cardnet/Helper/Data.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Helper_Data extends Mage_Core_Helper_Abstract
|
17 |
+
{
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param $orderIncrementId
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function createInvoice(string $orderIncrementId){
|
24 |
+
$_order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
25 |
+
|
26 |
+
if($_order->canInvoice()) {
|
27 |
+
$invoiceId = Mage::getModel('sales/order_invoice_api')->create($_order->getIncrementId(), array(), 'Invoice Created', true, true);
|
28 |
+
|
29 |
+
$invoice = Mage::getModel('sales/order_invoice_api')->capture($invoiceId);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getDateFromTimestamp($timestamp){
|
34 |
+
$year = substr($timestamp, 0, 4);
|
35 |
+
$month = substr($timestamp, 4, 2);
|
36 |
+
$day = substr($timestamp, 6, 2);
|
37 |
+
$hour = substr($timestamp, 8, 2);
|
38 |
+
$minutes = substr($timestamp, 10, 2);
|
39 |
+
$seconds = substr($timestamp, 12, 2);
|
40 |
+
$date = $year . '-' . $month . '-' . $day . ' ' . $hour . ':' . $minutes . ':' . $seconds;
|
41 |
+
Mage::log($date);
|
42 |
+
return strtotime($date);
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getCustomerMessage($block, $order, $response){
|
46 |
+
$variables = array();
|
47 |
+
$variables['order'] = $order;
|
48 |
+
$variables['response'] = $response;
|
49 |
+
$filter = Mage::getModel('core/email_template_filter');
|
50 |
+
$filter->setVariables($variables);
|
51 |
+
return $filter->filter($block->toHtml());
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
|
app/code/local/VirtualPayer/Cardnet/Model/Cardnet.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class VirtualPayer_Cardnet_Model_Cardnet extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('cardnet/cardnet');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Model/Mysql4/Cardnet.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class VirtualPayer_Cardnet_Model_Mysql4_Cardnet extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('cardnet/cardnet', 'cardnet_id');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Model/Mysql4/Cardnet/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class VirtualPayer_Cardnet_Model_Mysql4_Cardnet_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('cardnet/cardnet');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Model/Redirect.php
ADDED
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Model_Redirect extends Mage_Payment_Model_Method_Abstract{
|
17 |
+
|
18 |
+
protected $_code = 'cardnet';
|
19 |
+
protected $_formBlockType = 'cardnet/redirect_form';
|
20 |
+
protected $_allowCurrencyCode = array('AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'JPY', 'NOK', 'NZD', 'PLN', 'SEK', 'SGD','USD');
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param $data
|
24 |
+
* @return VirtualPayer_Cardnet_Model_Redirect
|
25 |
+
*/
|
26 |
+
public function assignData($data)
|
27 |
+
{
|
28 |
+
if (!($data instanceof Varien_Object)) {
|
29 |
+
$data = new Varien_Object($data);
|
30 |
+
}
|
31 |
+
$info = $this->getInfoInstance();
|
32 |
+
$info->setCcType($data->getAmex());
|
33 |
+
|
34 |
+
return $this;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get checkout session namespace
|
39 |
+
*
|
40 |
+
* @return Mage_Checkout_Model_Session
|
41 |
+
*/
|
42 |
+
public function getCheckout()
|
43 |
+
{
|
44 |
+
return Mage::getSingleton('checkout/session');
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Get current quote
|
49 |
+
*
|
50 |
+
* @return Mage_Sales_Model_Quote
|
51 |
+
*/
|
52 |
+
public function getQuote()
|
53 |
+
{
|
54 |
+
return $this->getCheckout()->getQuote();
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Using internal pages for input payment data
|
59 |
+
*
|
60 |
+
* @return bool
|
61 |
+
*/
|
62 |
+
public function canUseInternal()
|
63 |
+
{
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Using for multiple shipping address
|
69 |
+
*
|
70 |
+
* @return bool
|
71 |
+
*/
|
72 |
+
public function canUseForMultishipping()
|
73 |
+
{
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function createFormBlock($name)
|
78 |
+
{
|
79 |
+
$block = $this->getLayout()->createBlock('cardnet/redirect_form', $name)
|
80 |
+
->setMethod('cardnet_redirect')
|
81 |
+
->setPayment($this->getPayment())
|
82 |
+
->setTemplate('cardnet/redirect/form.phtml');
|
83 |
+
|
84 |
+
return $block;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Validate the currency code is available to use for cardnet or not
|
89 |
+
*
|
90 |
+
* @return VirtualPayer_Cardnet_Model_Redirect
|
91 |
+
*/
|
92 |
+
|
93 |
+
public function validate()
|
94 |
+
{
|
95 |
+
parent::validate();
|
96 |
+
$currency_code = $this->getQuote()->getBaseCurrencyCode();
|
97 |
+
if (!in_array($currency_code,$this->_allowCurrencyCode)) {
|
98 |
+
}
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
104 |
+
* @return VirtualPayer_Cardnet_Model_Redirect
|
105 |
+
*/
|
106 |
+
public function onOrderValidate(Mage_Sales_Model_Order_Payment $payment)
|
107 |
+
{
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @param Mage_Sales_Model_Invoice_Payment $payment
|
113 |
+
* @return void
|
114 |
+
*/
|
115 |
+
public function onInvoiceCreate(Mage_Sales_Model_Invoice_Payment $payment)
|
116 |
+
{
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @return bool
|
122 |
+
*/
|
123 |
+
public function canCapture()
|
124 |
+
{
|
125 |
+
return true;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
public function getOrderPlaceRedirectUrl()
|
132 |
+
{
|
133 |
+
return Mage::getUrl('cardnet/redirect/', array('_secure' => true));
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
/**
|
138 |
+
* @return string
|
139 |
+
*/
|
140 |
+
public function getSuccessUrl(){
|
141 |
+
return Mage::getUrl('cardnet/response/');
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @return string
|
146 |
+
*/
|
147 |
+
public function getCancelUrl(){
|
148 |
+
return Mage::getUrl('cardnet/redirect/cancel');
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
+
public function getCardnetUrl(){
|
155 |
+
$url = "https://www.ipg-online.com/connect/gateway/processing";
|
156 |
+
return $url;
|
157 |
+
}
|
158 |
+
|
159 |
+
public function getCardnetTestUrl(){
|
160 |
+
$url = "https://test.ipg-online.com/connect/gateway/processing";
|
161 |
+
return $url;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* @return bool
|
166 |
+
*/
|
167 |
+
public function isInitializeNeeded()
|
168 |
+
{
|
169 |
+
return true;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @param $paymentAction
|
174 |
+
* @param $stateObject
|
175 |
+
* @return void
|
176 |
+
*/
|
177 |
+
public function initialize($paymentAction, $stateObject)
|
178 |
+
{
|
179 |
+
$state = "cardnet Processing";
|
180 |
+
$stateObject->setState($state);
|
181 |
+
$stateObject->setIsNotified(false);
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @return bool
|
186 |
+
*/
|
187 |
+
public function processRedirectResponse($post){
|
188 |
+
Mage::log($post);
|
189 |
+
$this->savecardnetTransaction($post);
|
190 |
+
|
191 |
+
$timestamp = $post['tdate'];
|
192 |
+
$result = $post['processor_response_code'];
|
193 |
+
$orderid = $post['oid'];
|
194 |
+
$message = $post['status'];
|
195 |
+
$authcode = $post['terminal_id'];
|
196 |
+
$pasref = $post['refnumber'];
|
197 |
+
$cardnetsha1 = $post['response_hash'];
|
198 |
+
|
199 |
+
$redirect = Mage::getModel('cardnet/redirect');
|
200 |
+
$storeid = $redirect->getConfigData('login');
|
201 |
+
$secret = $redirect->getConfigData('pwd');
|
202 |
+
|
203 |
+
$tmp = "$timestamp.$storeid.$orderid.$result.$message.$pasref.$authcode";
|
204 |
+
$sha1hash = sha1($tmp);
|
205 |
+
$tmp = "$sha1hash.$secret";
|
206 |
+
$sha1hash = sha1($tmp);
|
207 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderid);
|
208 |
+
|
209 |
+
$session = Mage::getSingleton('checkout/session');
|
210 |
+
$session->setOrderId($orderid);
|
211 |
+
|
212 |
+
if ($result != "00" && $message != 'APPROVED') {
|
213 |
+
if ($order->getId()) {
|
214 |
+
$order->cancel();
|
215 |
+
$order->addStatusToHistory('cancelled', $post['fail_reason'], false);
|
216 |
+
$order->save();
|
217 |
+
}
|
218 |
+
return false;
|
219 |
+
}else{
|
220 |
+
if ($result == "00" || $message == 'APPROVED') {
|
221 |
+
if ($order->getId()) {
|
222 |
+
$order->addStatusToHistory('processing', 'Payment Successful: ' . $result . ': ' . $message, false);
|
223 |
+
$order->addStatusToHistory('processing', 'Authorisation Code: ' . $authcode, false);
|
224 |
+
$order->sendNewOrderEmail();
|
225 |
+
$order->setEmailSent(true);
|
226 |
+
|
227 |
+
$session->setLastSuccessQuoteId($order->getId());
|
228 |
+
$session->setLastQuoteId($order->getId());
|
229 |
+
$session->setLastOrderId($order->getId());
|
230 |
+
|
231 |
+
$order->save();
|
232 |
+
}
|
233 |
+
if($redirect->getConfigData('capture')){
|
234 |
+
Mage::helper('cardnet')->createInvoice($orderid);
|
235 |
+
}
|
236 |
+
return true;
|
237 |
+
}else{
|
238 |
+
$session->addError('There was a problem completing your order. Please try again');
|
239 |
+
if ($order->getId()) {
|
240 |
+
$order->addStatusToHistory('cancelled', $result . ': ' . $message, false);
|
241 |
+
$order->cancel();
|
242 |
+
}
|
243 |
+
$order->save();
|
244 |
+
return false;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
public function savecardnetTransaction($post){
|
250 |
+
$cardnet = Mage::getModel('cardnet/cardnet');
|
251 |
+
|
252 |
+
try{
|
253 |
+
$cardnet->setOrderId($post['oid'])
|
254 |
+
->setTimestamp(Mage::helper('cardnet')->getDateFromTimestamp($post['txndatetime']))
|
255 |
+
->setTerminalid($post['terminal_id'])
|
256 |
+
->setExpmonth($post['expmonth'])
|
257 |
+
->setStatus($post['status'])
|
258 |
+
->setFailreason($post['fail_reason'])
|
259 |
+
->setOid($post['oid'])
|
260 |
+
->setCurrency($post['currency'])
|
261 |
+
->setProcessorresponsecode($post['processor_response_code'])
|
262 |
+
->setApprovalcode($post['approval_code'])
|
263 |
+
->setExpyear($post['expyear'])
|
264 |
+
->setRefnumber($post['refnumber'])
|
265 |
+
->setCcbrand($post['ccbrand'])
|
266 |
+
->setCccountry($post['cccountry'])
|
267 |
+
->setTimezone($post['timezone'])
|
268 |
+
->setChargetotal($post['chargetotal'])
|
269 |
+
->setTxntype($post['txntype'])
|
270 |
+
->setCcbin($post['ccbin'])
|
271 |
+
->setTdate($post['tdate'])
|
272 |
+
->setTxndate_processed($post['txndate_processed'])
|
273 |
+
->setFailrc($post['fail_rc'])
|
274 |
+
->setResponsehash($post['response_hash'])
|
275 |
+
->setPaymentMethod($post['paymentMethod'])
|
276 |
+
->save();
|
277 |
+
}catch(Exception $e){
|
278 |
+
Mage::logException($e);
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
?>
|
app/code/local/VirtualPayer/Cardnet/Model/Setup.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class VirtualPayer_Cardnet_Model_Setup extends Mage_Eav_Model_Entity_Setup
|
4 |
+
{
|
5 |
+
|
6 |
+
public function createStaticBlocks(){
|
7 |
+
$error = Mage::getModel('cms/block');
|
8 |
+
$error->setTitle('Cardnet Error Message')
|
9 |
+
->setIdentifier('cardnet_error')
|
10 |
+
->setContent('{{var response.message}}')
|
11 |
+
->setCreationTime(date('Y-m-d H:i:s'))
|
12 |
+
->setUpdateTime(date('Y-m-d H:i:s'))
|
13 |
+
->setIsActive(1)
|
14 |
+
->setStores(0)
|
15 |
+
->save();
|
16 |
+
|
17 |
+
$success = Mage::getModel('cms/block');
|
18 |
+
$success->setTitle('Cardnet Success Message')
|
19 |
+
->setIdentifier('cardnet_success')
|
20 |
+
->setContent('{{var response.message}}')
|
21 |
+
->setCreationTime(date('Y-m-d H:i:s'))
|
22 |
+
->setUpdateTime(date('Y-m-d H:i:s'))
|
23 |
+
->setIsActive(1)
|
24 |
+
->setStores(0)
|
25 |
+
->save();
|
26 |
+
|
27 |
+
$redirect = Mage::getModel('cms/block');
|
28 |
+
$redirect->setTitle('Cardnet Redirect Message')
|
29 |
+
->setIdentifier('cardnet_redirect')
|
30 |
+
->setContent('You will be redirected to cardnet in a few seconds.')
|
31 |
+
->setCreationTime(date('Y-m-d H:i:s'))
|
32 |
+
->setUpdateTime(date('Y-m-d H:i:s'))
|
33 |
+
->setIsActive(1)
|
34 |
+
->setStores(0)
|
35 |
+
->save();
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Model/Source/Cctype.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype
|
17 |
+
{
|
18 |
+
public function getAllowedTypes()
|
19 |
+
{
|
20 |
+
return array('VI', 'MC', 'AE');
|
21 |
+
}
|
22 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Model/Source/Currency.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Model_Source_Currency
|
17 |
+
{
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return array(
|
21 |
+
array(
|
22 |
+
'value' => 'base',
|
23 |
+
'label' => Mage::helper('cardnet')->__('Use Base Currency')
|
24 |
+
),
|
25 |
+
array(
|
26 |
+
'value' => 'display',
|
27 |
+
'label' => Mage::helper('cardnet')->__('Use Display Currency')
|
28 |
+
),
|
29 |
+
);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
?>
|
app/code/local/VirtualPayer/Cardnet/Model/Source/OrderStatus.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Model_Source_OrderStatus{
|
17 |
+
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return array(
|
21 |
+
array('value' => 'canceled', 'label' => Mage::helper('cardnet')->__('Canceled')),
|
22 |
+
array('value' => 'pending', 'label' => Mage::helper('cardnet')->__('Pending')),
|
23 |
+
array('value' => 'processing', 'label' => Mage::helper('cardnet')->__('Processing')),
|
24 |
+
);
|
25 |
+
}
|
26 |
+
}
|
app/code/local/VirtualPayer/Cardnet/Model/Source/PaymentAction.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Model_Source_PaymentAction
|
17 |
+
{
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return array(
|
21 |
+
array(
|
22 |
+
'value' => Mage_Cardnet_Model_Redirect::ACTION_AUTHORIZE,
|
23 |
+
'label' => Mage::helper('cardnet')->__('Defer Settlement')
|
24 |
+
),
|
25 |
+
array(
|
26 |
+
'value' => Mage_Cardnet_Model_Redirect::ACTION_AUTHORIZE_CAPTURE,
|
27 |
+
'label' => Mage::helper('cardnet')->__('Settle Immediately')
|
28 |
+
),
|
29 |
+
);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
?>
|
app/code/local/VirtualPayer/Cardnet/Model/Source/PaymentMode.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_Model_Source_PaymentMode
|
17 |
+
{
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return array(
|
21 |
+
array(
|
22 |
+
'value' => 'cardnet/redirect',
|
23 |
+
'label' => Mage::helper('cardnet')->__('Redirect')
|
24 |
+
),
|
25 |
+
);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
?>
|
app/code/local/VirtualPayer/Cardnet/controllers/Adminhtml/CardnetController.php
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class VirtualPayer_Cardnet_Adminhtml_CardnetController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('cardnet/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Cardnet Transactions Manager'), Mage::helper('adminhtml')->__('Cardnet Connect Transactions Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('cardnet/cardnet')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('cardnet_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('cardnet/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Cardnet Manager'), Mage::helper('adminhtml')->__('Cardnet Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Code News'), Mage::helper('adminhtml')->__('Code News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('cardnet/adminhtml_cardnet_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('cardnet/adminhtml_cardnet_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cardnet')->__('Code does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function uploadAction() {
|
54 |
+
$this->loadLayout();
|
55 |
+
$this->_setActiveMenu('cardnet/items');
|
56 |
+
|
57 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Cardnet Manager'), Mage::helper('adminhtml')->__('Cardnet Manager'));
|
58 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Code Import'), Mage::helper('adminhtml')->__('Code Import'));
|
59 |
+
|
60 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
61 |
+
|
62 |
+
$this->_addContent($this->getLayout()->createBlock('cardnet/adminhtml_cardnet_import'))
|
63 |
+
->_addLeft($this->getLayout()->createBlock('cardnet/adminhtml_cardnet_import_tabs'));
|
64 |
+
|
65 |
+
$this->renderLayout();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function importCSV(){
|
69 |
+
try {
|
70 |
+
$uploader = new Varien_File_Uploader('filename');
|
71 |
+
$uploader->setAllowedExtensions(array('csv'));
|
72 |
+
$uploader->setAllowRenameFiles(false);
|
73 |
+
$uploader->setFilesDispersion(false);
|
74 |
+
|
75 |
+
$path = Mage::getBaseDir('media') . DS ;
|
76 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
77 |
+
|
78 |
+
$row = 1;
|
79 |
+
if (($handle = fopen($path . $_FILES['filename']['name'], "r")) !== FALSE) {
|
80 |
+
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
81 |
+
if($row == 1){
|
82 |
+
$num = count($data);
|
83 |
+
$headings = array();
|
84 |
+
for ($c=0; $c < $num; $c++) {
|
85 |
+
$headings[$c] = $data[$c];
|
86 |
+
}
|
87 |
+
$row++;
|
88 |
+
continue;
|
89 |
+
}else{
|
90 |
+
$model = Mage::getModel('cardnet/cardnet');
|
91 |
+
$row++;
|
92 |
+
$num = count($data);
|
93 |
+
for ($c=0; $c < $num; $c++) {
|
94 |
+
$model->setData($headings[$c], $data[$c]);
|
95 |
+
}
|
96 |
+
$model->save();
|
97 |
+
}
|
98 |
+
}
|
99 |
+
fclose($handle);
|
100 |
+
}else{
|
101 |
+
Mage::throwException('File Not Found');
|
102 |
+
}
|
103 |
+
|
104 |
+
} catch (Exception $e) {
|
105 |
+
Mage::throwException($e->getMessage());
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
public function saveAction() {
|
110 |
+
if ($data = $this->getRequest()->getPost()) {
|
111 |
+
|
112 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
113 |
+
$this->importCSV();
|
114 |
+
$this->_redirect('*/*/');
|
115 |
+
return;
|
116 |
+
}
|
117 |
+
|
118 |
+
$model = Mage::getModel('cardnet/cardnet');
|
119 |
+
$model->setData($data)
|
120 |
+
->setId($this->getRequest()->getParam('id'));
|
121 |
+
|
122 |
+
try {
|
123 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
124 |
+
$model->setCreatedTime(now())
|
125 |
+
->setUpdateTime(now());
|
126 |
+
} else {
|
127 |
+
$model->setUpdateTime(now());
|
128 |
+
}
|
129 |
+
|
130 |
+
$model->save();
|
131 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cardnet')->__('Code was successfully saved'));
|
132 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
133 |
+
|
134 |
+
if ($this->getRequest()->getParam('back')) {
|
135 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
136 |
+
return;
|
137 |
+
}
|
138 |
+
$this->_redirect('*/*/');
|
139 |
+
return;
|
140 |
+
} catch (Exception $e) {
|
141 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
142 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
143 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
144 |
+
return;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cardnet')->__('Unable to find code to save'));
|
148 |
+
$this->_redirect('*/*/');
|
149 |
+
}
|
150 |
+
|
151 |
+
public function deleteAction() {
|
152 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
153 |
+
try {
|
154 |
+
$model = Mage::getModel('cardnet/cardnet');
|
155 |
+
|
156 |
+
$model->setId($this->getRequest()->getParam('id'))
|
157 |
+
->delete();
|
158 |
+
|
159 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Code was successfully deleted'));
|
160 |
+
$this->_redirect('*/*/');
|
161 |
+
} catch (Exception $e) {
|
162 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
163 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
164 |
+
}
|
165 |
+
}
|
166 |
+
$this->_redirect('*/*/');
|
167 |
+
}
|
168 |
+
|
169 |
+
public function massDeleteAction() {
|
170 |
+
$cardnetconnectIds = $this->getRequest()->getParam('cardnet');
|
171 |
+
if(!is_array($cardnetIds)) {
|
172 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select code(s)'));
|
173 |
+
} else {
|
174 |
+
try {
|
175 |
+
foreach ($cardnetconnectIds as $cardnetconnectId) {
|
176 |
+
$cardnet = Mage::getModel('cardnet/cardnet')->load($cardnetconnectId);
|
177 |
+
$cardnet->delete();
|
178 |
+
}
|
179 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
180 |
+
Mage::helper('adminhtml')->__(
|
181 |
+
'Total of %d code(s) were successfully deleted', count($cardnetIds)
|
182 |
+
)
|
183 |
+
);
|
184 |
+
} catch (Exception $e) {
|
185 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
186 |
+
}
|
187 |
+
}
|
188 |
+
$this->_redirect('*/*/index');
|
189 |
+
}
|
190 |
+
|
191 |
+
public function massStatusAction()
|
192 |
+
{
|
193 |
+
$cardnetconnectIds = $this->getRequest()->getParam('cardnet');
|
194 |
+
if(!is_array($cardnetconnectIds)) {
|
195 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select code(s)'));
|
196 |
+
} else {
|
197 |
+
try {
|
198 |
+
foreach ($cardnetconnectIds as $cardnetconnectId) {
|
199 |
+
$cardnet = Mage::getSingleton('cardnet/cardnet')
|
200 |
+
->load($cardnetconnectId)
|
201 |
+
->setStatus($this->getRequest()->getParam('status'))
|
202 |
+
->setIsMassupdate(true)
|
203 |
+
->save();
|
204 |
+
}
|
205 |
+
$this->_getSession()->addSuccess(
|
206 |
+
$this->__('Total of %d code(s) were successfully updated', count($cardnetconnectIds))
|
207 |
+
);
|
208 |
+
} catch (Exception $e) {
|
209 |
+
$this->_getSession()->addError($e->getMessage());
|
210 |
+
}
|
211 |
+
}
|
212 |
+
$this->_redirect('*/*/index');
|
213 |
+
}
|
214 |
+
|
215 |
+
public function massAssignAction(){
|
216 |
+
$cardnetconnectIds = $this->getRequest()->getParam('cardnet');
|
217 |
+
if(!is_array($fdmsconnectIds)) {
|
218 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select code(s)'));
|
219 |
+
} else {
|
220 |
+
try {
|
221 |
+
foreach ($cardnetconnectIds as $cardnetconnectId) {
|
222 |
+
$cardnet = Mage::getSingleton('cardnet/cardnet')
|
223 |
+
->load($cardnetconnectId)
|
224 |
+
->setAgentId($this->getRequest()->getParam('agent_id'))
|
225 |
+
->setIsMassupdate(true)
|
226 |
+
->save();
|
227 |
+
}
|
228 |
+
$this->_getSession()->addSuccess(
|
229 |
+
$this->__('Total of %d code(s) were successfully updated', count($cardnetconnectIds))
|
230 |
+
);
|
231 |
+
} catch (Exception $e) {
|
232 |
+
$this->_getSession()->addError($e->getMessage());
|
233 |
+
}
|
234 |
+
}
|
235 |
+
$this->_redirect('*/*/index');
|
236 |
+
}
|
237 |
+
|
238 |
+
public function exportCsvAction()
|
239 |
+
{
|
240 |
+
$fileName = 'cardnet.csv';
|
241 |
+
$content = $this->getLayout()->createBlock('cardnet/adminhtml_cardnet_grid')
|
242 |
+
->getCsv();
|
243 |
+
|
244 |
+
$this->_sendUploadResponse($fileName, $content);
|
245 |
+
}
|
246 |
+
|
247 |
+
public function exportXmlAction()
|
248 |
+
{
|
249 |
+
$fileName = 'cardnet.xml';
|
250 |
+
$content = $this->getLayout()->createBlock('cardnet/adminhtml_cardnet_grid')
|
251 |
+
->getXml();
|
252 |
+
|
253 |
+
$this->_sendUploadResponse($fileName, $content);
|
254 |
+
}
|
255 |
+
|
256 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
257 |
+
{
|
258 |
+
$response = $this->getResponse();
|
259 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
260 |
+
$response->setHeader('Pragma', 'public', true);
|
261 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
262 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
263 |
+
$response->setHeader('Last-Modified', date('r'));
|
264 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
265 |
+
$response->setHeader('Content-Length', strlen($content));
|
266 |
+
$response->setHeader('Content-type', $contentType);
|
267 |
+
$response->setBody($content);
|
268 |
+
$response->sendResponse();
|
269 |
+
die;
|
270 |
+
}
|
271 |
+
}
|
app/code/local/VirtualPayer/Cardnet/controllers/RedirectController.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_RedirectController extends Mage_Core_Controller_Front_Action
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Order instance
|
20 |
+
*/
|
21 |
+
protected $_order;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get one page checkout model
|
25 |
+
*
|
26 |
+
* @return Mage_Checkout_Model_Type_Onepage
|
27 |
+
*/
|
28 |
+
public function getOnepage()
|
29 |
+
{
|
30 |
+
return Mage::getSingleton('checkout/type_onepage');
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get order
|
35 |
+
*
|
36 |
+
* @param none
|
37 |
+
* @return Mage_Sales_Model_Order
|
38 |
+
*/
|
39 |
+
public function getOrder()
|
40 |
+
{
|
41 |
+
if ($this->_order == null) {
|
42 |
+
}
|
43 |
+
return $this->_order;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Get singleton with Cardnet Redirect order transaction information
|
48 |
+
*
|
49 |
+
* @return Mage_Cardnet_Model_Redirect
|
50 |
+
*/
|
51 |
+
public function getRedirect()
|
52 |
+
{
|
53 |
+
return Mage::getSingleton('cardnet/redirect');
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
public function indexAction()
|
60 |
+
{
|
61 |
+
$session = Mage::getSingleton('checkout/session');
|
62 |
+
$session->setCardnetRedirectQuoteId($session->getQuoteId());
|
63 |
+
$session->unsQuoteId();
|
64 |
+
|
65 |
+
$this->loadLayout();
|
66 |
+
$this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('cardnet/redirect_redirect'));
|
67 |
+
$this->renderLayout();
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @return void
|
73 |
+
*/
|
74 |
+
public function cancelAction()
|
75 |
+
{
|
76 |
+
$session = Mage::getSingleton('checkout/session');
|
77 |
+
|
78 |
+
// cancel order
|
79 |
+
if ($session->getLastRealOrderId()) {
|
80 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
81 |
+
if ($order->getId()) {
|
82 |
+
$session->addNotice($this->__('Your order with Cardnet has been cancelled.'));
|
83 |
+
$order->cancel()->save();
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
$this->_redirect('checkout/cart');
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Order success action
|
92 |
+
*/
|
93 |
+
public function successAction()
|
94 |
+
{
|
95 |
+
$session = $this->getOnepage()->getCheckout();
|
96 |
+
if (!$session->getLastSuccessQuoteId()) {
|
97 |
+
$this->_redirect('checkout/cart');
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
$lastQuoteId = $session->getLastQuoteId();
|
102 |
+
$lastOrderId = $session->getLastOrderId();
|
103 |
+
$lastRecurringProfiles = $session->getLastRecurringProfileIds();
|
104 |
+
if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
|
105 |
+
$this->_redirect('checkout/cart');
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
|
109 |
+
$session->clear();
|
110 |
+
$this->loadLayout();
|
111 |
+
$this->_initLayoutMessages('checkout/session');
|
112 |
+
Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
|
113 |
+
$this->renderLayout();
|
114 |
+
}
|
115 |
+
|
116 |
+
public function failureAction()
|
117 |
+
{
|
118 |
+
$lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
|
119 |
+
$lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
|
120 |
+
|
121 |
+
if (!$lastQuoteId || !$lastOrderId) {
|
122 |
+
$this->_redirect('checkout/cart');
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$this->loadLayout();
|
127 |
+
$this->renderLayout();
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
app/code/local/VirtualPayer/Cardnet/controllers/ResponseController.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
class VirtualPayer_Cardnet_ResponseController extends Mage_Core_Controller_Front_Action
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
public function indexAction()
|
22 |
+
{
|
23 |
+
$session = Mage::getSingleton('checkout/session');
|
24 |
+
$post = $this->getRequest()->getPost();
|
25 |
+
|
26 |
+
if($post){
|
27 |
+
if (isset($post['oid'])) {
|
28 |
+
if(Mage::getModel('cardnet/redirect')->processRedirectResponse($post)){
|
29 |
+
$session->setQuoteId($session->getCardnetRedirectQuoteId());
|
30 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('cardnet/redirect_success')->toHtml());
|
31 |
+
}else{
|
32 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('cardnet/redirect_error')->toHtml());
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}else{
|
36 |
+
//set the quote as inactive after back from Cardnet
|
37 |
+
$session->getQuote()->setIsActive(false)->save();
|
38 |
+
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @return
|
44 |
+
*/
|
45 |
+
public function failureAction(){
|
46 |
+
$session = Mage::getSingleton('checkout/session');
|
47 |
+
$lastQuoteId = $session->getLastQuoteId();
|
48 |
+
$lastOrderId = $session->getLastOrderId();
|
49 |
+
|
50 |
+
if (!$lastQuoteId || !$lastOrderId) {
|
51 |
+
$this->_redirect('checkout/cart');
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
|
55 |
+
$order = Mage::getModel('sales/order')->loadByAttribute('entity_id', $lastOrderId);
|
56 |
+
|
57 |
+
if ($order->getId()) {
|
58 |
+
$order->addStatusToHistory('canceled', $session->getErrorMessage())->save();
|
59 |
+
}
|
60 |
+
|
61 |
+
$this->_redirect('checkout/onepage/failure');
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
}
|
app/code/local/VirtualPayer/Cardnet/etc/config.xml
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* VirtualPayer_Cardnet Connect Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* @category VirtualPayer
|
14 |
+
* @package VirtualPayer_Cardnet
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<modules>
|
20 |
+
<VirtualPayer_Cardnet>
|
21 |
+
<version>1.0.0</version>
|
22 |
+
</VirtualPayer_Cardnet>
|
23 |
+
</modules>
|
24 |
+
<global>
|
25 |
+
<models>
|
26 |
+
<cardnet>
|
27 |
+
<class>VirtualPayer_Cardnet_Model</class>
|
28 |
+
<resourceModel>cardnet_mysql4</resourceModel>
|
29 |
+
</cardnet>
|
30 |
+
<cardnet_mysql4>
|
31 |
+
<class>VirtualPayer_Cardnet_Model_Mysql4</class>
|
32 |
+
<entities>
|
33 |
+
<cardnet>
|
34 |
+
<table>cardnet</table>
|
35 |
+
</cardnet>
|
36 |
+
</entities>
|
37 |
+
</cardnet_mysql4>
|
38 |
+
</models>
|
39 |
+
<blocks>
|
40 |
+
<cardnet>
|
41 |
+
<class>VirtualPayer_Cardnet_Block</class>
|
42 |
+
</cardnet>
|
43 |
+
</blocks>
|
44 |
+
<helpers>
|
45 |
+
<cardnet>
|
46 |
+
<class>VirtualPayer_Cardnet_Helper</class>
|
47 |
+
</cardnet>
|
48 |
+
</helpers>
|
49 |
+
<resources>
|
50 |
+
<cardnet_setup>
|
51 |
+
<setup>
|
52 |
+
<module>VirtualPayer_Cardnet</module>
|
53 |
+
<class>VirtualPayer_Cardnet_Model_Setup</class>
|
54 |
+
</setup>
|
55 |
+
<connection>
|
56 |
+
<use>core_setup</use>
|
57 |
+
</connection>
|
58 |
+
</cardnet_setup>
|
59 |
+
<cardnet_write>
|
60 |
+
<connection>
|
61 |
+
<use>core_write</use>
|
62 |
+
</connection>
|
63 |
+
</cardnet_write>
|
64 |
+
<cardnet_read>
|
65 |
+
<connection>
|
66 |
+
<use>core_read</use>
|
67 |
+
</connection>
|
68 |
+
</cardnet_read>
|
69 |
+
</resources>
|
70 |
+
<payment>
|
71 |
+
<cc>
|
72 |
+
<types>
|
73 |
+
<VI>
|
74 |
+
<code>VI</code>
|
75 |
+
<name>Visa</name>
|
76 |
+
<order>0</order>
|
77 |
+
</VI>
|
78 |
+
<MC>
|
79 |
+
<code>MC</code>
|
80 |
+
<name>MasterCard</name>
|
81 |
+
<order>100</order>
|
82 |
+
</MC>
|
83 |
+
<AM>
|
84 |
+
<code>AM</code>
|
85 |
+
<name>American Express</name>
|
86 |
+
<order>200</order>
|
87 |
+
</AM>
|
88 |
+
</types>
|
89 |
+
</cc>
|
90 |
+
</payment>
|
91 |
+
</global>
|
92 |
+
<frontend>
|
93 |
+
<routers>
|
94 |
+
<cardnet>
|
95 |
+
<use>standard</use>
|
96 |
+
<args>
|
97 |
+
<module>VirtualPayer_Cardnet</module>
|
98 |
+
<frontName>cardnet</frontName>
|
99 |
+
</args>
|
100 |
+
</cardnet>
|
101 |
+
</routers>
|
102 |
+
|
103 |
+
<layout>
|
104 |
+
<updates>
|
105 |
+
<cardnet>
|
106 |
+
<file>cardnet.xml</file>
|
107 |
+
</cardnet>
|
108 |
+
</updates>
|
109 |
+
</layout>
|
110 |
+
</frontend>
|
111 |
+
|
112 |
+
<adminhtml>
|
113 |
+
<menu>
|
114 |
+
<sales module="sales">
|
115 |
+
<children>
|
116 |
+
<cardnet module="cardnet">
|
117 |
+
<title>Cardnet Transactions</title>
|
118 |
+
<sort_order>300</sort_order>
|
119 |
+
<action>cardnet/adminhtml_cardnet</action>
|
120 |
+
</cardnet>
|
121 |
+
</children>
|
122 |
+
</sales>
|
123 |
+
</menu>
|
124 |
+
<acl>
|
125 |
+
<resources>
|
126 |
+
<all>
|
127 |
+
<title>Allow Everything</title>
|
128 |
+
</all>
|
129 |
+
<admin>
|
130 |
+
<children>
|
131 |
+
<sales>
|
132 |
+
<children>
|
133 |
+
<cardnet>
|
134 |
+
<title>Cardnet Transactions</title>
|
135 |
+
<sort_order>10</sort_order>
|
136 |
+
</cardnet>
|
137 |
+
</children>
|
138 |
+
</sales>
|
139 |
+
</children>
|
140 |
+
</admin>
|
141 |
+
</resources>
|
142 |
+
</acl>
|
143 |
+
<layout>
|
144 |
+
<updates>
|
145 |
+
<cardnet>
|
146 |
+
<file>cardnet.xml</file>
|
147 |
+
</cardnet>
|
148 |
+
</updates>
|
149 |
+
</layout>
|
150 |
+
</adminhtml>
|
151 |
+
<default>
|
152 |
+
<payment>
|
153 |
+
<cardnet>
|
154 |
+
<active>0</active>
|
155 |
+
<title>Lloyds Cardnet Payment Gateway</title>
|
156 |
+
<model>cardnet/redirect</model>
|
157 |
+
<order_status>processing</order_status>
|
158 |
+
<payment_action>authorize</payment_action>
|
159 |
+
</cardnet>
|
160 |
+
</payment>
|
161 |
+
</default>
|
162 |
+
</config>
|
app/code/local/VirtualPayer/Cardnet/etc/system.xml
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* VirtualPayer_Cardnet Connect Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* @category VirtualPayer
|
14 |
+
* @package VirtualPayer_Cardnet
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<sections>
|
20 |
+
<payment>
|
21 |
+
<groups>
|
22 |
+
<cardnet translate="label" module="paygate">
|
23 |
+
<label>Lloyds Cardnet</label>
|
24 |
+
<sort_order>670</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
<fields>
|
29 |
+
<active translate="label">
|
30 |
+
<label>Enabled</label>
|
31 |
+
<frontend_type>select</frontend_type>
|
32 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
33 |
+
<sort_order>10</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 |
+
</active>
|
38 |
+
<title translate="label">
|
39 |
+
<label>Title</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>20</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<validate>required-entry</validate>
|
46 |
+
<comment>Appears in the checkout and in emails sent to the customer.</comment>
|
47 |
+
<depends>
|
48 |
+
<active>1</active>
|
49 |
+
</depends>
|
50 |
+
</title>
|
51 |
+
<model translate="label">
|
52 |
+
<label>Payment Gateway Mode</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>cardnet/source_paymentMode</source_model>
|
55 |
+
<sort_order>25</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
<comment>For PCI DSS related reasons, please contact First Data or developer for other Payment Modes.</comment>
|
60 |
+
<depends>
|
61 |
+
<active>1</active>
|
62 |
+
</depends>
|
63 |
+
</model>
|
64 |
+
<storeid translate="label">
|
65 |
+
<label>Store ID</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>40</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<validate>required-entry</validate>
|
72 |
+
<depends>
|
73 |
+
<active>1</active>
|
74 |
+
</depends>
|
75 |
+
</storeid>
|
76 |
+
<sharedsecret translate="label">
|
77 |
+
<label>Shared Secret</label>
|
78 |
+
<frontend_type>password</frontend_type>
|
79 |
+
<sort_order>50</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 |
+
<validate>required-entry</validate>
|
84 |
+
<depends>
|
85 |
+
<active>1</active>
|
86 |
+
</depends>
|
87 |
+
</sharedsecret>
|
88 |
+
<order_status translate="label">
|
89 |
+
<label>New order status</label>
|
90 |
+
<frontend_type>select</frontend_type>
|
91 |
+
<source_model>cardnet/source_orderStatus</source_model>
|
92 |
+
<sort_order>80</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
<depends>
|
97 |
+
<active>1</active>
|
98 |
+
</depends>
|
99 |
+
</order_status>
|
100 |
+
<currency translate="label">
|
101 |
+
<label>Transaction Currency</label>
|
102 |
+
<frontend_type>select</frontend_type>
|
103 |
+
<source_model>cardnet/source_currency</source_model>
|
104 |
+
<sort_order>95</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>1</show_in_store>
|
108 |
+
<depends>
|
109 |
+
<active>1</active>
|
110 |
+
</depends>
|
111 |
+
</currency>
|
112 |
+
<test translate="label">
|
113 |
+
<label>Test Environment</label>
|
114 |
+
<frontend_type>select</frontend_type>
|
115 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
116 |
+
<sort_order>100</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>1</show_in_store>
|
120 |
+
<depends>
|
121 |
+
<active>1</active>
|
122 |
+
</depends>
|
123 |
+
</test>
|
124 |
+
<debug translate="label">
|
125 |
+
<label>Debug</label>
|
126 |
+
<frontend_type>select</frontend_type>
|
127 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
128 |
+
<sort_order>110</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 |
+
<comment>Logs requests to and responses from cardnet to /var/log.system.log provided that logging is enabled.</comment>
|
133 |
+
<depends>
|
134 |
+
<active>1</active>
|
135 |
+
</depends>
|
136 |
+
</debug>
|
137 |
+
</fields>
|
138 |
+
</cardnet>
|
139 |
+
</groups>
|
140 |
+
</payment>
|
141 |
+
</sections>
|
142 |
+
</config>
|
app/code/local/VirtualPayer/Cardnet/sql/cardnet_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
DROP TABLE IF EXISTS {$this->getTable('cardnet')};
|
10 |
+
CREATE TABLE {$this->getTable('cardnet')} (
|
11 |
+
`cardnet_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`order_id` varchar(255) NOT NULL default '',
|
13 |
+
`timestamp` datetime NULL,
|
14 |
+
`terminal_id` varchar(255) NOT NULL default '',
|
15 |
+
`oid` varchar(255) NOT NULL default '',
|
16 |
+
`status` varchar(255) NOT NULL default '',
|
17 |
+
`fail_reason` varchar(255) NOT NULL default '',
|
18 |
+
`fail_rc` varchar(255) NOT NULL default '',
|
19 |
+
`approval_code` varchar(255) NOT NULL default '',
|
20 |
+
`processor_response_code` varchar(255) NOT NULL default '',
|
21 |
+
`cardnumber` varchar(255) NOT NULL default '',
|
22 |
+
`currency` varchar(255) NOT NULL default '',
|
23 |
+
`ccbin` varchar(255) NOT NULL default '',
|
24 |
+
`tdate` date NULL,
|
25 |
+
`txndate_processed` varchar(255) NOT NULL default '',
|
26 |
+
`expyear` varchar(255) NOT NULL default '',
|
27 |
+
`expmonth` varchar(255) NOT NULL default '',
|
28 |
+
`refnumber` varchar(255) NOT NULL default '',
|
29 |
+
`ccbrand` varchar(255) NOT NULL default '',
|
30 |
+
`cccountry` varchar(255) NOT NULL default '',
|
31 |
+
`chargetotal` varchar(255) NOT NULL default '',
|
32 |
+
`txntype` varchar(255) NOT NULL default '',
|
33 |
+
`response_hash` varchar(255) NOT NULL default '',
|
34 |
+
`paymentMethod` varchar(2) NOT NULL default '',
|
35 |
+
PRIMARY KEY (`cardnet_id`)
|
36 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
37 |
+
|
38 |
+
");
|
39 |
+
|
40 |
+
$installer->endSetup();
|
41 |
+
|
app/design/adminhtml/default/default/layout/cardnet.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<cardnet_adminhtml_cardnet_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="cardnet/adminhtml_cardnet" name="cardnet" />
|
6 |
+
</reference>
|
7 |
+
</cardnet_adminhtml_cardnet_index>
|
8 |
+
</layout>
|
app/design/frontend/base/default/layout/cardnet.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<cardnet_redirect_success>
|
3 |
+
<reference name="root">
|
4 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
5 |
+
</reference>
|
6 |
+
|
7 |
+
<reference name="content">
|
8 |
+
<block type="core/template" name="cardnet.redirect.success" template="cardnet/redirect/success.phtml" />
|
9 |
+
</reference>
|
10 |
+
</cardnet_redirect_success>
|
11 |
+
|
12 |
+
<cardnet_redirect_failure>
|
13 |
+
<reference name="root">
|
14 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
15 |
+
</reference>
|
16 |
+
|
17 |
+
<reference name="content">
|
18 |
+
<block type="core/template" name="cardnet.redirect.failure" template="cardnet/redirect/failure.phtml" />
|
19 |
+
</reference>
|
20 |
+
</cardnet_redirect_failure>
|
21 |
+
</layout>
|
app/design/frontend/base/default/template/cardnet/redirect/failure.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$block = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('cardnet_error');
|
4 |
+
|
5 |
+
$html = Mage::helper('cardnet')->getCustomerMessage($block, Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()), Mage::getModel('cardnet/cardnet')->getCollection()->addFieldToFilter('order_id', Mage::getSingleton('checkout/session')->getLastRealOrderId())->getFirstItem());
|
6 |
+
|
7 |
+
echo $html;
|
8 |
+
|
9 |
+
?>
|
app/design/frontend/base/default/template/cardnet/redirect/form.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* VirtualPayer_Cardnet Connect Plugin
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category VirtualPayer
|
13 |
+
* @package VirtualPayer_Cardnet
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
<fieldset class="form-list">
|
18 |
+
<?php $_code=$this->getMethodCode() ?>
|
19 |
+
|
20 |
+
<?php $redirect = Mage::getModel('cardnet/redirect'); ?>
|
21 |
+
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
22 |
+
<li>
|
23 |
+
<?php echo $this->__('You will be redirected to Lloyds Cardnet secure Hosted Payment Page.') ?>
|
24 |
+
</li>
|
25 |
+
</ul>
|
26 |
+
</fieldset>
|
app/design/frontend/base/default/template/cardnet/redirect/success.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$block = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('cardnet_success');
|
4 |
+
|
5 |
+
$html = Mage::helper('cardnet')->getCustomerMessage($block, Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()), Mage::getModel('cardnet/cardnet')->getCollection()->addFieldToFilter('order_id', Mage::getSingleton('checkout/session')->getLastRealOrderId())->getFirstItem());
|
6 |
+
|
7 |
+
echo $html;
|
8 |
+
|
9 |
+
?>
|
app/etc/modules/VirtualPayer_Cardnet.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* VirtualPayer_Cardnet Connect Plugin
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
*
|
13 |
+
* @category VirtualPayer
|
14 |
+
* @package VirtualPayer_Cardnet
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
-->
|
18 |
+
<config>
|
19 |
+
<modules>
|
20 |
+
<VirtualPayer_Cardnet>
|
21 |
+
<active>true</active>
|
22 |
+
<codePool>local</codePool>
|
23 |
+
<depends>
|
24 |
+
<Mage_Payment />
|
25 |
+
</depends>
|
26 |
+
</VirtualPayer_Cardnet>
|
27 |
+
</modules>
|
28 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>VirtualPayer_Cardnet</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Lloyds Cardnet Hosted Payment Page redirects the customer to the Cardnet Hosted Page to complete payment.</summary>
|
10 |
+
<description>This module integrates Lloyds Cardnet Online Payments Gateway with your Magento store and its fully tested on the Internet Payment Gateway (IPG) environments for Cardnet.
|
11 |
+
The module supports card types enabled on your Cardnet Merchant Account.</description>
|
12 |
+
<notes>Fully tested in Cardnet sandbox.
|
13 |
+
</notes>
|
14 |
+
<authors><author><name>VirtualPayer</name><user>VirtualPayer</user><email>support@virtualpayer.com</email></author></authors>
|
15 |
+
<date>2016-03-13</date>
|
16 |
+
<time>10:59:01</time>
|
17 |
+
<contents><target name="magelocal"><dir name="VirtualPayer"><dir name="Cardnet"><dir name="Block"><dir name="Adminhtml"><dir name="Cardnet"><file name="Grid.php" hash="87a91bc91ce3296e6b54eeca50dc1820"/></dir><file name="Cardnet.php" hash="3ad5f2d6ad0469a4e6aa4daed2bda2b8"/></dir><dir name="Redirect"><file name="Error.php" hash="4a8f9273026340573ef4eae57b628ece"/><file name="Form.php" hash="3685f91a30f30863c0294021b694deac"/><file name="Redirect.php" hash="981b733cfad3c060faf1830bf38c8e1f"/><file name="Success.php" hash="2b945527ace7d540e75259c43037d802"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3ce734726d72d9cee504cbeafdafa813"/></dir><dir name="Model"><file name="Cardnet.php" hash="5dc133c873ad6a01760f26040142d39a"/><dir name="Mysql4"><dir name="Cardnet"><file name="Collection.php" hash="9b61c677f6c67f9d93fb94e0598e930d"/></dir><file name="Cardnet.php" hash="d20f9c68a29e15c929270816801724a5"/></dir><file name="Redirect.php" hash="1aa57cf55b2eed9eff007a09a2aff0d8"/><file name="Setup.php" hash="31849416748d7cb74038b57f2463ab90"/><dir name="Source"><file name="Cctype.php" hash="f8a12f7ae85456983f825f6aab988a4e"/><file name="Currency.php" hash="c5331e7d9140d2133777edf0b789f847"/><file name="OrderStatus.php" hash="a88573ff48f78f9ccd8381540cb68be9"/><file name="PaymentAction.php" hash="8b508cf6ba5700312abdcbfa26f0bdfe"/><file name="PaymentMode.php" hash="1690a2ccf3740fe4bf9a0e47fd56c0ca"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CardnetController.php" hash="c50f2f98cc2a79efadc30cc8907669c1"/></dir><file name="RedirectController.php" hash="0fca1177e8e20976a337528c66befe57"/><file name="ResponseController.php" hash="67dd6c4fd33ae1d648f250238e72b793"/></dir><dir name="etc"><file name="config.xml" hash="fc6c0d7de8332a7548b946b03731c5c3"/><file name="system.xml" hash="6d0ab7ba713209e960ba30cde0145848"/></dir><dir name="sql"><dir name="cardnet_setup"><file name="mysql4-install-0.1.0.php" hash="f41f20cd16b34866548a39ffbcc7f3c4"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cardnet.xml" hash="8d5d667f93f00208c69880854c8e4cf1"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cardnet.xml" hash="9142a3f5ebf31e2fa6df7bc22554c48a"/></dir><dir name="template"><dir name="cardnet"><dir name="redirect"><file name="failure.phtml" hash="9a4b060f22cbe7b3b4a2846d6866e3ba"/><file name="form.phtml" hash="e919e5a96f9c98b0ef71a4ff8d2c26cc"/><file name="success.phtml" hash="fc51be2b84ad9f75ebaef082504846da"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VirtualPayer_Cardnet.xml" hash="11de582fcaf1661b5067337e579f1427"/></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|