Signifyd_Connect - Version 3.8.0

Version Notes

Supports all versions of Magento

Download this release

Release Info

Developer Magento Core Team
Extension Signifyd_Connect
Version 3.8.0
Comparing to
See all releases


Code changes from version 3.6.0 to 3.8.0

Files changed (19) hide show
  1. app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order/Grid.php +9 -0
  2. app/code/community/Signifyd/Connect/Helper/Data.php +10 -11
  3. app/code/community/Signifyd/Connect/Model/Case.php +1 -0
  4. app/code/community/Signifyd/Connect/Model/Observer.php +44 -31
  5. app/code/community/Signifyd/Connect/Model/Resource/Case.php +2 -1
  6. app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Negative.php +22 -0
  7. app/code/community/Signifyd/Connect/controllers/ConnectController.php +246 -175
  8. app/code/community/Signifyd/Connect/etc/config.xml +1 -1
  9. app/code/community/Signifyd/Connect/etc/system.xml +20 -0
  10. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.7.0.php +18 -0
  11. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.8.0.php +19 -0
  12. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.8-3.5.0.php +8 -0
  13. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.0-3.5.1.php +8 -0
  14. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.1-3.5.2.php +8 -0
  15. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.2-3.5.3.php +8 -0
  16. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.3-3.6.0.php +8 -0
  17. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.6.0-3.7.0.php +31 -0
  18. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.7.0-3.8.0.php +10 -0
  19. package.xml +4 -4
app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order/Grid.php CHANGED
@@ -43,6 +43,7 @@ class Signifyd_Connect_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_B
43
'signifyd.order_increment = main_table.increment_id',
44
array(
45
'score' => 'score',
46
)
47
);
48
}
@@ -97,6 +98,14 @@ class Signifyd_Connect_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_B
97
'renderer' => 'signifyd_connect/renderer',
98
'width' => '100px',
99
));
100
101
$this->addColumn('order_status', array(
102
'header' => $helper->__('Status'),
43
'signifyd.order_increment = main_table.increment_id',
44
array(
45
'score' => 'score',
46
+ 'guarantee' => 'guarantee',
47
)
48
);
49
}
98
'renderer' => 'signifyd_connect/renderer',
99
'width' => '100px',
100
));
101
+
102
+ $this->addColumn('guarantee', array(
103
+ 'header' => $helper->__('Signifyd Guarantee Status'),
104
+ 'align' => 'left',
105
+ 'type' => 'text',
106
+ 'index' => 'guarantee',
107
+ 'filter' => false,
108
+ ));
109
110
$this->addColumn('order_status', array(
111
'header' => $helper->__('Status'),
app/code/community/Signifyd/Connect/Helper/Data.php CHANGED
@@ -17,12 +17,10 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
17
18
public function getCaseUrl($order_id)
19
{
20
- $collection = Mage::getModel('signifyd_connect/case')->getCollection()->addFieldToFilter('order_increment', $order_id);
21
-
22
- foreach ($collection as $case) {
23
- if ($case->getCode()) {
24
- return "https://www.signifyd.com/cases/" . $case->getCode();
25
- }
26
}
27
Mage::log('Case URL not found: '.$order_id, null, 'signifyd_connect.log');
28
return '';
@@ -60,9 +58,10 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
60
61
public function isProcessed($order)
62
{
63
- $collection = Mage::getModel('signifyd_connect/case')->getCollection()->addFieldToFilter('order_increment', $order->getIncrementId());
64
65
- if (count($collection)) {
66
return true;
67
}
68
@@ -87,9 +86,9 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
87
88
public function unmarkProcessed($order)
89
{
90
- $collection = Mage::getModel('signifyd_connect/case')->getCollection()->addFieldToFilter('order_increment', $order->getIncrementId());
91
-
92
- foreach ($collection as $case) {
93
$case->delete();
94
}
95
}
17
18
public function getCaseUrl($order_id)
19
{
20
+ $case = Mage::getModel('signifyd_connect/case')->load($order_id);
21
+
22
+ if ($case->getCode()) {
23
+ return "https://www.signifyd.com/cases/" . $case->getCode();
24
}
25
Mage::log('Case URL not found: '.$order_id, null, 'signifyd_connect.log');
26
return '';
58
59
public function isProcessed($order)
60
{
61
+ $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
62
63
+ if ($case)
64
+ {
65
return true;
66
}
67
86
87
public function unmarkProcessed($order)
88
{
89
+ $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
90
+ if($case)
91
+ {
92
$case->delete();
93
}
94
}
app/code/community/Signifyd/Connect/Model/Case.php CHANGED
@@ -5,5 +5,6 @@ class Signifyd_Connect_Model_Case extends Mage_Core_Model_Abstract
5
protected function _construct()
6
{
7
$this->_init('signifyd_connect/case');
8
}
9
}
5
protected function _construct()
6
{
7
$this->_init('signifyd_connect/case');
8
+ $this->_isPkAutoIncrement = false;
9
}
10
}
app/code/community/Signifyd/Connect/Model/Observer.php CHANGED
@@ -17,11 +17,12 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
17
$helper = Mage::helper('signifyd_connect');
18
19
foreach ($this->quote->getAllItems() as $item) {
20
- if (!$item->getProductType() || $item->getProductType() == 'simple') {
21
$product_object = $item->getData('product');
22
23
if (!$product_object || !$product_object->getId()) {
24
- $product_object = Mage::getModel('catalog/product')->load($item->getProductId());
25
}
26
27
if ($product_object) {
@@ -444,18 +445,12 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
444
}
445
446
if ($order && $order->getId()) {
447
- if (Mage::helper('signifyd_connect')->isProcessed($order) && !$this->getForceProcess()) {
448
- return;
449
- }
450
-
451
$payments = $order->getPaymentsCollection();
452
453
foreach ($payments as $payment) {
454
$this->payment = $payment;
455
}
456
457
- $method = $this->payment->getMethod();
458
-
459
$state = $order->getState();
460
461
if (!$state || $state == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
@@ -487,14 +482,14 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
487
488
if (substr($response_code, 0, 1) == '2') {
489
$response_data = json_decode($response->getRawResponse(), true);
490
-
491
- $case_object = Mage::getModel('signifyd_connect/case')->load($case_object->getId());
492
$case_object->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
493
$case_object->setCode($response_data['investigationId']);
494
$case_object->save();
495
}
496
} catch (Exception $e) {
497
-
498
}
499
}
500
} catch (Exception $e) {
@@ -634,7 +629,6 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
634
$request = Mage::app()->getRequest();
635
$module = $request->getModuleName();
636
$controller = $request->getControllerName();
637
- $action = $request->getActionName();
638
639
if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
640
return;
@@ -642,13 +636,16 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
642
643
$collection = $observer->getOrderGridCollection();
644
$select = $collection->getSelect();
645
-
646
- if (Mage::getStoreConfig('signifyd_connect/advanced/show_scores')) {
647
if ($this->oldSupport()) {
648
$select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=e.increment_id', array('score'=>'score'));
649
$this->joins++;
650
} else {
651
- $select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=main_table.increment_id', array('score'=>'score'));
652
$this->joins++;
653
}
654
@@ -659,11 +656,12 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
659
660
public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer)
661
{
662
- if (Mage::getStoreConfig('signifyd_connect/advanced/show_scores')) {
663
$request = Mage::app()->getRequest();
664
$module = $request->getModuleName();
665
$controller = $request->getControllerName();
666
- $action = $request->getActionName();
667
668
if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
669
return;
@@ -673,20 +671,35 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
673
$block = $observer->getEvent()->getBlock();
674
675
if ($block->getId() == 'sales_order_grid') {
676
- $block->addColumnAfter(
677
- 'score',
678
- array(
679
- 'header' => $helper->__('Signifyd Score'),
680
- 'align' => 'left',
681
- 'type' => 'text',
682
- 'index' => 'score',
683
- 'filter' => false,
684
- 'renderer' => 'signifyd_connect/renderer',
685
- 'width' => '100px',
686
- ),
687
- 'status'
688
- );
689
-
690
$block->sortColumnsByOrder();
691
}
692
}
17
$helper = Mage::helper('signifyd_connect');
18
19
foreach ($this->quote->getAllItems() as $item) {
20
+ $product_type = $item->getProductType();
21
+ if (!$product_type || $product_type == 'simple' || $product_type == 'downloadable') {
22
$product_object = $item->getData('product');
23
24
if (!$product_object || !$product_object->getId()) {
25
+ $product_object = Mage::getModel('catalog/product')->load($product_type);
26
}
27
28
if ($product_object) {
445
}
446
447
if ($order && $order->getId()) {
448
$payments = $order->getPaymentsCollection();
449
450
foreach ($payments as $payment) {
451
$this->payment = $payment;
452
}
453
454
$state = $order->getState();
455
456
if (!$state || $state == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
482
483
if (substr($response_code, 0, 1) == '2') {
484
$response_data = json_decode($response->getRawResponse(), true);
485
+
486
+ $case_object = Mage::getModel('signifyd_connect/case')->load($case_object->getOrderIncrement());
487
$case_object->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
488
$case_object->setCode($response_data['investigationId']);
489
$case_object->save();
490
}
491
} catch (Exception $e) {
492
+ Mage::log($e->__toString(), null, 'signifyd_connect.log');
493
}
494
}
495
} catch (Exception $e) {
629
$request = Mage::app()->getRequest();
630
$module = $request->getModuleName();
631
$controller = $request->getControllerName();
632
633
if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
634
return;
636
637
$collection = $observer->getOrderGridCollection();
638
$select = $collection->getSelect();
639
+
640
+ $show_scores = Mage::getStoreConfig('signifyd_connect/advanced/show_scores');
641
+ $show_guarantee = Mage::getStoreConfig('signifyd_connect/advanced/show_guarantee');
642
+ if ($show_scores || $show_guarantee) {
643
if ($this->oldSupport()) {
644
$select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=e.increment_id', array('score'=>'score'));
645
$this->joins++;
646
} else {
647
+ $select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=main_table.increment_id', array('score'=>'score',
648
+ 'guarantee' => 'guarantee'));
649
$this->joins++;
650
}
651
656
657
public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer)
658
{
659
+ $show_scores = Mage::getStoreConfig('signifyd_connect/advanced/show_scores');
660
+ $show_guarantee = Mage::getStoreConfig('signifyd_connect/advanced/show_guarantee');
661
+ if ($show_scores || $show_guarantee) {
662
$request = Mage::app()->getRequest();
663
$module = $request->getModuleName();
664
$controller = $request->getControllerName();
665
666
if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
667
return;
671
$block = $observer->getEvent()->getBlock();
672
673
if ($block->getId() == 'sales_order_grid') {
674
+ if($show_scores) {
675
+ $block->addColumnAfter(
676
+ 'score',
677
+ array(
678
+ 'header' => $helper->__('Signifyd Score'),
679
+ 'align' => 'left',
680
+ 'type' => 'text',
681
+ 'index' => 'score',
682
+ 'filter' => false,
683
+ 'renderer' => 'signifyd_connect/renderer',
684
+ 'width' => '100px',
685
+ ),
686
+ 'status'
687
+ );
688
+ }
689
+ if($show_guarantee) {
690
+ $block->addColumnAfter(
691
+ 'guarantee',
692
+ array(
693
+ 'header' => $helper->__('Guarantee Status'),
694
+ 'align' => 'left',
695
+ 'type' => 'text',
696
+ 'index' => 'guarantee',
697
+ 'filter' => false,
698
+ 'width' => '100px',
699
+ ),
700
+ 'status'
701
+ );
702
+ }
703
$block->sortColumnsByOrder();
704
}
705
}
app/code/community/Signifyd/Connect/Model/Resource/Case.php CHANGED
@@ -4,6 +4,7 @@ class Signifyd_Connect_Model_Resource_Case extends Mage_Core_Model_Mysql4_Abstra
4
{
5
protected function _construct()
6
{
7
- $this->_init('signifyd_connect/case', 'case_id');
8
}
9
}
4
{
5
protected function _construct()
6
{
7
+ $this->_init('signifyd_connect/case', 'order_increment');
8
+ $this->_isPkAutoIncrement = false;
9
}
10
}
app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Negative.php ADDED
@@ -0,0 +1,22 @@
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_System_Config_Source_Options_Negative
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array(
9
+ 'value' => 'nothing',
10
+ 'label' => 'Nothing',
11
+ ),
12
+ array(
13
+ 'value' => 'hold',
14
+ 'label' => 'Hold Order',
15
+ ),
16
+ array(
17
+ 'value' => 'cancel',
18
+ 'label' => 'Cancel Order',
19
+ ),
20
+ );
21
+ }
22
+ }
app/code/community/Signifyd/Connect/controllers/ConnectController.php CHANGED
@@ -7,164 +7,236 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
7
public $_order = false;
8
public $_store_id = null;
9
public $_case = false;
10
-
11
public function getApiKey()
12
{
13
return Mage::getStoreConfig('signifyd_connect/settings/key');
14
}
15
-
16
public function holdThreshold()
17
{
18
return (int)Mage::getStoreConfig('signifyd_connect/advanced/hold_orders_threshold', $this->_store_id);
19
}
20
-
21
- public function canHold()
22
{
23
return Mage::getStoreConfig('signifyd_connect/advanced/hold_orders', $this->_store_id);
24
}
25
-
26
public function canInvoice()
27
{
28
return Mage::getStoreConfig('signifyd_connect/advanced/invoice_orders', $this->_store_id);
29
}
30
-
31
public function notifyCustomer()
32
{
33
return Mage::getStoreConfig('signifyd_connect/advanced/invoice_orders_notify', $this->_store_id);
34
}
35
-
36
public function enabled()
37
{
38
$retrieve_scores = Mage::getStoreConfig('signifyd_connect/advanced/retrieve_score');
39
$enabled = Mage::getStoreConfig('signifyd_connect/settings/enabled');
40
-
41
return $enabled && $retrieve_scores;
42
}
43
-
44
-
45
public function getUrl($code)
46
{
47
return Mage::getStoreConfig('signifyd_connect/settings/url', $this->_store_id) . '/cases/' . $code;
48
}
49
-
50
public function logErrors()
51
{
52
return Mage::getStoreConfig('signifyd_connect/log/error');
53
}
54
-
55
public function logRequest()
56
{
57
return Mage::getStoreConfig('signifyd_connect/log/request');
58
}
59
-
60
public function getRawPost()
61
{
62
if (isset($HTTP_RAW_POST_DATA) && $HTTP_RAW_POST_DATA) {
63
return $HTTP_RAW_POST_DATA;
64
}
65
-
66
$post = file_get_contents("php://input");
67
-
68
if ($post) {
69
return $post;
70
}
71
-
72
return '';
73
}
74
-
75
public function getDefaultMessage()
76
{
77
return 'This URL is working! Please copy & paste the current URL into your <a href="https://signifyd.com/settings">settings</a> page in the Notifications section';
78
}
79
-
80
public function getDisabledMessage()
81
{
82
return 'This URL is disabled in the Magento admin panel! Please enable score retrieval under Admin>System>Config>Signifyd Connect>Advanced before setting this url in your Signifyd <a href="https://signifyd.com/settings">settings</a> page.';
83
}
84
-
85
public function unsupported()
86
{
87
Mage::app()->getResponse()
88
- ->setHeader('HTTP/1.1','403 Forbidden')
89
->sendResponse();
90
echo 'This request type is currently unsupported';
91
exit;
92
}
93
-
94
public function complete()
95
{
96
Mage::app()->getResponse()
97
- ->setHeader('HTTP/1.1','200 Ok')
98
->sendResponse();
99
-
100
exit;
101
}
102
-
103
public function validRequest($request, $hash)
104
{
105
$check = base64_encode(hash_hmac('sha256', $request, $this->getApiKey(), true));
106
-
107
if ($this->logRequest()) {
108
Mage::log('API request hash check: ' . $check, null, 'signifyd_connect.log');
109
}
110
-
111
if ($check == $hash) {
112
return true;
113
}
114
-
115
return false;
116
}
117
-
118
public function initCase($order_increment)
119
{
120
$case = false;
121
122
- if (isset($this->_request['orderId'])) {
123
- $cases = Mage::getModel('signifyd_connect/case')->getCollection();
124
- $cases->addFieldToFilter('order_increment', $this->_request['orderId']);
125
-
126
- foreach ($cases as $c) {
127
- $case = $c;
128
- break;
129
- }
130
}
131
132
return $case;
133
}
134
-
135
public function initRequest($request)
136
{
137
$this->_request = json_decode($request, true);
138
-
139
$topic = $this->getHeader('X-SIGNIFYD-TOPIC');
140
-
141
$this->_topic = $topic;
142
-
143
$this->_case = $this->initCase($this->_request['orderId']);
144
-
145
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_request['orderId']);
146
-
147
if ($this->_order && $this->_order->getId()) {
148
$this->_store_id = $this->_order->getStoreId();
149
}
150
-
151
if (!$this->_case && $this->logRequest()) {
152
Mage::log('No matching case was found for this request. order_increment: ' . $this->_request['orderId'], null, 'signifyd_connect.log');
153
}
154
}
155
-
156
public function holdOrder($order)
157
{
158
- if ($order && $order->getId() && $order->canHold() && $this->canHold()) {
159
$order->hold();
160
$order->save();
161
-
162
if ($this->logRequest()) {
163
Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
164
}
165
}
166
}
167
-
168
public function invoiceOrder($order)
169
{
170
if ($order && $order->getId() && $order->canInvoice() && $this->canInvoice()) {
@@ -172,12 +244,12 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
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()) {
@@ -186,144 +258,134 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
186
}
187
}
188
}
189
-
190
- public function processAdditional($case, $original_status=false)
191
- {
192
- if ($this->canHold() || $this->canInvoice()) {
193
- $order = $this->_order;
194
- $held = false;
195
-
196
- if ($order && $order->getId() && $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 ($order && $order->getId() && $this->canInvoice() && !$held && !$original_status) {
228
$this->invoiceOrder($order);
229
}
230
}
231
}
232
-
233
public function processCreation()
234
{
235
$case = $this->_case;
236
-
237
if (!$case) {
238
return;
239
}
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()
276
{
277
$case = $this->_case;
278
-
279
if (!$case) {
280
return;
281
}
282
-
283
$original_status = $case->getSignifydStatus();
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 caseLookup()
316
{
317
$result = false;
318
$case = $this->_case;
319
-
320
try {
321
$url = $this->getUrl($case->getCode());
322
-
323
$response = Mage::helper('signifyd_connect')->request($url, null, $this->getApiKey(), null, 'application/json');
324
-
325
$response_code = $response->getHttpCode();
326
-
327
if (substr($response_code, 0, 1) == '2') {
328
$result = json_decode($response->getRawResponse(), true);
329
} else {
@@ -336,42 +398,37 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
336
Mage::log('Fallback issue: ' . $e->__toString(), null, 'signifyd_connect.log');
337
}
338
}
339
-
340
return $result;
341
}
342
-
343
public function processFallback($request)
344
{
345
if ($this->logRequest()) {
346
Mage::log('Attempting auth via fallback request', null, 'signifyd_connect.log');
347
}
348
-
349
$request = json_decode($request, true);
350
-
351
$this->_topic = "cases/review"; // Topic header is most likely not available
352
353
- if (is_array($request) && isset($request['orderId'])) {
354
- $cases = Mage::getModel('signifyd_connect/case')->getCollection();
355
- $cases->addFieldToFilter('order_increment', $request['orderId']);
356
-
357
- foreach ($cases as $case) {
358
- $this->_case = $case;
359
- break;
360
- }
361
}
362
-
363
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_request['orderId']);
364
-
365
if ($this->_order && $this->_order->getId()) {
366
$this->_store_id = $this->_order->getStoreId();
367
}
368
-
369
if ($this->_case) {
370
$lookup = $this->caseLookup();
371
-
372
if ($lookup && is_array($lookup)) {
373
$this->_request = $lookup;
374
-
375
$this->processReview();
376
} else {
377
if ($this->logRequest()) {
@@ -384,7 +441,7 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
384
}
385
}
386
}
387
-
388
public function getHeader($header)
389
{
390
// T379: Some frameworks add an extra HTTP_ before the header, so check for both names
@@ -403,34 +460,34 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
403
return '';
404
405
}
406
-
407
public function apiAction()
408
{
409
if (!$this->enabled()) {
410
echo $this->getDisabledMessage();
411
-
412
return;
413
}
414
-
415
$request = $this->getRawPost();
416
-
417
$hash = $this->getHeader('X-SIGNIFYD-SEC-HMAC-SHA256');
418
-
419
if ($this->logRequest()) {
420
Mage::log('API request: ' . $request, null, 'signifyd_connect.log');
421
Mage::log('API request hash: ' . $hash, null, 'signifyd_connect.log');
422
}
423
-
424
if ($request) {
425
if ($this->validRequest($request, $hash)) {
426
$this->initRequest($request);
427
-
428
$topic = $this->_topic;
429
-
430
if ($this->logRequest()) {
431
Mage::log('API request topic: ' . $topic, null, 'signifyd_connect.log');
432
}
433
-
434
switch ($topic) {
435
case "cases/creation":
436
try {
@@ -451,6 +508,19 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
451
}
452
}
453
break;
454
default:
455
$this->unsupported();
456
}
@@ -458,13 +528,14 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
458
if ($this->logRequest()) {
459
Mage::log('API request failed auth', null, 'signifyd_connect.log');
460
}
461
-
462
$this->processFallback($request);
463
}
464
} else {
465
echo $this->getDefaultMessage();
466
}
467
-
468
$this->complete();
469
}
470
}
7
public $_order = false;
8
public $_store_id = null;
9
public $_case = false;
10
+
11
public function getApiKey()
12
{
13
return Mage::getStoreConfig('signifyd_connect/settings/key');
14
}
15
+
16
public function holdThreshold()
17
{
18
return (int)Mage::getStoreConfig('signifyd_connect/advanced/hold_orders_threshold', $this->_store_id);
19
}
20
+
21
+ public function canReviewHold()
22
{
23
return Mage::getStoreConfig('signifyd_connect/advanced/hold_orders', $this->_store_id);
24
}
25
+
26
public function canInvoice()
27
{
28
return Mage::getStoreConfig('signifyd_connect/advanced/invoice_orders', $this->_store_id);
29
}
30
+
31
public function notifyCustomer()
32
{
33
return Mage::getStoreConfig('signifyd_connect/advanced/invoice_orders_notify', $this->_store_id);
34
}
35
+
36
+ public function negativeGuaranteeAction()
37
+ {
38
+ return Mage::getStoreConfig('signifyd_connect/advanced/guarantee_negative_action', $this->_store_id);
39
+ }
40
+
41
+ public function positiveGuaranteeAction()
42
+ {
43
+ return 'nothing';
44
+ }
45
+
46
public function enabled()
47
{
48
$retrieve_scores = Mage::getStoreConfig('signifyd_connect/advanced/retrieve_score');
49
$enabled = Mage::getStoreConfig('signifyd_connect/settings/enabled');
50
+
51
return $enabled && $retrieve_scores;
52
}
53
+
54
+
55
public function getUrl($code)
56
{
57
return Mage::getStoreConfig('signifyd_connect/settings/url', $this->_store_id) . '/cases/' . $code;
58
}
59
+
60
public function logErrors()
61
{
62
return Mage::getStoreConfig('signifyd_connect/log/error');
63
}
64
+
65
public function logRequest()
66
{
67
return Mage::getStoreConfig('signifyd_connect/log/request');
68
}
69
+
70
public function getRawPost()
71
{
72
if (isset($HTTP_RAW_POST_DATA) && $HTTP_RAW_POST_DATA) {
73
return $HTTP_RAW_POST_DATA;
74
}
75
+
76
$post = file_get_contents("php://input");
77
+
78
if ($post) {
79
return $post;
80
}
81
+
82
return '';
83
}
84
+
85
public function getDefaultMessage()
86
{
87
return 'This URL is working! Please copy & paste the current URL into your <a href="https://signifyd.com/settings">settings</a> page in the Notifications section';
88
}
89
+
90
public function getDisabledMessage()
91
{
92
return 'This URL is disabled in the Magento admin panel! Please enable score retrieval under Admin>System>Config>Signifyd Connect>Advanced before setting this url in your Signifyd <a href="https://signifyd.com/settings">settings</a> page.';
93
}
94
+
95
public function unsupported()
96
{
97
Mage::app()->getResponse()
98
+ ->setHeader('HTTP/1.1', '403 Forbidden')
99
->sendResponse();
100
echo 'This request type is currently unsupported';
101
exit;
102
}
103
+
104
public function complete()
105
{
106
Mage::app()->getResponse()
107
+ ->setHeader('HTTP/1.1', '200 Ok')
108
->sendResponse();
109
+
110
exit;
111
}
112
+
113
+ private function updateScore($case)
114
+ {
115
+ if (isset($this->_request['score'])) {
116
+ $case->setScore($this->_request['score']);
117
+
118
+ if ($this->logRequest()) {
119
+ Mage::log('Set score to ' . $this->_request['score'], null, 'signifyd_connect.log');
120
+ }
121
+ } else {
122
+ if ($this->logRequest()) {
123
+ Mage::log('No score value available', null, 'signifyd_connect.log');
124
+ }
125
+ }
126
+ }
127
+
128
+ private function updateStatus($case)
129
+ {
130
+ if (isset($this->_request['status'])) {
131
+ $case->setSignifydStatus($this->_request['status']);
132
+
133
+ if ($this->logRequest()) {
134
+ Mage::log('Set status to ' . $this->_request['status'], null, 'signifyd_connect.log');
135
+ }
136
+ } else {
137
+ if ($this->logRequest()) {
138
+ Mage::log('No status value available', null, 'signifyd_connect.log');
139
+ }
140
+ }
141
+ }
142
+
143
+ private function updateGuarantee($case)
144
+ {
145
+ if (isset($this->_request['guaranteeDisposition'])) {
146
+ $case->setGuarantee($this->_request['guaranteeDisposition']);
147
+
148
+ if ($this->logRequest()) {
149
+ Mage::log('Set guarantee to ' . $this->_request['guaranteeDisposition'], null, 'signifyd_connect.log');
150
+ }
151
+ } else {
152
+ if ($this->logRequest()) {
153
+ Mage::log('No guarantee available', null, 'signifyd_connect.log');
154
+ }
155
+ }
156
+ }
157
+
158
public function validRequest($request, $hash)
159
{
160
$check = base64_encode(hash_hmac('sha256', $request, $this->getApiKey(), true));
161
+
162
if ($this->logRequest()) {
163
Mage::log('API request hash check: ' . $check, null, 'signifyd_connect.log');
164
}
165
+
166
if ($check == $hash) {
167
return true;
168
}
169
+ else if ($this->getHeader('X-SIGNIFYD-TOPIC') == "cases/test"){
170
+ // In the case that this is a webhook test, the encoding ABCDE is allowed
171
+ $check = base64_encode(hash_hmac('sha256', $request, 'ABCDE', true));
172
+ if ($check == $hash) {
173
+ return true;
174
+ }
175
+ }
176
+
177
return false;
178
}
179
+
180
public function initCase($order_increment)
181
{
182
$case = false;
183
184
+ if (isset($this->_request['orderId']))
185
+ {
186
+ $case = Mage::getModel('signifyd_connect/case')->load($this->_request['orderId']);
187
}
188
189
return $case;
190
}
191
+
192
public function initRequest($request)
193
{
194
$this->_request = json_decode($request, true);
195
+
196
$topic = $this->getHeader('X-SIGNIFYD-TOPIC');
197
+
198
$this->_topic = $topic;
199
+
200
+ // For the webhook test, all of the request data will be invalid
201
+ if ($topic == "cases/test") return;
202
+
203
$this->_case = $this->initCase($this->_request['orderId']);
204
+
205
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_request['orderId']);
206
+
207
if ($this->_order && $this->_order->getId()) {
208
$this->_store_id = $this->_order->getStoreId();
209
}
210
+
211
if (!$this->_case && $this->logRequest()) {
212
Mage::log('No matching case was found for this request. order_increment: ' . $this->_request['orderId'], null, 'signifyd_connect.log');
213
}
214
}
215
+
216
public function holdOrder($order)
217
{
218
+ if ($order && $order->getId() && $order->canHold()) {
219
$order->hold();
220
$order->save();
221
+
222
if ($this->logRequest()) {
223
Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
224
}
225
}
226
}
227
+
228
+ public function cancelOrder($order)
229
+ {
230
+ if ($order && $order->getId() && $order->canCancel()) {
231
+ $order->cancel();
232
+ $order->save();
233
+
234
+ if ($this->logRequest()) {
235
+ Mage::log('Order ' . $order->getId() . ' cancelled', null, 'signifyd_connect.log');
236
+ }
237
+ }
238
+ }
239
+
240
public function invoiceOrder($order)
241
{
242
if ($order && $order->getId() && $order->canInvoice() && $this->canInvoice()) {
244
foreach ($order->getAllItems() as $item) {
245
$items[$item->getId()] = $item->getQtyOrdered();
246
}
247
+
248
$invoice_api = Mage::getModel('sales/order_invoice_api');
249
+
250
try {
251
$invoice_id = $invoice_api->create($order->getIncrementId(), $items, null, false, true);
252
+
253
$invoice_api->capture($invoice_id);
254
} catch (Exception $e) {
255
if ($this->logErrors()) {
258
}
259
}
260
}
261
+
262
+ public function processAdditional($case, $original_status = false)
263
+ {
264
+ $order = $this->_order;
265
+ $impeded = false;
266
+
267
+ if ($order && $order->getId()) {
268
+ $threshold = $this->holdThreshold();
269
+
270
+ $negativeAction = $this->negativeGuaranteeAction();
271
+ if ($this->_request['guaranteeDisposition'] == 'DECLINED' && $negativeAction != 'nothing') {
272
+ if($negativeAction == 'hold') {
273
+ $this->holdOrder($order);
274
+ $impeded = true;
275
+ }
276
+ else if($negativeAction == 'cancel') {
277
+ $this->cancelOrder($order);
278
+ $impeded = true;
279
+ }
280
+ else {
281
+ Mage::log("Unknown action $negativeAction", null, 'signifyd_connect.log');
282
+ }
283
+ }
284
+ if (!$original_status || $original_status == 'PENDING') {
285
+ if ($threshold && $case->getScore() <= $threshold && $this->canReviewHold()) {
286
+ $this->holdOrder($order);
287
+ $impeded = true;
288
+ }
289
+ } else if ($original_status) {
290
+ if ($this->_request['reviewDisposition'] == 'FRAUDULENT') {
291
+ if ($order->canHold() && $this->canReviewHold()) {
292
+ $order->hold();
293
+ $order->save();
294
+
295
+ if ($this->logRequest()) {
296
+ Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
297
}
298
+ }
299
+ } else if ($this->_request['reviewDisposition'] == 'GOOD') {
300
+ if ($order->canUnhold() && $this->canReviewHold()) {
301
+ $order->unhold();
302
+ $order->save();
303
+
304
+ if ($this->logRequest()) {
305
+ Mage::log('Order ' . $order->getId() . ' unheld', null, 'signifyd_connect.log');
306
}
307
}
308
}
309
}
310
+
311
+ if ($order && $order->getId() && $this->canInvoice() && !$impeded && !$original_status) {
312
$this->invoiceOrder($order);
313
}
314
}
315
}
316
+
317
public function processCreation()
318
{
319
$case = $this->_case;
320
+
321
if (!$case) {
322
return;
323
}
324
+
325
+ $this->updateScore($case);
326
+ $this->updateStatus($case);
327
+
328
$case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
329
$case->save();
330
+
331
if ($this->logRequest()) {
332
Mage::log('Case ' . $case->getId() . ' created with status ' . $case->getSignifydStatus() . ' and score ' . $case->getScore(), null, 'signifyd_connect.log');
333
}
334
+
335
$this->processAdditional($case);
336
}
337
+
338
public function processReview()
339
{
340
$case = $this->_case;
341
+
342
if (!$case) {
343
return;
344
}
345
+
346
$original_status = $case->getSignifydStatus();
347
+
348
+ $this->updateScore($case);
349
+ $this->updateStatus($case);
350
+
351
+ $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
352
+ $case->save();
353
+
354
+ $this->processAdditional($case, $original_status);
355
+ }
356
+
357
+ public function processGuarantee()
358
+ {
359
+ $case = $this->_case;
360
+
361
+ if (!$case) {
362
+ return;
363
}
364
+
365
+ $original_status = $case->getSignifydStatus();
366
+
367
+ $this->updateScore($case);
368
+ $this->updateStatus($case);
369
+ $this->updateGuarantee($case);
370
+
371
$case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
372
$case->save();
373
+
374
$this->processAdditional($case, $original_status);
375
}
376
+
377
public function caseLookup()
378
{
379
$result = false;
380
$case = $this->_case;
381
+
382
try {
383
$url = $this->getUrl($case->getCode());
384
+
385
$response = Mage::helper('signifyd_connect')->request($url, null, $this->getApiKey(), null, 'application/json');
386
+
387
$response_code = $response->getHttpCode();
388
+
389
if (substr($response_code, 0, 1) == '2') {
390
$result = json_decode($response->getRawResponse(), true);
391
} else {
398
Mage::log('Fallback issue: ' . $e->__toString(), null, 'signifyd_connect.log');
399
}
400
}
401
+
402
return $result;
403
}
404
+
405
public function processFallback($request)
406
{
407
if ($this->logRequest()) {
408
Mage::log('Attempting auth via fallback request', null, 'signifyd_connect.log');
409
}
410
+
411
$request = json_decode($request, true);
412
+
413
$this->_topic = "cases/review"; // Topic header is most likely not available
414
415
+ if (is_array($request) && isset($request['orderId']))
416
+ {
417
+ $this->_case = Mage::getModel('signifyd_connect/case')->load($request['orderId']);
418
}
419
+
420
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_request['orderId']);
421
+
422
if ($this->_order && $this->_order->getId()) {
423
$this->_store_id = $this->_order->getStoreId();
424
}
425
+
426
if ($this->_case) {
427
$lookup = $this->caseLookup();
428
+
429
if ($lookup && is_array($lookup)) {
430
$this->_request = $lookup;
431
+
432
$this->processReview();
433
} else {
434
if ($this->logRequest()) {
441
}
442
}
443
}
444
+
445
public function getHeader($header)
446
{
447
// T379: Some frameworks add an extra HTTP_ before the header, so check for both names
460
return '';
461
462
}
463
+
464
public function apiAction()
465
{
466
if (!$this->enabled()) {
467
echo $this->getDisabledMessage();
468
+
469
return;
470
}
471
+
472
$request = $this->getRawPost();
473
+
474
$hash = $this->getHeader('X-SIGNIFYD-SEC-HMAC-SHA256');
475
+
476
if ($this->logRequest()) {
477
Mage::log('API request: ' . $request, null, 'signifyd_connect.log');
478
Mage::log('API request hash: ' . $hash, null, 'signifyd_connect.log');
479
}
480
+
481
if ($request) {
482
if ($this->validRequest($request, $hash)) {
483
$this->initRequest($request);
484
+
485
$topic = $this->_topic;
486
+
487
if ($this->logRequest()) {
488
Mage::log('API request topic: ' . $topic, null, 'signifyd_connect.log');
489
}
490
+
491
switch ($topic) {
492
case "cases/creation":
493
try {
508
}
509
}
510
break;
511
+ case "guarantees/completion":
512
+ try {
513
+ $this->processGuarantee($request);
514
+ } catch (Exception $ex) {
515
+ if ($this->logErrors()) {
516
+ Mage::log('Case guarantee issue: ' . $ex->__toString(), null, 'signifyd_connect.log');
517
+ }
518
+ }
519
+ break;
520
+ case "cases/test":
521
+ // Test is only verifying that the endpoint is reachable. So we just complete here
522
+ break;
523
+
524
default:
525
$this->unsupported();
526
}
528
if ($this->logRequest()) {
529
Mage::log('API request failed auth', null, 'signifyd_connect.log');
530
}
531
+
532
$this->processFallback($request);
533
}
534
} else {
535
echo $this->getDefaultMessage();
536
}
537
+
538
$this->complete();
539
}
540
+
541
}
app/code/community/Signifyd/Connect/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
<config>
4
<modules>
5
<Signifyd_Connect>
6
- <version>3.6.0</version>
7
</Signifyd_Connect>
8
</modules>
9
<global>
3
<config>
4
<modules>
5
<Signifyd_Connect>
6
+ <version>3.8.0</version>
7
</Signifyd_Connect>
8
</modules>
9
<global>
app/code/community/Signifyd/Connect/etc/system.xml CHANGED
@@ -104,6 +104,26 @@
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>
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
+ <show_guarantee translate="label">
108
+ <label>Show Guarantee status in Magento Order Grid</label>
109
+ <frontend_type>select</frontend_type>
110
+ <source_model>adminhtml/system_config_source_yesno</source_model>
111
+ <sort_order>80</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>0</show_in_website>
114
+ <show_in_store>0</show_in_store>
115
+ <comment><![CDATA[You will be able to view current guarantee status in the Magento Order Grid when enabled]]></comment>
116
+ </show_guarantee>
117
+ <guarantee_negative_action translate="label">
118
+ <label>Action on Guarantee Decline</label>
119
+ <frontend_type>select</frontend_type>
120
+ <source_model>signifyd_connect/system_config_source_options_negative</source_model>
121
+ <sort_order>85</sort_order>
122
+ <show_in_default>1</show_in_default>
123
+ <show_in_website>1</show_in_website>
124
+ <show_in_store>1</show_in_store>
125
+ <comment><![CDATA[Which action to take on orders when the guarantee is declined]]></comment>
126
+ </guarantee_negative_action>
127
<invoice_orders translate="label">
128
<label>Invoice orders after receiving Signifyd Scores</label>
129
<frontend_type>select</frontend_type>
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.7.0.php ADDED
@@ -0,0 +1,18 @@
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
+ `order_increment` varchar(255) NOT NULL,
9
+ `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
10
+ `code` varchar(255) NOT NULL,
11
+ `score` float DEFAULT NULL,
12
+ `entries` text NOT NULL,
13
+ `created` timestamp NULL DEFAULT NULL,
14
+ `updated` timestamp NULL DEFAULT NULL,
15
+ PRIMARY KEY (`order_increment`)
16
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
17
+ ");
18
+ $this->endSetup();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.8.0.php ADDED
@@ -0,0 +1,19 @@
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
+ `order_increment` varchar(255) NOT NULL,
9
+ `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
10
+ `code` varchar(255) NOT NULL,
11
+ `score` float DEFAULT NULL,
12
+ `guarantee` VARCHAR( 64 ) NOT NULL DEFAULT 'N/A',
13
+ `entries` text NOT NULL,
14
+ `created` timestamp NULL DEFAULT NULL,
15
+ `updated` timestamp NULL DEFAULT NULL,
16
+ PRIMARY KEY (`order_increment`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
18
+ ");
19
+ $this->endSetup();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.8-3.5.0.php ADDED
@@ -0,0 +1,8 @@
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->endSetup();
6
+ } catch (Exception $e) {
7
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
8
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.0-3.5.1.php ADDED
@@ -0,0 +1,8 @@
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->endSetup();
6
+ } catch (Exception $e) {
7
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
8
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.1-3.5.2.php ADDED
@@ -0,0 +1,8 @@
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->endSetup();
6
+ } catch (Exception $e) {
7
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
8
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.2-3.5.3.php ADDED
@@ -0,0 +1,8 @@
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->endSetup();
6
+ } catch (Exception $e) {
7
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
8
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.3-3.6.0.php ADDED
@@ -0,0 +1,8 @@
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->endSetup();
6
+ } catch (Exception $e) {
7
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
8
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.6.0-3.7.0.php ADDED
@@ -0,0 +1,31 @@
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` RENAME TO temp_signifyd;");
6
+ $this->run("
7
+ CREATE TABLE `{$this->getTable('signifyd_connect_case')}` (
8
+ `order_increment` varchar(255) NOT NULL,
9
+ `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
10
+ `code` varchar(255) NOT NULL,
11
+ `score` float DEFAULT NULL,
12
+ `entries` text NOT NULL,
13
+ `created` timestamp NULL DEFAULT NULL,
14
+ `updated` timestamp NULL DEFAULT NULL,
15
+ PRIMARY KEY (`order_increment`)
16
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
17
+ ");
18
+ $this->run("
19
+ INSERT INTO `{$this->getTable('signifyd_connect_case')}` (`order_increment`, `signifyd_status`, `code`, `score`, `entries`,
20
+ `created`, `updated`)
21
+ SELECT `order_increment`, `signifyd_status`, `code`, `score`, `entries`,
22
+ MIN(`created`) as `created`, MAX(`updated`) as `updated`
23
+ FROM (SELECT `order_increment`, `signifyd_status`, `code`, `score`, `entries`,
24
+ `created`, `updated` FROM temp_signifyd ORDER BY updated DESC) as temp_by_updated
25
+ GROUP BY `order_increment`;
26
+ ");
27
+ $this->run("DROP TABLE temp_signifyd");
28
+ $this->endSetup();
29
+ } catch (Exception $e) {
30
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
31
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.7.0-3.8.0.php ADDED
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->register();
6
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `guarantee` VARCHAR( 64 ) NOT NULL DEFAULT 'N/A'");
7
+ $this->endSetup();
8
+ } catch (Exception $e) {
9
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
10
+ }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>Signifyd_Connect</name>
4
- <version>3.6.0</version>
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>2015-05-17</date>
14
- <time>02:27:32</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="2b4ecd3e91506eed6d155f8f6e299507"/></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="ecaf4c403a586b4b5c8b67c77f6ac433"/><file name="Observer.php" hash="65f9e1b5b41f6281a402b42fa5621b04"/><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="4d5cf9c36b3a72e8f1d1f80aa4752b26"/></dir><dir name="etc"><file name="adminhtml.xml" hash="894bd3f5ac76e9f602ab6ab592648b03"/><file name="config.xml" hash="34dbad6194e5aa3c294cddab92744a69"/><file name="system.xml" hash="dc115570682f75c6666d5b4657db729f"/></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.4.5.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"/><file name="mysql4-upgrade-3.4.5-3.4.6.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.4.6-3.4.7.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.4.7-3.4.8.php" hash="3ceb86495f33475774d4fc8727254cfc"/></dir></dir></dir></dir></target></contents>
16
<compatible/>
17
<dependencies/>
18
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Signifyd_Connect</name>
4
+ <version>3.8.0</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>2015-07-01</date>
14
+ <time>06:14:41</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="52843fc84cdb65214bb3469b6390bee5"/></dir><file name="Order.php" hash="e49f869c0aa5fb3ab6b70fb5752049ac"/></dir></dir><file name="Renderer.php" hash="5564e9c6926afbbdade26a6fe746948a"/></dir><dir name="Helper"><file name="Data.php" hash="d88c0c8e3a6c6780919afcc0eaa0c92c"/></dir><dir name="Model"><dir name="Resource"><dir name="Case"><file name="Collection.php" hash="b7dac9979a0c81db56294d1548570fc2"/></dir><file name="Case.php" hash="60d14407c9c90148aad543ce6868f343"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Options"><file name="Negative.php" hash="098488fbb0ea84945fdd1e1fe8449b4b"/></dir></dir></dir></dir><file name="Case.php" hash="2a28a63f02df1b9103b89a562c0abe1b"/><file name="Cron.php" hash="51665978bd2bcf67b493f2a2b450d1b8"/><file name="Link.php" hash="ecaf4c403a586b4b5c8b67c77f6ac433"/><file name="Observer.php" hash="abbab7f087c7e88e579b843f8c4bd3bb"/><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="08690c3d872e752e26d002e0adfe24ea"/></dir><dir name="etc"><file name="adminhtml.xml" hash="894bd3f5ac76e9f602ab6ab592648b03"/><file name="config.xml" hash="bf399232ab0c5eb2773a1fdac776e2ac"/><file name="system.xml" hash="eab15c87f36a8adc6b38f38a7654c66e"/></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.4.5.php" hash="401b92235c0e534c941a64c60d24b851"/><file name="mysql4-install-3.7.0.php" hash="48a9d427944a4e63a000343ab329f517"/><file name="mysql4-install-3.8.0.php" hash="0fb3583eb4481c21b84ea674abc200f0"/><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"/><file name="mysql4-upgrade-3.4.5-3.4.6.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.4.6-3.4.7.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.4.7-3.4.8.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.4.8-3.5.0.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.5.0-3.5.1.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.5.1-3.5.2.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.5.2-3.5.3.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.5.3-3.6.0.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.6.0-3.7.0.php" hash="1456a6d0ddf091be9c87b3bbc91263ba"/><file name="mysql4-upgrade-3.7.0-3.8.0.php" hash="e6fc207541cacc5079e8ea8e4d55f356"/></dir></dir></dir></dir></target></contents>
16
<compatible/>
17
<dependencies/>
18
</package>