Signifyd_Connect - Version 3.15.1

Version Notes

Supports all versions of Magento

Download this release

Release Info

Developer signifyd
Extension Signifyd_Connect
Version 3.15.1
Comparing to
See all releases


Code changes from version 3.15.0 to 3.15.1

app/code/community/Signifyd/Connect/Block/Url.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
-
4
- class Signifyd_Connect_Block_Url
5
- {
6
- public function setForm()
7
- {
8
- return Mage::getUrl('/');
9
- }
10
- }
app/code/community/Signifyd/Connect/Helper/Data.php CHANGED
@@ -7,11 +7,6 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
7
const CASE_CREATED_STATUS = 2;
8
const TRANSACTION_SENT_STATUS = 3;
9
10
- const WAITING_SUBMISSION_STATUS = "waiting_submission";
11
- const IN_REVIEW_STATUS = "in_review";
12
- const PROCESSING_RESPONSE_STATUS = "processing_response";
13
- const COMPLETED_STATUS = "completed";
14
-
15
public function logRequest($message)
16
{
17
if (Mage::getStoreConfig('signifyd_connect/log/request')) {
@@ -414,8 +409,7 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
414
415
public function getUrl()
416
{
417
- // return Mage::getStoreConfig('signifyd_connect/settings/url') . '/cases';
418
- return 'https://api.signifyd.com/v2/cases/';
419
}
420
421
public function getAuth()
@@ -479,6 +473,57 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
479
}
480
}
481
482
public function buildAndSendOrderToSignifyd($order, $forceSend = false)
483
{
484
if ($order && $order->getId()) {
@@ -500,10 +545,7 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
500
return "notready"; // Note: would not be in the order grid if this were the case
501
}
502
503
- if(is_null(Mage::registry('signifyd_action'))) {
504
- Mage::register('signifyd_action', 1); // Work will now take place
505
- }
506
-
507
$customer = null;
508
if ($order->getCustomer()) {
509
$customer = $order->getCustomer();
@@ -526,7 +568,6 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
526
$case_object->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
527
$case_object->setCode($caseId);
528
$case_object->setTransactionId($case['purchase']['transactionId']);
529
- $case_object->setMagentoStatus(self::IN_REVIEW_STATUS);
530
$case_object->save();
531
532
$order->addStatusHistoryComment("Signifyd: case $caseId created for order");
@@ -537,11 +578,44 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
537
} catch (Exception $e) {
538
Mage::log($e->__toString(), null, 'signifyd_connect.log');
539
}
540
- //$this->unmarkProcessed($order);
541
return "error";
542
}
543
}
544
545
public function getProductUrl($product)
546
{
547
$url = null;
@@ -722,69 +796,4 @@ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
722
723
return $response;
724
}
725
-
726
- /**
727
- * Get the order payment status
728
- * @param $order
729
- * @return array
730
- */
731
- public function getOrderPaymentStatus($order)
732
- {
733
- $status = array('authorize' => false, 'capture' => false, 'credit_memo' => false);
734
- $logger = Mage::helper('signifyd_connect/log');
735
- $paymentMethod = $order->getPayment();
736
- $paymentAuthorized = $paymentMethod->getBaseAmountAuthorized();
737
- $baseTotalPaid = $order->getBaseTotalPaid();
738
- $baseTotalRefunded = $order->getBaseTotalRefunded();
739
- // Maybe used in the future
740
- // $canVoid = $paymentMethod->canVoid($order);
741
- // $amountPayed = $paymentMethod->getAmountPaid();
742
- // $baseTotalCanceled = $order->getBaseTotalCanceled();
743
- // $baseTotalInvoiced = $order->getBaseTotalInvoiced();
744
-
745
- // Check authorization
746
- if(!empty($paymentAuthorized)){
747
- $status['authorize'] = true;
748
- }
749
-
750
- // Special case for Paypal payment type "order"
751
- if($this->isPaypalOrder($paymentMethod)){
752
- $paymentAdditional = $paymentMethod->getData('additional_information');
753
- if(isset($paymentAdditional['is_order_action']) && $paymentAdditional['is_order_action']){
754
- $status['authorize'] = true;
755
- }
756
- }
757
-
758
- // Check capture
759
- if(!empty($baseTotalPaid)){
760
- $status['capture'] = true;
761
- }
762
-
763
- // Check credit memo
764
- if(!empty($baseTotalRefunded)){
765
- $status['credit_memo'] = true;
766
- }
767
-
768
- // Log status
769
- $logger->addLog("Order: {$order->getIncrementId()} has a status of " . json_encode($status));
770
-
771
- return $status;
772
- }
773
-
774
- /**
775
- * Checking if the payment method si paypal_express
776
- * @param $paymentMethod
777
- * @return bool
778
- */
779
- public function isPaypalOrder($paymentMethod)
780
- {
781
- $code = $paymentMethod->getMethodInstance()->getCode();
782
- return (stripos($code, 'paypal_express') !== false)? true : false;
783
- }
784
-
785
- public function isGuarantyDeclined($order)
786
- {
787
- $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
788
- return ($case->getGuarantee() == 'DECLINED')? true : false;
789
- }
790
}
7
const CASE_CREATED_STATUS = 2;
8
const TRANSACTION_SENT_STATUS = 3;
9
10
public function logRequest($message)
11
{
12
if (Mage::getStoreConfig('signifyd_connect/log/request')) {
409
410
public function getUrl()
411
{
412
+ return Mage::getStoreConfig('signifyd_connect/settings/url') . '/cases';
413
}
414
415
public function getAuth()
473
}
474
}
475
476
+ public function bulkSend($controller)
477
+ {
478
+ try {
479
+ $orderIds = $controller->getRequest()->getParam('order_ids');
480
+ if(is_string($orderIds))
481
+ {
482
+ $orderIds = array_map('intval', explode(',', $orderIds));
483
+ }
484
+ if (!is_array($orderIds)) {
485
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')
486
+ ->__('Please select order(s)'));
487
+ } else {
488
+ // Reference T2395
489
+ $user = "Unknown";
490
+ try {
491
+ $user = Mage::getSingleton('admin/session')->getUser()->getUsername();
492
+ } catch (Exception $ex) {
493
+ $this->logError($ex->__toString());
494
+ }
495
+ $this->logRequest("Bulk send initiated by: $user");
496
+
497
+ $collection = Mage::getModel('sales/order')->getCollection()
498
+ ->addFieldToSelect('*')
499
+ ->addFieldToFilter('entity_id', array('in' => $orderIds));
500
+
501
+ foreach ($collection as $order) {
502
+ $result = $this->buildAndSendOrderToSignifyd($order, /*forceSend*/ true);
503
+ if($result == "sent") {
504
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')
505
+ ->__('Successfully sent order ' . $order->getIncrementId() . '.'));
506
+ } else if ($result == "exists") {
507
+ Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('adminhtml')
508
+ ->__('Order ' . $order->getIncrementId() . ' has already been sent to Signifyd.'));
509
+ } else if ($result == "nodata") {
510
+ $this->logRequest("Request/Update not sent because there is no data");
511
+ } else {
512
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')
513
+ ->__('Order ' . $order->getIncrementId() . ' failed to send. See log for details.'));
514
+ }
515
+ }
516
+ if (Mage::getStoreConfig('signifyd_connect/log/request')) {
517
+ $this->logRequest("Bulk send complete");
518
+ }
519
+ }
520
+ } catch(Exception $ex) {
521
+ $this->logError($ex->__toString());
522
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')
523
+ ->__('Send failed. See log for details'));
524
+ }
525
+ }
526
+
527
public function buildAndSendOrderToSignifyd($order, $forceSend = false)
528
{
529
if ($order && $order->getId()) {
545
return "notready"; // Note: would not be in the order grid if this were the case
546
}
547
548
+ Mage::register('signifyd_action', 1); // Work will now take place
549
$customer = null;
550
if ($order->getCustomer()) {
551
$customer = $order->getCustomer();
568
$case_object->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
569
$case_object->setCode($caseId);
570
$case_object->setTransactionId($case['purchase']['transactionId']);
571
$case_object->save();
572
573
$order->addStatusHistoryComment("Signifyd: case $caseId created for order");
578
} catch (Exception $e) {
579
Mage::log($e->__toString(), null, 'signifyd_connect.log');
580
}
581
+ $this->unmarkProcessed($order);
582
return "error";
583
}
584
}
585
586
+ /**
587
+ * Run through up to $max items in the retry queue
588
+ * @param int $max The maximum numbers of items to process
589
+ */
590
+ public function processRetryQueue($max = 99999)
591
+ {
592
+ $failed_orders = Mage::getModel('signifyd_connect/retries')->getCollection();
593
+ $process_count = 0;
594
+ try {
595
+ foreach ($failed_orders as $order_id) {
596
+ if ($process_count++ >= $max) {
597
+ return;
598
+ }
599
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order_id->getOrderIncrement());
600
+ $result = "unset";
601
+ $this->logRequest("Retrying " . $order_id->getOrderIncrement());
602
+ if ($order != null && $this->processedStatus($order) < self::CASE_CREATED_STATUS) {
603
+ $result = $this->buildAndSendOrderToSignifyd($order);
604
+ }
605
+ if ($result !== "error") {
606
+ $this->logRequest("Completed retry " . $order_id->getOrderIncrement());
607
+ Mage::register('isSecureArea', true);
608
+ $order_id->delete();
609
+ Mage::unregister('isSecureArea');
610
+ } else {
611
+ $this->logError("Failed retry " . $order_id->getOrderIncrement());
612
+ }
613
+ }
614
+ } catch (Exception $e) {
615
+ $this->logError($e->__toString());
616
+ }
617
+ }
618
+
619
public function getProductUrl($product)
620
{
621
$url = null;
796
797
return $response;
798
}
799
}
app/code/community/Signifyd/Connect/Helper/Log.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- /**
3
- * Log Helper
4
- *
5
- * @category Signifyd Connect
6
- * @package Signifyd_Connect
7
- * @author Signifyd
8
- */
9
- class Signifyd_Connect_Helper_Log extends Mage_Core_Helper_Abstract
10
- {
11
- protected $logFile;
12
-
13
- public function __construct()
14
- {
15
- $this->logFile = 'signifyd_connect.log';
16
- }
17
-
18
- public function addLog($msg)
19
- {
20
- return Mage::log($msg, null, $this->logFile);
21
- }
22
- }
23
-
24
- /* Filename: Log.php */
25
- /* Location: ../app/code/Community/Signifyd/Connect/Helper/Log.php */
app/code/community/Signifyd/Connect/Model/Case.php CHANGED
@@ -2,28 +2,9 @@
2
3
class Signifyd_Connect_Model_Case extends Mage_Core_Model_Abstract
4
{
5
- protected $logger;
6
-
7
protected function _construct()
8
{
9
$this->_init('signifyd_connect/case');
10
$this->_isPkAutoIncrement = false;
11
- $this->logger = Mage::helper('signifyd_connect/log');
12
- }
13
-
14
- public function setMagentoStatusTo($case, $status)
15
- {
16
- $id = (is_array($case))? $case['order_increment'] : $case->getId();
17
- $caseLoaded = Mage::getModel('signifyd_connect/case')->load($id);
18
- try {
19
- $caseLoaded->setMagentoStatus($status);
20
- $caseLoaded->save();
21
- $this->logger->addLog("Signifyd: Case no:{$caseLoaded->getId()} status set to {$status}");
22
- } catch (Exception $e){
23
- $this->logger->addLog("Signifyd: Error setting case no:{$caseLoaded->getId()} status to {$status}");
24
- return false;
25
- }
26
-
27
- return true;
28
}
29
}
2
3
class Signifyd_Connect_Model_Case extends Mage_Core_Model_Abstract
4
{
5
protected function _construct()
6
{
7
$this->_init('signifyd_connect/case');
8
$this->_isPkAutoIncrement = false;
9
}
10
}
app/code/community/Signifyd/Connect/Model/Cron.php CHANGED
@@ -1,136 +1,9 @@
1
<?php
2
- /**
3
- * Cron Model
4
- *
5
- * @category Signifyd Connect
6
- * @package Signifyd_Connect
7
- * @author Signifyd
8
- */
9
class Signifyd_Connect_Model_Cron
10
{
11
- /* The status when a case is created */
12
- const WAITING_SUBMISSION_STATUS = "waiting_submission";
13
-
14
- /* The status for a case when the first response from Signifyd is received */
15
- const IN_REVIEW_STATUS = "in_review";
16
-
17
- /* The status for a case when the case is processing the response */
18
- const PROCESSING_RESPONSE_STATUS = "processing_response";
19
-
20
- /* The status for a case that is completed */
21
- const COMPLETED_STATUS = "completed";
22
-
23
- protected $logger;
24
-
25
- public function __construct()
26
- {
27
- $this->logger = Mage::helper('signifyd_connect/log');
28
- }
29
-
30
- /**
31
- * Method to reprocessing the cases than did not fully complete
32
- */
33
- public function retry()
34
- {
35
- $this->logger->addLog("Main retry method called");
36
- // Getting all the cases that were not submitted to Signifyd
37
- $cases_for_resubmit = $this->getRetryCasesByStatus(self::WAITING_SUBMISSION_STATUS);
38
- foreach ($cases_for_resubmit as $current_case) {
39
- $this->logger->addLog("Signifyd: preparing for send case no: {$current_case['order_increment']}");
40
- $current_order_id = $current_case['order_increment'];
41
- $current_order = Mage::getModel('sales/order')->loadByIncrementId($current_order_id);
42
- Mage::helper('signifyd_connect')->buildAndSendOrderToSignifyd($current_order,true);
43
- }
44
-
45
- // Getting all the cases that are awaiting review from Signifyd
46
- $cases_for_resubmit = $this->getRetryCasesByStatus(self::IN_REVIEW_STATUS);
47
- foreach ($cases_for_resubmit as $current_case) {
48
- $this->logger->addLog("Signifyd: preparing for review case no: {$current_case['order_increment']}");
49
- $this->processInReviewCase($current_case);
50
- }
51
-
52
- // Getting all the cases that need processing after the response was received
53
- $cases_for_resubmit = $this->getRetryCasesByStatus(self::PROCESSING_RESPONSE_STATUS);
54
- foreach ($cases_for_resubmit as $current_case) {
55
- $this->logger->addLog("Signifyd: preparing for review case no: {$current_case['order_increment']}");
56
- $current_order_id = $current_case['order_increment'];
57
- $current_order = Mage::getModel('sales/order')->loadByIncrementId($current_order_id);
58
- // need to refactor this
59
- $this->loadClass();
60
- $signifyd_controller = @new Signifyd_Connect_ConnectController();
61
- $signifyd_controller->processAdditional($current_case,false,$current_order);
62
- }
63
-
64
- $this->logger->addLog("Main retry method ended");
65
- return;
66
- }
67
-
68
- /**
69
- * Getting the retry cases by the status of the case
70
- * @param $status
71
- * @return mixed
72
- */
73
- public function getRetryCasesByStatus($status)
74
- {
75
-
76
- $time = time();
77
- $lastTime = $time - 60*60*24*7; // not longer than 7 days
78
- $firstTime = $time - 60*30; // longer than last 30 minuted
79
- $from = date('Y-m-d H:i:s', $lastTime);
80
- $to = date('Y-m-d H:i:s', $firstTime);
81
-
82
- $cases = Mage::getModel('signifyd_connect/case')->getCollection()
83
- ->addFieldToFilter('updated', array('from' => $from, 'to' => $to))
84
- ->addFieldToFilter('magento_status', $status);
85
-
86
- return $cases->getData();
87
-
88
- }
89
-
90
- /**
91
- * Process the cases that are in review
92
- * @param $case
93
- */
94
- public function processInReviewCase($case)
95
- {
96
- $case_url = $this->getCaseUrl($case['code']);
97
- $response = Mage::helper('signifyd_connect')->request($case_url,null,Mage::helper('signifyd_connect')->getAuth(),'application/json');
98
- try {
99
- $response_code = $response->getHttpCode();
100
- if (substr($response_code, 0, 1) == '2') {
101
- $response_data = $response->getRawResponse();
102
- // need to refactor this
103
- $this->loadClass();
104
- $signifyd_controller = @new Signifyd_Connect_ConnectController();
105
- $signifyd_controller->processFallback($response_data);
106
- return;
107
- }
108
- } catch (Exception $e) {
109
- Mage::log($e->__toString(), null, 'signifyd_connect.log');
110
- }
111
- }
112
-
113
- /**
114
- * Get the cases url
115
- * @param $case_code
116
- * @return string
117
- */
118
- public function getCaseUrl($case_code)
119
{
120
- // $url = Mage::getStoreConfig('signifyd_connect/settings/url') . '/cases/' . $case_code;
121
- // return (empty($url))? "https://api.signifyd.com/v2/cases/" . $case_code : $url;
122
- return 'https://api.signifyd.com/v2/cases/' . $case_code;
123
- }
124
-
125
- public function loadClass(){
126
- if(!@class_exists('Signifyd_Connect_ConnectController')) //in case the class already exists
127
- {
128
- $dir = Mage::getModuleDir('controllers', 'Signifyd_Connect');
129
- require_once($dir . '/ConnectController.php');
130
- }
131
- return true;
132
}
133
}
134
-
135
- /* Filename: Cron.php */
136
- /* Location: ../app/code/Community/Signifyd/Connect/Model/Cron.php */
1
<?php
2
+
3
class Signifyd_Connect_Model_Cron
4
{
5
+ public function update()
6
{
7
+ return; // Deprecated
8
}
9
}
app/code/community/Signifyd/Connect/Model/Link.php CHANGED
@@ -4,6 +4,6 @@ class Signifyd_Connect_Model_Link
4
{
5
public function getCommentText()
6
{
7
- return "<a href=\"" . Mage::getUrl('signifyd/connect/api') . "\" target=\"_blank\">" . Mage::getUrl('signifyd/connect/api') . "</a>";
8
}
9
}
4
{
5
public function getCommentText()
6
{
7
+ return "Turn this on if you would like to receive Signifyd scores. Visit this url to confirm the callback functionality is working: <a href=\"" . Mage::getUrl('signifyd/connect/api') . "\" target=\"_blank\">" . Mage::getUrl('signifyd/connect/api') . "</a>";
8
}
9
}
app/code/community/Signifyd/Connect/Model/Observer.php CHANGED
@@ -3,14 +3,7 @@
3
class Signifyd_Connect_Model_Observer extends Varien_Object
4
{
5
public $joins = 0;
6
- protected $helper;
7
-
8
- public function _construct()
9
- {
10
- $this->helper = Mage::helper('signifyd_connect');
11
- }
12
-
13
-
14
public function openCase($observer)
15
{
16
try {
@@ -36,12 +29,28 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
36
return;
37
}
38
39
- Mage::helper('signifyd_connect')->buildAndSendOrderToSignifyd($order);
40
} catch (Exception $e) {
41
Mage::log($e->__toString(), null, 'signifyd_connect.log');
42
}
43
// If we get here, then we have failed to create the case.
44
45
}
46
47
public function logData($order, $payment, $quote)
@@ -186,57 +195,92 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
186
return;
187
}
188
189
- if ($this->oldSupport()) {
190
- $select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=e.increment_id', array('score'=>'score'));
191
- $this->joins++;
192
- } else {
193
- $select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=main_table.increment_id', array('score'=>'score',
194
- 'guarantee' => 'guarantee'));
195
- $this->joins++;
196
}
197
}
198
-
199
- public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer)
200
- {
201
- $request = Mage::app()->getRequest();
202
- $module = $request->getModuleName();
203
- $controller = $request->getControllerName();
204
205
- if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
206
return;
207
}
208
209
- $helper = Mage::helper('signifyd_connect');
210
$block = $observer->getEvent()->getBlock();
211
-
212
- if ($block->getId() == 'sales_order_grid') {
213
- $block->addColumnAfter(
214
- 'score',
215
- array(
216
- 'header' => $helper->__('Signifyd Score'),
217
- 'align' => 'left',
218
- 'type' => 'text',
219
- 'index' => 'score',
220
- 'filter' => false,
221
- 'renderer' => 'signifyd_connect/renderer',
222
- 'width' => '100px',
223
- ),
224
- 'status'
225
- );
226
- $block->addColumnAfter(
227
- 'guarantee',
228
- array(
229
- 'header' => $helper->__('Guarantee Status'),
230
- 'align' => 'left',
231
- 'type' => 'text',
232
- 'index' => 'guarantee',
233
- 'filter' => false,
234
- 'renderer' => 'signifyd_connect/renderer',
235
- 'width' => '100px',
236
- ),
237
- 'status'
238
- );
239
- $block->sortColumnsByOrder();
240
}
241
}
242
@@ -273,27 +317,4 @@ class Signifyd_Connect_Model_Observer extends Varien_Object
273
$helper->logError("Guarantee cancel: $ex");
274
}
275
}
276
-
277
- /**
278
- * Putting an order on hold after the order was placed until the response comes back and an action can be taken.
279
- * @param Varien_Event_Observer $observer
280
- * @return $this
281
- */
282
- public function putOrderOnHold(Varien_Event_Observer $observer)
283
- {
284
- $order = $observer->getEvent()->getOrder();
285
- if($order->canHold() === false){
286
- $this->helper->logError("Order {$order->getIncrementId()} could not be held because Magento returned false for canHold");
287
- }
288
-
289
- try {
290
- $order->hold();
291
- $order->addStatusHistoryComment("Signifyd: order held after order place");
292
- $order->save();
293
- } catch (Exception $e){
294
- $this->helper->logError("PutOrderOnHold Error: $e");
295
- }
296
-
297
- return $this;
298
- }
299
}
3
class Signifyd_Connect_Model_Observer extends Varien_Object
4
{
5
public $joins = 0;
6
+
7
public function openCase($observer)
8
{
9
try {
29
return;
30
}
31
32
+ $result = Mage::helper('signifyd_connect')->buildAndSendOrderToSignifyd($order);
33
+ if($result !== "error") {
34
+ if($result !== "notready") {
35
+ // Handle two of the retry items in queue
36
+ Mage::helper('signifyd_connect')->processRetryQueue(2);
37
+ }
38
+ return;
39
+ }
40
} catch (Exception $e) {
41
Mage::log($e->__toString(), null, 'signifyd_connect.log');
42
}
43
// If we get here, then we have failed to create the case.
44
+ $this->addToRetryQueue($order);
45
+ }
46
47
+ private function addToRetryQueue($order)
48
+ {
49
+ Mage::log("Add to retries", null, 'signifyd_connect.log');
50
+ $order_tag = Mage::getModel('signifyd_connect/retries');
51
+ $order_tag->setOrderIncrement($order->getIncrementId());
52
+ $order_tag->setCreated(strftime('%Y-%m-%d %H:%M:%S', time()));
53
+ $order_tag->save();
54
}
55
56
public function logData($order, $payment, $quote)
195
return;
196
}
197
198
+ $show_scores = Mage::getStoreConfig('signifyd_connect/advanced/show_scores');
199
+ $show_guarantee = Mage::getStoreConfig('signifyd_connect/advanced/show_guarantee');
200
+ if ($show_scores || $show_guarantee) {
201
+ if ($this->oldSupport()) {
202
+ $select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=e.increment_id', array('score'=>'score'));
203
+ $this->joins++;
204
+ } else {
205
+ $select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=main_table.increment_id', array('score'=>'score',
206
+ 'guarantee' => 'guarantee'));
207
+ $this->joins++;
208
+ }
209
}
210
}
211
212
+ public function coreBlockAbstractPrepareLayoutBefore(Varien_Event_Observer $observer)
213
+ {
214
+ if (!Mage::getStoreConfig('signifyd_connect/settings/enabled') && !$this->getEnabled()) {
215
return;
216
}
217
218
$block = $observer->getEvent()->getBlock();
219
+ if((get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
220
+ || get_class($block) == 'Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction')
221
+ && $block->getRequest()->getControllerName() == 'sales_order')
222
+ {
223
+ $url = Mage::helper("adminhtml")->getUrl('signifyd_connect/adminhtml_signifyd/send');
224
+ if(Mage::getStoreConfig('signifyd_connect/advanced/use_unsecure_requests')){
225
+ $url = Mage::getUrl('signifyd/connect/send');
226
+ }
227
+ $block->setFormFieldName('increment_id');
228
+ $block->addItem('signifyd_connect', array(
229
+ 'label' => 'Send order(s) to Signifyd',
230
+ 'url' => $url,
231
+ ));
232
+ }
233
+ }
234
+
235
+ public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer)
236
+ {
237
+ $show_scores = Mage::getStoreConfig('signifyd_connect/advanced/show_scores');
238
+ $show_guarantee = Mage::getStoreConfig('signifyd_connect/advanced/show_guarantee');
239
+ if ($show_scores || $show_guarantee) {
240
+ $request = Mage::app()->getRequest();
241
+ $module = $request->getModuleName();
242
+ $controller = $request->getControllerName();
243
+
244
+ if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
245
+ return;
246
+ }
247
+
248
+ $helper = Mage::helper('signifyd_connect');
249
+ $block = $observer->getEvent()->getBlock();
250
+
251
+ if ($block->getId() == 'sales_order_grid') {
252
+ if($show_scores) {
253
+ $block->addColumnAfter(
254
+ 'score',
255
+ array(
256
+ 'header' => $helper->__('Signifyd Score'),
257
+ 'align' => 'left',
258
+ 'type' => 'text',
259
+ 'index' => 'score',
260
+ 'filter' => false,
261
+ 'renderer' => 'signifyd_connect/renderer',
262
+ 'width' => '100px',
263
+ ),
264
+ 'status'
265
+ );
266
+ }
267
+ if($show_guarantee) {
268
+ $block->addColumnAfter(
269
+ 'guarantee',
270
+ array(
271
+ 'header' => $helper->__('Guarantee Status'),
272
+ 'align' => 'left',
273
+ 'type' => 'text',
274
+ 'index' => 'guarantee',
275
+ 'filter' => false,
276
+ 'renderer' => 'signifyd_connect/renderer',
277
+ 'width' => '100px',
278
+ ),
279
+ 'status'
280
+ );
281
+ }
282
+ $block->sortColumnsByOrder();
283
+ }
284
}
285
}
286
317
$helper->logError("Guarantee cancel: $ex");
318
}
319
}
320
}
app/code/community/Signifyd/Connect/Model/Order.php DELETED
@@ -1,412 +0,0 @@
1
- <?php
2
- /**
3
- * Order Model
4
- *
5
- * @category Signifyd Connect
6
- * @package Signifyd_Connect
7
- * @author Signifyd
8
- */
9
- class Signifyd_Connect_Model_Order extends Mage_Core_Model_Abstract
10
- {
11
- /* Property for instance of the log helper */
12
- protected $logger;
13
-
14
- /* Property for instance of the data helper */
15
- protected $dataHelper;
16
-
17
- /* Property for configuration */
18
- protected $logRequest;
19
-
20
- /**
21
- * Internal magento constructor
22
- */
23
- public function _construct()
24
- {
25
- $this->logger = Mage::helper('signifyd_connect/log');
26
- $this->dataHelper = Mage::helper('signifyd_connect');
27
- $this->logRequest = Mage::getStoreConfig('signifyd_connect/log/request');
28
- parent::_construct();
29
- }
30
-
31
- /**
32
- * Method to authorize an order after order place
33
- * @param $order
34
- * @return bool
35
- */
36
- public function authorizeOrder($order)
37
- {
38
- // Get the payment status for this order
39
- $status = $this->dataHelper->getOrderPaymentStatus($order);
40
- if($status['authorize']){
41
- $this->logger->addLog("Order {$order->getIncrementId()} is already authorize");
42
- return true;
43
- }
44
- $payment = $order->getPayment();
45
- $method = $payment->getMethodInstance();
46
- if(!$method->canAuthorize()){
47
- $this->logger->addLog("Order {$order->getIncrementId()} can not be authorize");
48
- return true;
49
- }
50
-
51
- $amount = $order->getData('grand_total');
52
-
53
- try{
54
- // check if method authorize returns anything usefully
55
- $method->authorize($payment, $amount);
56
- $this->logger->addLog("Authorize order {$order->getIncrementId()} was successful");
57
- } catch (Exception $e) {
58
- $this->logger->addLog("Authorize order {$order->getIncrementId()} was not authorized:");
59
- $this->logger->addLog($e->__toString());
60
- return false;
61
- }
62
-
63
- return true;
64
- }
65
-
66
- /**
67
- * Method to generate the invoice after a order was placed
68
- * @param $order
69
- * @return bool
70
- */
71
- public function generateInvoice($order)
72
- {
73
- if(!$order->canInvoice()){
74
- $this->logger->addLog("Order {$order->getIncrementId()} can not be invoiced");
75
- return false;
76
- }
77
-
78
- try {
79
-
80
- $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
81
-
82
- $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
83
- $invoice->register();
84
- $transactionSave = Mage::getModel('core/resource_transaction')
85
- ->addObject($invoice)
86
- ->addObject($invoice->getOrder());
87
- $transactionSave->save();
88
- $this->logger->addLog("Invoice was created for order: {$order->getIncrementId()}");
89
-
90
- $invoice->addComment('Automatic Invoice', false);
91
- $invoice->sendEmail();
92
- $invoice->setEmailSent(true);
93
- $invoice->save();
94
-
95
- $order->addStatusHistoryComment('Automatic Invoice: '.$invoice->getIncrementId());
96
- $order->save();
97
- } catch (Exception $e) {
98
- $this->logger->addLog('Exception while creating invoice: ' . $e->__toString());
99
- return false;
100
- }
101
-
102
- return true;
103
- }
104
-
105
- /**
106
- * Method to walk the flow for an order when the config is set to unhold, invoice and capture.
107
- * When guaranty is approved
108
- * @param $order
109
- * @param $reason
110
- * @return bool
111
- */
112
- public function unholdOrderAndCapture($order, $reason)
113
- {
114
- if(is_null($order->getId())){
115
- $this->logger->addLog("Order was not found");
116
- return false;
117
- }
118
-
119
- if(!$order->canUnhold()){
120
- $this->logger->addLog("Order {$order->getIncrementId()} can not be unheld");
121
- return false;
122
- }
123
- $status = $this->dataHelper->getOrderPaymentStatus($order);
124
-
125
- try {
126
- $order->unhold();
127
- $order->addStatusHistoryComment("Signifyd: order unheld because $reason");
128
- $order->save();
129
-
130
- if ($this->logRequest) {
131
- $this->logger->addLog("Order {$order->getIncrementId()} unheld because {$reason}");
132
- }
133
-
134
- // Authorize the order
135
- $result = $this->authorizeOrder($order);
136
- if($result === false){
137
- $this->holdOrder($order, 'Fail to Authorize Order');
138
- }
139
-
140
- // Generate the invoice
141
- if($status['capture'] !== true){
142
- $result = $this->generateInvoice($order);
143
- if($result === false){
144
- $this->holdOrder($order, 'Fail to generate Invoice');
145
- }
146
- }
147
- } catch (Exception $e) {
148
- $this->logger->addLog("Order {$order->getIncrementId()} unable to be saved because {$e->getMessage()}");
149
- $this->logger->addLog("Order {$order->getIncrementId()} was not unheld.");
150
- return false;
151
- }
152
-
153
- return true;
154
- }
155
-
156
- /**
157
- * Method to walk the flow for an order when the config is set to unhold only.
158
- * When guaranty is approved
159
- * @param $order
160
- * @param $reason
161
- * @return bool
162
- */
163
- public function unholdOrder($order, $reason)
164
- {
165
- if(is_null($order->getId())){
166
- $this->logger->addLog("Order was not found");
167
- return false;
168
- }
169
-
170
- if(!$order->canUnhold()){
171
- $this->logger->addLog("Order {$order->getIncrementId()} can not be unheld");
172
- return false;
173
- }
174
-
175
- try {
176
- $order->unhold();
177
- $order->addStatusHistoryComment("Signifyd: order unheld because $reason");
178
- $order->save();
179
-
180
- // Authorize the order
181
- // $result = $this->authorizeOrder($order);
182
- // if($result === false){
183
- // $this->holdOrder($order, 'Fail to Authorize Order');
184
- // }
185
-
186
- if ($this->logRequest) {
187
- $this->logger->addLog("Order {$order->getIncrementId()} unheld because {$reason}");
188
- }
189
- } catch (Exception $e) {
190
- $this->logger->addLog("Order {$order->getIncrementId()} unable to be saved because {$e->getMessage()}");
191
- $this->logger->addLog("Order {$order->getIncrementId()} was not unheld.");
192
- return false;
193
- }
194
- return true;
195
- }
196
-
197
- /**
198
- * Method to hold the order whe the guaranty is declined
199
- * @param $order
200
- * @param $reason
201
- * @return bool
202
- */
203
- public function holdOrder($order, $reason)
204
- {
205
- if(is_null($order->getId())){
206
- $this->logger->addLog("Order was not found");
207
- return false;
208
- }
209
-
210
- if(!$order->canHold()){
211
- $this->logger->addLog("Order {$order->getIncrementId()} can not be held");
212
- return false;
213
- }
214
-
215
- try {
216
- $order->hold();
217
- $order->addStatusHistoryComment("Signifyd: order held because {$reason}");
218
- $order->save();
219
-
220
- if ($this->logRequest) {
221
- $this->logger->addLog("Order {$order->getIncrementId()} held because {$reason}");
222
- }
223
- } catch (Exception $e){
224
- $this->logger->addLog("Order {$order->getIncrementId()} unable to be saved because {$e->getMessage()}");
225
- $this->logger->addLog("Order {$order->getIncrementId()} was not held.");
226
- return false;
227
- }
228
-
229
- return true;
230
- }
231
-
232
- /**
233
- * Method to hold the order whe the guaranty is declined and magento config is set to cancel the order
234
- * @param $order
235
- * @param $reason
236
- * @return bool
237
- */
238
- public function cancelOrder($order, $reason)
239
- {
240
- if(is_null($order->getId())){
241
- $this->logger->addLog("Order was not found");
242
- return false;
243
- }
244
-
245
- if ($order->getState() === $order::STATE_HOLDED) {
246
- $this->unholdOrder($order, $reason);
247
- }
248
-
249
- if(!$order->canCancel()){
250
- $this->logger->addLog("Order {$order->getIncrementId()} can not be canceled");
251
- return false;
252
- }
253
-
254
- try {
255
- $order->cancel();
256
- $order->addStatusHistoryComment("Signifyd: order canceled because $reason");
257
- $order->save();
258
-
259
- if ($this->logRequest) {
260
- $this->logger->addLog("Order {$order->getIncrementId()} cancelled because {$reason}");
261
- }
262
- } catch (Exception $e){
263
- $this->logger->addLog("Order {$order->getIncrementId()} unable to be saved because {$e->getMessage()}");
264
- $this->logger->addLog("Order {$order->getIncrementId()} was not canceled.");
265
- return false;
266
- }
267
-
268
- return true;
269
- }
270
- /*
271
- public function voidOrderPayment($order, $reason)
272
- {
273
- if(is_null($order->getId())){
274
- $this->logger->addLog("Order was not found");
275
- return false;
276
- }
277
- $payment = $order->getPayment();
278
- $method = $payment->getMethodInstance();
279
-
280
- if(!$method->canVoid($payment)){
281
- $this->logger->addLog("Payment for order {$order->getIncrementId()} can not be voided");
282
- return false;
283
- }
284
-
285
- try{
286
- $method->void($payment);
287
- $order->save();
288
- $this->cancelOrder($order, $reason);
289
- $this->logger->addLog("Void order payment {$order->getIncrementId()} was successful");
290
- } catch (Exception $e) {
291
- $this->holdOrder($order, 'Signifyd: Failed to void order payment');
292
- $this->logger->addLog("Void order payment {$order->getIncrementId()} was not authorized:");
293
- $this->logger->addLog($e->__toString());
294
- return false;
295
- }
296
-
297
- return true;
298
- }
299
- */
300
-
301
- public function keepOrderOnHold($order, $reason)
302
- {
303
- if(is_null($order->getId())){
304
- $this->logger->addLog("Order was not found");
305
- return false;
306
- }
307
-
308
- if($order->getStatus() != Mage_Sales_Model_Order::STATE_HOLDED){
309
- try{
310
- $this->holdOrder($order, $reason);
311
- }catch (Exception $e){
312
- $this->logger->addLog($e->__toString());
313
- }
314
- }
315
- $this->logger->addLog("Order {$order->getIncrementId()} was kept on hold because {$reason}");
316
-
317
- return true;
318
- }
319
-
320
- public function cancelCloseOrder($order, $reason)
321
- {
322
- $status = $this->dataHelper->getOrderPaymentStatus($order);
323
- if(is_null($order->getId())){
324
- $this->logger->addLog("Order was not found");
325
- return false;
326
- }
327
- if(!$order->canUnhold()){
328
- $this->logger->addLog("Order {$order->getIncrementId()} can not be unheld");
329
- return false;
330
- }
331
- try {
332
- $order->unhold();
333
- $order->addStatusHistoryComment("Signifyd: order unheld because $reason");
334
- $order->save();
335
- $this->logger->addLog("Order {$order->getIncrementId()} unheld in order to cancel it");
336
- } catch (Exception $e){
337
-
338
- $this->logger->addLog("Order {$order->getIncrementId()} can not be unheld");
339
- $this->logger->addLog($e->__toString());
340
- return false;
341
- }
342
-
343
- // if($status['authorize'] === true && $status['capture'] === false) {
344
- // $this->logger->addLog("cancel close order5");
345
- // $this->voidOrderPayment($order, $reason);
346
- if($status['authorize'] === true && $status['capture'] === true) {
347
- $result = $this->canNotCancel($order, $reason);
348
- } else {
349
- $result = $this->cancelOrder($order, $reason);
350
- }
351
- if($result === false){
352
- $this->holdOrder($order, 'Fail to Cancel/Close Order');
353
- }
354
- return true;
355
- }
356
-
357
- public function checkStatus($order, $status)
358
- {
359
- $theOrder = Mage::getModel('sales/order')->load($order->getId());
360
- return ($theOrder->getStatus() == $status)? true : false;
361
- }
362
-
363
- public function finalStatus($order, $type, $case)
364
- {
365
- $id = (is_array($case))? $case['order_increment'] : $case->getId();
366
- try {
367
- $holdStatus = $this->checkStatus($order, Mage_Sales_Model_Order::STATE_HOLDED);
368
- $caseModel = Mage::getModel('signifyd_connect/case');
369
- // type refers to the need to by held or not held: 1 needs to be held, 2 needs to be not held
370
- if($type == 1){
371
- // needs to be true
372
- if($holdStatus === true){
373
- $caseModel->setMagentoStatusTo($case, Signifyd_Connect_Helper_Data::COMPLETED_STATUS);
374
- }
375
- } elseif($type == 2) {
376
- // needs to be false
377
- if($holdStatus === false){
378
- $caseModel->setMagentoStatusTo($case, Signifyd_Connect_Helper_Data::COMPLETED_STATUS);
379
- }
380
- } else {
381
- $this->logger->addLog('Final status unknown type');
382
- }
383
-
384
- $this->logger->addLog("Case no:{$id}, set status to complete successful.");
385
- } catch (Exception $e){
386
- $this->logger->addLog("Case no:{$id}, set status to complete fail: " . $e->__toString());
387
- return false;
388
- }
389
-
390
- return true;
391
- }
392
-
393
- public function canNotCancel($order, $reason)
394
- {
395
- try {
396
- $order->hold();
397
- $order->addStatusHistoryComment("Signifyd: order held because $reason");
398
- $order->addStatusHistoryComment("Signifyd: order can not be canceled because it has a sum already captured, Please do a manual refund.");
399
- $order->save();
400
- $this->logger->addLog("Order {$order->getIncrementId()} was held because {$reason}");
401
- } catch (Exception $e){
402
- $this->logger->addLog("Order {$order->getIncrementId()} could not be held: " . $e->__toString());
403
- return false;
404
- }
405
-
406
- return true;
407
- }
408
-
409
- }
410
-
411
- /* Filename: Order.php */
412
- /* Location: ../app/code/Community/Signifyd/Connect/Model/Order.php */
app/code/community/Signifyd/Connect/Model/Order/Payment.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- /**
3
- * Payment Model
4
- *
5
- * @category Signifyd Connect
6
- * @package Signifyd_Connect
7
- * @author Signifyd
8
- */
9
- class Signifyd_Connect_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
10
- {
11
- public function registerCaptureNotification($amount, $skipFraudDetection = false)
12
- {
13
- Mage::log("Signifyd: Register capture notification", null, 'signifyd_connect.log');
14
- parent::registerCaptureNotification($amount, $skipFraudDetection = false);
15
- $order = $this->getOrder();
16
- $isDeclined = Mage::helper('signifyd_connect')->isGuarantyDeclined($order);
17
- if($isDeclined){
18
- Mage::log("Signifyd: Register capture notification execute hold status and state: order {$order->getIncrementId()}", null, 'signifyd_connect.log');
19
- $order->setState(Mage_Sales_Model_Order::STATE_HOLDED);
20
- $order->setStatus(Mage_Sales_Model_Order::STATE_HOLDED);
21
- $order->addStatusHistoryComment("Signifyd: order held because guarantee declined");
22
- }
23
-
24
- return $this;
25
- }
26
- }
27
-
28
- /* Filename: Cron.php */
29
- /* Location: ../app/code/Community/Signifyd/Connect/Model/Cron.php */
app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Accepted.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
-
4
- class Signifyd_Connect_Model_System_Config_Source_Options_Accepted
5
- {
6
- public function toOptionArray()
7
- {
8
- return array(
9
- array(
10
- 'value' => 1,
11
- 'label' => 'Do nothing'
12
- ),
13
- array(
14
- 'value' => 2,
15
- 'label' => 'Capture and Invoice'
16
- )
17
- );
18
- }
19
- }
app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Declined.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
-
4
- class Signifyd_Connect_Model_System_Config_Source_Options_Declined
5
- {
6
- public function toOptionArray()
7
- {
8
- return array(
9
- array(
10
- 'value' => 1,
11
- 'label' => 'Do nothing'
12
- ),
13
- array(
14
- 'value' => 2,
15
- 'label' => 'Cancel and Void'
16
- )
17
- );
18
- }
19
- }
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/Model/System/Config/Source/Options/Positive.php ADDED
@@ -0,0 +1,18 @@
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_System_Config_Source_Options_Positive
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array(
9
+ 'value' => 'nothing',
10
+ 'label' => 'Nothing',
11
+ ),
12
+ array(
13
+ 'value' => 'unhold',
14
+ 'label' => 'Unhold Order',
15
+ ),
16
+ );
17
+ }
18
+ }
app/code/community/Signifyd/Connect/controllers/Adminhtml/SignifydController.php CHANGED
@@ -19,4 +19,9 @@ class Signifyd_Connect_Adminhtml_SignifydController extends Mage_Adminhtml_Contr
19
);
20
}
21
22
}
19
);
20
}
21
22
+ public function sendAction()
23
+ {
24
+ Mage::helper('signifyd_connect')->bulkSend($this);
25
+ $this->_redirectReferer();
26
+ }
27
}
app/code/community/Signifyd/Connect/controllers/ConnectController.php CHANGED
@@ -1,11 +1,5 @@
1
<?php
2
- /**
3
- * Connect Controller
4
- *
5
- * @category Signifyd Connect
6
- * @package Signifyd_Connect
7
- * @author Signifyd
8
- */
9
class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Action
10
{
11
public $_request = array();
@@ -17,33 +11,52 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
17
public $_previousScore = false;
18
public $_unholdRetries = 0;
19
20
- const WAITING_SUBMISSION_STATUS = "waiting_submission";
21
- const IN_REVIEW_STATUS = "in_review";
22
- const PROCESSING_RESPONSE_STATUS = "processing_response";
23
- const COMPLETED_STATUS = "completed";
24
-
25
public function getApiKey()
26
{
27
return Mage::getStoreConfig('signifyd_connect/settings/key');
28
}
29
30
- public function getAcceptedFromGuaranty(){
31
- return Mage::getStoreConfig('signifyd_connect/advanced/accepted_from_guaranty', $this->_store_id);
32
}
33
34
- public function getDeclinedFromGuaranty(){
35
- return Mage::getStoreConfig('signifyd_connect/advanced/declined_from_guaranty', $this->_store_id);
36
}
37
38
public function enabled()
39
{
40
- return Mage::getStoreConfig('signifyd_connect/settings/enabled');
41
}
42
43
public function getUrl($code)
44
{
45
- // return Mage::getStoreConfig('signifyd_connect/settings/url', $this->_store_id) . '/cases/' . $code;
46
- return 'https://api.signifyd.com/v2/cases/' . $code;
47
}
48
49
public function logErrors()
@@ -142,7 +155,6 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
142
try {
143
if (isset($this->_request['guaranteeDisposition'])) {
144
$case->setGuarantee($this->_request['guaranteeDisposition']);
145
- $case->setMagentoStatus(self::PROCESSING_RESPONSE_STATUS);
146
147
if ($this->logRequest()) {
148
Mage::log('Set guarantee to ' . $this->_request['guaranteeDisposition'], null,
@@ -154,6 +166,9 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
154
Mage::log('ERROR ON WEBHOOK: ' . $e->__toString(), null, 'signifyd_connect.log');
155
}
156
}
157
}
158
159
public function validRequest($request, $hash)
@@ -222,59 +237,151 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
222
}
223
}
224
225
- public function processAdditional($case, $original_status = false,$custom_order = null)
226
{
227
- if ($custom_order)
228
- $order = $custom_order;
229
- else
230
- $order = $this->_order;
231
232
if ($order && $order->getId()) {
233
- $positiveAction = $this->getAcceptedFromGuaranty();
234
- $negativeAction = $this->getDeclinedFromGuaranty();
235
$newGuarantee = null;
236
try{
237
- if ($custom_order)
238
- $newGuarantee = $case['guarantee'];
239
- else
240
- $newGuarantee = isset($this->_request ['guaranteeDisposition']) ? $this->_request ['guaranteeDisposition'] : null;
241
} catch(Exception $e){
242
if ($this->logErrors()) {
243
Mage::log('ERROR ON WEBHOOK: ' . $e->__toString(), null, 'signifyd_connect.log');
244
}
245
}
246
// If a guarantee has been set, we no longer care about other actions
247
if (isset($newGuarantee) && $newGuarantee != $this->_previousGuarantee) {
248
- // Loading the signifyd order model
249
- $orderModel = Mage::getModel('signifyd_connect/order');
250
- if ($newGuarantee == 'DECLINED' ) {
251
- if ($negativeAction == 1) {
252
- // this is for when config is set to keep order on hold
253
- $orderModel->keepOrderOnHold($order, "guarantee declined");
254
- $orderModel->finalStatus($order, 1, $case);
255
- } else if ($negativeAction == 2) {
256
- // this is for when config is set to cancel close order
257
- $orderModel->cancelCloseOrder($order, "guarantee declined");
258
- $orderModel->finalStatus($order, 2, $case);
259
} else {
260
- // this is when the config is not set or it is set to something unknown
261
Mage::log("Unknown action $negativeAction", null, 'signifyd_connect.log');
262
}
263
- } else if ($newGuarantee == 'APPROVED') {
264
- if ($positiveAction == 1) {
265
- // this is for when config is set to unhold order
266
- $orderModel->unholdOrder($order, "guarantee approved");
267
- $orderModel->finalStatus($order, 2, $case);
268
- } elseif($positiveAction == 2){
269
- // this is for when config is set to unhold, invoice and capture
270
- $orderModel->unholdOrderAndCapture($order, "guarantee approved");
271
- $orderModel->finalStatus($order, 2, $case);
272
} else {
273
- // this is when the config is not set or it is set to something unknown
274
Mage::log("Unknown action $positiveAction", null, 'signifyd_connect.log');
275
}
276
}
277
- // add else for unknown guarantee
278
}
279
}
280
}
@@ -428,20 +535,39 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
428
429
}
430
431
- /**
432
- * Main entry point for the signifyd callback
433
- */
434
public function apiAction()
435
{
436
if (!$this->enabled()) {
437
echo $this->getDisabledMessage();
438
return;
439
}
440
441
- // Prevent recurring on save
442
- if(is_null(Mage::registry('signifyd_action'))){
443
- Mage::register('signifyd_action', 1);
444
- }
445
446
$request = $this->getRawPost();
447
@@ -512,12 +638,4 @@ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Acti
512
$this->complete();
513
}
514
515
- public function cronAction()
516
- {
517
- Mage::getModel('signifyd_connect/cron')->retry();
518
- }
519
-
520
}
521
-
522
- /* Filename: ConnectController.php */
523
- /* Location: ../app/code/Community/Signifyd/Connect/controllers/ConnectController.php */
1
<?php
2
+
3
class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Action
4
{
5
public $_request = array();
11
public $_previousScore = false;
12
public $_unholdRetries = 0;
13
14
public function getApiKey()
15
{
16
return Mage::getStoreConfig('signifyd_connect/settings/key');
17
}
18
19
+ public function holdThreshold()
20
+ {
21
+ return (int)Mage::getStoreConfig('signifyd_connect/advanced/hold_orders_threshold', $this->_store_id);
22
}
23
24
+ public function canReviewHold()
25
+ {
26
+ return Mage::getStoreConfig('signifyd_connect/advanced/hold_orders', $this->_store_id);
27
+ }
28
+
29
+ public function canInvoice()
30
+ {
31
+ return Mage::getStoreConfig('signifyd_connect/advanced/invoice_orders', $this->_store_id);
32
+ }
33
+
34
+ public function notifyCustomer()
35
+ {
36
+ return Mage::getStoreConfig('signifyd_connect/advanced/invoice_orders_notify', $this->_store_id);
37
+ }
38
+
39
+ public function negativeGuaranteeAction()
40
+ {
41
+ return Mage::getStoreConfig('signifyd_connect/advanced/guarantee_negative_action', $this->_store_id);
42
+ }
43
+
44
+ public function positiveGuaranteeAction()
45
+ {
46
+ return Mage::getStoreConfig('signifyd_connect/advanced/guarantee_positive_action', $this->_store_id);
47
}
48
49
public function enabled()
50
{
51
+ $retrieve_scores = Mage::getStoreConfig('signifyd_connect/advanced/retrieve_score');
52
+ $enabled = Mage::getStoreConfig('signifyd_connect/settings/enabled');
53
+
54
+ return $enabled && $retrieve_scores;
55
}
56
57
public function getUrl($code)
58
{
59
+ return Mage::getStoreConfig('signifyd_connect/settings/url', $this->_store_id) . '/cases/' . $code;
60
}
61
62
public function logErrors()
155
try {
156
if (isset($this->_request['guaranteeDisposition'])) {
157
$case->setGuarantee($this->_request['guaranteeDisposition']);
158
159
if ($this->logRequest()) {
160
Mage::log('Set guarantee to ' . $this->_request['guaranteeDisposition'], null,
166
Mage::log('ERROR ON WEBHOOK: ' . $e->__toString(), null, 'signifyd_connect.log');
167
}
168
}
169
+ if ($this->logRequest()) {
170
+ Mage::log('No guarantee available', null, 'signifyd_connect.log');
171
+ }
172
}
173
174
public function validRequest($request, $hash)
237
}
238
}
239
240
+ public function holdOrder($order, $reason)
241
{
242
+ if ($order && $order->getId() && $order->canHold()) {
243
+ $order->hold();
244
+ $order->addStatusHistoryComment("Signifyd: order held because $reason");
245
+ $order->save();
246
+
247
+ if ($this->logRequest()) {
248
+ Mage::log('Order ' . $order->getId() . ' held because ' . $reason, null, 'signifyd_connect.log');
249
+ }
250
+ }
251
+ }
252
+
253
+ public function unholdOrder($order, $reason)
254
+ {
255
+ // in case we are in a order save retry, add a delay in order to avoid the current problem
256
+ switch ($this->_unholdRetries)
257
+ {
258
+ case 1: sleep(5); break;
259
+ case 2: sleep(10); break;
260
+ case 3: sleep(20); break;
261
+ }
262
+ $this->_unholdRetries++;
263
+ if ($order && $order->getId() && $order->canUnhold()) {
264
+ try {
265
+ $order->unhold();
266
+ $order->addStatusHistoryComment("Signifyd: order unheld because $reason");
267
+ $order->save();
268
+
269
+ if ($this->logRequest()) {
270
+ Mage::log('Order ' . $order->getId() . ' unheld because ' . $reason, null, 'signifyd_connect.log');
271
+ }
272
+ }
273
+ catch (Exception $exception)
274
+ {
275
+ Mage::log('Order ' . $order->getId() . ' unable to be saved because ' . $exception->getMessage(), null, 'signifyd_connect.log');
276
+ Mage::log('Order ' . $order->getId() . ' was not unheld. Retry attempt ' . $this->_unholdRetries, null, 'signifyd_connect.log');
277
+ // in case there was an error during order save operation, make a new attempt to save the order
278
+ if ($this->_unholdRetries < 3)
279
+ $this->unholdOrder($order, $reason);
280
+ }
281
+ }
282
+ // verify once again if the order have the right status, if the right status is not setup, retry the operation
283
+ if ($this->_unholdRetries <= 3) {
284
+ $reloaded_order = Mage::getModel('sales/order')->load($order->getId());
285
+ if ($reloaded_order->getState() === $order::STATE_HOLDED) {
286
+ Mage::log('Order ' . $order->getId() . ' was not unheld. Retry attempt ' . $this->_unholdRetries, null, 'signifyd_connect.log');
287
+ $this->unholdOrder($order, $reason);
288
+ }
289
+ }
290
+ }
291
+
292
+ public function cancelOrder($order, $reason)
293
+ {
294
+ if ($order->getState() === $order::STATE_HOLDED)
295
+ $this->unholdOrder($order, $reason);
296
+ if ($order && $order->getId() && $order->canCancel()) {
297
+ $order->cancel();
298
+ $order->addStatusHistoryComment("Signifyd: order canceled because $reason");
299
+ $order->save();
300
+
301
+ if ($this->logRequest()) {
302
+ Mage::log('Order ' . $order->getId() . ' cancelled because ' . $reason, null, 'signifyd_connect.log');
303
+ }
304
+ }
305
+ }
306
+
307
+ public function invoiceOrder($order)
308
+ {
309
+ if ($order && $order->getId() && $order->canInvoice() && $this->canInvoice()) {
310
+ $items = array();
311
+ foreach ($order->getAllItems() as $item) {
312
+ $items[$item->getId()] = $item->getQtyOrdered();
313
+ }
314
+
315
+ $invoice_api = Mage::getModel('sales/order_invoice_api');
316
+
317
+ try {
318
+ $invoice_id = $invoice_api->create($order->getIncrementId(), $items, null, false, true);
319
+
320
+ $invoice_api->capture($invoice_id);
321
+ } catch (Exception $e) {
322
+ if ($this->logErrors()) {
323
+ Mage::log('Exception while creating invoice: ' . $e->__toString(), null, 'signifyd_connect.log');
324
+ }
325
+ }
326
+ }
327
+ }
328
+
329
+ public function processAdditional($case, $original_status = false)
330
+ {
331
+ $order = $this->_order;
332
333
if ($order && $order->getId()) {
334
+ $threshold = $this->holdThreshold();
335
+
336
+ $negativeAction = $this->negativeGuaranteeAction();
337
+ $positiveAction = $this->positiveGuaranteeAction();
338
+
339
$newGuarantee = null;
340
try{
341
+ $newGuarantee = isset($this->_request ['guaranteeDisposition']) ? $this->_request ['guaranteeDisposition'] : null;
342
} catch(Exception $e){
343
if ($this->logErrors()) {
344
Mage::log('ERROR ON WEBHOOK: ' . $e->__toString(), null, 'signifyd_connect.log');
345
}
346
}
347
+ $newScore = $case->getScore();
348
+
349
// If a guarantee has been set, we no longer care about other actions
350
if (isset($newGuarantee) && $newGuarantee != $this->_previousGuarantee) {
351
+ if ($newGuarantee == 'DECLINED' && $negativeAction != 'nothing') {
352
+ if ($negativeAction == 'hold') {
353
+ $this->holdOrder($order, "guarantee declined");
354
+ } else if ($negativeAction == 'cancel') {
355
+ $this->cancelOrder($order, "guarantee declined");
356
} else {
357
Mage::log("Unknown action $negativeAction", null, 'signifyd_connect.log');
358
}
359
+ } else if ($newGuarantee == 'APPROVED' && $positiveAction != 'nothing') {
360
+ if ($positiveAction == 'unhold') {
361
+ $this->unholdOrder($order, "guarantee approved");
362
} else {
363
Mage::log("Unknown action $positiveAction", null, 'signifyd_connect.log');
364
}
365
}
366
+ } else if($this->_previousGuarantee == "N/A") {
367
+ if (!$original_status || $original_status == 'PENDING') {
368
+ if ($threshold && $this->_previousScore != $newScore
369
+ && $newScore <= $threshold
370
+ && $this->canReviewHold())
371
+ {
372
+ $this->holdOrder($order, "score below threshold");
373
+ }
374
+ } else if ($original_status) {
375
+ if ($this->_request['reviewDisposition'] == 'FRAUDULENT') {
376
+ if ($this->canReviewHold()) {
377
+ $this->holdOrder($order, "case review fraudulent");
378
+ }
379
+ } else if ($this->_request['reviewDisposition'] == 'GOOD') {
380
+ if ($this->canReviewHold()) {
381
+ $this->unholdOrder($order, "case review good");
382
+ }
383
+ }
384
+ }
385
}
386
}
387
}
535
536
}
537
538
+ public function retriesAction()
539
+ {
540
+ Mage::helper('signifyd_connect')->processRetryQueue();
541
+ }
542
+
543
+ public function sendAction()
544
+ {
545
+ try {
546
+ // This request handles the send action only if we are using an unsecured
547
+ // connection. Otherwise, it does nothing
548
+ if (!Mage::getStoreConfig('signifyd_connect/settings/enabled') ||
549
+ !Mage::getStoreConfig('signifyd_connect/advanced/use_unsecure_requests')
550
+ ) {
551
+ Mage::log("Attempting to access send endpoint from frontend when it is currently disabled.", null, 'signifyd_connect.log');
552
+ return;
553
+ }
554
+ Mage::helper('signifyd_connect')->bulkSend($this);
555
+ } catch (Exception $e) {
556
+ Mage::log('Exception while sending: ' . $e->__toString(), null, 'signifyd_connect.log');
557
+ }
558
+ $this->_redirectReferer();
559
+ }
560
+
561
public function apiAction()
562
{
563
if (!$this->enabled()) {
564
echo $this->getDisabledMessage();
565
+
566
return;
567
}
568
569
+ // Prevent recursing on save
570
+ Mage::register('signifyd_action', 1);
571
572
$request = $this->getRawPost();
573
638
$this->complete();
639
}
640
641
}
app/code/community/Signifyd/Connect/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
<config>
4
<modules>
5
<Signifyd_Connect>
6
- <version>3.15.0</version>
7
</Signifyd_Connect>
8
</modules>
9
<global>
@@ -13,11 +13,6 @@
13
<authorizenet>Signifyd_Connect_Model_Authnet</authorizenet>
14
</rewrite>
15
</paygate>
16
- <sales>
17
- <rewrite>
18
- <order_payment>Signifyd_Connect_Model_Order_Payment</order_payment>
19
- </rewrite>
20
- </sales>
21
<signifyd_connect>
22
<class>Signifyd_Connect_Model</class>
23
<resourceModel>signifyd_connect_resource</resourceModel>
@@ -74,28 +69,8 @@
74
</signifyd_connect>
75
</observers>
76
</model_save_after>
77
- <sales_order_place_after>
78
- <observers>
79
- <signifyd_connect>
80
- <class>signifyd_connect/observer</class>
81
- <method>putOrderOnHold</method>
82
- </signifyd_connect>
83
- </observers>
84
- </sales_order_place_after>
85
</events>
86
</global>
87
- <crontab>
88
- <jobs>
89
- <signifyd_retry>
90
- <schedule>
91
- <cron_expr>*/30 * * * *</cron_expr>
92
- </schedule>
93
- <run>
94
- <model>signifyd_connect/cron::retry</model>
95
- </run>
96
- </signifyd_retry>
97
- </jobs>
98
- </crontab>
99
<frontend>
100
<routers>
101
<signifyd_connect>
@@ -114,6 +89,8 @@
114
<url>https://api.signifyd.com/v2</url>
115
</settings>
116
<advanced>
117
<hold_orders>0</hold_orders>
118
<hold_orders_threshold>500</hold_orders_threshold>
119
<invoice_orders>0</invoice_orders>
@@ -209,6 +186,14 @@
209
</signifyd_connect>
210
</observers>
211
</core_block_abstract_to_html_before>
212
</events>
213
</adminhtml>
214
</config>
3
<config>
4
<modules>
5
<Signifyd_Connect>
6
+ <version>3.15.1</version>
7
</Signifyd_Connect>
8
</modules>
9
<global>
13
<authorizenet>Signifyd_Connect_Model_Authnet</authorizenet>
14
</rewrite>
15
</paygate>
16
<signifyd_connect>
17
<class>Signifyd_Connect_Model</class>
18
<resourceModel>signifyd_connect_resource</resourceModel>
69
</signifyd_connect>
70
</observers>
71
</model_save_after>
72
</events>
73
</global>
74
<frontend>
75
<routers>
76
<signifyd_connect>
89
<url>https://api.signifyd.com/v2</url>
90
</settings>
91
<advanced>
92
+ <retrieve_score>0</retrieve_score>
93
+ <show_scores>0</show_scores>
94
<hold_orders>0</hold_orders>
95
<hold_orders_threshold>500</hold_orders_threshold>
96
<invoice_orders>0</invoice_orders>
186
</signifyd_connect>
187
</observers>
188
</core_block_abstract_to_html_before>
189
+ <core_block_abstract_prepare_layout_before>
190
+ <observers>
191
+ <signifyd_connect>
192
+ <model>signifyd_connect/observer</model>
193
+ <method>coreBlockAbstractPrepareLayoutBefore</method>
194
+ </signifyd_connect>
195
+ </observers>
196
+ </core_block_abstract_prepare_layout_before>
197
</events>
198
</adminhtml>
199
</config>
app/code/community/Signifyd/Connect/etc/system.xml CHANGED
@@ -17,7 +17,7 @@
17
<show_in_store>1</show_in_store>
18
<groups>
19
<settings translate="label">
20
- <label>General</label>
21
<frontend_type>text</frontend_type>
22
<sort_order>2</sort_order>
23
<show_in_default>1</show_in_default>
@@ -32,71 +32,160 @@
32
<show_in_default>1</show_in_default>
33
<show_in_website>1</show_in_website>
34
<show_in_store>1</show_in_store>
35
</enabled>
36
<key translate="label">
37
- <label>API Key</label>
38
<frontend_type>text</frontend_type>
39
<sort_order>20</sort_order>
40
<show_in_default>1</show_in_default>
41
<show_in_website>1</show_in_website>
42
<show_in_store>1</show_in_store>
43
</key>
44
</fields>
45
</settings>
46
<advanced>
47
- <label>Order Workflow</label>
48
<frontend_type>text</frontend_type>
49
<sort_order>2</sort_order>
50
<show_in_default>1</show_in_default>
51
<show_in_website>1</show_in_website>
52
<show_in_store>1</show_in_store>
53
<fields>
54
- <accepted_from_guaranty translate="label">
55
- <label>When an order is approved for Guarantee:</label>
56
<frontend_type>select</frontend_type>
57
- <source_model>signifyd_connect/system_config_source_options_accepted</source_model>
58
- <sort_order>20</sort_order>
59
<show_in_default>1</show_in_default>
60
<show_in_website>1</show_in_website>
61
<show_in_store>1</show_in_store>
62
- </accepted_from_guaranty>
63
- <declined_from_guaranty translate="label">
64
- <label>When an order is declined for Guarantee:</label>
65
<frontend_type>select</frontend_type>
66
- <source_model>signifyd_connect/system_config_source_options_declined</source_model>
67
- <sort_order>30</sort_order>
68
<show_in_default>1</show_in_default>
69
<show_in_website>1</show_in_website>
70
<show_in_store>1</show_in_store>
71
- </declined_from_guaranty>
72
- </fields>
73
- </advanced>
74
- <webhook>
75
- <label>Webhook URL</label>
76
- <frontend_type>text</frontend_type>
77
- <sort_order>3</sort_order>
78
- <show_in_default>1</show_in_default>
79
- <show_in_website>1</show_in_website>
80
- <show_in_store>1</show_in_store>
81
- <fields>
82
- <url translate="label">
83
- <label>Webhook URL</label>
84
- <frontend_type>label</frontend_type>
85
- <sort_order>30</sort_order>
86
<show_in_default>1</show_in_default>
87
<show_in_website>1</show_in_website>
88
<show_in_store>1</show_in_store>
89
- <comment><model>signifyd_connect/link</model></comment>
90
- </url>
91
</fields>
92
- </webhook>
93
<log translate="label">
94
- <label>Logging</label>
95
<frontend_type>text</frontend_type>
96
- <sort_order>4</sort_order>
97
<show_in_default>1</show_in_default>
98
<show_in_website>1</show_in_website>
99
<show_in_store>1</show_in_store>
100
<fields>
101
<request>
102
<label>Log requests</label>
17
<show_in_store>1</show_in_store>
18
<groups>
19
<settings translate="label">
20
+ <label>General Settings</label>
21
<frontend_type>text</frontend_type>
22
<sort_order>2</sort_order>
23
<show_in_default>1</show_in_default>
32
<show_in_default>1</show_in_default>
33
<show_in_website>1</show_in_website>
34
<show_in_store>1</show_in_store>
35
+ <comment><![CDATA[This enables or disables the Signifyd extension]]></comment>
36
</enabled>
37
<key translate="label">
38
+ <label>Signifyd API Key</label>
39
<frontend_type>text</frontend_type>
40
<sort_order>20</sort_order>
41
<show_in_default>1</show_in_default>
42
<show_in_website>1</show_in_website>
43
<show_in_store>1</show_in_store>
44
+ <comment><![CDATA[You will find this in <a href="http://signifyd.com/settings/teams">http://signifyd.com/settings/teams</a> after you create a Signifyd account]]></comment>
45
</key>
46
+ <url translate="label">
47
+ <label>Signifyd API URL</label>
48
+ <frontend_type>text</frontend_type>
49
+ <sort_order>30</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ <comment><![CDATA[This is set by default. Don’t change unless asked to do so.]]></comment>
54
+ </url>
55
</fields>
56
</settings>
57
<advanced>
58
+ <label>Advanced</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>1</show_in_website>
63
<show_in_store>1</show_in_store>
64
<fields>
65
+ <retrieve_score translate="label">
66
+ <label>Retrieve Signifyd scores</label>
67
<frontend_type>select</frontend_type>
68
+ <source_model>adminhtml/system_config_source_yesno</source_model>
69
+ <sort_order>50</sort_order>
70
<show_in_default>1</show_in_default>
71
<show_in_website>1</show_in_website>
72
<show_in_store>1</show_in_store>
73
+ <comment><model>signifyd_connect/link</model></comment>
74
+ </retrieve_score>
75
+ <show_scores translate="label">
76
+ <label>Show Scores in Magento Order Grid</label>
77
<frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_yesno</source_model>
79
+ <sort_order>55</sort_order>
80
<show_in_default>1</show_in_default>
81
<show_in_website>1</show_in_website>
82
<show_in_store>1</show_in_store>
83
+ <depends><retrieve_score>1</retrieve_score></depends>
84
+ <comment><![CDATA[Your scores will show in the Magento Order Grid once enabled]]></comment>
85
+ </show_scores>
86
+ <hold_orders translate="label">
87
+ <label>Place hold on orders below score threshold</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>adminhtml/system_config_source_yesno</source_model>
90
+ <sort_order>60</sort_order>
91
<show_in_default>1</show_in_default>
92
<show_in_website>1</show_in_website>
93
<show_in_store>1</show_in_store>
94
+ <depends><retrieve_score>1</retrieve_score></depends>
95
+ <comment><![CDATA[Orders will be placed on hold below a threshold specified by you. We recommend a threshold of 500. Clicking Thumbs Up will Unhold the Order and Thumbs down will leave the Order on Hold. ]]></comment>
96
+ </hold_orders>
97
+ <hold_orders_threshold translate="label">
98
+ <label>Hold score threshold</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>70</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
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>1</show_in_website>
114
+ <show_in_store>1</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
+ <guarantee_positive_action translate="label">
128
+ <label>Action on Guarantee Approve</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>signifyd_connect/system_config_source_options_positive</source_model>
131
+ <sort_order>86</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ <comment><![CDATA[Which action to take on orders when the guarantee is approved]]></comment>
136
+ </guarantee_positive_action>
137
+ <invoice_orders translate="label">
138
+ <label>Invoice orders after receiving Signifyd Scores</label>
139
+ <frontend_type>select</frontend_type>
140
+ <source_model>adminhtml/system_config_source_yesno</source_model>
141
+ <sort_order>90</sort_order>
142
+ <show_in_default>0</show_in_default>
143
+ <show_in_website>0</show_in_website>
144
+ <show_in_store>0</show_in_store>
145
+ <depends><retrieve_score>1</retrieve_score></depends>
146
+ <comment><![CDATA[Attempt to invoice (and capture) orders after receiving a Signifyd score where the order has not been held. If the order cannot be invoiced, no action will be taken. This will invoice the whole order, so is not suitable for workflows where partial invoices are needed.]]></comment>
147
+ </invoice_orders>
148
+ <invoice_orders_notify translate="label">
149
+ <label>Notify customer</label>
150
+ <frontend_type>select</frontend_type>
151
+ <source_model>adminhtml/system_config_source_yesno</source_model>
152
+ <sort_order>95</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ <comment><![CDATA[Send email notification to customers after invoicing orders]]></comment>
157
+ <depends><invoice_orders>1</invoice_orders></depends>
158
+ </invoice_orders_notify>
159
+ <use_unsecure_requests>
160
+ <label>Use Unsecure Requests</label>
161
+ <frontend_type>select</frontend_type>
162
+ <source_model>adminhtml/system_config_source_yesno</source_model>
163
+ <sort_order>100</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ <comment><![CDATA[For backend actions (such as bulk-send from the order grid), use the frontend controller instead of the secure backend controller. This is intended to work around some potential issues. Use only when necessary, and set it back once the actions are completed]]></comment>
168
+ </use_unsecure_requests>
169
+ <enable_payment_updates>
170
+ <label>Enable payment updates</label>
171
+ <frontend_type>select</frontend_type>
172
+ <source_model>adminhtml/system_config_source_yesno</source_model>
173
+ <sort_order>110</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><![CDATA[Enable update request when new payment information is received by a payment service]]></comment>
178
+ </enable_payment_updates>
179
</fields>
180
+ </advanced>
181
<log translate="label">
182
+ <label>Log Settings</label>
183
<frontend_type>text</frontend_type>
184
+ <sort_order>3</sort_order>
185
<show_in_default>1</show_in_default>
186
<show_in_website>1</show_in_website>
187
<show_in_store>1</show_in_store>
188
+ <comment><![CDATA[Note: You must also enable logging for the site. You can find the setting in Configuration->Advanced->Developer->Log Settings]]></comment>
189
<fields>
190
<request>
191
<label>Log requests</label>
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.14.0-3.15.0.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- try {
4
- $this->startSetup();
5
- $this->register();
6
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `magento_status` VARCHAR( 64 ) NOT NULL DEFAULT 'waiting_submission'");
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.15.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>signifyd</user><email>manelis@signifyd.com</email></author></authors>
13
- <date>2016-09-07</date>
14
- <time>12:07:40</time>
15
- <contents><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="eed53eab290b65da639e22fe195f9fcb"/></dir><file name="Order.php" hash="89619b9c5c9795e98e7637b4c5396888"/></dir></dir><file name="Renderer.php" hash="dce3cc400745afa31806e7de6dbf9d02"/><file name="Url.php" hash="dbe3e967879a69a2c943056f820e4688"/></dir><dir name="Helper"><file name="Data.php" hash="e4584d73cb17e75f871759c47daabb53"/><file name="Log.php" hash="96f1286eb9c273f637178ffd94a04d42"/></dir><dir name="Model"><file name="Authnet.php" hash="876c96e26693d26adf194e889c1a802e"/><file name="Case.php" hash="db5387f02172996e6ee83b00a687820f"/><file name="Cron.php" hash="fddfc61904a2d844c35a78593a6712b8"/><file name="Link.php" hash="989876b57bd340597372e20570086abe"/><file name="Observer.php" hash="46b0b3d8908ce19f81bd9f381b14d96c"/><dir name="Order"><file name="Payment.php" hash="a0ad3107170b7bae94b8402960b5cf48"/></dir><file name="Order.php" hash="9c7a8fa528a95fbcf42b7231909a4496"/><dir name="Resource"><dir name="Case"><file name="Collection.php" hash="a1ed45e9bde8f823384009c6d1a6be64"/></dir><file name="Case.php" hash="19ae43ac4339a6efa4c5399b7524c61a"/><dir name="Retries"><file name="Collection.php" hash="04e0aa690b9887b7c24c48c92adc62b5"/></dir><file name="Retries.php" hash="ab59ce50d0b089a0b001250d49377719"/></dir><file name="Retries.php" hash="3a945234c76244d2d8cccf8a2b67309c"/><file name="Setup.php" hash="89df3e016fa0a582f9eb94c55dee1ede"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Options"><file name="Accepted.php" hash="1dcb358d451c75f297921bbf84e9bd3b"/><file name="Declined.php" hash="ed2441579a7bad4e7505a6f0a3f530ac"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="SignifydController.php" hash="145877221ca9e5b0fd3adbefb1b42315"/></dir><file name="ConnectController.php" hash="c3eed72ff1b813ffda0b4ac69c11271f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bfe6943cf5eab707f64694f555b9f2c1"/><file name="config.xml" hash="266f892e6d108970a9be55a9577df1d0"/><file name="system.xml" hash="bc12ac0cc5f189d95b2127e2414a25a4"/></dir><dir name="sql"><dir name="signifyd_connect_setup"><file name="mysql4-install-3.1.1.php" hash="119e423f67c7e47c345374eddbb1dfe5"/><file name="mysql4-install-3.12.0.php" hash="3dd59c1e20105629157dfe134193dcb9"/><file name="mysql4-install-3.3.0.php" hash="455c92d22c1e5c55661f050ca19f82f6"/><file name="mysql4-install-3.4.0.php" hash="383226cc656aa9e0db194178be7dfc10"/><file name="mysql4-install-3.4.5.php" hash="f8eaec5f235b7bb16777720e0e999268"/><file name="mysql4-install-3.7.0.php" hash="cdc3701ad0793bc360addfec51466605"/><file name="mysql4-install-3.8.0.php" hash="f74e65329444df9b088c00d5837f4593"/><file name="mysql4-upgrade-3.10.0-3.10.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.10.1-3.11.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.11.0-3.11.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.11.1-3.12.0.php" hash="703ddd745468f40c75758cd8066d63fe"/><file name="mysql4-upgrade-3.12.0-3.13.0.php" hash="333f7116c34aa765f4e7efaf8be5feda"/><file name="mysql4-upgrade-3.14.0-3.15.0.php" hash="7cde716fe0e3e849c1f82bbd7bf8ec3a"/><file name="mysql4-upgrade-3.2.0-3.2.1.php" hash="26f702c9c4d38873e0050657b003ffd4"/><file name="mysql4-upgrade-3.2.1-3.2.2.php" hash="4a5fe35d03268d0a8448a1accaf64958"/><file name="mysql4-upgrade-3.2.2-3.2.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.2.3-3.3.0.php" hash="7b5c5ae2ac87cc7fef2ac99bc28b27ae"/><file name="mysql4-upgrade-3.3.0-3.4.0.php" hash="8faecf3097eaf538fece8fe91b575356"/><file name="mysql4-upgrade-3.4.0-3.4.1.php" hash="11ad4be0af110283e2ce34b1315721f1"/><file name="mysql4-upgrade-3.4.1-3.4.2.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.2-3.4.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.3-3.4.4.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.4-3.4.5.php" hash="5320d366b6f72258f4e27a046ba04c3c"/><file name="mysql4-upgrade-3.4.5-3.4.6.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.6-3.4.7.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.7-3.4.8.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.8-3.5.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.0-3.5.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.1-3.5.2.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.2-3.5.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.3-3.6.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.6.0-3.7.0.php" hash="1462d8ccaf0d0480d31a47afb3a00f63"/><file name="mysql4-upgrade-3.7.0-3.8.0.php" hash="758799806d039277d8d509e017c64535"/><file name="mysql4-upgrade-3.8.0-3.9.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.9.0-3.10.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Signifyd_Connect.xml" hash="0f6a1fe90c078db114746aa381208982"/></dir></target></contents>
16
<compatible/>
17
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Signifyd_Connect</name>
4
+ <version>3.15.1</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>signifyd</user><email>manelis@signifyd.com</email></author></authors>
13
+ <date>2016-09-13</date>
14
+ <time>08:36:24</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Signifyd_Connect.xml" hash="0f6a1fe90c078db114746aa381208982"/></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="eed53eab290b65da639e22fe195f9fcb"/></dir><file name="Order.php" hash="89619b9c5c9795e98e7637b4c5396888"/></dir></dir><file name="Renderer.php" hash="dce3cc400745afa31806e7de6dbf9d02"/></dir><dir name="Helper"><file name="Data.php" hash="ca0f88bc35ef0954e3846623d40cf5e9"/></dir><dir name="Model"><file name="Authnet.php" hash="876c96e26693d26adf194e889c1a802e"/><file name="Case.php" hash="76d681cf954c7c71eeb034d7de25c7c2"/><file name="Cron.php" hash="98bc248c7ab392d6ea47e38be3a4f76e"/><file name="Link.php" hash="7136232749510f192cd589c1c905498c"/><file name="Observer.php" hash="0289a316455aebb3bc1a676dfe787532"/><dir name="Resource"><dir name="Case"><file name="Collection.php" hash="a1ed45e9bde8f823384009c6d1a6be64"/></dir><file name="Case.php" hash="19ae43ac4339a6efa4c5399b7524c61a"/><dir name="Retries"><file name="Collection.php" hash="04e0aa690b9887b7c24c48c92adc62b5"/></dir><file name="Retries.php" hash="ab59ce50d0b089a0b001250d49377719"/></dir><file name="Retries.php" hash="3a945234c76244d2d8cccf8a2b67309c"/><file name="Setup.php" hash="89df3e016fa0a582f9eb94c55dee1ede"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Options"><file name="Negative.php" hash="60a03a97d0a093ad8296996480f696dd"/><file name="Positive.php" hash="c08bd01028744afa638121f06178c5c1"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="SignifydController.php" hash="afde33d7b0149760524084facd926621"/></dir><file name="ConnectController.php" hash="6467925749dc28121ef1d62e8d6354a3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bfe6943cf5eab707f64694f555b9f2c1"/><file name="config.xml" hash="0f3e156c9f95045c4cff2e20eb8d1919"/><file name="system.xml" hash="f9774d7bc239768837ee12b9d2a76d30"/></dir><dir name="sql"><dir name="signifyd_connect_setup"><file name="mysql4-install-3.1.1.php" hash="119e423f67c7e47c345374eddbb1dfe5"/><file name="mysql4-install-3.12.0.php" hash="3dd59c1e20105629157dfe134193dcb9"/><file name="mysql4-install-3.3.0.php" hash="455c92d22c1e5c55661f050ca19f82f6"/><file name="mysql4-install-3.4.0.php" hash="383226cc656aa9e0db194178be7dfc10"/><file name="mysql4-install-3.4.5.php" hash="f8eaec5f235b7bb16777720e0e999268"/><file name="mysql4-install-3.7.0.php" hash="cdc3701ad0793bc360addfec51466605"/><file name="mysql4-install-3.8.0.php" hash="f74e65329444df9b088c00d5837f4593"/><file name="mysql4-upgrade-3.10.0-3.10.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.10.1-3.11.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.11.0-3.11.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.11.1-3.12.0.php" hash="703ddd745468f40c75758cd8066d63fe"/><file name="mysql4-upgrade-3.12.0-3.13.0.php" hash="333f7116c34aa765f4e7efaf8be5feda"/><file name="mysql4-upgrade-3.2.0-3.2.1.php" hash="26f702c9c4d38873e0050657b003ffd4"/><file name="mysql4-upgrade-3.2.1-3.2.2.php" hash="4a5fe35d03268d0a8448a1accaf64958"/><file name="mysql4-upgrade-3.2.2-3.2.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.2.3-3.3.0.php" hash="7b5c5ae2ac87cc7fef2ac99bc28b27ae"/><file name="mysql4-upgrade-3.3.0-3.4.0.php" hash="8faecf3097eaf538fece8fe91b575356"/><file name="mysql4-upgrade-3.4.0-3.4.1.php" hash="11ad4be0af110283e2ce34b1315721f1"/><file name="mysql4-upgrade-3.4.1-3.4.2.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.2-3.4.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.3-3.4.4.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.4-3.4.5.php" hash="5320d366b6f72258f4e27a046ba04c3c"/><file name="mysql4-upgrade-3.4.5-3.4.6.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.6-3.4.7.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.7-3.4.8.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.8-3.5.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.0-3.5.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.1-3.5.2.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.2-3.5.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.3-3.6.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.6.0-3.7.0.php" hash="1462d8ccaf0d0480d31a47afb3a00f63"/><file name="mysql4-upgrade-3.7.0-3.8.0.php" hash="758799806d039277d8d509e017c64535"/><file name="mysql4-upgrade-3.8.0-3.9.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.9.0-3.10.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/></dir></dir></dir></dir></target></contents>
16
<compatible/>
17
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
</package>