Version Notes
Initial release.
Download this release
Release Info
Developer | Evan Steiner |
Extension | Foundation_CustomizableFraudFilters |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/Foundation/CustomizableFraudFilters/Adminhtml/Model/.DS_Store +0 -0
- app/code/community/Foundation/CustomizableFraudFilters/Adminhtml/Model/System/.DS_Store +0 -0
- app/code/community/Foundation/CustomizableFraudFilters/Adminhtml/Model/System/Config/.DS_Store +0 -0
- app/code/community/Foundation/CustomizableFraudFilters/Adminhtml/Model/System/Config/Source/Shipping.php +25 -0
- app/code/community/Foundation/CustomizableFraudFilters/Helper/Data.php +347 -0
- app/code/community/Foundation/CustomizableFraudFilters/Model/Observer.php +87 -0
- app/code/community/Foundation/CustomizableFraudFilters/Model/Sales/.DS_Store +0 -0
- app/code/community/Foundation/CustomizableFraudFilters/Model/Sales/Order.php +13 -0
- app/code/community/Foundation/CustomizableFraudFilters/etc/.DS_Store +0 -0
- app/code/community/Foundation/CustomizableFraudFilters/etc/adminhtml.xml +23 -0
- app/code/community/Foundation/CustomizableFraudFilters/etc/config.xml +97 -0
- app/code/community/Foundation/CustomizableFraudFilters/etc/system.xml +238 -0
- app/code/community/Foundation/CustomizableFraudFilters/sql/.DS_Store +0 -0
- app/code/community/Foundation/CustomizableFraudFilters/sql/customizablefraudfilters_setup/.DS_Store +0 -0
- app/code/community/Foundation/CustomizableFraudFilters/sql/customizablefraudfilters_setup/mysql4-install-0.1.0.php +11 -0
- app/etc/modules/Foundation_CustomizableFraudFilters.xml +10 -0
- app/locale/en_US/template/email/fraud_filter_alert.html +8 -0
- package.xml +18 -0
app/code/community/Foundation/CustomizableFraudFilters/Adminhtml/Model/.DS_Store
ADDED
Binary file
|
app/code/community/Foundation/CustomizableFraudFilters/Adminhtml/Model/System/.DS_Store
ADDED
Binary file
|
app/code/community/Foundation/CustomizableFraudFilters/Adminhtml/Model/System/Config/.DS_Store
ADDED
Binary file
|
app/code/community/Foundation/CustomizableFraudFilters/Adminhtml/Model/System/Config/Source/Shipping.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Foundation_CustomizableFraudFilters_Adminhtml_Model_System_Config_Source_Shipping
|
3 |
+
{
|
4 |
+
public function toOptionArray() {
|
5 |
+
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
|
6 |
+
$options = array();
|
7 |
+
foreach($methods as $_ccode => $_carrier) {
|
8 |
+
$_methodOptions = array();
|
9 |
+
if($_methods = $_carrier->getAllowedMethods()) {
|
10 |
+
foreach($_methods as $_mcode => $_method) {
|
11 |
+
$_code = $_ccode . '_' . $_mcode;
|
12 |
+
$_methodOptions[] = array('value' => $_code, 'label' => $_method);
|
13 |
+
}
|
14 |
+
if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
|
15 |
+
$_title = $_ccode;
|
16 |
+
$options[] = array('value' => $_methodOptions, 'label' => $_title, 'code' => $_code);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
$optionsArray = array();
|
20 |
+
foreach ($options as $option){
|
21 |
+
array_push($optionsArray, array('value' => $option['code'], 'label'=>Mage::helper('adminhtml')->__($option['label'])));
|
22 |
+
}
|
23 |
+
return $optionsArray;
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Foundation/CustomizableFraudFilters/Helper/Data.php
ADDED
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Foundation_CustomizableFraudFilters_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
public function checkState($order) {
|
5 |
+
$billingAddress = $order->getBillingAddress();
|
6 |
+
$shippingAddress = $order->getShippingAddress();
|
7 |
+
$billingState = $billingAddress["region"];
|
8 |
+
$shippingState = $shippingAddress["region"];
|
9 |
+
if ($billingState != $shippingState) {
|
10 |
+
$flagReason = "Shipping and billing state does not match.";
|
11 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
12 |
+
}
|
13 |
+
if(isset($flagReason)){
|
14 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
15 |
+
}
|
16 |
+
else {
|
17 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function checkCity($order) {
|
22 |
+
$billingAddress = $order->getBillingAddress();
|
23 |
+
$shippingAddress = $order->getShippingAddress();
|
24 |
+
$billingCity = $billingAddress["city"];
|
25 |
+
$shippingCity = $shippingAddress["city"];
|
26 |
+
if ($billingCity != $shippingCity) {
|
27 |
+
$flagReason = "Shipping and billing city do not match.";
|
28 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
29 |
+
}
|
30 |
+
if(isset($flagReason)){
|
31 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
32 |
+
}
|
33 |
+
else {
|
34 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
public function checkZipCode($order) {
|
39 |
+
$billingAddress = $order->getBillingAddress();
|
40 |
+
$shippingAddress = $order->getShippingAddress();
|
41 |
+
$billingZip = $billingAddress["postcode"];
|
42 |
+
$shippingZip = $shippingAddress["postcode"];
|
43 |
+
if ($billingZip != $shippingZip) {
|
44 |
+
$flagReason = "Shipping and billing zip code do not match.";
|
45 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
46 |
+
}
|
47 |
+
if(isset($flagReason)){
|
48 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
49 |
+
}
|
50 |
+
else {
|
51 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
public function checkCountry($order) {
|
56 |
+
$billingAddress = $order->getBillingAddress();
|
57 |
+
$shippingAddress = $order->getShippingAddress();
|
58 |
+
$billingCountry = $billingAddress["country_id"];
|
59 |
+
$shippingCountry = $shippingAddress["country_id"];
|
60 |
+
if ($billingCountry != $shippingCountry) {
|
61 |
+
$flagReason = "Shipping and billing country do not match.";
|
62 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
63 |
+
}
|
64 |
+
if(isset($flagReason)){
|
65 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
66 |
+
}
|
67 |
+
else {
|
68 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
public function checkGuest($order) {
|
73 |
+
if($order["customer_is_guest"] == 1) {
|
74 |
+
$flagReason = "Order was placed from a guest (not logged in) account.";
|
75 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
76 |
+
}
|
77 |
+
if(isset($flagReason)){
|
78 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
79 |
+
}
|
80 |
+
else {
|
81 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
public function checkGrandTotalMax($order, $grandTotalMax) {
|
86 |
+
$grandTotal = $order["grand_total"];
|
87 |
+
if ($grandTotal > $grandTotalMax) {
|
88 |
+
$flagReason = "Grand total of this order ($".number_format($grandTotal,2).") exceeds the maximum grand total limit ($".$grandTotalMax.").";
|
89 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
90 |
+
}
|
91 |
+
if(isset($flagReason)){
|
92 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
93 |
+
}
|
94 |
+
else {
|
95 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
public function checkGrandTotalMin($order, $grandTotalMin) {
|
100 |
+
$grandTotal = $order["grand_total"];
|
101 |
+
if ($grandTotal < $grandTotalMin) {
|
102 |
+
$flagReason = "Grand total of this order ($".number_format($grandTotal,2).") is less than the minimum grand total limit ($".$grandTotalMin.").";
|
103 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
104 |
+
}
|
105 |
+
if(isset($flagReason)){
|
106 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
107 |
+
}
|
108 |
+
else {
|
109 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
public function checkOrderContainsProducts($order) {
|
115 |
+
$flaggedItems = "";
|
116 |
+
$filterProducts = Mage::getStoreConfig('customizablefraudfilters/filters/order_contains_products_flag');
|
117 |
+
$filterProducts = explode(",", $filterProducts);
|
118 |
+
foreach ($filterProducts as &$filterProduct) {
|
119 |
+
$filterProduct = trim($filterProduct);
|
120 |
+
unset($filterProduct);
|
121 |
+
}
|
122 |
+
$items = $order->getAllItems();
|
123 |
+
$itemcount = count($items);
|
124 |
+
foreach ($items as $item){
|
125 |
+
$itemId = $item->getProductId();
|
126 |
+
if (in_array($itemId, $filterProducts)){
|
127 |
+
$flaggedItems = $flaggedItems."Product ID: ".$itemId." - ".$item->getName()."<br/>";
|
128 |
+
}
|
129 |
+
}
|
130 |
+
if($flaggedItems != ""){
|
131 |
+
$flagReason = "The order contained the following items which have been flagged for manual review: <br/><br/>".$flaggedItems;
|
132 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
133 |
+
}
|
134 |
+
if(isset($flagReason)){
|
135 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
136 |
+
}
|
137 |
+
else {
|
138 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
public function checkShippingCountry($order) {
|
144 |
+
$filterCountries = Mage::getStoreConfig('customizablefraudfilters/filters/shipping_country_flag');
|
145 |
+
$filterCountries = explode(",", $filterCountries);
|
146 |
+
foreach ($filterCountries as &$filterCountry) {
|
147 |
+
$filterCountry = trim($filterCountry);
|
148 |
+
unset($filterCountry);
|
149 |
+
}
|
150 |
+
$shippingAddress = $order->getShippingAddress();
|
151 |
+
$shippingCountry = $shippingAddress["country_id"];
|
152 |
+
if(in_array($shippingCountry, $filterCountries)) {
|
153 |
+
$flagReason = "The shipping country for this order (".$shippingCountry.") is on the filter list.";
|
154 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
155 |
+
}
|
156 |
+
if(isset($flagReason)){
|
157 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
158 |
+
}
|
159 |
+
else {
|
160 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
public function checkBillingCountry($order) {
|
166 |
+
$filterCountries = Mage::getStoreConfig('customizablefraudfilters/filters/billing_country_flag');
|
167 |
+
$filterCountries = explode(",", $filterCountries);
|
168 |
+
foreach ($filterCountries as &$filterCountry) {
|
169 |
+
$filterCountry = trim($filterCountry);
|
170 |
+
unset($filterCountry);
|
171 |
+
}
|
172 |
+
$billingAddress = $order->getBillingAddress();
|
173 |
+
$billingCountry = $billingAddress["country_id"];
|
174 |
+
if(in_array($billingCountry, $filterCountries)) {
|
175 |
+
$flagReason = "The billing country for this order (".$billingCountry.") is on the filter list.";
|
176 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
177 |
+
}
|
178 |
+
if(isset($flagReason)){
|
179 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
180 |
+
}
|
181 |
+
else {
|
182 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
public function checkShippingMethod($order) {
|
187 |
+
$filterMethods = Mage::getStoreConfig('customizablefraudfilters/filters/shipping_method_flag');
|
188 |
+
$filterMethods = explode(",", $filterMethods);
|
189 |
+
$orderShippingMethod = $order['shipping_method'];
|
190 |
+
|
191 |
+
if(in_array($orderShippingMethod, $filterMethods)) {
|
192 |
+
$flagReason = "The shipping method for this order (".$orderShippingMethod.") is on the filter list.";
|
193 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
194 |
+
}
|
195 |
+
if(isset($flagReason)){
|
196 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
197 |
+
}
|
198 |
+
else {
|
199 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
|
204 |
+
public function checkBillingStreetContains($order) {
|
205 |
+
$billingAddress = $order->getBillingAddress();
|
206 |
+
$billingStreet = $billingAddress["street"];
|
207 |
+
|
208 |
+
$filterStrings = Mage::getStoreConfig('customizablefraudfilters/filters/billing_street_contains_flag');
|
209 |
+
$filterStrings = str_getcsv($filterStrings,',','"');
|
210 |
+
foreach ($filterStrings as &$filterString) {
|
211 |
+
$filterString = trim($filterString);
|
212 |
+
if(stripos($billingStreet, $filterString) !== false){
|
213 |
+
$flagReason = "The billing street address for this order contains a filtered phrase ('".$filterString."').";
|
214 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
215 |
+
}
|
216 |
+
unset($filterString);
|
217 |
+
}
|
218 |
+
if(isset($flagReason)){
|
219 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
220 |
+
}
|
221 |
+
else {
|
222 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
public function checkShippingStreetContains($order) {
|
228 |
+
$shippingAddress = $order->getShippingAddress();
|
229 |
+
$shippingStreet = $shippingAddress["street"];
|
230 |
+
|
231 |
+
$filterStrings = Mage::getStoreConfig('customizablefraudfilters/filters/shipping_street_contains_flag');
|
232 |
+
$filterStrings = str_getcsv($filterStrings,',','"');
|
233 |
+
foreach ($filterStrings as &$filterString) {
|
234 |
+
$filterString = trim($filterString);
|
235 |
+
if(stripos($shippingStreet, $filterString) !== false){
|
236 |
+
$flagReason = "The shipping street address for this order contains a filtered phrase ('".$filterString."').";
|
237 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
238 |
+
}
|
239 |
+
unset($filterString);
|
240 |
+
}
|
241 |
+
if(isset($flagReason)){
|
242 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
243 |
+
}
|
244 |
+
else {
|
245 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
public function checkRestrictedEmails($order) {
|
250 |
+
$filterEmails = Mage::getStoreConfig('customizablefraudfilters/filters/restricted_email_flag');
|
251 |
+
$filterEmails = explode(",", $filterEmails);
|
252 |
+
foreach ($filterEmails as &$filterEmail) {
|
253 |
+
$filterEmail = trim($filterEmail);
|
254 |
+
unset($filterEmail);
|
255 |
+
}
|
256 |
+
$customerEmail = $order->getCustomerEmail();
|
257 |
+
if(in_array($customerEmail, $filterEmails)) {
|
258 |
+
$flagReason = "The customer email address used to place this order (".$customerEmail.") is on the filter list.";
|
259 |
+
Mage::helper('customizablefraudfilters')->applyFraudFlag($order, $flagReason);
|
260 |
+
}
|
261 |
+
if(isset($flagReason)){
|
262 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, $flagReason);
|
263 |
+
}
|
264 |
+
else {
|
265 |
+
Mage::helper('customizablefraudfilters')->logAction($order, __FUNCTION__, "");
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
public function applyFraudFlag($order, $flagReason){
|
270 |
+
$state = "holded";
|
271 |
+
$status = "manual_review";
|
272 |
+
$notice = "Flagged for manual review: ";
|
273 |
+
$comment = $notice.$flagReason;
|
274 |
+
$isCustomerNotified = false;
|
275 |
+
$order->setState($state, $status, $comment, $isCustomerNotified);
|
276 |
+
$order->save();
|
277 |
+
|
278 |
+
if(Mage::getStoreConfig('customizablefraudfilters/general_settings/alert_email') != null){
|
279 |
+
$alertEmailAddresses = Mage::getStoreConfig('customizablefraudfilters/general_settings/alert_email');
|
280 |
+
$alertEmailAddresses = explode(",", $alertEmailAddresses);
|
281 |
+
foreach ($alertEmailAddresses as $alertEmailAddress) {
|
282 |
+
$alertEmailAddress = trim($alertEmailAddress);
|
283 |
+
Mage::helper('customizablefraudfilters')->sendAlertEmail($order, $alertEmailAddress, $flagReason);
|
284 |
+
}
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
+
|
289 |
+
public function sendAlertEmail($order, $alertEmailAddress, $flagReason) {
|
290 |
+
$emailTemplate = Mage::getModel("core/email_template")->loadDefault("fraud_filter_alert");
|
291 |
+
|
292 |
+
if(Mage::getStoreConfig('customizablefraudfilters/general_settings/alert_email_from') != "") {
|
293 |
+
$from = Mage::getStoreConfig('customizablefraudfilters/general_settings/alert_email_from');
|
294 |
+
}
|
295 |
+
else {
|
296 |
+
$from = Mage::app()->getStore()->getFrontendName();
|
297 |
+
}
|
298 |
+
$emailTemplate->setSenderName($from);
|
299 |
+
|
300 |
+
if(Mage::getStoreConfig('customizablefraudfilters/general_settings/alert_email_reply') != "") {
|
301 |
+
$replyTo = Mage::getStoreConfig('customizablefraudfilters/general_settings/alert_email_reply');
|
302 |
+
}
|
303 |
+
else {
|
304 |
+
$replyTo = Mage::getStoreConfig('trans_email/ident_general/email');
|
305 |
+
}
|
306 |
+
$emailTemplate->setSenderEmail($replyTo);
|
307 |
+
|
308 |
+
if(Mage::getStoreConfig('customizablefraudfilters/general_settings/alert_email_subject') != "") {
|
309 |
+
$subject = Mage::getStoreConfig('customizablefraudfilters/general_settings/alert_email_subject');
|
310 |
+
}
|
311 |
+
else {
|
312 |
+
$subject = "Potential Fraud Alert";
|
313 |
+
}
|
314 |
+
|
315 |
+
$orderEntityId = $order['entity_id'];
|
316 |
+
$orderUrl = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view',array('order_id' => $orderEntityId));
|
317 |
+
|
318 |
+
$emailTemplate->setTemplateSubject($subject.": Order #".$order["increment_id"]);
|
319 |
+
$emailTemplate->setType("html");
|
320 |
+
|
321 |
+
$emailTemplateVariables = array();
|
322 |
+
$emailTemplateVariables['orderNumber'] = $order["increment_id"];
|
323 |
+
$emailTemplateVariables['storeName'] = Mage::app()->getStore()->getFrontendName();
|
324 |
+
$emailTemplateVariables['flagReason'] = $flagReason;
|
325 |
+
|
326 |
+
if(Mage::getStoreConfig('customizablefraudfilters/general_settings/include_order_link') == 1){
|
327 |
+
$emailTemplateVariables['orderUrl'] = $orderUrl;
|
328 |
+
}
|
329 |
+
|
330 |
+
$emailTemplate->send($alertEmailAddress, null, $emailTemplateVariables);
|
331 |
+
}
|
332 |
+
|
333 |
+
public function logAction($order, $functionName, $flagReason) {
|
334 |
+
if(Mage::getStoreConfig('customizablefraudfilters/general_settings/filter_logging') == 1) {
|
335 |
+
if($flagReason != ""){
|
336 |
+
$result = "failed";
|
337 |
+
}
|
338 |
+
else {
|
339 |
+
$result = "passed";
|
340 |
+
}
|
341 |
+
$orderId = $order["increment_id"];
|
342 |
+
$message = $orderId.": ".$functionName." - ".$result;
|
343 |
+
Mage::log($message, null, 'customizablefraudfilters.log');
|
344 |
+
}
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
app/code/community/Foundation/CustomizableFraudFilters/Model/Observer.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Foundation_CustomizableFraudFilters_Model_Observer {
|
3 |
+
public function applyFilters(Varien_Event_Observer $observer) {
|
4 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
5 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
6 |
+
|
7 |
+
//set flags
|
8 |
+
$stateFlag = Mage::getStoreConfig('customizablefraudfilters/filters/state_match_flag');
|
9 |
+
$cityFlag = Mage::getStoreConfig('customizablefraudfilters/filters/city_match_flag');
|
10 |
+
$zipCodeFlag = Mage::getStoreConfig('customizablefraudfilters/filters/zip_code_match_flag');
|
11 |
+
$countryFlag = Mage::getStoreConfig('customizablefraudfilters/filters/country_match_flag');
|
12 |
+
$guestFlag = Mage::getStoreConfig('customizablefraudfilters/filters/guest_flag');
|
13 |
+
$grandTotalMaxFlag = Mage::getStoreConfig('customizablefraudfilters/filters/grand_total_max_flag');
|
14 |
+
$grandTotalMinFlag = Mage::getStoreConfig('customizablefraudfilters/filters/grand_total_min_flag');
|
15 |
+
$orderContainsProductsFlag = Mage::getStoreConfig('customizablefraudfilters/filters/order_contains_products_flag');
|
16 |
+
$shippingCountryFlag = Mage::getStoreConfig('customizablefraudfilters/filters/shipping_country_flag');
|
17 |
+
$billingCountryFlag = Mage::getStoreConfig('customizablefraudfilters/filters/billing_country_flag');
|
18 |
+
$restrictedEmailFlag = Mage::getStoreConfig('customizablefraudfilters/filters/restricted_email_flag');
|
19 |
+
$billingStreetContainsFlag = Mage::getStoreConfig('customizablefraudfilters/filters/billing_street_contains_flag');
|
20 |
+
$shippingStreetContainsFlag = Mage::getStoreConfig('customizablefraudfilters/filters/shipping_street_contains_flag');
|
21 |
+
$shippingMethodFlag = Mage::getStoreConfig('customizablefraudfilters/filters/shipping_method_flag');
|
22 |
+
|
23 |
+
|
24 |
+
// Logging for all flags
|
25 |
+
// Mage::log("&stateFlag: ".$stateFlag);
|
26 |
+
// Mage::log("&cityFlag: ".$cityFlag);
|
27 |
+
// Mage::log("&zipCodeFlag: ".$zipCodeFlag);
|
28 |
+
// Mage::log("&countryFlag: ".$countryFlag);
|
29 |
+
// Mage::log("&guestFlag: ".$guestFlag);
|
30 |
+
// Mage::log("&grandTotalMaxFlag: ".$grandTotalMaxFlag);
|
31 |
+
// Mage::log("&grandTotalMinFlag: ".$grandTotalMinFlag);
|
32 |
+
// Mage::log("&orderContainsProductsFlag: ".$orderContainsProductsFlag);
|
33 |
+
// Mage::log("&shippingCountryFlag: ".$shippingCountryFlag);
|
34 |
+
// Mage::log("&billingCountryFlag: ".$billingCountryFlag);
|
35 |
+
// Mage::log("&restrictedEmailFlag: ".$restrictedEmailFlag);
|
36 |
+
// Mage::log("&billingStreetContainsFlag: ".$billingStreetContainsFlag);
|
37 |
+
// Mage::log("&shippingStreetContainsFlag: ".$shippingStreetContainsFlag);
|
38 |
+
// Mage::log("&shippingMethodFlag: ".$shippingMethodFlag);
|
39 |
+
|
40 |
+
|
41 |
+
//begin filters
|
42 |
+
if ($stateFlag == 1) {
|
43 |
+
Mage::helper('customizablefraudfilters')->checkState($order);
|
44 |
+
}
|
45 |
+
if ($cityFlag == 1) {
|
46 |
+
Mage::helper('customizablefraudfilters')->checkCity($order);
|
47 |
+
}
|
48 |
+
if ($zipCodeFlag == 1) {
|
49 |
+
Mage::helper('customizablefraudfilters')->checkZipCode($order);
|
50 |
+
}
|
51 |
+
if ($countryFlag == 1) {
|
52 |
+
Mage::helper('customizablefraudfilters')->checkCountry($order);
|
53 |
+
}
|
54 |
+
if ($guestFlag == 1) {
|
55 |
+
Mage::helper('customizablefraudfilters')->checkGuest($order);
|
56 |
+
}
|
57 |
+
if ($grandTotalMaxFlag != null && $grandTotalMaxFlag > 0) {
|
58 |
+
$grandTotalMax = Mage::getStoreConfig('customizablefraudfilters/filters/grand_total_max_flag');
|
59 |
+
Mage::helper('customizablefraudfilters')->checkGrandTotalMax($order, $grandTotalMax);
|
60 |
+
}
|
61 |
+
if ($grandTotalMinFlag != null && $grandTotalMinFlag > 0) {
|
62 |
+
$grandTotalMin = Mage::getStoreConfig('customizablefraudfilters/filters/grand_total_min_flag');
|
63 |
+
Mage::helper('customizablefraudfilters')->checkGrandTotalMin($order, $grandTotalMin);
|
64 |
+
}
|
65 |
+
if ($orderContainsProductsFlag != null) {
|
66 |
+
Mage::helper('customizablefraudfilters')->checkOrderContainsProducts($order);
|
67 |
+
}
|
68 |
+
if ($shippingCountryFlag != null) {
|
69 |
+
Mage::helper('customizablefraudfilters')->checkShippingCountry($order);
|
70 |
+
}
|
71 |
+
if ($billingCountryFlag != null) {
|
72 |
+
Mage::helper('customizablefraudfilters')->checkBillingCountry($order);
|
73 |
+
}
|
74 |
+
if ($restrictedEmailFlag != null) {
|
75 |
+
Mage::helper('customizablefraudfilters')->checkRestrictedEmails($order);
|
76 |
+
}
|
77 |
+
if ($billingStreetContainsFlag != null) {
|
78 |
+
Mage::helper('customizablefraudfilters')->checkBillingStreetContains($order);
|
79 |
+
}
|
80 |
+
if ($shippingStreetContainsFlag != null) {
|
81 |
+
Mage::helper('customizablefraudfilters')->checkShippingStreetContains($order);
|
82 |
+
}
|
83 |
+
if ($shippingMethodFlag != null) {
|
84 |
+
Mage::helper('customizablefraudfilters')->checkShippingMethod($order);
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
app/code/community/Foundation/CustomizableFraudFilters/Model/Sales/.DS_Store
ADDED
Binary file
|
app/code/community/Foundation/CustomizableFraudFilters/Model/Sales/Order.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Foundation_CustomizableFraudFilters_Model_Sales_Order extends Mage_Sales_Model_Order {
|
3 |
+
public function getStatusLabel() {
|
4 |
+
$status = $this->getConfig()->getStatusLabel($this->getStatus());
|
5 |
+
if($status == "Manual Review Required"){
|
6 |
+
$replaceStatus = Mage::getStoreConfig('customizablefraudfilters/general_settings/frontend_status');
|
7 |
+
if($replaceStatus != ""){
|
8 |
+
$status = $replaceStatus;
|
9 |
+
}
|
10 |
+
}
|
11 |
+
return $status;
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Foundation/CustomizableFraudFilters/etc/.DS_Store
ADDED
Binary file
|
app/code/community/Foundation/CustomizableFraudFilters/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 |
+
<customizablefraudfilters translate="title" module="customizablefraudfilters">
|
12 |
+
<title>Customizable Fraud Filters Section</title>
|
13 |
+
<sort_order>0</sort_order>
|
14 |
+
</customizablefraudfilters>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/community/Foundation/CustomizableFraudFilters/etc/config.xml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Foundation_CustomizableFraudFilters>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Foundation_CustomizableFraudFilters>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<customizablefraudfilters>
|
11 |
+
<class>Foundation_CustomizableFraudFilters_Helper</class>
|
12 |
+
</customizablefraudfilters>
|
13 |
+
</helpers>
|
14 |
+
|
15 |
+
<template>
|
16 |
+
<email>
|
17 |
+
<fraud_filter_alert module="customizablefraudfilters">
|
18 |
+
<label>Potential Fraud Alert</label>
|
19 |
+
<file>fraud_filter_alert.html</file>
|
20 |
+
<type>html</type>
|
21 |
+
</fraud_filter_alert>
|
22 |
+
</email>
|
23 |
+
</template>
|
24 |
+
|
25 |
+
<resources>
|
26 |
+
<customizablefraudfilters_setup>
|
27 |
+
<setup>
|
28 |
+
<module>Foundation_CustomizableFraudFilters</module>
|
29 |
+
</setup>
|
30 |
+
<connection>
|
31 |
+
<use>core_setup</use>
|
32 |
+
</connection>
|
33 |
+
</customizablefraudfilters_setup>
|
34 |
+
<customizablefraudfilters_write>
|
35 |
+
<connection>
|
36 |
+
<use>core_write</use>
|
37 |
+
</connection>
|
38 |
+
</customizablefraudfilters_write>
|
39 |
+
<customizablefraudfilters_read>
|
40 |
+
<connection>
|
41 |
+
<use>core_read</use>
|
42 |
+
</connection>
|
43 |
+
</customizablefraudfilters_read>
|
44 |
+
</resources>
|
45 |
+
|
46 |
+
<models>
|
47 |
+
<customizablefraudfilters_adminhtml>
|
48 |
+
<class>Foundation_CustomizableFraudFilters_Adminhtml_Model</class>
|
49 |
+
</customizablefraudfilters_adminhtml>
|
50 |
+
<customizablefraudfilters>
|
51 |
+
<class>Foundation_CustomizableFraudFilters_Model</class>
|
52 |
+
<resourceModel>customizablefraudfilters_mysql4</resourceModel>
|
53 |
+
</customizablefraudfilters>
|
54 |
+
<sales>
|
55 |
+
<rewrite>
|
56 |
+
<order>Foundation_CustomizableFraudFilters_Model_Sales_Order</order>
|
57 |
+
</rewrite>
|
58 |
+
</sales>
|
59 |
+
</models>
|
60 |
+
|
61 |
+
<events>
|
62 |
+
<checkout_onepage_controller_success_action> <!-- identifier of the event we want to catch -->
|
63 |
+
<observers>
|
64 |
+
<checkout_onepage_controller_success_action_handler> <!-- identifier of the event handler -->
|
65 |
+
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
66 |
+
<class>customizablefraudfilters/observer</class> <!-- observers class alias -->
|
67 |
+
<method>applyFilters</method> <!-- observer's method to be called -->
|
68 |
+
<args></args> <!-- additional arguments passed to observer -->
|
69 |
+
</checkout_onepage_controller_success_action_handler>
|
70 |
+
</observers>
|
71 |
+
</checkout_onepage_controller_success_action>
|
72 |
+
</events>
|
73 |
+
|
74 |
+
</global>
|
75 |
+
|
76 |
+
<adminhtml>
|
77 |
+
<acl>
|
78 |
+
<resources>
|
79 |
+
<admin>
|
80 |
+
<children>
|
81 |
+
<system>
|
82 |
+
<children>
|
83 |
+
<config>
|
84 |
+
<children>
|
85 |
+
<customizablefraudfilters>
|
86 |
+
<title>Customizable Fraud Filters</title>
|
87 |
+
</customizablefraudfilters>
|
88 |
+
</children>
|
89 |
+
</config>
|
90 |
+
</children>
|
91 |
+
</system>
|
92 |
+
</children>
|
93 |
+
</admin>
|
94 |
+
</resources>
|
95 |
+
</acl>
|
96 |
+
</adminhtml>
|
97 |
+
</config>
|
app/code/community/Foundation/CustomizableFraudFilters/etc/system.xml
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<foundation translate="label" module="customizablefraudfilters">
|
5 |
+
<label>Foundation Extensions</label>
|
6 |
+
<sort_order>900</sort_order>
|
7 |
+
</foundation>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<customizablefraudfilters translate="label" module="customizablefraudfilters">
|
11 |
+
<label>Customizable Fraud Filters</label>
|
12 |
+
<tab>foundation</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>100</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 |
+
<general_settings translate="label">
|
20 |
+
<label>General Settings</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<frontend_status translate="label">
|
28 |
+
<label>Status of flagged order shown on front end: </label>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>5</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
<comment>The order status your customer will see when the order has been flagged for review. Some themes may not show status. If left blank, the default status of "Held For Manual Review" will be shown. Applies retroactively.</comment>
|
35 |
+
</frontend_status>
|
36 |
+
<alert_email translate="label">
|
37 |
+
<label>Send email alert when order is flagged to: </label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>10</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>Enter one or more email addreess (comma seperated) and they will be notified when an order is being held for review.</comment>
|
44 |
+
</alert_email>
|
45 |
+
<alert_email_subject translate="label">
|
46 |
+
<label>Alert email subject: </label>
|
47 |
+
<frontend_type>text</frontend_type>
|
48 |
+
<sort_order>15</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 |
+
<comment>The order number will be automatically appended to the end of your subject. Leave blank to use default subject line.</comment>
|
53 |
+
</alert_email_subject>
|
54 |
+
<alert_email_from translate="label">
|
55 |
+
<label>Alert email from name: </label>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<sort_order>17</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
<comment>This is the name that you alert emails will appear to come from. If left blank, your store name will be used as the default.</comment>
|
62 |
+
</alert_email_from>
|
63 |
+
<alert_email_reply translate="label">
|
64 |
+
<label>Alert email reply-to address: </label>
|
65 |
+
<frontend_type>text</frontend_type>
|
66 |
+
<sort_order>18</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
<comment>This is the email address that will recieve replies to alert emails. If left blank, it will default to your general store contact email address.</comment>
|
71 |
+
</alert_email_reply>
|
72 |
+
<include_order_link translate="label">
|
73 |
+
<label>Include link to order in alert emails:</label>
|
74 |
+
<frontend_type>radios</frontend_type>
|
75 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
76 |
+
<sort_order>19</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<comment>If set to yes, a link directly to the order (in the Magento back end) will be included in each alert email. Users will still have to log in to view order.</comment>
|
81 |
+
</include_order_link>
|
82 |
+
<filter_logging translate="label">
|
83 |
+
<label>Enable logging:</label>
|
84 |
+
<frontend_type>radios</frontend_type>
|
85 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
86 |
+
<sort_order>20</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>1</show_in_store>
|
90 |
+
<comment>If enabled, a log of every active filter pass/fail will be written to /var/log/customizablefraudfilters.log. Useful when testing new filter configurations, but shouldn't be left on indefinately.</comment>
|
91 |
+
</filter_logging>
|
92 |
+
</fields>
|
93 |
+
</general_settings>
|
94 |
+
<filters translate="label">
|
95 |
+
<label>Filters</label>
|
96 |
+
<frontend_type>text</frontend_type>
|
97 |
+
<sort_order>5</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>1</show_in_store>
|
101 |
+
<fields>
|
102 |
+
<city_match_flag translate="label">
|
103 |
+
<label>Flag order when shipping city does not match billing city.</label>
|
104 |
+
<frontend_type>radios</frontend_type>
|
105 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
106 |
+
<sort_order>10</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
<comment>Select 'yes' to hold orders when the cities do not match.</comment>
|
111 |
+
</city_match_flag>
|
112 |
+
<state_match_flag translate="label">
|
113 |
+
<label>Flag order when shipping state does not match billing state.</label>
|
114 |
+
<frontend_type>radios</frontend_type>
|
115 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
116 |
+
<sort_order>13</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 |
+
<comment>Select 'yes' to hold orders when the states do not match.</comment>
|
121 |
+
</state_match_flag>
|
122 |
+
<zip_code_match_flag translate="label">
|
123 |
+
<label>Flag order when shipping zip code does not match billing zip code.</label>
|
124 |
+
<frontend_type>radios</frontend_type>
|
125 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
126 |
+
<sort_order>15</sort_order>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>1</show_in_website>
|
129 |
+
<show_in_store>1</show_in_store>
|
130 |
+
<comment>Select 'yes' to hold orders when the zip codes do not match.</comment>
|
131 |
+
</zip_code_match_flag>
|
132 |
+
<country_match_flag translate="label">
|
133 |
+
<label>Flag order when shipping country does not match billing country.</label>
|
134 |
+
<frontend_type>radios</frontend_type>
|
135 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
136 |
+
<sort_order>16</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>1</show_in_store>
|
140 |
+
<comment>Select 'yes' to hold orders when the countries do not match.</comment>
|
141 |
+
</country_match_flag>
|
142 |
+
<shipping_street_contains_flag translate="label">
|
143 |
+
<label>Flag order when the shipping street address (line one or two) contains:</label>
|
144 |
+
<frontend_type>text</frontend_type>
|
145 |
+
<sort_order>17</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>1</show_in_store>
|
149 |
+
<comment>Enter each value enclosed in double quotes, comma seperated. ie: "PO Box", "P.O. Box". Case does not matter.</comment>
|
150 |
+
</shipping_street_contains_flag>
|
151 |
+
<billing_street_contains_flag translate="label">
|
152 |
+
<label>Flag order when the billing street address (line one or two) contains:</label>
|
153 |
+
<frontend_type>text</frontend_type>
|
154 |
+
<sort_order>18</sort_order>
|
155 |
+
<show_in_default>1</show_in_default>
|
156 |
+
<show_in_website>1</show_in_website>
|
157 |
+
<show_in_store>1</show_in_store>
|
158 |
+
<comment>Enter each value enclosed in double quotes, comma seperated. ie: "PO Box", "P.O. Box". Case does not matter.</comment>
|
159 |
+
</billing_street_contains_flag>
|
160 |
+
<guest_flag translate="label">
|
161 |
+
<label>Flag order when placed by a guest.</label>
|
162 |
+
<frontend_type>radios</frontend_type>
|
163 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
164 |
+
<sort_order>17</sort_order>
|
165 |
+
<show_in_default>1</show_in_default>
|
166 |
+
<show_in_website>1</show_in_website>
|
167 |
+
<show_in_store>1</show_in_store>
|
168 |
+
<comment>Select 'yes' to hold orders when the customer is not logged into an account when the order was placed.</comment>
|
169 |
+
</guest_flag>
|
170 |
+
<grand_total_max_flag translate="label">
|
171 |
+
<label>Flag order when grand total is GREATER than: </label>
|
172 |
+
<frontend_type>text</frontend_type>
|
173 |
+
<sort_order>20</sort_order>
|
174 |
+
<show_in_default>1</show_in_default>
|
175 |
+
<show_in_website>1</show_in_website>
|
176 |
+
<show_in_store>1</show_in_store>
|
177 |
+
<comment>Enter only numbers and decimals (ie: 99.99). Leave blank to deactivate this filter.</comment>
|
178 |
+
</grand_total_max_flag>
|
179 |
+
<grand_total_min_flag translate="label">
|
180 |
+
<label>Flag order when grand total is LESS than: </label>
|
181 |
+
<frontend_type>text</frontend_type>
|
182 |
+
<sort_order>25</sort_order>
|
183 |
+
<show_in_default>1</show_in_default>
|
184 |
+
<show_in_website>1</show_in_website>
|
185 |
+
<show_in_store>1</show_in_store>
|
186 |
+
<comment>Enter only numbers and decimals (ie: 1.99). Leave blank to deactivate this filter.</comment>
|
187 |
+
</grand_total_min_flag>
|
188 |
+
<order_contains_products_flag translate="label">
|
189 |
+
<label>Flag if order contains product IDs: </label>
|
190 |
+
<frontend_type>text</frontend_type>
|
191 |
+
<sort_order>30</sort_order>
|
192 |
+
<show_in_default>1</show_in_default>
|
193 |
+
<show_in_website>1</show_in_website>
|
194 |
+
<show_in_store>1</show_in_store>
|
195 |
+
<comment>Enter comma-seperated list of product IDs (not product SKUs).</comment>
|
196 |
+
</order_contains_products_flag>
|
197 |
+
<shipping_country_flag translate="label">
|
198 |
+
<label>Flag order when shipping country is:</label>
|
199 |
+
<frontend_type>multiselect</frontend_type>
|
200 |
+
<sort_order>35</sort_order>
|
201 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
202 |
+
<show_in_default>1</show_in_default>
|
203 |
+
<show_in_website>1</show_in_website>
|
204 |
+
<show_in_store>1</show_in_store>
|
205 |
+
</shipping_country_flag>
|
206 |
+
<billing_country_flag translate="label">
|
207 |
+
<label>Flag order when billing country is:</label>
|
208 |
+
<frontend_type>multiselect</frontend_type>
|
209 |
+
<sort_order>40</sort_order>
|
210 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
211 |
+
<show_in_default>1</show_in_default>
|
212 |
+
<show_in_website>1</show_in_website>
|
213 |
+
<show_in_store>1</show_in_store>
|
214 |
+
</billing_country_flag>
|
215 |
+
<shipping_method_flag translate="label">
|
216 |
+
<label>Flag if shipping method is:</label>
|
217 |
+
<frontend_type>multiselect</frontend_type>
|
218 |
+
<sort_order>43</sort_order>
|
219 |
+
<source_model>customizablefraudfilters_adminhtml/system_config_source_shipping</source_model>
|
220 |
+
<show_in_default>1</show_in_default>
|
221 |
+
<show_in_website>1</show_in_website>
|
222 |
+
<show_in_store>1</show_in_store>
|
223 |
+
</shipping_method_flag>
|
224 |
+
<restricted_email_flag translate="label">
|
225 |
+
<label>Flag order if customer email is: </label>
|
226 |
+
<frontend_type>text</frontend_type>
|
227 |
+
<sort_order>45</sort_order>
|
228 |
+
<show_in_default>1</show_in_default>
|
229 |
+
<show_in_website>1</show_in_website>
|
230 |
+
<show_in_store>1</show_in_store>
|
231 |
+
<comment>Enter comma-seperated list of email addresses.</comment>
|
232 |
+
</restricted_email_flag>
|
233 |
+
</fields>
|
234 |
+
</filters>
|
235 |
+
</groups>
|
236 |
+
</customizablefraudfilters>
|
237 |
+
</sections>
|
238 |
+
</config>
|
app/code/community/Foundation/CustomizableFraudFilters/sql/.DS_Store
ADDED
Binary file
|
app/code/community/Foundation/CustomizableFraudFilters/sql/customizablefraudfilters_setup/.DS_Store
ADDED
Binary file
|
app/code/community/Foundation/CustomizableFraudFilters/sql/customizablefraudfilters_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
|
5 |
+
$status = Mage::getModel('sales/order_status');
|
6 |
+
|
7 |
+
$status->setStatus('manual_review')->setLabel('Manual Review Required')
|
8 |
+
->assignState(Mage_Sales_Model_Order::STATE_HOLDED)
|
9 |
+
->save();
|
10 |
+
|
11 |
+
$installer->endSetup();
|
app/etc/modules/Foundation_CustomizableFraudFilters.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Foundation_CustomizableFraudFilters>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</Foundation_CustomizableFraudFilters>
|
9 |
+
</modules>
|
10 |
+
</config>
|
app/locale/en_US/template/email/fraud_filter_alert.html
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject Order Approver: Potential Fraud Alert @-->
|
2 |
+
This email is to alert you that order #{{var orderNumber}} which was placed on {{var storeName}} is being held for manual review. The reason it is being held is:
|
3 |
+
<br/><br/>
|
4 |
+
{{var flagReason}}
|
5 |
+
{{depend orderUrl}}
|
6 |
+
<br/><br/>
|
7 |
+
View this order: <a href="{{var orderUrl}}">{{var orderUrl}}</a>
|
8 |
+
{{/depend}}
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Foundation_CustomizableFraudFilters</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache Software License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Hold orders for manual review based on filters you create. No fees, no subscriptions.</summary>
|
10 |
+
<description>Customizable Fraud Filters is a Magento extension which allows store owners to configure a series of filters which are common fraud indicators and then validate each order placed on their site against those filters. Orders which are flagged by a filter are held held for manual review and approval by the store owner. Filters can be tuned to be as liberal or conservative as suits the store owner’s needs.</description>
|
11 |
+
<notes>Initial release.</notes>
|
12 |
+
<authors><author><name>Evan Steiner</name><user>EDS_Magento</user><email>evan.d.steiner@gmail.com</email></author></authors>
|
13 |
+
<date>2014-10-19</date>
|
14 |
+
<time>19:58:48</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Foundation_CustomizableFraudFilters.xml" hash="2df4e5df8a24a98aaea52115600cb0f2"/></dir></target><target name="magecommunity"><dir name="Foundation"><dir name="CustomizableFraudFilters"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Shipping.php" hash="4c6fe8bab2d6f033cdb73f45ef6ded74"/></dir><file name=".DS_Store" hash="6ab7130cd4bbd376753eb4c525ade0ac"/></dir><file name=".DS_Store" hash="0416cfc090912b484a4ab107c631a955"/></dir><file name=".DS_Store" hash="6d34756281b2a246701d3c9ec04531a4"/></dir></dir><dir name="Helper"><file name="Data.php" hash="bdba064e5a6b6e31e93a3a8bd79200b1"/></dir><dir name="Model"><file name="Observer.php" hash="5b25e990e75e346204fd9d47e7ab1d90"/><dir name="Sales"><file name="Order.php" hash="26817b46cfb2cae11680983dcd6bdd3d"/><file name=".DS_Store" hash="51f1e245d83d17ef27bc315fa6e97b4b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="966d76e22e7a4409c0c594cfe0db3bcb"/><file name="config.xml" hash="c7ead0e96099c0b18a7bdedaa6506d8d"/><file name="system.xml" hash="e848ce8ca9556612ffdefaac741c75a0"/><file name=".DS_Store" hash="1ea47d26cfe5ffc1b678c0db1d97ee85"/></dir><dir name="sql"><dir name="customizablefraudfilters_setup"><file name="mysql4-install-0.1.0.php" hash="0c4c575b08559ffed483ee4128950228"/><file name=".DS_Store" hash="81280b7582a2e9a1f9c58a9a93f243c2"/></dir><file name=".DS_Store" hash="341e88061fdd94e134a543c39b74e6ea"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="fraud_filter_alert.html" hash="c3a06d2276d98dd90d8e9c179c70972d"/></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.13</min><max>5.6.0</max></php></required></dependencies>
|
18 |
+
</package>
|