Version Notes
Online credit card fraud detection
Download this release
Release Info
Developer | MerchantRMS |
Extension | Mrms_Mrms |
Version | 1.0.1 |
Comparing to | |
See all releases |
Version 1.0.1
- app/code/local/Mrms/Mrms/Block/Jssnippet.php +36 -0
- app/code/local/Mrms/Mrms/Block/Sales/Order/Grid.php +180 -0
- app/code/local/Mrms/Mrms/Block/Sales/Order/Grid/Renderer/Risk.php +17 -0
- app/code/local/Mrms/Mrms/Block/Sales/Order/Mrmsresult.php +174 -0
- app/code/local/Mrms/Mrms/Controller/Observer.php +152 -0
- app/code/local/Mrms/Mrms/Helper/Data.php +3 -0
- app/code/local/Mrms/Mrms/controllers/IndexController.php +7 -0
- app/code/local/Mrms/Mrms/etc/adminhtml.xml +23 -0
- app/code/local/Mrms/Mrms/etc/config.xml +105 -0
- app/code/local/Mrms/Mrms/etc/system.xml +74 -0
- app/code/local/Mrms/Mrms/sql/mrms_setup/mysql4-install-1.0.0.php +7 -0
- app/design/adminhtml/default/default/layout/mrms.xml +9 -0
- app/design/adminhtml/default/default/template/mrms/sales/order/view/tab/info.phtml +113 -0
- app/design/frontend/base/default/layout/mrms.xml +47 -0
- app/design/frontend/base/default/template/mrms/jssnippet.phtml +36 -0
- app/etc/modules/Mrms_Mrms.xml +9 -0
- package.xml +18 -0
app/code/local/Mrms/Mrms/Block/Jssnippet.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Copyright (c) 2014 Sift Science
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
+
* of this software and associated documentation files (the "Software"), to deal
|
8 |
+
* in the Software without restriction, including without limitation the rights
|
9 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the Software is
|
11 |
+
* furnished to do so, subject to the following conditions:
|
12 |
+
*
|
13 |
+
* The above copyright notice and this permission notice shall be included in
|
14 |
+
* all copies or substantial portions of the Software.
|
15 |
+
*
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 |
+
* THE SOFTWARE.
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Mrms_Mrms_Block_Jssnippet extends Mage_Page_Block_Html
|
26 |
+
{
|
27 |
+
public function getUserId()
|
28 |
+
{
|
29 |
+
return Mage::getSingleton('adminhtml/session')->getEmail();
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getSessionId()
|
33 |
+
{
|
34 |
+
return Mage::getSingleton('adminhtml/session')->getSessionId();
|
35 |
+
}
|
36 |
+
}
|
app/code/local/Mrms/Mrms/Block/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mrms_Mrms_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid{
|
3 |
+
public function __construct(){
|
4 |
+
parent::__construct();
|
5 |
+
$this->setId('sales_order_grid');
|
6 |
+
$this->setUseAjax(true);
|
7 |
+
$this->setDefaultSort('created_at');
|
8 |
+
$this->setDefaultDir('DESC');
|
9 |
+
$this->setSaveParametersInSession(true);
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _getCollectionClass(){
|
13 |
+
return 'sales/order_grid_collection';
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareCollection(){
|
17 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
18 |
+
|
19 |
+
$this->setCollection($collection);
|
20 |
+
return parent::_prepareCollection();
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _prepareColumns(){
|
24 |
+
$this->addColumn('real_order_id', array(
|
25 |
+
'header'=> Mage::helper('sales')->__('Order #'),
|
26 |
+
'width' => '80px',
|
27 |
+
'type' => 'text',
|
28 |
+
'index' => 'increment_id',
|
29 |
+
));
|
30 |
+
|
31 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
32 |
+
$this->addColumn('store_id', array(
|
33 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
34 |
+
'index' => 'store_id',
|
35 |
+
'type' => 'store',
|
36 |
+
'store_view'=> true,
|
37 |
+
'display_deleted' => true,
|
38 |
+
));
|
39 |
+
}
|
40 |
+
|
41 |
+
$this->addColumn('created_at', array(
|
42 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
43 |
+
'index' => 'created_at',
|
44 |
+
'type' => 'datetime',
|
45 |
+
'width' => '100px',
|
46 |
+
));
|
47 |
+
|
48 |
+
$this->addColumn('billing_name', array(
|
49 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
50 |
+
'index' => 'billing_name',
|
51 |
+
));
|
52 |
+
|
53 |
+
$this->addColumn('shipping_name', array(
|
54 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
55 |
+
'index' => 'shipping_name',
|
56 |
+
));
|
57 |
+
|
58 |
+
$this->addColumn('base_grand_total', array(
|
59 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
60 |
+
'index' => 'base_grand_total',
|
61 |
+
'type' => 'currency',
|
62 |
+
'currency' => 'base_currency_code',
|
63 |
+
));
|
64 |
+
|
65 |
+
$this->addColumn('grand_total', array(
|
66 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
67 |
+
'index' => 'grand_total',
|
68 |
+
'type' => 'currency',
|
69 |
+
'currency' => 'order_currency_code',
|
70 |
+
));
|
71 |
+
|
72 |
+
$this->addColumn('status', array(
|
73 |
+
'header' => Mage::helper('sales')->__('Status'),
|
74 |
+
'index' => 'status',
|
75 |
+
'type' => 'options',
|
76 |
+
'width' => '70px',
|
77 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
78 |
+
));
|
79 |
+
|
80 |
+
$this->addColumn('risk', array(
|
81 |
+
'header' => Mage::helper('sales')->__('Risk Assessment'),
|
82 |
+
'width' => '50px',
|
83 |
+
'sortable' => false,
|
84 |
+
'filter' => false,
|
85 |
+
'renderer' => 'mrms/sales_order_grid_renderer_risk',
|
86 |
+
));
|
87 |
+
|
88 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
89 |
+
$this->addColumn('action',
|
90 |
+
array(
|
91 |
+
'header' => Mage::helper('sales')->__('Action'),
|
92 |
+
'width' => '50px',
|
93 |
+
'type' => 'action',
|
94 |
+
'getter' => 'getId',
|
95 |
+
'actions' => array(
|
96 |
+
array(
|
97 |
+
'caption' => Mage::helper('sales')->__('View'),
|
98 |
+
'url' => array('base'=>'*/sales_order/view'),
|
99 |
+
'field' => 'order_id'
|
100 |
+
)
|
101 |
+
),
|
102 |
+
'filter' => false,
|
103 |
+
'sortable' => false,
|
104 |
+
'index' => 'stores',
|
105 |
+
'is_system' => true,
|
106 |
+
));
|
107 |
+
}
|
108 |
+
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
|
109 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
110 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
|
111 |
+
|
112 |
+
return parent::_prepareColumns();
|
113 |
+
}
|
114 |
+
|
115 |
+
protected function _prepareMassaction(){
|
116 |
+
$this->setMassactionIdField('entity_id');
|
117 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
118 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
119 |
+
|
120 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
|
121 |
+
$this->getMassactionBlock()->addItem('cancel_order', array(
|
122 |
+
'label'=> Mage::helper('sales')->__('Cancel'),
|
123 |
+
'url' => $this->getUrl('*/sales_order/massCancel'),
|
124 |
+
));
|
125 |
+
}
|
126 |
+
|
127 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
|
128 |
+
$this->getMassactionBlock()->addItem('hold_order', array(
|
129 |
+
'label'=> Mage::helper('sales')->__('Hold'),
|
130 |
+
'url' => $this->getUrl('*/sales_order/massHold'),
|
131 |
+
));
|
132 |
+
}
|
133 |
+
|
134 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
|
135 |
+
$this->getMassactionBlock()->addItem('unhold_order', array(
|
136 |
+
'label'=> Mage::helper('sales')->__('Unhold'),
|
137 |
+
'url' => $this->getUrl('*/sales_order/massUnhold'),
|
138 |
+
));
|
139 |
+
}
|
140 |
+
|
141 |
+
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
|
142 |
+
'label'=> Mage::helper('sales')->__('Print Invoices'),
|
143 |
+
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
|
144 |
+
));
|
145 |
+
|
146 |
+
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
147 |
+
'label'=> Mage::helper('sales')->__('Print Packingslips'),
|
148 |
+
'url' => $this->getUrl('*/sales_order/pdfshipments'),
|
149 |
+
));
|
150 |
+
|
151 |
+
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
|
152 |
+
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
|
153 |
+
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
|
154 |
+
));
|
155 |
+
|
156 |
+
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
|
157 |
+
'label'=> Mage::helper('sales')->__('Print All'),
|
158 |
+
'url' => $this->getUrl('*/sales_order/pdfdocs'),
|
159 |
+
));
|
160 |
+
|
161 |
+
$this->getMassactionBlock()->addItem('print_shipping_label', array(
|
162 |
+
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
|
163 |
+
'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
|
164 |
+
));
|
165 |
+
|
166 |
+
return $this;
|
167 |
+
}
|
168 |
+
|
169 |
+
public function getRowUrl($row){
|
170 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
171 |
+
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
172 |
+
}
|
173 |
+
return false;
|
174 |
+
}
|
175 |
+
|
176 |
+
public function getGridUrl(){
|
177 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
178 |
+
}
|
179 |
+
}
|
180 |
+
?>
|
app/code/local/Mrms/Mrms/Block/Sales/Order/Grid/Renderer/Risk.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mrms_Mrms_Block_Sales_Order_Grid_Renderer_Risk extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{
|
3 |
+
public function render(Varien_Object $row){
|
4 |
+
$out = '';
|
5 |
+
|
6 |
+
$order = Mage::getModel('sales/order')->load($row->getId());
|
7 |
+
$result = $order->getmrms_response();
|
8 |
+
|
9 |
+
if(!$result){
|
10 |
+
$out = Mage::helper('mrms')->__('-');
|
11 |
+
}else{
|
12 |
+
$data = unserialize($result);
|
13 |
+
$out .= ($data['PaymentStatus'] == 'Paid' ? 'Review' : $data['PaymentStatus']);
|
14 |
+
}
|
15 |
+
return $out;
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Mrms/Mrms/Block/Sales/Order/Mrmsresult.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mrms_Mrms_Block_Sales_Order_Mrmsresult extends Mage_Adminhtml_Block_Template{
|
3 |
+
protected function _toHtml(){
|
4 |
+
if(!Mage::getStoreConfig('mrms/basic_settings/active')){
|
5 |
+
return false;
|
6 |
+
}
|
7 |
+
|
8 |
+
$order = Mage::registry('current_order');
|
9 |
+
|
10 |
+
$data = unserialize($order->getmrms_response());
|
11 |
+
|
12 |
+
if(isset($_GET['mrms_refresh'])){
|
13 |
+
$params = array(
|
14 |
+
'MerchantID'=>Mage::getStoreConfig('mrms/basic_settings/merchant_id'),
|
15 |
+
'Key'=>Mage::getStoreConfig('mrms/basic_settings/api_key'),
|
16 |
+
'TxnLogID'=>$data['TxnLogID']
|
17 |
+
);
|
18 |
+
$response = $this->_get('https://s1.rmsid.com/fde/api/txn/GetByID.xml',count($params),$params);
|
19 |
+
if($response){
|
20 |
+
$json = json_encode(simplexml_load_string($response));
|
21 |
+
$result = json_decode($json,true);
|
22 |
+
$data['PaymentStatus'] = $result['PaymentStatus'];
|
23 |
+
$order->setmrms_response(serialize($data))->save();
|
24 |
+
}
|
25 |
+
die(header('Location: ' . substr(Mage::helper('core/url')->getCurrentUrl(), 0, strpos(Mage::helper('core/url')->getCurrentUrl(), '?'))));
|
26 |
+
|
27 |
+
}
|
28 |
+
if(isset($data['Error'])){
|
29 |
+
$data = 0;
|
30 |
+
}
|
31 |
+
|
32 |
+
if(!$data) return '
|
33 |
+
<div class="entry-edit">
|
34 |
+
<div class="entry-edit-head" style="background:#cc0000;">
|
35 |
+
<h4 class="icon-head head-shipping-method">MerchantRMS</h4>
|
36 |
+
</div>
|
37 |
+
<fieldset>
|
38 |
+
This order is not procssed by MerchantRMS.
|
39 |
+
</fieldset>
|
40 |
+
</div>';
|
41 |
+
|
42 |
+
if($data['RiskLevel'] == 'Red'){
|
43 |
+
$score = '<div style="color:#FF0000;font-size:4em;margin-top:20px;"><strong>'.$data['RiskPercentage'].'</strong></div>';
|
44 |
+
}else if($data['RiskLevel'] == 'Yellow'){
|
45 |
+
$score = '<div style="color:#ffff00;font-size:4em;margin-top:20px;"><strong>'.$data['RiskPercentage'].'</strong></div>';
|
46 |
+
}else{
|
47 |
+
$score = '<div style="color:#33CC00;font-size:3em;margin-top:20px;"><strong>'.$data['RiskPercentage'].'</strong></div>';
|
48 |
+
}
|
49 |
+
|
50 |
+
switch($data['PaymentStatus']){
|
51 |
+
case 'Paid':
|
52 |
+
$status = '<div style="color:#FFCC00;font-size:2em;margin-top:10px;"><strong>Review</strong></div>';
|
53 |
+
break;
|
54 |
+
|
55 |
+
case 'Rejected':
|
56 |
+
$status = '<div style="color:#cc0000;font-size:2em;margin-top:10px;"><strong>'.$data['PaymentStatus'].'</strong></div>';
|
57 |
+
break;
|
58 |
+
|
59 |
+
case 'Approved':
|
60 |
+
$status = '<div style="color:#336600;font-size:2em;margin-top:10px;"><strong>'.$data['PaymentStatus'].'</strong></div>';
|
61 |
+
break;
|
62 |
+
|
63 |
+
default:
|
64 |
+
$status = '-';
|
65 |
+
}
|
66 |
+
$txnid = explode('-',$data['TxnLogID']);
|
67 |
+
//$reviewLink = "<a href=http://localhost/mrms-v3/trunk/app/rms/txnlog/action/view/txnlogid/".$txnid[1].">Review</a>";
|
68 |
+
$txnviewLink = "http://www.rmsid.com/fde/app/rms/txnlog/action/view/pageID/1/txnlogid/".$txnid[1];
|
69 |
+
|
70 |
+
$out = '
|
71 |
+
<div class="entry-edit">
|
72 |
+
<div class="entry-edit-head" style="background:#1DA1E0; padding:5px;">
|
73 |
+
<h4 class="icon-head head-shipping-method">MerchantRMS</h4>
|
74 |
+
</div>
|
75 |
+
<fieldset>
|
76 |
+
<table width="100%" border="1" bordercolor="#c0c0c0" style="border-collapse:collapse;">
|
77 |
+
<tr>
|
78 |
+
<td rowspan="3" style="width:90px; text-align:center; vertical-align:top; padding:5px;">
|
79 |
+
<strong>Score</strong>
|
80 |
+
<a href="javascript:;" title="Overall score between 0 and 100. 100 is the highest risk. 0 is the lowest risk.">[?]</a><br/>'. $score .'
|
81 |
+
</td>
|
82 |
+
<td style="width:120px; padding:5px;"><span><strong>MerchantRMS Id </strong></span></td>
|
83 |
+
<td style="width:150px; padding:5px;"><span><a href="'.$txnviewLink.'" target="_blank">'.$data['TxnLogID'].'</a></span></td>
|
84 |
+
<td style="width:140px; padding:5px;"><span><strong>Template Id</strong></span></td>
|
85 |
+
<td style="width:140px; padding:5px;"><span>' . $data['TemplateID'] . '</span></td>
|
86 |
+
<td style="width:120px; padding:5px;"><span><strong>Merchant Id</strong></span></td>
|
87 |
+
<td style="padding:5px;"><span>'.Mage::getStoreConfig('mrms/basic_settings/merchant_id') .'</span></td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<td style="padding:5px;"><span><strong>Reference No</strong></span></td>
|
91 |
+
<td style="padding:5px;"><span>' . $data['ReferenceNo'] . '</span></td>
|
92 |
+
<td style="padding:5px;"><span><strong>Device Id</strong></span></td>
|
93 |
+
<td style="padding:5px;"><span>' . $data['DeviceID'] . '</span></td>
|
94 |
+
<td style="padding:5px;"><span><strong>Device Profile Status</strong></span></td>
|
95 |
+
<td style="padding:5px;"><span>' . $data['DeviceProfileStatus'] . '</span></td>
|
96 |
+
</tr>
|
97 |
+
<tr>
|
98 |
+
<td style="padding:5px;"><span><strong>IP City</strong></span></td>
|
99 |
+
<td colspan="3" style="padding:5px;">
|
100 |
+
<span>' . (empty($data['Output']['Ipcity']) ? "-" : $data['Output']['Ipcity']). '</span>
|
101 |
+
</td>
|
102 |
+
<td style="padding:5px;"><span><strong>IP Address</strong></span></td>
|
103 |
+
<td style="padding:5px;">
|
104 |
+
<span>'.$data['ip_address'].'
|
105 |
+
<a href="http://www.geolocation.com/' . $data['ip_address'] . '" target="_blank">[Map]</a>
|
106 |
+
</span>
|
107 |
+
</td>
|
108 |
+
</tr>
|
109 |
+
<tr>
|
110 |
+
<td rowspan="4" style="padding:5px; vertical-align:top; text-align:center;">
|
111 |
+
<span><strong>Mrms Status</strong>
|
112 |
+
<a href="javascript:;" title="Mrms status.">[?]</a><br>' . $status . '</span>'. (($data['PaymentStatus'] == "Paid") ? "<br><form><input type='submit' name='mrms_refresh' value='Refresh' /></form>" : " ").'
|
113 |
+
</td>
|
114 |
+
<td style="padding:5px;"><span><strong>IP Country</strong></span></td>
|
115 |
+
<td style="padding:5px;"><span>' .(empty($data['Output']['Ipcountry']) ? "-" : $data['Output']['Ipcountry']) . '</span></td>
|
116 |
+
<td style="padding:5px;"><span><strong>IP ISP</strong></span></td>
|
117 |
+
<td colspan="3" style="padding:5px;"><span>' . $data['Output']['Ipisp'] . '</span></td>
|
118 |
+
</tr>
|
119 |
+
<tr>
|
120 |
+
<td style="padding:5px;"><span><strong>IP Origin</strong></span></td>
|
121 |
+
<td style="padding:5px;"><span>' .(empty($data['Output']['Iporg']) ? "-" : $data['Output']['Iporg']) . '</span></td>
|
122 |
+
<td style="padding:5px;"><span><strong>IP Latitude</strong></span></td>
|
123 |
+
<td style="padding:5px;"><span>' .(empty($data['Output']['Iplatitude']) ? "-" : $data['Output']['Iplatitude']) . '</span></td>
|
124 |
+
<td style="padding:5px;"><span><strong>IP Longitude</strong></span></td>
|
125 |
+
<td style="padding:5px;"><span>' .(empty($data['Output']['Iplongitude']) ? "-" : $data['Output']['Iplongitude']) . '</span></td>
|
126 |
+
</tr>
|
127 |
+
<tr>
|
128 |
+
<td style="padding:5px;"><span><strong>BIN Name</strong></span></td>
|
129 |
+
<td style="padding:5px;"><span>' .(empty($data['Output']['Binname']) ? "-" : $data['Output']['Binname']) . '</span></td>
|
130 |
+
<td style="padding:5px;"><span><strong>BIN Country</strong></span></td>
|
131 |
+
<td style="padding:5px;"><span>' .(empty($data['Output']['Bincountry']) ? "-" : $data['Output']['Bincountry']) . '</span></td>
|
132 |
+
<td colspan="3" style="padding:5px;"></td>
|
133 |
+
</tr>
|
134 |
+
<tr>
|
135 |
+
<td style="padding:5px;"><span><strong>Free Email</strong></span></td>
|
136 |
+
<td style="padding:5px;"><span>' .(empty($data['Output']['Freeemail']) ? "-" : $data['Output']['Freeemail']) . '</span></td>
|
137 |
+
<td style="padding:5px;"><span><strong>Email Domain</strong></span></td>
|
138 |
+
<td style="padding:5px;"><span>' .(empty($data['Output']['Emaildomain']) ? "-" : $data['Output']['Emaildomain']) . '</span></td>
|
139 |
+
<td colspan="3" style="padding:5px;"><span> </span></td>
|
140 |
+
</tr>
|
141 |
+
<tr>
|
142 |
+
<td style="padding:5px;"><span><strong>Message</strong></span></td>
|
143 |
+
<td colspan="6" style="padding:5px;"><span>-</span></td>
|
144 |
+
</tr>';
|
145 |
+
|
146 |
+
$out .= '</table></fieldset></div>';
|
147 |
+
|
148 |
+
return $out;
|
149 |
+
}
|
150 |
+
|
151 |
+
private function _get($url,$paramscount,$params){
|
152 |
+
$ch = curl_init();
|
153 |
+
|
154 |
+
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
|
155 |
+
curl_setopt($ch,CURLOPT_URL, $url);
|
156 |
+
curl_setopt($ch,CURLOPT_POST, $paramscount);
|
157 |
+
curl_setopt($ch,CURLOPT_POSTFIELDS, $params);
|
158 |
+
|
159 |
+
//execute post
|
160 |
+
$result = curl_exec($ch);
|
161 |
+
|
162 |
+
if(!curl_errno($ch)) return $result;
|
163 |
+
|
164 |
+
curl_close($ch);
|
165 |
+
|
166 |
+
return false;
|
167 |
+
}
|
168 |
+
|
169 |
+
private function _case($s){
|
170 |
+
$s = ucwords(strtolower($s));
|
171 |
+
$s = preg_replace_callback("/( [ a-zA-Z]{1}')([a-zA-Z0-9]{1})/s",create_function('$matches','return $matches[1].strtoupper($matches[2]);'),$s);
|
172 |
+
return $s;
|
173 |
+
}
|
174 |
+
}
|
app/code/local/Mrms/Mrms/Controller/Observer.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mrms_Mrms_Controller_Observer{
|
3 |
+
|
4 |
+
public function sendRequestToMrmsNonObserver($order_id){
|
5 |
+
|
6 |
+
if(!Mage::getStoreConfig('mrms/basic_settings/active')){
|
7 |
+
return true;
|
8 |
+
}
|
9 |
+
|
10 |
+
$order = Mage::getModel('sales/order')->load($order_id);
|
11 |
+
|
12 |
+
if($order->getmrms_response()){
|
13 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mrms')->__('Request already submitted to Mrms.'));
|
14 |
+
return true;
|
15 |
+
}
|
16 |
+
|
17 |
+
return $this->processSendRequestToMrms($order);
|
18 |
+
}
|
19 |
+
|
20 |
+
public function sendRequestToMrms($observer){
|
21 |
+
|
22 |
+
if(!Mage::getStoreConfig('mrms/basic_settings/active')){
|
23 |
+
return true;
|
24 |
+
}
|
25 |
+
|
26 |
+
$event = $observer->getEvent();
|
27 |
+
$order = $event->getOrder();
|
28 |
+
|
29 |
+
if($order->getmrms_response()){
|
30 |
+
return true;
|
31 |
+
}
|
32 |
+
|
33 |
+
return $this->processSendRequestToMrms($order);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function processSendRequestToMrms($order){
|
37 |
+
|
38 |
+
if(isset($_SERVER['DEV_MODE'])) $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
39 |
+
|
40 |
+
$apiKey = Mage::getStoreConfig('mrms/basic_settings/api_key');
|
41 |
+
$merchant_id = Mage::getStoreConfig('mrms/basic_settings/merchant_id');
|
42 |
+
$site = Mage::getStoreConfig('mrms/basic_settings/site_id');
|
43 |
+
$template_id = Mage::getStoreConfig('mrms/basic_settings/template_id');
|
44 |
+
|
45 |
+
$billingAddress = $order->getBillingAddress();
|
46 |
+
|
47 |
+
$shippingAddress = $order->getShippingAddress();
|
48 |
+
|
49 |
+
$fields = array(
|
50 |
+
'MerchantID'=>$merchant_id,
|
51 |
+
'Key'=>$apiKey,
|
52 |
+
'Site'=>$site,
|
53 |
+
'TemplateID'=>$template_id,
|
54 |
+
'GroupID'=>'',
|
55 |
+
'SessionID'=>md5(session_id()),
|
56 |
+
'ReferenceNo'=> 'MAG-'.$merchant_id.'-'.$order->getIncrementId(), //ref no. combination of MAG- <merchant_id> - <order_id>
|
57 |
+
'Amount'=> $order->getBaseGrandTotal(),
|
58 |
+
'DateTime'=>date('Y-m-d H:i:s'),
|
59 |
+
'CardNumberHash'=>'',
|
60 |
+
'CardNumber'=> '',
|
61 |
+
'CardType'=>'',
|
62 |
+
'NameOnCard'=>'',
|
63 |
+
'CustomerID'=>$order->getCustomerId(),
|
64 |
+
'CustomerIsReliable'=> 'N',
|
65 |
+
'CustEmail'=>$order->getCustomerEmail(),
|
66 |
+
'CustPhone'=>($billingAddress->getTelephone() == '') ? '0000000000000000' : $billingAddress->getTelephone(),
|
67 |
+
'UserMD5'=>strtoupper(md5($order->getCustomerEmail())),
|
68 |
+
'PassMD5'=>'',
|
69 |
+
'Name'=>$order->getCustomerName(),
|
70 |
+
'Address'=>$billingAddress->getStreet(1) .' '. $billingAddress->getStreet(2),
|
71 |
+
'City'=>$billingAddress->getCity(),
|
72 |
+
'Region'=>$billingAddress->getRegion(),
|
73 |
+
'Postal'=>$billingAddress->getPostcode(),
|
74 |
+
'Country'=>$billingAddress->getCountryId(),
|
75 |
+
'ShipName'=>'',
|
76 |
+
'ShipAddress'=>trim($shippingAddress->getStreet(1) . ' ' . $shippingAddress->getStreet(2)),
|
77 |
+
'ShipCity'=>$shippingAddress->getCity(),
|
78 |
+
'ShipState'=>$shippingAddress->getRegion(),
|
79 |
+
'ShipPostal'=>$shippingAddress->getPostcode(),
|
80 |
+
'ShipCountry'=>$shippingAddress->getCountryId(),
|
81 |
+
'ShipEmail'=>$shippingAddress->getEmail(),
|
82 |
+
'ShipPhone'=>'',
|
83 |
+
'ShipPeriod'=>0,
|
84 |
+
'ShipMethod'=>'',
|
85 |
+
'Products'=>'',
|
86 |
+
'Ip'=>$_SERVER['REMOTE_ADDR'],
|
87 |
+
'Submit'=>'Submit'
|
88 |
+
);
|
89 |
+
|
90 |
+
$fields_string = http_build_query($fields);
|
91 |
+
|
92 |
+
$url = "https://s1.rmsid.com/fde/api/txn/Post.xml";
|
93 |
+
if(isset($_SESSION['mrms_txn']) && $_SESSION['mrms_txn'] == $order->getIncrementId()){
|
94 |
+
unset($_SESSION['mrms_txn']);
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
$result = $this->_get($url,count($fields),$fields_string);
|
98 |
+
$_SESSION['mrms_txn'] = $order->getIncrementId();
|
99 |
+
$json = json_encode(simplexml_load_string($result));
|
100 |
+
$response = json_decode($json,true);
|
101 |
+
|
102 |
+
if(!$response) return false;
|
103 |
+
|
104 |
+
if(isset($response['Error'])){
|
105 |
+
if($response['Error'] == '256-ReferenceNo is already exists'){
|
106 |
+
return false;
|
107 |
+
}else{
|
108 |
+
$order->setmrms_response(serialize($response))->save();
|
109 |
+
return false;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
$response['ip_address'] = $fields['Ip'];
|
114 |
+
$response['api_key'] = $apiKey;
|
115 |
+
|
116 |
+
$order->setmrms_response(serialize($response))->save();
|
117 |
+
|
118 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('mrms')->__('Mrms Request sent.'));
|
119 |
+
|
120 |
+
return true;
|
121 |
+
}
|
122 |
+
|
123 |
+
private function _get($url,$paramscount,$params){
|
124 |
+
|
125 |
+
$ch = curl_init();
|
126 |
+
|
127 |
+
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
|
128 |
+
curl_setopt($ch,CURLOPT_URL, $url);
|
129 |
+
curl_setopt($ch,CURLOPT_POST, $paramscount);
|
130 |
+
curl_setopt($ch,CURLOPT_POSTFIELDS, $params);
|
131 |
+
|
132 |
+
//execute post
|
133 |
+
$result = curl_exec($ch);
|
134 |
+
|
135 |
+
if(!curl_errno($ch)) return $result;
|
136 |
+
else{
|
137 |
+
$errXML = "<?xml version='1.0'?><RMSID><Error>Curl error no.".curl_errno($ch)."</Error></RMSID>";
|
138 |
+
return $errXML;
|
139 |
+
}
|
140 |
+
|
141 |
+
curl_close($ch);
|
142 |
+
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
|
146 |
+
private function _hash($s, $prefix='mrms_'){
|
147 |
+
$hash = $prefix . $s;
|
148 |
+
for($i=0; $i<65536; $i++) $hash = sha1($prefix . $hash);
|
149 |
+
|
150 |
+
return $hash;
|
151 |
+
}
|
152 |
+
}
|
app/code/local/Mrms/Mrms/Helper/Data.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mrms_Mrms_Helper_Data extends Mage_Core_Helper_Abstract{}
|
3 |
+
?>
|
app/code/local/Mrms/Mrms/controllers/IndexController.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mrms_Mrms_IndexController extends Mage_Core_Controller_Front_Action{
|
3 |
+
public function indexAction(){
|
4 |
+
$this->loadLayout(array('default'));
|
5 |
+
$this->renderLayout();
|
6 |
+
}
|
7 |
+
}
|
app/code/local/Mrms/Mrms/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<mrms translate="title" module="mrms">
|
12 |
+
<title>MerchantRMS</title>
|
13 |
+
<sort_order>10</sort_order>
|
14 |
+
</mrms>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/local/Mrms/Mrms/etc/config.xml
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mrms_Mrms>
|
5 |
+
<version>1.0.1</version>
|
6 |
+
</Mrms_Mrms>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<blocks>
|
11 |
+
<mrms>
|
12 |
+
<class>Mrms_Mrms_Block</class>
|
13 |
+
</mrms>
|
14 |
+
<adminhtml>
|
15 |
+
<rewrite>
|
16 |
+
<sales_order_grid>Mrms_Mrms_Block_Sales_Order_Grid</sales_order_grid>
|
17 |
+
</rewrite>
|
18 |
+
</adminhtml>
|
19 |
+
</blocks>
|
20 |
+
<models>
|
21 |
+
<mrms>
|
22 |
+
<class>Mrms_Mrms_Model</class>
|
23 |
+
</mrms>
|
24 |
+
</models>
|
25 |
+
<helpers>
|
26 |
+
<mrms>
|
27 |
+
<class>Mrms_Mrms_Helper</class>
|
28 |
+
</mrms>
|
29 |
+
</helpers>
|
30 |
+
|
31 |
+
<resources>
|
32 |
+
<mrms_setup>
|
33 |
+
<setup>
|
34 |
+
<module>Mrms_Mrms</module>
|
35 |
+
</setup>
|
36 |
+
<connection>
|
37 |
+
<use>core_setup</use>
|
38 |
+
</connection>
|
39 |
+
</mrms_setup>
|
40 |
+
|
41 |
+
<mrms_write>
|
42 |
+
<connection>
|
43 |
+
<use>core_write</use>
|
44 |
+
</connection>
|
45 |
+
</mrms_write>
|
46 |
+
<mrms_read>
|
47 |
+
<connection>
|
48 |
+
<use>core_read</use>
|
49 |
+
</connection>
|
50 |
+
</mrms_read>
|
51 |
+
</resources>
|
52 |
+
|
53 |
+
<events>
|
54 |
+
<sales_order_save_after>
|
55 |
+
<observers>
|
56 |
+
<send_request_to_mrms>
|
57 |
+
<type>singleton</type>
|
58 |
+
<class>Mrms_Mrms_Controller_Observer</class>
|
59 |
+
<method>sendRequestToMrms</method>
|
60 |
+
</send_request_to_mrms>
|
61 |
+
</observers>
|
62 |
+
</sales_order_save_after>
|
63 |
+
</events>
|
64 |
+
</global>
|
65 |
+
|
66 |
+
<adminhtml>
|
67 |
+
<layout>
|
68 |
+
<updates>
|
69 |
+
<mrms>
|
70 |
+
<file>mrms.xml</file>
|
71 |
+
</mrms>
|
72 |
+
</updates>
|
73 |
+
</layout>
|
74 |
+
</adminhtml>
|
75 |
+
|
76 |
+
<frontend>
|
77 |
+
<routers>
|
78 |
+
<mrms>
|
79 |
+
<use>standard</use>
|
80 |
+
<args>
|
81 |
+
<module>Mrms_Mrms</module>
|
82 |
+
<frontName>mrms</frontName>
|
83 |
+
</args>
|
84 |
+
</mrms>
|
85 |
+
</routers>
|
86 |
+
|
87 |
+
<layout>
|
88 |
+
<updates>
|
89 |
+
<mrms>
|
90 |
+
<file>mrms.xml</file>
|
91 |
+
</mrms>
|
92 |
+
</updates>
|
93 |
+
</layout>
|
94 |
+
|
95 |
+
</frontend>
|
96 |
+
|
97 |
+
<default>
|
98 |
+
<mrms>
|
99 |
+
<basic_settings>
|
100 |
+
<active>0</active>
|
101 |
+
<api_key></api_key>
|
102 |
+
</basic_settings>
|
103 |
+
</mrms>
|
104 |
+
</default>
|
105 |
+
</config>
|
app/code/local/Mrms/Mrms/etc/system.xml
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<mrms translate="label" module="mrms">
|
5 |
+
<label>MerchantRMS</label>
|
6 |
+
<sort_order>200</sort_order>
|
7 |
+
</mrms>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<mrms translate="label" module="mrms">
|
11 |
+
<class>separator-top</class>
|
12 |
+
<label>Settings</label>
|
13 |
+
<tab>mrms</tab>
|
14 |
+
<sort_order>130</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<basic_settings translate="label">
|
20 |
+
<label>MerchantRMS</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>0</show_in_website>
|
25 |
+
<show_in_store>0</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<active translate="label">
|
28 |
+
<label>Enabled</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</active>
|
36 |
+
<api_key translate="label">
|
37 |
+
<label>API Key</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>20</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
<comment><![CDATA[You can register for a free license key at <a href="http://www.merchantrms.com/signup" target="_blank">http://www.merchantrms.com/signup</a> if you do not have one.]]></comment>
|
44 |
+
</api_key>
|
45 |
+
<merchant_id translate="label">
|
46 |
+
<label>Merchant Id</label>
|
47 |
+
<frontend_type>text</frontend_type>
|
48 |
+
<sort_order>21</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</merchant_id>
|
53 |
+
<site_id translate="label">
|
54 |
+
<label>Site Id</label>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<sort_order>22</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
</site_id>
|
61 |
+
<template_id translate="label">
|
62 |
+
<label>Template Id</label>
|
63 |
+
<frontend_type>text</frontend_type>
|
64 |
+
<sort_order>23</sort_order>
|
65 |
+
<show_in_default>1</show_in_default>
|
66 |
+
<show_in_website>1</show_in_website>
|
67 |
+
<show_in_store>1</show_in_store>
|
68 |
+
</template_id>
|
69 |
+
</fields>
|
70 |
+
</basic_settings>
|
71 |
+
</groups>
|
72 |
+
</mrms>
|
73 |
+
</sections>
|
74 |
+
</config>
|
app/code/local/Mrms/Mrms/sql/mrms_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$conn = $installer->getConnection();
|
5 |
+
$conn->addColumn($installer->getTable('sales_flat_order'), 'mrms_response', 'text');
|
6 |
+
$installer->endSetup();
|
7 |
+
?>
|
app/design/adminhtml/default/default/layout/mrms.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_sales_order_view>
|
4 |
+
<reference name="order_tab_info">
|
5 |
+
<action method="setTemplate" ifconfig="mrms/basic_settings/active"><template>mrms/sales/order/view/tab/info.phtml</template></action>
|
6 |
+
<block type="mrms/sales_order_mrmsresult" name="mrms_sales_order_mrmsresult"></block>
|
7 |
+
</reference>
|
8 |
+
</adminhtml_sales_order_view>
|
9 |
+
</layout>
|
app/design/adminhtml/default/default/template/mrms/sales/order/view/tab/info.phtml
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_order = $this->getOrder()
|
3 |
+
?>
|
4 |
+
<div>
|
5 |
+
<div id="order-messages">
|
6 |
+
<?php echo $this->getChildHtml('order_messages') ?>
|
7 |
+
</div>
|
8 |
+
<?php echo $this->getChildHtml('order_info') ?>
|
9 |
+
<input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
|
10 |
+
<?php if ($_order->getIsVirtual()): ?>
|
11 |
+
<div class="box-right">
|
12 |
+
<?php else: ?>
|
13 |
+
<div class="box-left">
|
14 |
+
<?php endif; ?>
|
15 |
+
<!--Payment Method-->
|
16 |
+
<div class="entry-edit">
|
17 |
+
<div class="entry-edit-head">
|
18 |
+
<h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
|
19 |
+
</div>
|
20 |
+
<fieldset>
|
21 |
+
<?php echo $this->getPaymentHtml() ?>
|
22 |
+
<div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
|
23 |
+
</fieldset>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
27 |
+
<div class="box-right">
|
28 |
+
<!--Shipping Method-->
|
29 |
+
<div class="entry-edit">
|
30 |
+
<div class="entry-edit-head">
|
31 |
+
<h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping & Handling Information') ?></h4>
|
32 |
+
</div>
|
33 |
+
<fieldset>
|
34 |
+
<?php if ($_order->getTracksCollection()->count()) : ?>
|
35 |
+
<a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
|
36 |
+
<br/>
|
37 |
+
<?php endif; ?>
|
38 |
+
<?php if ($_order->getShippingDescription()): ?>
|
39 |
+
<strong><?php echo $_order->getShippingDescription() ?></strong>
|
40 |
+
|
41 |
+
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
42 |
+
<?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
|
43 |
+
<?php else: ?>
|
44 |
+
<?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
|
47 |
+
|
48 |
+
<?php echo $_excl; ?>
|
49 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
50 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
51 |
+
<?php endif; ?>
|
52 |
+
<?php else: ?>
|
53 |
+
<?php echo $this->helper('sales')->__('No shipping information available'); ?>
|
54 |
+
<?php endif; ?>
|
55 |
+
</fieldset>
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
<?php endif; ?>
|
59 |
+
<div class="clear"></div>
|
60 |
+
<?php echo $this->getGiftOptionsHtml() ?>
|
61 |
+
<div class="clear"></div>
|
62 |
+
<div class="entry-edit">
|
63 |
+
<div class="entry-edit-head">
|
64 |
+
<h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
|
65 |
+
</div>
|
66 |
+
</div>
|
67 |
+
<?php echo $this->getItemsHtml() ?>
|
68 |
+
<div class="clear"></div>
|
69 |
+
|
70 |
+
<?php echo $this->getChildHtml('mrms_sales_order_mrmsresult') ?>
|
71 |
+
<div class="clear"></div>
|
72 |
+
|
73 |
+
<div class="box-left">
|
74 |
+
<div class="entry-edit">
|
75 |
+
<div class="entry-edit-head">
|
76 |
+
<h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
|
77 |
+
</div>
|
78 |
+
<fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
<div class="box-right entry-edit">
|
82 |
+
<div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
|
83 |
+
<div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
|
84 |
+
</div>
|
85 |
+
<div class="clear"></div>
|
86 |
+
</div>
|
87 |
+
|
88 |
+
<?php echo $this->getChildHtml('popup_window');?>
|
89 |
+
<script type="text/javascript">
|
90 |
+
//<![CDATA[
|
91 |
+
/**
|
92 |
+
* Retrieve gift options tooltip content
|
93 |
+
*/
|
94 |
+
function getGiftOptionsTooltipContent(itemId) {
|
95 |
+
var contentLines = [];
|
96 |
+
var headerLine = null;
|
97 |
+
var contentLine = null;
|
98 |
+
|
99 |
+
$$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
|
100 |
+
if (element.down(0)) {
|
101 |
+
headerLine = element.down(0).innerHTML;
|
102 |
+
contentLine = element.down(0).next().innerHTML;
|
103 |
+
if (contentLine.length > 30) {
|
104 |
+
contentLine = contentLine.slice(0,30) + '...';
|
105 |
+
}
|
106 |
+
contentLines.push(headerLine + ' ' + contentLine);
|
107 |
+
}
|
108 |
+
});
|
109 |
+
return contentLines.join('<br/>');
|
110 |
+
}
|
111 |
+
giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
|
112 |
+
//]]>
|
113 |
+
</script>
|
app/design/frontend/base/default/layout/mrms.xml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
Copyright (c) 2014 Sift Science
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in
|
13 |
+
all copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21 |
+
THE SOFTWARE.
|
22 |
+
-->
|
23 |
+
|
24 |
+
<layout version="0.1.0">
|
25 |
+
<default>
|
26 |
+
<reference name="head">
|
27 |
+
<block ifconfig="mrms/basic_settings/active" type="mrms/jssnippet" name="mrms_snippet" as="mrms_snippet">
|
28 |
+
<action ifconfig="mrms/basic_settings/active" method="setTemplate">
|
29 |
+
<template>mrms/jssnippet.phtml</template>
|
30 |
+
</action>
|
31 |
+
<!-- This is compatibility with magento-turpentine extension -->
|
32 |
+
<action ifconfig="mrms/basic_settings/active" method="setEsiOptions">
|
33 |
+
<params>
|
34 |
+
<method>esi</method>
|
35 |
+
<access>private</access>
|
36 |
+
<scope>global</scope>
|
37 |
+
|
38 |
+
<flush_events>
|
39 |
+
<customer_logout/>
|
40 |
+
<customer_login/>
|
41 |
+
</flush_events>
|
42 |
+
</params>
|
43 |
+
</action>
|
44 |
+
</block>
|
45 |
+
</reference>
|
46 |
+
</default>
|
47 |
+
</layout>
|
app/design/frontend/base/default/template/mrms/jssnippet.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Copyright (c) 2014 Sift Science
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
+
* of this software and associated documentation files (the "Software"), to deal
|
8 |
+
* in the Software without restriction, including without limitation the rights
|
9 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the Software is
|
11 |
+
* furnished to do so, subject to the following conditions:
|
12 |
+
*
|
13 |
+
* The above copyright notice and this permission notice shall be included in
|
14 |
+
* all copies or substantial portions of the Software.
|
15 |
+
*
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 |
+
* THE SOFTWARE.
|
23 |
+
*
|
24 |
+
*
|
25 |
+
* $this == Mrms_Mrms_Block_Jssnippet
|
26 |
+
*/
|
27 |
+
?>
|
28 |
+
<script type="text/javascript" async="true" src="https://elistva.com/api/script.js?aid=10376&sid=<? echo md5($this->getSessionId());?>"></script>
|
29 |
+
|
30 |
+
<noscript>
|
31 |
+
<p style="background:url(//elistva.com/api/assets/clear.png?aid=10376&sid=<? echo md5($this->getSessionId());?>)"></p>
|
32 |
+
</noscript>
|
33 |
+
|
34 |
+
<object type="application/x-shockwave-flash" data="//elistva.com/api/udid.swf?aid=10376&sid=<? echo md5($this->getSessionId());?>" width="1" height="1" style="display: block;">
|
35 |
+
<param name="movie" value="//elistva.com/api/udid.swf?aid=10376&sid=<? echo md5($this->getSessionId());?>" />
|
36 |
+
</object>
|
app/etc/modules/Mrms_Mrms.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mrms_Mrms>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Mrms_Mrms>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Mrms_Mrms</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Online transaction fraud detection</summary>
|
10 |
+
<description>Online transaction fraud detection</description>
|
11 |
+
<notes>Online credit card fraud detection</notes>
|
12 |
+
<authors><author><name>MerchantRMS</name><user>devadmin</user><email>devadmin@merchantrms.com</email></author></authors>
|
13 |
+
<date>2014-04-08</date>
|
14 |
+
<time>10:43:48</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Mrms"><dir name="Mrms"><dir name="Block"><file name="Jssnippet.php" hash="cf9fb49fb983b77cbf11fa223caea73b"/><dir name="Sales"><dir name="Order"><dir name="Grid"><dir name="Renderer"><file name="Risk.php" hash="549a824c2612fbda2df9c8252fdbdbae"/></dir></dir><file name="Grid.php" hash="d8ada82a9f58ef39a4c63f50929c24c2"/><file name="Mrmsresult.php" hash="1877a77a7037082ac60528087bf87a5d"/></dir></dir></dir><dir name="Controller"><file name="Observer.php" hash="dd2361575b8200f4c30587d7f3892ec4"/></dir><dir name="Helper"><file name="Data.php" hash="2994a2b1afa2ba7aab9608c276c4df2c"/></dir><dir name="controllers"><file name="IndexController.php" hash="eaa56b78de7f1b82d97e8e272e319516"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4521234c57634fce4863c1d76b3b69db"/><file name="config.xml" hash="0a29c95516514f7999d797259055e077"/><file name="system.xml" hash="64e374feda73d9c2becab0f7ebd63efc"/></dir><dir name="sql"><dir name="mrms_setup"><file name="mysql4-install-1.0.0.php" hash="b72f2d6066d5601c3919773cdffd681a"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mrms.xml" hash="53c1df7384c4af93553b93b30037b324"/></dir><dir name="template"><dir name="mrms"><dir name="sales"><dir name="order"><dir name="view"><dir name="tab"><file name="info.phtml" hash="4090fae7900f0f9d8e9b7369cf8ffd30"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mrms.xml" hash="947d78c51f49d47aa578dd606f01af90"/></dir><dir name="template"><dir name="mrms"><file name="jssnippet.phtml" hash="434cbe42b0db8082c6747dfa3dddde41"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mrms_Mrms.xml" hash="da097edc67d2a76ba4e67e7af39f3d35"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|