Version Notes
Supports all versions of Magento
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Signifyd_Connect |
| Version | 3.4.5 |
| Comparing to | |
| See all releases | |
Code changes from version 3.4.4 to 3.4.5
- app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order/Grid.php +1 -1
- app/code/community/Signifyd/Connect/Helper/Data.php +7 -2
- app/code/community/Signifyd/Connect/Model/Observer.php +39 -10
- app/code/community/Signifyd/Connect/controllers/ConnectController.php +167 -60
- app/code/community/Signifyd/Connect/etc/adminhtml.xml +1 -1
- app/code/community/Signifyd/Connect/etc/config.xml +10 -1
- app/code/community/Signifyd/Connect/etc/system.xml +24 -2
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.5.0.php +21 -0
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.4-3.4.5.php +13 -0
- package.xml +4 -4
app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order/Grid.php
CHANGED
|
@@ -93,7 +93,7 @@ class Signifyd_Connect_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_B
|
|
| 93 |
'align' => 'left',
|
| 94 |
'type' => 'text',
|
| 95 |
'index' => 'score',
|
| 96 |
-
'
|
| 97 |
'renderer' => 'signifyd_connect/renderer',
|
| 98 |
'width' => '100px',
|
| 99 |
));
|
| 93 |
'align' => 'left',
|
| 94 |
'type' => 'text',
|
| 95 |
'index' => 'score',
|
| 96 |
+
'filter' => false,
|
| 97 |
'renderer' => 'signifyd_connect/renderer',
|
| 98 |
'width' => '100px',
|
| 99 |
));
|
app/code/community/Signifyd/Connect/Helper/Data.php
CHANGED
|
@@ -67,12 +67,17 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 67 |
return false;
|
| 68 |
}
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
public function markProcessed($order)
|
| 71 |
{
|
| 72 |
$case = Mage::getModel('signifyd_connect/case');
|
| 73 |
$case->setOrderIncrement($order->getIncrementId());
|
| 74 |
-
$case->
|
| 75 |
-
$case->
|
| 76 |
$case->save();
|
| 77 |
|
| 78 |
return $case;
|
| 67 |
return false;
|
| 68 |
}
|
| 69 |
|
| 70 |
+
public function generateCase($order)
|
| 71 |
+
{
|
| 72 |
+
return $this->markProcessed($order);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
public function markProcessed($order)
|
| 76 |
{
|
| 77 |
$case = Mage::getModel('signifyd_connect/case');
|
| 78 |
$case->setOrderIncrement($order->getIncrementId());
|
| 79 |
+
$case->setCreated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
| 80 |
+
$case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
| 81 |
$case->save();
|
| 82 |
|
| 83 |
return $case;
|
app/code/community/Signifyd/Connect/Model/Observer.php
CHANGED
|
@@ -85,14 +85,19 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
|
|
| 85 |
{
|
| 86 |
if ($this->order->getRemoteIp()) {
|
| 87 |
if ($this->order->getXForwardedFor()) {
|
| 88 |
-
return $this->order->getXForwardedFor();
|
| 89 |
}
|
| 90 |
|
| 91 |
-
return $this->order->getRemoteIp();
|
| 92 |
}
|
| 93 |
|
| 94 |
// Checks each configured value in app/etc/local.xml & falls back to REMOTE_ADDR. See app/etc/local.xml.additional for examples.
|
| 95 |
-
return Mage::helper('core/http')->getRemoteAddr(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
}
|
| 97 |
|
| 98 |
public function formatAvs($value)
|
|
@@ -435,16 +440,18 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
|
|
| 435 |
|
| 436 |
$case = $this->generateCase();
|
| 437 |
|
| 438 |
-
$response = $this->submitCase($case);
|
| 439 |
-
|
| 440 |
$case_object = Mage::helper('signifyd_connect')->markProcessed($order);
|
| 441 |
|
|
|
|
|
|
|
| 442 |
try {
|
| 443 |
$response_code = $response->getHttpCode();
|
| 444 |
|
| 445 |
if (substr($response_code, 0, 1) == '2') {
|
| 446 |
$response_data = json_decode($response->getRawResponse(), true);
|
| 447 |
|
|
|
|
|
|
|
| 448 |
$case_object->setCode($response_data['investigationId']);
|
| 449 |
$case_object->save();
|
| 450 |
}
|
|
@@ -489,6 +496,28 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
|
|
| 489 |
Mage::log("Products:\n $products", null, 'signifyd_connect_objects.log');
|
| 490 |
}
|
| 491 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
public function eavCollectionAbstractLoadBefore($observer)
|
| 493 |
{
|
| 494 |
$x = $observer->getCollection();
|
|
@@ -498,7 +527,7 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
|
|
| 498 |
$controller = $request->getControllerName();
|
| 499 |
$action = $request->getActionName();
|
| 500 |
|
| 501 |
-
if ($module !=
|
| 502 |
return;
|
| 503 |
}
|
| 504 |
|
|
@@ -518,7 +547,7 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
|
|
| 518 |
$controller = $request->getControllerName();
|
| 519 |
$action = $request->getActionName();
|
| 520 |
|
| 521 |
-
if ($module !=
|
| 522 |
return;
|
| 523 |
}
|
| 524 |
|
|
@@ -569,7 +598,7 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
|
|
| 569 |
$controller = $request->getControllerName();
|
| 570 |
$action = $request->getActionName();
|
| 571 |
|
| 572 |
-
if ($module !=
|
| 573 |
return;
|
| 574 |
}
|
| 575 |
|
|
@@ -598,7 +627,7 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
|
|
| 598 |
$controller = $request->getControllerName();
|
| 599 |
$action = $request->getActionName();
|
| 600 |
|
| 601 |
-
if ($module !=
|
| 602 |
return;
|
| 603 |
}
|
| 604 |
|
|
@@ -613,7 +642,7 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
|
|
| 613 |
'align' => 'left',
|
| 614 |
'type' => 'text',
|
| 615 |
'index' => 'score',
|
| 616 |
-
'
|
| 617 |
'renderer' => 'signifyd_connect/renderer',
|
| 618 |
'width' => '100px',
|
| 619 |
),
|
| 85 |
{
|
| 86 |
if ($this->order->getRemoteIp()) {
|
| 87 |
if ($this->order->getXForwardedFor()) {
|
| 88 |
+
return $this->filterIp($this->order->getXForwardedFor());
|
| 89 |
}
|
| 90 |
|
| 91 |
+
return $this->filterIp($this->order->getRemoteIp());
|
| 92 |
}
|
| 93 |
|
| 94 |
// Checks each configured value in app/etc/local.xml & falls back to REMOTE_ADDR. See app/etc/local.xml.additional for examples.
|
| 95 |
+
return $this->filterIp(Mage::helper('core/http')->getRemoteAddr(false));
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
public function filterIp($ip)
|
| 99 |
+
{
|
| 100 |
+
return preg_replace('/[^0-9a-zA-Z:\.]/', '', strtok($ip, "\n"));
|
| 101 |
}
|
| 102 |
|
| 103 |
public function formatAvs($value)
|
| 440 |
|
| 441 |
$case = $this->generateCase();
|
| 442 |
|
|
|
|
|
|
|
| 443 |
$case_object = Mage::helper('signifyd_connect')->markProcessed($order);
|
| 444 |
|
| 445 |
+
$response = $this->submitCase($case);
|
| 446 |
+
|
| 447 |
try {
|
| 448 |
$response_code = $response->getHttpCode();
|
| 449 |
|
| 450 |
if (substr($response_code, 0, 1) == '2') {
|
| 451 |
$response_data = json_decode($response->getRawResponse(), true);
|
| 452 |
|
| 453 |
+
$case_object = Mage::getModel('signifyd_connect/case')->load($case_object->getId());
|
| 454 |
+
$case_object->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
| 455 |
$case_object->setCode($response_data['investigationId']);
|
| 456 |
$case_object->save();
|
| 457 |
}
|
| 496 |
Mage::log("Products:\n $products", null, 'signifyd_connect_objects.log');
|
| 497 |
}
|
| 498 |
|
| 499 |
+
public function getAdminRoute()
|
| 500 |
+
{
|
| 501 |
+
$route = false;
|
| 502 |
+
|
| 503 |
+
try {
|
| 504 |
+
// 1.4.0.0 support means we need to hard code these paths
|
| 505 |
+
if ((bool)(string)Mage::getConfig()->getNode('default/admin/url/use_custom_path')) {
|
| 506 |
+
$route = Mage::getConfig()->getNode('default/admin/url/custom_path');
|
| 507 |
+
} else {
|
| 508 |
+
$route = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
|
| 509 |
+
}
|
| 510 |
+
} catch (Exception $e) {
|
| 511 |
+
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
if (!$route) {
|
| 515 |
+
$route = 'admin';
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
return $route;
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
public function eavCollectionAbstractLoadBefore($observer)
|
| 522 |
{
|
| 523 |
$x = $observer->getCollection();
|
| 527 |
$controller = $request->getControllerName();
|
| 528 |
$action = $request->getActionName();
|
| 529 |
|
| 530 |
+
if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
|
| 531 |
return;
|
| 532 |
}
|
| 533 |
|
| 547 |
$controller = $request->getControllerName();
|
| 548 |
$action = $request->getActionName();
|
| 549 |
|
| 550 |
+
if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
|
| 551 |
return;
|
| 552 |
}
|
| 553 |
|
| 598 |
$controller = $request->getControllerName();
|
| 599 |
$action = $request->getActionName();
|
| 600 |
|
| 601 |
+
if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
|
| 602 |
return;
|
| 603 |
}
|
| 604 |
|
| 627 |
$controller = $request->getControllerName();
|
| 628 |
$action = $request->getActionName();
|
| 629 |
|
| 630 |
+
if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
|
| 631 |
return;
|
| 632 |
}
|
| 633 |
|
| 642 |
'align' => 'left',
|
| 643 |
'type' => 'text',
|
| 644 |
'index' => 'score',
|
| 645 |
+
'filter' => false,
|
| 646 |
'renderer' => 'signifyd_connect/renderer',
|
| 647 |
'width' => '100px',
|
| 648 |
),
|
app/code/community/Signifyd/Connect/controllers/ConnectController.php
CHANGED
|
@@ -22,6 +22,11 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
|
|
| 22 |
return Mage::getStoreConfig('signifyd_connect/advanced/hold_orders');
|
| 23 |
}
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
public function enabled()
|
| 26 |
{
|
| 27 |
$retrieve_scores = Mage::getStoreConfig('signifyd_connect/advanced/retrieve_score');
|
|
@@ -100,6 +105,34 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
|
|
| 100 |
return false;
|
| 101 |
}
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
public function initRequest($request)
|
| 104 |
{
|
| 105 |
$this->_request = json_decode($request, true);
|
|
@@ -108,13 +141,91 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
|
|
| 108 |
|
| 109 |
$this->_topic = $topic;
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
|
| 116 |
-
$
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
}
|
| 119 |
}
|
| 120 |
}
|
|
@@ -129,34 +240,36 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
|
|
| 129 |
|
| 130 |
if (isset($this->_request['score'])) {
|
| 131 |
$case->setScore($this->_request['score']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
}
|
| 133 |
|
| 134 |
if (isset($this->_request['status'])) {
|
| 135 |
$case->setSignifydStatus($this->_request['status']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
|
| 138 |
-
$case->
|
| 139 |
$case->save();
|
| 140 |
|
| 141 |
if ($this->logRequest()) {
|
| 142 |
Mage::log('Case ' . $case->getId() . ' created with status ' . $case->getSignifydStatus() . ' and score ' . $case->getScore(), null, 'signifyd_connect.log');
|
| 143 |
}
|
| 144 |
|
| 145 |
-
|
| 146 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($case->getOrderIncrement());
|
| 147 |
-
|
| 148 |
-
$threshold = $this->holdThreshold();
|
| 149 |
-
if ($threshold && $case->getScore() <= $threshold) {
|
| 150 |
-
if ($order->canHold()) {
|
| 151 |
-
$order->hold();
|
| 152 |
-
$order->save();
|
| 153 |
-
|
| 154 |
-
if ($this->logRequest()) {
|
| 155 |
-
Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
|
| 156 |
-
}
|
| 157 |
-
}
|
| 158 |
-
}
|
| 159 |
-
}
|
| 160 |
}
|
| 161 |
|
| 162 |
public function processReview()
|
|
@@ -171,52 +284,32 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
|
|
| 171 |
|
| 172 |
if (isset($this->_request['score'])) {
|
| 173 |
$case->setScore($this->_request['score']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
}
|
| 175 |
|
| 176 |
if (isset($this->_request['status'])) {
|
| 177 |
$case->setSignifydStatus($this->_request['status']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
}
|
| 179 |
|
| 180 |
-
$case->
|
| 181 |
$case->save();
|
| 182 |
|
| 183 |
-
|
| 184 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($case->getOrderIncrement());
|
| 185 |
-
|
| 186 |
-
if ($original_status == 'PENDING') { // i.e. First update
|
| 187 |
-
$threshold = $this->holdThreshold();
|
| 188 |
-
if ($threshold && $case->getScore() <= $threshold) {
|
| 189 |
-
if ($order->canHold()) {
|
| 190 |
-
$order->hold();
|
| 191 |
-
$order->save();
|
| 192 |
-
|
| 193 |
-
if ($this->logRequest()) {
|
| 194 |
-
Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
|
| 195 |
-
}
|
| 196 |
-
}
|
| 197 |
-
}
|
| 198 |
-
} else {
|
| 199 |
-
if ($this->_request['reviewDisposition'] == 'FRAUDULENT') {
|
| 200 |
-
if ($order->canHold()) {
|
| 201 |
-
$order->hold();
|
| 202 |
-
$order->save();
|
| 203 |
-
|
| 204 |
-
if ($this->logRequest()) {
|
| 205 |
-
Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
|
| 206 |
-
}
|
| 207 |
-
}
|
| 208 |
-
} else if ($this->_request['reviewDisposition'] == 'GOOD') {
|
| 209 |
-
if ($order->canUnhold()) {
|
| 210 |
-
$order->unhold();
|
| 211 |
-
$order->save();
|
| 212 |
-
|
| 213 |
-
if ($this->logRequest()) {
|
| 214 |
-
Mage::log('Order ' . $order->getId() . ' unheld', null, 'signifyd_connect.log');
|
| 215 |
-
}
|
| 216 |
-
}
|
| 217 |
-
}
|
| 218 |
-
}
|
| 219 |
-
}
|
| 220 |
}
|
| 221 |
|
| 222 |
public function getUrl($code)
|
|
@@ -270,6 +363,19 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
|
|
| 270 |
$this->_case = $case;
|
| 271 |
break;
|
| 272 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
}
|
| 274 |
|
| 275 |
if ($this->_case) {
|
|
@@ -338,6 +444,7 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
|
|
| 338 |
}
|
| 339 |
}
|
| 340 |
break;
|
|
|
|
| 341 |
case "cases/review":
|
| 342 |
try {
|
| 343 |
$this->processReview($request);
|
| 22 |
return Mage::getStoreConfig('signifyd_connect/advanced/hold_orders');
|
| 23 |
}
|
| 24 |
|
| 25 |
+
public function canInvoice()
|
| 26 |
+
{
|
| 27 |
+
return Mage::getStoreConfig('signifyd_connect/advanced/invoice_orders');
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
public function enabled()
|
| 31 |
{
|
| 32 |
$retrieve_scores = Mage::getStoreConfig('signifyd_connect/advanced/retrieve_score');
|
| 105 |
return false;
|
| 106 |
}
|
| 107 |
|
| 108 |
+
public function initCase($order_increment)
|
| 109 |
+
{
|
| 110 |
+
$case = false;
|
| 111 |
+
|
| 112 |
+
if (isset($this->_request['orderId'])) {
|
| 113 |
+
$cases = Mage::getModel('signifyd_connect/case')->getCollection();
|
| 114 |
+
$cases->addFieldToFilter('order_increment', $this->_request['orderId']);
|
| 115 |
+
|
| 116 |
+
foreach ($cases as $c) {
|
| 117 |
+
$case = $c;
|
| 118 |
+
break;
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/*
|
| 123 |
+
// Do not create cases if not found -- potential concurrency issues
|
| 124 |
+
if (!$case) {
|
| 125 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($order_increment);
|
| 126 |
+
|
| 127 |
+
if ($order && $order->getId()) {
|
| 128 |
+
$case = Mage::helper('signifyd_connect')->generateCase($order);
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
*/
|
| 132 |
+
|
| 133 |
+
return $case;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
public function initRequest($request)
|
| 137 |
{
|
| 138 |
$this->_request = json_decode($request, true);
|
| 141 |
|
| 142 |
$this->_topic = $topic;
|
| 143 |
|
| 144 |
+
$this->_case = $this->initCase($this->_request['orderId']);
|
| 145 |
+
|
| 146 |
+
if (!$this->_case && $this->logRequest()) {
|
| 147 |
+
Mage::log('No matching case was found for this request. order_increment: ' . $this->_request['orderId'], null, 'signifyd_connect.log');
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
public function holdOrder($order)
|
| 152 |
+
{
|
| 153 |
+
if ($order->canHold() && $this->canHold()) {
|
| 154 |
+
$order->hold();
|
| 155 |
+
$order->save();
|
| 156 |
|
| 157 |
+
if ($this->logRequest()) {
|
| 158 |
+
Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
public function notifyCustomer()
|
| 164 |
+
{
|
| 165 |
+
return Mage::getStoreConfig('signifyd_connect/advanced/invoice_orders_notify');
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
public function invoiceOrder($order)
|
| 169 |
+
{
|
| 170 |
+
if ($order->canInvoice() && $this->canInvoice()) {
|
| 171 |
+
$items = array();
|
| 172 |
+
foreach ($order->getAllItems() as $item) {
|
| 173 |
+
$items[$item->getId()] = $item->getQtyOrdered();
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
$invoice_api = Mage::getModel('sales/order_invoice_api');
|
| 177 |
+
|
| 178 |
+
try {
|
| 179 |
+
$invoice_id = $invoice_api->create($order->getIncrementId(), $items, null, false, true);
|
| 180 |
+
|
| 181 |
+
$invoice_api->capture($invoice_id);
|
| 182 |
+
} catch (Exception $e) {
|
| 183 |
+
if ($this->logErrors()) {
|
| 184 |
+
Mage::log('Exception while creating invoice: ' . $e->__toString(), null, 'signifyd_connect.log');
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
public function processAdditional($case, $original_status=false)
|
| 191 |
+
{
|
| 192 |
+
if ($this->canHold() || $this->canInvoice()) {
|
| 193 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($case->getOrderIncrement());
|
| 194 |
+
$held = false;
|
| 195 |
+
|
| 196 |
+
if ($this->canHold()) {
|
| 197 |
+
$threshold = $this->holdThreshold();
|
| 198 |
+
|
| 199 |
+
if (!$original_status || $original_status == 'PENDING') {
|
| 200 |
+
if ($threshold && $case->getScore() <= $threshold) {
|
| 201 |
+
$this->holdOrder($order);
|
| 202 |
+
$held = true;
|
| 203 |
+
}
|
| 204 |
+
} else if ($original_status) {
|
| 205 |
+
if ($this->_request['reviewDisposition'] == 'FRAUDULENT') {
|
| 206 |
+
if ($order->canHold()) {
|
| 207 |
+
$order->hold();
|
| 208 |
+
$order->save();
|
| 209 |
+
|
| 210 |
+
if ($this->logRequest()) {
|
| 211 |
+
Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
|
| 212 |
+
}
|
| 213 |
+
}
|
| 214 |
+
} else if ($this->_request['reviewDisposition'] == 'GOOD') {
|
| 215 |
+
if ($order->canUnhold()) {
|
| 216 |
+
$order->unhold();
|
| 217 |
+
$order->save();
|
| 218 |
+
|
| 219 |
+
if ($this->logRequest()) {
|
| 220 |
+
Mage::log('Order ' . $order->getId() . ' unheld', null, 'signifyd_connect.log');
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
if ($this->canInvoice() && !$held && !$original_status) {
|
| 228 |
+
$this->invoiceOrder($order);
|
| 229 |
}
|
| 230 |
}
|
| 231 |
}
|
| 240 |
|
| 241 |
if (isset($this->_request['score'])) {
|
| 242 |
$case->setScore($this->_request['score']);
|
| 243 |
+
|
| 244 |
+
if ($this->logRequest()) {
|
| 245 |
+
Mage::log('Set score to ' . $this->_request['score'], null, 'signifyd_connect.log');
|
| 246 |
+
}
|
| 247 |
+
} else {
|
| 248 |
+
if ($this->logRequest()) {
|
| 249 |
+
Mage::log('No score value available', null, 'signifyd_connect.log');
|
| 250 |
+
}
|
| 251 |
}
|
| 252 |
|
| 253 |
if (isset($this->_request['status'])) {
|
| 254 |
$case->setSignifydStatus($this->_request['status']);
|
| 255 |
+
|
| 256 |
+
if ($this->logRequest()) {
|
| 257 |
+
Mage::log('Set status to ' . $this->_request['status'], null, 'signifyd_connect.log');
|
| 258 |
+
}
|
| 259 |
+
} else {
|
| 260 |
+
if ($this->logRequest()) {
|
| 261 |
+
Mage::log('No status value available', null, 'signifyd_connect.log');
|
| 262 |
+
}
|
| 263 |
}
|
| 264 |
|
| 265 |
+
$case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
| 266 |
$case->save();
|
| 267 |
|
| 268 |
if ($this->logRequest()) {
|
| 269 |
Mage::log('Case ' . $case->getId() . ' created with status ' . $case->getSignifydStatus() . ' and score ' . $case->getScore(), null, 'signifyd_connect.log');
|
| 270 |
}
|
| 271 |
|
| 272 |
+
$this->processAdditional($case);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
}
|
| 274 |
|
| 275 |
public function processReview()
|
| 284 |
|
| 285 |
if (isset($this->_request['score'])) {
|
| 286 |
$case->setScore($this->_request['score']);
|
| 287 |
+
|
| 288 |
+
if ($this->logRequest()) {
|
| 289 |
+
Mage::log('Set score to ' . $this->_request['score'], null, 'signifyd_connect.log');
|
| 290 |
+
}
|
| 291 |
+
} else {
|
| 292 |
+
if ($this->logRequest()) {
|
| 293 |
+
Mage::log('No score value available', null, 'signifyd_connect.log');
|
| 294 |
+
}
|
| 295 |
}
|
| 296 |
|
| 297 |
if (isset($this->_request['status'])) {
|
| 298 |
$case->setSignifydStatus($this->_request['status']);
|
| 299 |
+
|
| 300 |
+
if ($this->logRequest()) {
|
| 301 |
+
Mage::log('Set status to ' . $this->_request['status'], null, 'signifyd_connect.log');
|
| 302 |
+
}
|
| 303 |
+
} else {
|
| 304 |
+
if ($this->logRequest()) {
|
| 305 |
+
Mage::log('No status value available', null, 'signifyd_connect.log');
|
| 306 |
+
}
|
| 307 |
}
|
| 308 |
|
| 309 |
+
$case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
| 310 |
$case->save();
|
| 311 |
|
| 312 |
+
$this->processAdditional($case, $original_status);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
}
|
| 314 |
|
| 315 |
public function getUrl($code)
|
| 363 |
$this->_case = $case;
|
| 364 |
break;
|
| 365 |
}
|
| 366 |
+
|
| 367 |
+
/*
|
| 368 |
+
// Do not create cases if not found -- potential concurrency issues
|
| 369 |
+
if (!$this->_case && isset($request['investigationId'])) {
|
| 370 |
+
$case = Mage::getModel('signifyd_connect/case');
|
| 371 |
+
$case->setOrderIncrement($request['orderId']);
|
| 372 |
+
$case->setCode($request['investigationId']);
|
| 373 |
+
$case->setCreated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
| 374 |
+
$case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
| 375 |
+
|
| 376 |
+
$this->_case = $case;
|
| 377 |
+
}
|
| 378 |
+
*/
|
| 379 |
}
|
| 380 |
|
| 381 |
if ($this->_case) {
|
| 444 |
}
|
| 445 |
}
|
| 446 |
break;
|
| 447 |
+
case "cases/rescore":
|
| 448 |
case "cases/review":
|
| 449 |
try {
|
| 450 |
$this->processReview($request);
|
app/code/community/Signifyd/Connect/etc/adminhtml.xml
CHANGED
|
@@ -11,4 +11,4 @@
|
|
| 11 |
</children>
|
| 12 |
</sales>
|
| 13 |
</menu>
|
| 14 |
-
</config>
|
| 11 |
</children>
|
| 12 |
</sales>
|
| 13 |
</menu>
|
| 14 |
+
</config>
|
app/code/community/Signifyd/Connect/etc/config.xml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<config>
|
| 4 |
<modules>
|
| 5 |
<Signifyd_Connect>
|
| 6 |
-
<version>3.4.
|
| 7 |
</Signifyd_Connect>
|
| 8 |
</modules>
|
| 9 |
<global>
|
|
@@ -85,6 +85,7 @@
|
|
| 85 |
<show_scores>0</show_scores>
|
| 86 |
<hold_orders>0</hold_orders>
|
| 87 |
<hold_orders_threshold>500</hold_orders_threshold>
|
|
|
|
| 88 |
</advanced>
|
| 89 |
<log>
|
| 90 |
<request>0</request>
|
|
@@ -124,6 +125,14 @@
|
|
| 124 |
</config>
|
| 125 |
</children>
|
| 126 |
</system>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
</children>
|
| 128 |
</admin>
|
| 129 |
</resources>
|
| 3 |
<config>
|
| 4 |
<modules>
|
| 5 |
<Signifyd_Connect>
|
| 6 |
+
<version>3.4.5</version>
|
| 7 |
</Signifyd_Connect>
|
| 8 |
</modules>
|
| 9 |
<global>
|
| 85 |
<show_scores>0</show_scores>
|
| 86 |
<hold_orders>0</hold_orders>
|
| 87 |
<hold_orders_threshold>500</hold_orders_threshold>
|
| 88 |
+
<invoice_orders>0</invoice_orders>
|
| 89 |
</advanced>
|
| 90 |
<log>
|
| 91 |
<request>0</request>
|
| 125 |
</config>
|
| 126 |
</children>
|
| 127 |
</system>
|
| 128 |
+
<sales>
|
| 129 |
+
<children>
|
| 130 |
+
<signifyd_connect>
|
| 131 |
+
<sort_order>50</sort_order>
|
| 132 |
+
<title>Signifyd Scores</title>
|
| 133 |
+
</signifyd_connect>
|
| 134 |
+
</children>
|
| 135 |
+
</sales>
|
| 136 |
</children>
|
| 137 |
</admin>
|
| 138 |
</resources>
|
app/code/community/Signifyd/Connect/etc/system.xml
CHANGED
|
@@ -59,8 +59,8 @@
|
|
| 59 |
<frontend_type>text</frontend_type>
|
| 60 |
<sort_order>2</sort_order>
|
| 61 |
<show_in_default>1</show_in_default>
|
| 62 |
-
<show_in_website>
|
| 63 |
-
<show_in_store>
|
| 64 |
<fields>
|
| 65 |
<retrieve_score translate="label">
|
| 66 |
<label>Retrieve Signifyd scores</label>
|
|
@@ -104,6 +104,28 @@
|
|
| 104 |
<comment><![CDATA[0-1000. Threshold at which orders get put on HOLD. Default is 500.]]></comment>
|
| 105 |
<depends><hold_orders>1</hold_orders></depends>
|
| 106 |
</hold_orders_threshold>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
</fields>
|
| 108 |
</advanced>
|
| 109 |
<log translate="label">
|
| 59 |
<frontend_type>text</frontend_type>
|
| 60 |
<sort_order>2</sort_order>
|
| 61 |
<show_in_default>1</show_in_default>
|
| 62 |
+
<show_in_website>0</show_in_website>
|
| 63 |
+
<show_in_store>0</show_in_store>
|
| 64 |
<fields>
|
| 65 |
<retrieve_score translate="label">
|
| 66 |
<label>Retrieve Signifyd scores</label>
|
| 104 |
<comment><![CDATA[0-1000. Threshold at which orders get put on HOLD. Default is 500.]]></comment>
|
| 105 |
<depends><hold_orders>1</hold_orders></depends>
|
| 106 |
</hold_orders_threshold>
|
| 107 |
+
<invoice_orders translate="label">
|
| 108 |
+
<label>Invoice orders after receiving Signifyd Scores</label>
|
| 109 |
+
<frontend_type>select</frontend_type>
|
| 110 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 111 |
+
<sort_order>90</sort_order>
|
| 112 |
+
<show_in_default>1</show_in_default>
|
| 113 |
+
<show_in_website>1</show_in_website>
|
| 114 |
+
<show_in_store>1</show_in_store>
|
| 115 |
+
<depends><retrieve_score>1</retrieve_score></depends>
|
| 116 |
+
<comment><![CDATA[Orders that have not been held will be fully invoiced after receiving a Signifyd score when this setting is enabled. If the order cannot be invoiced, no action will be taken.]]></comment>
|
| 117 |
+
</invoice_orders>
|
| 118 |
+
<invoice_orders_notify translate="label">
|
| 119 |
+
<label>Notify customer</label>
|
| 120 |
+
<frontend_type>select</frontend_type>
|
| 121 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 122 |
+
<sort_order>95</sort_order>
|
| 123 |
+
<show_in_default>1</show_in_default>
|
| 124 |
+
<show_in_website>1</show_in_website>
|
| 125 |
+
<show_in_store>1</show_in_store>
|
| 126 |
+
<comment><![CDATA[Send email notification to customers after invoicing orders]]></comment>
|
| 127 |
+
<depends><invoice_orders>1</invoice_orders></depends>
|
| 128 |
+
</invoice_orders_notify>
|
| 129 |
</fields>
|
| 130 |
</advanced>
|
| 131 |
<log translate="label">
|
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.5.0.php
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$this->startSetup();
|
| 4 |
+
$this->register();
|
| 5 |
+
$this->run("
|
| 6 |
+
DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
|
| 7 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
|
| 8 |
+
`case_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
| 9 |
+
`order_increment` varchar(255) NOT NULL,
|
| 10 |
+
`signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
|
| 11 |
+
`code` varchar(255) NOT NULL,
|
| 12 |
+
`score` float DEFAULT NULL,
|
| 13 |
+
`entries` text NOT NULL,
|
| 14 |
+
`created` timestamp NULL DEFAULT NULL,
|
| 15 |
+
`updated` timestamp NULL DEFAULT NULL,
|
| 16 |
+
PRIMARY KEY (`case_id`)
|
| 17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
|
| 18 |
+
|
| 19 |
+
CREATE INDEX signifyd_connect_case_order ON `{$this->getTable('signifyd_connect_case')}` (order_increment);
|
| 20 |
+
");
|
| 21 |
+
$this->endSetup();
|
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.4-3.4.5.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
try {
|
| 4 |
+
$this->startSetup();
|
| 5 |
+
$this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `created_at` `created` timestamp NULL DEFAULT NULL");
|
| 6 |
+
$this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `updated_at` `updated` timestamp NULL DEFAULT NULL");
|
| 7 |
+
Mage::getConfig()->saveConfig('signifyd_connect/advanced/retrieve_score', 0, 'default', 0);
|
| 8 |
+
Mage::getConfig()->saveConfig('signifyd_connect/advanced/show_scores', 0, 'default', 0);
|
| 9 |
+
Mage::getConfig()->saveConfig('signifyd_connect/advanced/hold_orders', 0, 'default', 0);
|
| 10 |
+
$this->endSetup();
|
| 11 |
+
} catch (Exception $e) {
|
| 12 |
+
Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
|
| 13 |
+
}
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Signifyd_Connect</name>
|
| 4 |
-
<version>3.4.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
<description>Supports all versions of Magento</description>
|
| 11 |
<notes>Supports all versions of Magento</notes>
|
| 12 |
<authors><author><name>signifyd</name><user>auto-converted</user><email>manelis@signifyd.com</email></author></authors>
|
| 13 |
-
<date>2014-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Signifyd_Connect.xml" hash="bcd998a24567eba8a20423c40fba2adf"/></dir></target><target name="magecommunity"><dir name="Signifyd"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies/>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Signifyd_Connect</name>
|
| 4 |
+
<version>3.4.5</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>Supports all versions of Magento</description>
|
| 11 |
<notes>Supports all versions of Magento</notes>
|
| 12 |
<authors><author><name>signifyd</name><user>auto-converted</user><email>manelis@signifyd.com</email></author></authors>
|
| 13 |
+
<date>2014-10-29</date>
|
| 14 |
+
<time>00:48:29</time>
|
| 15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Signifyd_Connect.xml" hash="bcd998a24567eba8a20423c40fba2adf"/></dir></target><target name="magecommunity"><dir name="Signifyd"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="fcdcd4cb2933147e4b573b4fb7217992"/></dir><file name="Order.php" hash="e49f869c0aa5fb3ab6b70fb5752049ac"/></dir></dir><file name="Renderer.php" hash="5564e9c6926afbbdade26a6fe746948a"/></dir><dir name="Helper"><file name="Data.php" hash="5037f77184d4f023b7fb12e9e496ace1"/></dir><dir name="Model"><dir name="Resource"><dir name="Case"><file name="Collection.php" hash="b7dac9979a0c81db56294d1548570fc2"/></dir><file name="Case.php" hash="621fb50264bd0cdeba720dee6949a0bf"/></dir><file name="Case.php" hash="92e044f7414eddfe084320b4a2098cee"/><file name="Cron.php" hash="51665978bd2bcf67b493f2a2b450d1b8"/><file name="Link.php" hash="0027fc75ef766aa1f51a004305987937"/><file name="Observer.php" hash="06078c7b13dc1378e2c96c2df949affa"/><file name="Setup.php" hash="e803ffb4b86c7d8ec1d149e665d65877"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SignifydController.php" hash="937fa40bfd59857c738691e0fc6594e7"/></dir><file name="ConnectController.php" hash="e4a07caf8c08bee68334327693e726b2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8e72a4cdc4039ee12ad5174188b6ef3e"/><file name="config.xml" hash="61c092f6658c38abd51d5ba364ad948f"/><file name="system.xml" hash="84f0fd18d1b344731f36fa4f7958d39f"/></dir><dir name="sql"><dir name="signifyd_connect_setup"><file name="mysql4-install-3.1.1.php" hash="7fb2ccaf8352eea26e626ace6de53d80"/><file name="mysql4-install-3.3.0.php" hash="f61d0c018b28ae04d8d14b38556d18ad"/><file name="mysql4-install-3.4.0.php" hash="109cc5ca60974d0c4755dcb0f5ade3e7"/><file name="mysql4-install-3.5.0.php" hash="401b92235c0e534c941a64c60d24b851"/><file name="mysql4-upgrade-3.2.0-3.2.1.php" hash="9e36c608afd6e30e3052334e085eeff4"/><file name="mysql4-upgrade-3.2.1-3.2.2.php" hash="efcc5d46a41e549e508a693f1e77bf44"/><file name="mysql4-upgrade-3.2.2-3.2.3.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.2.3-3.3.0.php" hash="94b907c2cacde5fb9831408ce9a06190"/><file name="mysql4-upgrade-3.3.0-3.4.0.php" hash="6eb18705081483bb8d9c14adcdefd095"/><file name="mysql4-upgrade-3.4.0-3.4.1.php" hash="79f2064f1fa20d646e66aa3e7912d2a0"/><file name="mysql4-upgrade-3.4.1-3.4.2.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.4.2-3.4.3.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.4.3-3.4.4.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.4.4-3.4.5.php" hash="5b7507d6bb97bf44d27b7a89c56924bb"/></dir></dir></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies/>
|
| 18 |
</package>
|
