Signifyd_Connect - Version 3.16.1

Version Notes

Supports all versions of Magento

Download this release

Release Info

Developer signifyd
Extension Signifyd_Connect
Version 3.16.1
Comparing to
See all releases


Code changes from version 3.15.1 to 3.16.1

Files changed (67) hide show
  1. app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order.php +13 -13
  2. app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order/Grid.php +134 -134
  3. app/code/community/Signifyd/Connect/Block/Adminhtml/System/Config/Fieldset/Hint.php +28 -0
  4. app/code/community/Signifyd/Connect/Block/Renderer.php +28 -28
  5. app/code/community/Signifyd/Connect/Block/Url.php +10 -0
  6. app/code/community/Signifyd/Connect/Helper/Data.php +796 -799
  7. app/code/community/Signifyd/Connect/Helper/Log.php +25 -0
  8. app/code/community/Signifyd/Connect/Model/Authnet.php +17 -17
  9. app/code/community/Signifyd/Connect/Model/Case.php +29 -10
  10. app/code/community/Signifyd/Connect/Model/Cron.php +136 -9
  11. app/code/community/Signifyd/Connect/Model/Link.php +9 -9
  12. app/code/community/Signifyd/Connect/Model/Observer.php +302 -320
  13. app/code/community/Signifyd/Connect/Model/Order.php +412 -0
  14. app/code/community/Signifyd/Connect/Model/Order/Payment.php +29 -0
  15. app/code/community/Signifyd/Connect/Model/Resource/Case.php +10 -10
  16. app/code/community/Signifyd/Connect/Model/Resource/Case/Collection.php +9 -9
  17. app/code/community/Signifyd/Connect/Model/Resource/Retries.php +10 -10
  18. app/code/community/Signifyd/Connect/Model/Resource/Retries/Collection.php +9 -9
  19. app/code/community/Signifyd/Connect/Model/Retries.php +10 -10
  20. app/code/community/Signifyd/Connect/Model/Setup.php +53 -53
  21. app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Accepted.php +19 -0
  22. app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Declined.php +19 -0
  23. app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Negative.php +0 -22
  24. app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Positive.php +0 -18
  25. app/code/community/Signifyd/Connect/controllers/Adminhtml/SignifydController.php +22 -27
  26. app/code/community/Signifyd/Connect/controllers/ConnectController.php +523 -641
  27. app/code/community/Signifyd/Connect/etc/adminhtml.xml +16 -16
  28. app/code/community/Signifyd/Connect/etc/config.xml +224 -199
  29. app/code/community/Signifyd/Connect/etc/system.xml +127 -222
  30. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.1.1.php +13 -13
  31. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.12.0.php +26 -26
  32. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.3.0.php +19 -19
  33. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.4.0.php +21 -21
  34. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.4.5.php +21 -21
  35. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.7.0.php +18 -18
  36. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.8.0.php +19 -19
  37. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.10.0-3.10.1.php +8 -8
  38. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.10.1-3.11.0.php +8 -8
  39. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.11.0-3.11.1.php +8 -8
  40. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.11.1-3.12.0.php +17 -17
  41. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.12.0-3.13.0.php +15 -15
  42. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.15.1-3.16.0.php +10 -0
  43. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.0-3.2.1.php +5 -5
  44. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.1-3.2.2.php +17 -17
  45. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.2-3.2.3.php +8 -8
  46. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.3-3.3.0.php +10 -10
  47. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.3.0-3.4.0.php +11 -11
  48. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.0-3.4.1.php +10 -10
  49. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.1-3.4.2.php +8 -8
  50. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.2-3.4.3.php +8 -8
  51. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.3-3.4.4.php +8 -8
  52. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.4-3.4.5.php +13 -13
  53. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.5-3.4.6.php +8 -8
  54. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.6-3.4.7.php +8 -8
  55. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.7-3.4.8.php +8 -8
  56. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.8-3.5.0.php +8 -8
  57. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.0-3.5.1.php +8 -8
  58. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.1-3.5.2.php +8 -8
  59. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.2-3.5.3.php +8 -8
  60. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.3-3.6.0.php +8 -8
  61. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.6.0-3.7.0.php +31 -31
  62. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.7.0-3.8.0.php +10 -10
  63. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.8.0-3.9.0.php +8 -8
  64. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.9.0-3.10.0.php +8 -8
  65. app/design/adminhtml/default/default/template/signifyd/connect/config/hint.phtml +46 -0
  66. app/etc/modules/Signifyd_Connect.xml +9 -9
  67. package.xml +5 -5
app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Block_Adminhtml_Sales_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
4
- {
5
- public function __construct()
6
- {
7
- $this->_blockGroup = 'signifyd_connect';
8
- $this->_controller = 'adminhtml_sales_order';
9
- $this->_headerText = Mage::helper('signifyd_connect')->__('Signifyd Scores');
10
- parent::__construct();
11
- $this->_removeButton('add');
12
- }
13
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Block_Adminhtml_Sales_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->_blockGroup = 'signifyd_connect';
8
+ $this->_controller = 'adminhtml_sales_order';
9
+ $this->_headerText = Mage::helper('signifyd_connect')->__('Signifyd Scores');
10
+ parent::__construct();
11
+ $this->_removeButton('add');
12
+ }
13
+ }
app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order/Grid.php CHANGED
@@ -1,134 +1,134 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('signifyd_connect_grid');
9
- $this->setDefaultSort('increment_id');
10
- $this->setDefaultDir('DESC');
11
- $this->setSaveParametersInSession(true);
12
- $this->setUseAjax(true);
13
- }
14
-
15
- public function oldSupport()
16
- {
17
- $model = Mage::getSingleton('signifyd_connect/observer');
18
-
19
- return $model->oldSupport();
20
- }
21
-
22
- protected function _prepareCollection()
23
- {
24
- $collection = Mage::getResourceModel('sales/order_collection');
25
-
26
- if ($this->oldSupport()) {
27
- $collection->getSelect()->joinLeft(
28
- array('signifyd' => Mage::getSingleton('core/resource')->getTableName('signifyd_connect_case')),
29
- 'signifyd.order_increment = e.increment_id',
30
- array(
31
- 'score' => 'score',
32
- )
33
- );
34
- } else {
35
- $collection->addExpressionFieldToSelect(
36
- 'fullname',
37
- 'CONCAT({{customer_firstname}}, \' \', {{customer_lastname}})',
38
- array('customer_firstname' => 'main_table.customer_firstname', 'customer_lastname' => 'main_table.customer_lastname')
39
- );
40
-
41
- $collection->getSelect()->joinLeft(
42
- array('signifyd' => Mage::getSingleton('core/resource')->getTableName('signifyd_connect_case')),
43
- 'signifyd.order_increment = main_table.increment_id',
44
- array(
45
- 'score' => 'score',
46
- 'guarantee' => 'guarantee',
47
- )
48
- );
49
- }
50
-
51
- $this->setCollection($collection);
52
- parent::_prepareCollection();
53
- return $this;
54
- }
55
-
56
- protected function _prepareColumns()
57
- {
58
- $helper = Mage::helper('signifyd_connect');
59
- $currency = (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
60
-
61
- $this->addColumn('increment_id', array(
62
- 'header' => $helper->__('Order #'),
63
- 'index' => 'increment_id'
64
- ));
65
-
66
- $this->addColumn('purchased_on', array(
67
- 'header' => $helper->__('Purchased On'),
68
- 'type' => 'datetime',
69
- 'index' => 'created_at'
70
- ));
71
-
72
- if (!$this->oldSupport()) {
73
- $this->addColumn('fullname', array(
74
- 'header' => $helper->__('Name'),
75
- 'index' => 'fullname',
76
- 'filter_index' => 'CONCAT(customer_firstname, \' \', customer_lastname)'
77
- ));
78
- }
79
-
80
- $this->addColumn('grand_total', array(
81
- 'header' => $helper->__('Grand Total'),
82
- 'index' => 'grand_total',
83
- 'type' => 'currency',
84
- 'currency_code' => $currency
85
- ));
86
-
87
- $this->addColumn('shipping_method', array(
88
- 'header' => $helper->__('Shipping Method'),
89
- 'index' => 'shipping_description'
90
- ));
91
-
92
- $this->addColumn('score', array(
93
- 'header' => $helper->__('Signifyd Score'),
94
- 'align' => 'left',
95
- 'type' => 'text',
96
- 'index' => 'score',
97
- 'filter' => false,
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
- 'renderer' => 'signifyd_connect/renderer',
109
- ));
110
-
111
- $this->addColumn('order_status', array(
112
- 'header' => $helper->__('Status'),
113
- 'index' => 'status',
114
- 'type' => 'options',
115
- 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
116
- ));
117
-
118
- return parent::_prepareColumns();
119
- }
120
-
121
- public function getRowUrl($row)
122
- {
123
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
124
- return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
125
- }
126
-
127
- return false;
128
- }
129
-
130
- public function getGridUrl()
131
- {
132
- return $this->getUrl('*/*/grid', array('_current'=>true));
133
- }
134
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('signifyd_connect_grid');
9
+ $this->setDefaultSort('increment_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(true);
13
+ }
14
+
15
+ public function oldSupport()
16
+ {
17
+ $model = Mage::getSingleton('signifyd_connect/observer');
18
+
19
+ return $model->oldSupport();
20
+ }
21
+
22
+ protected function _prepareCollection()
23
+ {
24
+ $collection = Mage::getResourceModel('sales/order_collection');
25
+
26
+ if ($this->oldSupport()) {
27
+ $collection->getSelect()->joinLeft(
28
+ array('signifyd' => Mage::getSingleton('core/resource')->getTableName('signifyd_connect_case')),
29
+ 'signifyd.order_increment = e.increment_id',
30
+ array(
31
+ 'score' => 'score',
32
+ )
33
+ );
34
+ } else {
35
+ $collection->addExpressionFieldToSelect(
36
+ 'fullname',
37
+ 'CONCAT({{customer_firstname}}, \' \', {{customer_lastname}})',
38
+ array('customer_firstname' => 'main_table.customer_firstname', 'customer_lastname' => 'main_table.customer_lastname')
39
+ );
40
+
41
+ $collection->getSelect()->joinLeft(
42
+ array('signifyd' => Mage::getSingleton('core/resource')->getTableName('signifyd_connect_case')),
43
+ 'signifyd.order_increment = main_table.increment_id',
44
+ array(
45
+ 'score' => 'score',
46
+ 'guarantee' => 'guarantee',
47
+ )
48
+ );
49
+ }
50
+
51
+ $this->setCollection($collection);
52
+ parent::_prepareCollection();
53
+ return $this;
54
+ }
55
+
56
+ protected function _prepareColumns()
57
+ {
58
+ $helper = Mage::helper('signifyd_connect');
59
+ $currency = (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
60
+
61
+ $this->addColumn('increment_id', array(
62
+ 'header' => $helper->__('Order #'),
63
+ 'index' => 'increment_id'
64
+ ));
65
+
66
+ $this->addColumn('purchased_on', array(
67
+ 'header' => $helper->__('Purchased On'),
68
+ 'type' => 'datetime',
69
+ 'index' => 'created_at'
70
+ ));
71
+
72
+ if (!$this->oldSupport()) {
73
+ $this->addColumn('fullname', array(
74
+ 'header' => $helper->__('Name'),
75
+ 'index' => 'fullname',
76
+ 'filter_index' => 'CONCAT(customer_firstname, \' \', customer_lastname)'
77
+ ));
78
+ }
79
+
80
+ $this->addColumn('grand_total', array(
81
+ 'header' => $helper->__('Grand Total'),
82
+ 'index' => 'grand_total',
83
+ 'type' => 'currency',
84
+ 'currency_code' => $currency
85
+ ));
86
+
87
+ $this->addColumn('shipping_method', array(
88
+ 'header' => $helper->__('Shipping Method'),
89
+ 'index' => 'shipping_description'
90
+ ));
91
+
92
+ $this->addColumn('score', array(
93
+ 'header' => $helper->__('Signifyd Score'),
94
+ 'align' => 'left',
95
+ 'type' => 'text',
96
+ 'index' => 'score',
97
+ 'filter' => false,
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
+ 'renderer' => 'signifyd_connect/renderer',
109
+ ));
110
+
111
+ $this->addColumn('order_status', array(
112
+ 'header' => $helper->__('Status'),
113
+ 'index' => 'status',
114
+ 'type' => 'options',
115
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
116
+ ));
117
+
118
+ return parent::_prepareColumns();
119
+ }
120
+
121
+ public function getRowUrl($row)
122
+ {
123
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
124
+ return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
125
+ }
126
+
127
+ return false;
128
+ }
129
+
130
+ public function getGridUrl()
131
+ {
132
+ return $this->getUrl('*/*/grid', array('_current'=>true));
133
+ }
134
+ }
app/code/community/Signifyd/Connect/Block/Adminhtml/System/Config/Fieldset/Hint.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Hint Block
5
+ *
6
+ * @category Signifyd Connect
7
+ * @package Signifyd_Connect
8
+ * @author Signifyd
9
+ */
10
+
11
+ class Signifyd_Connect_Block_Adminhtml_System_Config_Fieldset_Hint
12
+ extends Mage_Adminhtml_Block_Abstract
13
+ implements Varien_Data_Form_Element_Renderer_Interface
14
+ {
15
+ protected $_template = 'signifyd/connect/config/hint.phtml';
16
+
17
+ /**
18
+ * Render fieldset html
19
+ *
20
+ * @param Varien_Data_Form_Element_Abstract $element
21
+ * @return string
22
+ */
23
+ public function render(Varien_Data_Form_Element_Abstract $element)
24
+ {
25
+ return $this->toHtml();
26
+ }
27
+ }
28
+
app/code/community/Signifyd/Connect/Block/Renderer.php CHANGED
@@ -1,28 +1,28 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Block_Renderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- $value = $row->getData($this->getColumn()->getIndex());
8
- $column = $this->getColumn()->getId();
9
- $helper = Mage::helper('signifyd_connect');
10
-
11
- $url = $helper->getCaseUrl($row->getIncrementId());
12
-
13
- if ($column == "score") {
14
- if(!is_numeric($value)) {
15
- return $helper->__('N/A');
16
- }
17
- $value = floor($value);
18
- } else if ($column == "guarantee" && $value == "N/A") {
19
- return $value;
20
- }
21
-
22
- if ($url) {
23
- $value = "<a href=\"$url\" target=\"_blank\">$value</a>";
24
- }
25
-
26
- return $value;
27
- }
28
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Block_Renderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ $value = $row->getData($this->getColumn()->getIndex());
8
+ $column = $this->getColumn()->getId();
9
+ $helper = Mage::helper('signifyd_connect');
10
+
11
+ $url = $helper->getCaseUrl($row->getIncrementId());
12
+
13
+ if ($column == "score") {
14
+ if(!is_numeric($value)) {
15
+ return $helper->__('N/A');
16
+ }
17
+ $value = floor($value);
18
+ } else if ($column == "guarantee" && $value == "N/A") {
19
+ return $value;
20
+ }
21
+
22
+ if ($url) {
23
+ $value = "<a href=\"$url\" target=\"_blank\">$value</a>";
24
+ }
25
+
26
+ return $value;
27
+ }
28
+ }
app/code/community/Signifyd/Connect/Block/Url.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
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
@@ -1,799 +1,796 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
- const UNPROCESSED_STATUS = 0;
6
- const ENTITY_CREATED_STATUS = 1;
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')) {
13
- Mage::log($message, null, 'signifyd_connect.log');
14
- }
15
- }
16
-
17
- public function logResponse($message)
18
- {
19
- if (Mage::getStoreConfig('signifyd_connect/log/response')) {
20
- Mage::log($message, null, 'signifyd_connect.log');
21
- }
22
- }
23
-
24
- public function logError($message)
25
- {
26
- if (Mage::getStoreConfig('signifyd_connect/log/error')) {
27
- Mage::log($message, null, 'signifyd_connect.log');
28
- }
29
- }
30
-
31
- public function getProducts($quote)
32
- {
33
- $products = array();
34
-
35
- foreach ($quote->getAllItems() as $item) {
36
- $product_type = $item->getProductType();
37
-
38
- if (!$product_type || $product_type == 'simple' || $product_type == 'downloadable'
39
- || $product_type == 'grouped' || $product_type == 'virtual' ) {
40
- $product_object = $item->getData('product');
41
-
42
- if (!$product_object || !$product_object->getId()) {
43
- $product_object = Mage::getModel('catalog/product')->load($product_type);
44
- }
45
-
46
- if ($product_object) {
47
- $product = array();
48
-
49
- $product['itemId'] = $item->getSku();
50
- $product['itemName'] = $item->getName();
51
- $product['itemUrl'] = $this->getProductUrl($product_object);
52
- $product['itemImage'] = $this->getProductImage($product_object);
53
-
54
- $qty = 1;
55
- if ($item->getQty()) {
56
- $qty = $item->getQty();
57
- } else if ($item->getQtyOrdered()) {
58
- $qty = $item->getQtyOrdered();
59
- }
60
-
61
- $price = 0;
62
- if ($item->getPrice() > 0) {
63
- $price = $item->getPrice();
64
- } else if ($item->getBasePrice() > 0) {
65
- $price = $item->getBasePrice();
66
- } else if ($product_object->getData('price') > 0) {
67
- $price = $product_object->getData('price');
68
- } else {
69
- $parent = $item->getData('parent');
70
-
71
- if (!$parent) {
72
- $parent = $item->getParentItem();
73
- }
74
-
75
- if ($parent) {
76
- if ($parent->getBasePrice() > 0) {
77
- $price = $parent->getBasePrice();
78
- } else if ($parent->getPrice()) {
79
- $price = $parent->getPrice();
80
- }
81
- }
82
- }
83
-
84
- $weight = 0;
85
- if ($item->hasWeight()) {
86
- $weight = $item->getWeight();
87
- } else if ($product_object->hasWeight()) {
88
- $weight = $product_object->getWeight();
89
- }
90
-
91
- $product['itemQuantity'] = intval($qty);
92
- $product['itemPrice'] = floatval($price);
93
- $product['itemWeight'] = floatval($weight);
94
-
95
- $products[] = $product;
96
- }
97
- }
98
- }
99
-
100
- return $products;
101
- }
102
-
103
- public function getIPAddress($order)
104
- {
105
- if ($order->getRemoteIp()) {
106
- if ($order->getXForwardedFor()) {
107
- return $this->filterIp($order->getXForwardedFor());
108
- }
109
-
110
- return $this->filterIp($order->getRemoteIp());
111
- }
112
-
113
- // Checks each configured value in app/etc/local.xml & falls back to REMOTE_ADDR. See app/etc/local.xml.additional for examples.
114
- return $this->filterIp(Mage::helper('core/http')->getRemoteAddr(false));
115
- }
116
-
117
- public function filterIp($ip)
118
- {
119
- $matches = array();
120
-
121
- if (preg_match('/[0-9]{1,3}(?:\.[0-9]{1,3}){3}/', $ip, $matches)) { //ipv4
122
- return current($matches);
123
- }
124
-
125
- if (preg_match('/[a-f0-9]{0,4}(?:\:[a-f0-9]{0,4}){2,7}/', strtolower($ip), $matches)) { //ipv6
126
- return current($matches);
127
- }
128
-
129
- return preg_replace('/[^0-9a-zA-Z:\.]/', '', strtok(str_replace($ip, ',', "\n"), "\n"));
130
- }
131
-
132
- public function formatAvs($value)
133
- {
134
- // http://www.emsecommerce.net/avs_cvv2_response_codes.htm
135
- $codes = array('X', 'Y', 'A', 'W', 'Z', 'N', 'U', 'R', 'E', 'S', 'D', 'M', 'B', 'P', 'C', 'I', 'G');
136
-
137
- if ($value) {
138
- $value = strtoupper($value);
139
-
140
- if (strlen($value) > 1) {
141
- if (preg_match('/\([A-Z]\)/', $value)) {
142
- $matches = array();
143
-
144
- preg_match('/\([A-Z]\)/', $value, $matches);
145
-
146
- foreach ($matches as $match) {
147
- $match = preg_replace('/[^A-Z]/', '', $match);
148
-
149
- if (in_array($match, $codes)) {
150
- $value = $match;
151
- }
152
- }
153
- }
154
- }
155
-
156
- if (strlen($value) > 1) {
157
- $value = substr($value, 0, 1);
158
- }
159
-
160
- if (!in_array($value, $codes)) {
161
- $value = null;
162
- }
163
- }
164
-
165
- return $value;
166
- }
167
-
168
- public function getAvsResponse($payment)
169
- {
170
- $value = null;
171
-
172
- if ($payment->getAdditionalInformation('paypal_avs_code')) {
173
- $value = $payment->getAdditionalInformation('paypal_avs_code');
174
- } else if ($payment->getAdditionalInformation('cc_avs_status')) {
175
- $value = $payment->getAdditionalInformation('cc_avs_status');
176
- }
177
-
178
- return $this->formatAvs($value);
179
- }
180
-
181
- public function getCvvResponse($payment)
182
- {
183
- if ($payment->getAdditionalInformation('paypal_cvv2_match')) {
184
- return $payment->getAdditionalInformation('paypal_cvv2_match');
185
- }
186
-
187
- return null;
188
- }
189
-
190
- private function getVersions()
191
- {
192
- $version = array();
193
- $version['platform'] = 'magento';
194
- $version['platformVersion'] = Mage::getVersion();
195
- $version['pluginVersion'] = (string)(Mage::getConfig()->getNode()->modules->Signifyd_Connect->version);
196
- return $version;
197
- }
198
-
199
- private function getTransactionId($payment)
200
- {
201
- $transId = $payment->getCcTransId();
202
- if(is_array($transId) && is_string($transId[0])) {
203
- $transId = $transId[0];
204
- } else if(!is_string($transId)) {
205
- $transId = null;
206
- }
207
- return $transId;
208
- }
209
-
210
- public function getPurchase($order)
211
- {
212
- $purchase = array();
213
- $payment = $order->getPayment();
214
-
215
- // T715: Send null rather than false when we can't get the IP Address
216
- $purchase['browserIpAddress'] = ($this->getIpAddress($order) ? $this->getIpAddress($order) : null);
217
- $purchase['orderId'] = $order->getIncrementId();
218
- $purchase['createdAt'] = date('c', strtotime($order->getCreatedAt())); // e.g: 2004-02-12T15:19:21+00:00
219
- $purchase['currency'] = $order->getOrderCurrencyCode();
220
- $purchase['totalPrice'] = floatval($order->getGrandTotal());
221
- $purchase['shippingPrice'] = floatval($order->getShippingAmount());
222
- $purchase['products'] = $this->getProducts($order);
223
- $purchase['paymentGateway'] = $payment->getMethod();
224
- $purchase['transactionId'] = $this->getTransactionId($payment);
225
-
226
- $purchase['avsResponseCode'] = $this->getAvsResponse($payment);
227
- $purchase['cvvResponseCode'] = $this->getCvvResponse($payment);
228
-
229
- return $purchase;
230
- }
231
-
232
- public function isPaymentCC($payment)
233
- {
234
- // Although the payment structure only has the entity data for the payment
235
- // the original payment method object is stored within the entity data.
236
- // It's not a requirement, but every CC handler I've found subclasses
237
- // from Mage_Payment_Model_Method_Cc, so we are using that as an
238
- // assumption for whether a method is based on CC data
239
- $method = $payment->getData('method_instance');
240
- if($method)
241
- {
242
- return is_subclass_of($method, 'Mage_Payment_Model_Method_Cc');
243
- }
244
- return false;
245
- }
246
-
247
- public function getCard($order, $payment)
248
- {
249
- $billing = $order->getBillingAddress();
250
-
251
- $card = array();
252
-
253
- $card['cardHolderName'] = null;
254
- $card['bin'] = null;
255
- $card['last4'] = null;
256
- $card['expiryMonth'] = null;
257
- $card['expiryYear'] = null;
258
- $card['hash'] = null;
259
-
260
- $card['billingAddress'] = $this->getSignifydAddress($billing);
261
-
262
- if ($payment->getCcOwner()) {
263
- $card['cardHolderName'] = $payment->getCcOwner();
264
- } else {
265
- $card['cardHolderName'] = $billing->getFirstname() . ' ' . $billing->getLastname();
266
- }
267
-
268
- // Card data may be set on payment even if payment was not with card.
269
- // If it is, we want to ignore the data
270
- if(!$this->isPaymentCC($payment)) return $card;
271
-
272
- if ($payment->getData('cc_last4')) {
273
- $card['last4'] = $payment->getData('cc_last4');
274
- }
275
-
276
- if ($payment->getData('cc_exp_year')) {
277
- $card['expiryYear'] = $payment->getData('cc_exp_year');
278
- }
279
-
280
- if ($payment->getData('cc_exp_month')) {
281
- $card['expiryMonth'] = $payment->getData('cc_exp_month');
282
- }
283
-
284
- if ($payment->getData('cc_number_enc')) {
285
- $card['hash'] = $payment->getData('cc_number_enc');
286
- }
287
-
288
- if ($payment->getData('cc_number') && is_numeric($payment->getData('cc_number')) && strlen((string)$payment->getData('cc_number')) > 6) {
289
- $card['bin'] = substr((string)$payment->getData('cc_number'), 0, 6);
290
- }
291
-
292
- return $card;
293
- }
294
-
295
- public function getSignifydAddress($address_object)
296
- {
297
- $address = array();
298
-
299
- $address['streetAddress'] = $address_object->getStreet1();
300
- $address['unit'] = null;
301
-
302
- if ($address_object->getStreet2()) {
303
- $address['unit'] = $address_object->getStreet2();
304
- }
305
-
306
- $address['city'] = $address_object->getCity();
307
-
308
- $address['provinceCode'] = $address_object->getRegionCode();
309
- $address['postalCode'] = $address_object->getPostcode();
310
- $address['countryCode'] = $address_object->getCountryId();
311
-
312
- $address['latitude'] = null;
313
- $address['longitude'] = null;
314
-
315
- return $address;
316
- }
317
-
318
- public function getRecipient($order)
319
- {
320
- $recipient = array();
321
-
322
- // In the case of non-shipped (ex: downloadable) orders, shipping address will be null so
323
- // in that case, we need to avoid the exception.
324
- $shipping_address = $order->getShippingAddress();
325
- if($shipping_address) {
326
- $recipient['deliveryAddress'] = $this->getSignifydAddress($shipping_address);
327
- $recipient['fullName'] = $shipping_address->getFirstname() . ' ' . $shipping_address->getLastname();
328
- $recipient['confirmationPhone'] = $shipping_address->getTelephone();
329
- // Email: Note that this field is always the same for both addresses
330
- $recipient['confirmationEmail'] = $shipping_address->getEmail();
331
- }
332
- // Some customers have reported seeing "n/a@na.na" come through instead of a valid or null address
333
- // We suspect that it is due to an older version of Magento. If it becomes unnecessary, do remove the extra check.
334
- if (!$recipient['confirmationEmail'] || $recipient['confirmationEmail'] == 'n/a@na.na') {
335
- $recipient['confirmationEmail'] = $order->getCustomerEmail();
336
- }
337
-
338
- return $recipient;
339
- }
340
-
341
- public function getUserAccount($customer, $order)
342
- {
343
- $user = array(
344
- "emailAddress" => null,
345
- "username" => null,
346
- "phone" => null,
347
- "createdDate" => null,
348
- "accountNumber" => null,
349
- "lastOrderId" => null,
350
- "aggregateOrderCount" => null,
351
- "aggregateOrderDollars" => null,
352
- "lastUpdateDate" => null
353
- );
354
-
355
- if ($customer && $customer->getId()) {
356
- $user['emailAddress'] = $customer->getEmail();
357
-
358
- $user['phone'] = $order->getBillingAddress()->getTelephone();
359
-
360
- $user['createdDate'] = date('c', strtotime($customer->getCreatedAt()));
361
- $user['lastUpdateDate'] = date('c', strtotime($customer->getUpdatedAt()));
362
-
363
- $user['accountNumber'] = $customer->getId();
364
-
365
- $last_order_id = null;
366
-
367
- $orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customer->getId());
368
- $orders->getSelect()->order('created_at DESC');
369
-
370
- $aggregate_total = 0.;
371
- $order_count = 0;
372
-
373
- foreach ($orders as $order) {
374
- if ($last_order_id === null) {
375
- $last_order_id = $order->getIncrementId();
376
- }
377
-
378
- $aggregate_total += floatval($order->getGrandTotal());
379
- $order_count += 1;
380
- }
381
-
382
- $user['lastOrderId'] = $last_order_id;
383
- $user['aggregateOrderCount'] = $order_count;
384
- $user['aggregateOrderDollars'] = floatval($aggregate_total);
385
- }
386
-
387
- return $user;
388
- }
389
-
390
- public function generateCase($order, $payment, $customer)
391
- {
392
- $case = array();
393
-
394
- $case['purchase'] = $this->getPurchase($order);
395
- $case['recipient'] = $this->getRecipient($order);
396
- $case['card'] = $this->getCard($order, $payment);
397
- $case['userAccount'] = $this->getUserAccount($customer, $order);
398
- $case['clientVersion'] = $this->getVersions();
399
-
400
- return $case;
401
- }
402
-
403
- public function submitCase($case, $url, $auth)
404
- {
405
- $case = json_encode($case);
406
-
407
- return $this->request($url, $case, $auth, 'application/json');
408
- }
409
-
410
- public function getUrl()
411
- {
412
- return Mage::getStoreConfig('signifyd_connect/settings/url') . '/cases';
413
- }
414
-
415
- public function getAuth()
416
- {
417
- return Mage::getStoreConfig('signifyd_connect/settings/key');
418
- }
419
-
420
- public function sendOrderUpdateToSignifyd($order)
421
- {
422
- if ($order && $order->getId() && Mage::getStoreConfig('signifyd_connect/advanced/enable_payment_updates')) {
423
- $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
424
- $caseId = $case->getCode();
425
-
426
- if (Mage::getStoreConfig('signifyd_connect/log/request')) {
427
- Mage::log("Created new case: $caseId", null, 'signifyd_connect.log');
428
- }
429
-
430
- $updateData = array();
431
- $payment = $order->getPayment();
432
-
433
- // These are the only supported update fields
434
- $purchase = array();
435
- $purchase['paymentGateway'] = $payment->getMethod();
436
- $purchase['transactionId'] = $this->getTransactionId($payment);
437
- $purchase['avsResponseCode'] = $this->getAvsResponse($payment);
438
- $purchase['cvvResponseCode'] = $this->getCvvResponse($payment);
439
-
440
- // Do not make request if there is no data to send
441
- if( $purchase['transactionId'] == null &&
442
- $purchase['avsResponseCode'] == null &&
443
- $purchase['cvvResponseCode'] == null)
444
- {
445
- return "nodata";
446
- }
447
- Mage::register('signifyd_action', 1); // Work will now take place
448
-
449
- $updateData['purchase'] = $purchase;
450
-
451
- $data = json_encode($updateData);
452
-
453
- $response = $this->request($this->getUrl() . "/$caseId", $data, $this->getAuth(), 'application/json', null, true);
454
-
455
- try {
456
- $response_code = $response->getHttpCode();
457
-
458
- if (substr($response_code, 0, 1) == '2') {
459
- // Reload in case a substantial amount of time has passed
460
- $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
461
- $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
462
- $case->setTransactionId($updateData['purchase']['transactionId']);
463
- $case->save();
464
- if (Mage::getStoreConfig('signifyd_connect/log/request')) {
465
- Mage::log("Wrote case to database: $caseId", null, 'signifyd_connect.log');
466
- }
467
- return "sent";
468
- }
469
- } catch (Exception $e) {
470
- Mage::log($e->__toString(), null, 'signifyd_connect.log');
471
- return "error";
472
- }
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()) {
530
- $processStatus = $this->processedStatus($order);
531
- if ($processStatus > 0 && !$forceSend) {
532
- if($processStatus == self::TRANSACTION_SENT_STATUS) return "exists";
533
- else return $this->sendOrderUpdateToSignifyd($order);
534
- }
535
-
536
- $payments = $order->getPaymentsCollection();
537
- $last_payment = null;
538
- foreach ($payments as $payment) {
539
- $last_payment = $payment;
540
- }
541
-
542
- $state = $order->getState();
543
-
544
- if (!$state || $state == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
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();
552
- }
553
-
554
- $case = $this->generateCase($order, $last_payment, $customer);
555
-
556
- $case_object = $this->markProcessed($order);
557
-
558
- $response = $this->submitCase($case, $this->getUrl(), $this->getAuth());
559
-
560
- try {
561
- $response_code = $response->getHttpCode();
562
-
563
- if (substr($response_code, 0, 1) == '2') {
564
- $response_data = json_decode($response->getRawResponse(), true);
565
-
566
- $caseId = $response_data['investigationId'];
567
- $case_object = Mage::getModel('signifyd_connect/case')->load($case_object->getOrderIncrement());
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");
574
- $order->save(); // Note: this will trigger recursion
575
-
576
- return "sent";
577
- }
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;
622
-
623
- try {
624
- $url = $product->getUrlModel()->getProductUrl($product);
625
- } catch (Exception $e) {
626
- $url = null;
627
- }
628
-
629
- return $url;
630
- }
631
-
632
- public function getCaseUrl($order_id)
633
- {
634
- $case = Mage::getModel('signifyd_connect/case')->load($order_id);
635
-
636
- if ($case->getCode()) {
637
- return "https://www.signifyd.com/cases/" . $case->getCode();
638
- }
639
- Mage::log('Case URL not found: '.$order_id, null, 'signifyd_connect.log');
640
- return '';
641
- }
642
-
643
- public function getProductImage($product, $size="150")
644
- {
645
- $image = null;
646
-
647
- try {
648
- $image = (string)Mage::helper('catalog/image')->init($product, 'image')->resize($size, $size)->keepFrame(true)->keepAspectRatio(true);
649
- } catch (Exception $e) {
650
- $image = null;
651
- }
652
-
653
- return $image;
654
- }
655
-
656
- public function getStoreName()
657
- {
658
- return Mage::getStoreConfig('trans_email/ident_general/name', 0);
659
- }
660
-
661
- public function getStoreEmail()
662
- {
663
- return Mage::getStoreConfig('trans_email/ident_general/email', 0);
664
- }
665
-
666
- public function getStoreUrl()
667
- {
668
- return Mage::getBaseUrl();
669
- }
670
-
671
- public function processedStatus($order)
672
- {
673
- $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
674
-
675
- if ($case->getTransactionId())
676
- {
677
- return self::TRANSACTION_SENT_STATUS;
678
- }
679
- else if ($case->getCode())
680
- {
681
- return self::CASE_CREATED_STATUS;
682
- }
683
- else if ($case->getId())
684
- {
685
- return self::ENTITY_CREATED_STATUS;
686
- }
687
-
688
- return self::UNPROCESSED_STATUS;
689
- }
690
-
691
- public function markProcessed($order)
692
- {
693
- $case = Mage::getModel('signifyd_connect/case');
694
- $case->setOrderIncrement($order->getIncrementId());
695
- $case->setCreated(strftime('%Y-%m-%d %H:%M:%S', time()));
696
- $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
697
- $case->save();
698
-
699
- return $case;
700
- }
701
-
702
- public function unmarkProcessed($order)
703
- {
704
- $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
705
- if($case && !$case->isObjectNew())
706
- {
707
- Mage::register('isSecureArea', true);
708
- $case->delete();
709
- Mage::unregister('isSecureArea');
710
- }
711
- }
712
-
713
- public function cancelGuarantee($case)
714
- {
715
- $caseId = $case->getCode();
716
- $url = $this->getUrl() . "/$caseId/guarantee";
717
- $body = json_encode(array("guaranteeDisposition" => "CANCELED"));
718
- $response = $this->request($url, $body, $this->getAuth(), 'application/json', null, true);
719
- $code = $response->getHttpCode();
720
- if(substr($code, 0, 1) == '2') {
721
- $case->setGuarantee('CANCELED');
722
- $case->save();
723
- } else {
724
- $this->logError("Guarantee cancel failed");
725
- }
726
- $this->logResponse("Received $code from guarantee cancel");
727
- }
728
-
729
- public function request($url, $data = null, $auth = null, $contenttype = "application/x-www-form-urlencoded",
730
- $accept = null, $is_update = false)
731
- {
732
- if (Mage::getStoreConfig('signifyd_connect/log/request')) {
733
- $authMask = preg_replace ( "/\S/", "*", $auth, strlen($auth) - 4 );
734
- Mage::log("Request:\nURL: $url \nAuth: $authMask\nData: $data", null, 'signifyd_connect.log');
735
- }
736
-
737
- $curl = curl_init();
738
- $response = new Varien_Object;
739
- $headers = array();
740
-
741
- curl_setopt($curl, CURLOPT_URL, $url);
742
-
743
- if (stripos($url, 'https://') === 0) {
744
- curl_setopt($curl, CURLOPT_PORT, 443);
745
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
746
- }
747
-
748
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
749
-
750
- if ($auth) {
751
- curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
752
- curl_setopt($curl, CURLOPT_USERPWD, $auth);
753
- }
754
-
755
- if ($accept) {
756
- $headers[] = 'Accept: ' . $accept;
757
- }
758
-
759
- if ($data) {
760
- if($is_update) curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
761
- else curl_setopt($curl, CURLOPT_POST, 1);
762
-
763
- $headers[] = "Content-Type: $contenttype";
764
- $headers[] = "Content-length: " . strlen($data);
765
- curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
766
- }
767
-
768
- if (count($headers)) {
769
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
770
- }
771
-
772
- curl_setopt($curl, CURLOPT_TIMEOUT, 4);
773
- curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 4);
774
-
775
- $raw_response = curl_exec($curl);
776
- $response->setRawResponse($raw_response);
777
-
778
- $response_data = curl_getinfo($curl);
779
- $response->addData($response_data);
780
-
781
- if (Mage::getStoreConfig('signifyd_connect/log/response')) {
782
- Mage::log("Response ($url):\n " . print_r($response, true), null, 'signifyd_connect.log');
783
- }
784
-
785
- if ($raw_response === false || curl_errno($curl)) {
786
- $error = curl_error($curl);
787
-
788
- if (Mage::getStoreConfig('signifyd_connect/log/error')) {
789
- Mage::log("ERROR ($url):\n$error", null, 'signifyd_connect.log');
790
- }
791
-
792
- $response->setData('error', $error);
793
- }
794
-
795
- curl_close($curl);
796
-
797
- return $response;
798
- }
799
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ const UNPROCESSED_STATUS = 0;
6
+ const ENTITY_CREATED_STATUS = 1;
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/all')) {
18
+ Mage::log($message, null, 'signifyd_connect.log');
19
+ }
20
+ }
21
+
22
+ public function logResponse($message)
23
+ {
24
+ if (Mage::getStoreConfig('signifyd_connect/log/all')) {
25
+ Mage::log($message, null, 'signifyd_connect.log');
26
+ }
27
+ }
28
+
29
+ public function logError($message)
30
+ {
31
+ if (Mage::getStoreConfig('signifyd_connect/log/all')) {
32
+ Mage::log($message, null, 'signifyd_connect.log');
33
+ }
34
+ }
35
+
36
+ public function getProducts($quote)
37
+ {
38
+ $products = array();
39
+
40
+ foreach ($quote->getAllItems() as $item) {
41
+ $product_type = $item->getProductType();
42
+
43
+ if (!$product_type || $product_type == 'simple' || $product_type == 'downloadable'
44
+ || $product_type == 'grouped' || $product_type == 'virtual' ) {
45
+ $product_object = $item->getData('product');
46
+
47
+ if (!$product_object || !$product_object->getId()) {
48
+ $product_object = Mage::getModel('catalog/product')->load($product_type);
49
+ }
50
+
51
+ if ($product_object) {
52
+ $product = array();
53
+
54
+ $product['itemId'] = $item->getSku();
55
+ $product['itemName'] = $item->getName();
56
+ $product['itemUrl'] = $this->getProductUrl($product_object);
57
+ $product['itemImage'] = $this->getProductImage($product_object);
58
+
59
+ $qty = 1;
60
+ if ($item->getQty()) {
61
+ $qty = $item->getQty();
62
+ } else if ($item->getQtyOrdered()) {
63
+ $qty = $item->getQtyOrdered();
64
+ }
65
+
66
+ $price = 0;
67
+ if ($item->getPrice() > 0) {
68
+ $price = $item->getPrice();
69
+ } else if ($item->getBasePrice() > 0) {
70
+ $price = $item->getBasePrice();
71
+ } else if ($product_object->getData('price') > 0) {
72
+ $price = $product_object->getData('price');
73
+ } else {
74
+ $parent = $item->getData('parent');
75
+
76
+ if (!$parent) {
77
+ $parent = $item->getParentItem();
78
+ }
79
+
80
+ if ($parent) {
81
+ if ($parent->getBasePrice() > 0) {
82
+ $price = $parent->getBasePrice();
83
+ } else if ($parent->getPrice()) {
84
+ $price = $parent->getPrice();
85
+ }
86
+ }
87
+ }
88
+
89
+ $weight = 0;
90
+ if ($item->hasWeight()) {
91
+ $weight = $item->getWeight();
92
+ } else if ($product_object->hasWeight()) {
93
+ $weight = $product_object->getWeight();
94
+ }
95
+
96
+ $product['itemQuantity'] = intval($qty);
97
+ $product['itemPrice'] = floatval($price);
98
+ $product['itemWeight'] = floatval($weight);
99
+
100
+ $products[] = $product;
101
+ }
102
+ }
103
+ }
104
+
105
+ return $products;
106
+ }
107
+
108
+ public function getIPAddress($order)
109
+ {
110
+ if ($order->getRemoteIp()) {
111
+ if ($order->getXForwardedFor()) {
112
+ return $this->filterIp($order->getXForwardedFor());
113
+ }
114
+
115
+ return $this->filterIp($order->getRemoteIp());
116
+ }
117
+
118
+ // Checks each configured value in app/etc/local.xml & falls back to REMOTE_ADDR. See app/etc/local.xml.additional for examples.
119
+ return $this->filterIp(Mage::helper('core/http')->getRemoteAddr(false));
120
+ }
121
+
122
+ public function filterIp($ip)
123
+ {
124
+ $matches = array();
125
+
126
+ if (preg_match('/[0-9]{1,3}(?:\.[0-9]{1,3}){3}/', $ip, $matches)) { //ipv4
127
+ return current($matches);
128
+ }
129
+
130
+ if (preg_match('/[a-f0-9]{0,4}(?:\:[a-f0-9]{0,4}){2,7}/', strtolower($ip), $matches)) { //ipv6
131
+ return current($matches);
132
+ }
133
+
134
+ return preg_replace('/[^0-9a-zA-Z:\.]/', '', strtok(str_replace($ip, ',', "\n"), "\n"));
135
+ }
136
+
137
+ public function formatAvs($value)
138
+ {
139
+ // http://www.emsecommerce.net/avs_cvv2_response_codes.htm
140
+ $codes = array('X', 'Y', 'A', 'W', 'Z', 'N', 'U', 'R', 'E', 'S', 'D', 'M', 'B', 'P', 'C', 'I', 'G');
141
+
142
+ if ($value) {
143
+ $value = strtoupper($value);
144
+
145
+ if (strlen($value) > 1) {
146
+ if (preg_match('/\([A-Z]\)/', $value)) {
147
+ $matches = array();
148
+
149
+ preg_match('/\([A-Z]\)/', $value, $matches);
150
+
151
+ foreach ($matches as $match) {
152
+ $match = preg_replace('/[^A-Z]/', '', $match);
153
+
154
+ if (in_array($match, $codes)) {
155
+ $value = $match;
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ if (strlen($value) > 1) {
162
+ $value = substr($value, 0, 1);
163
+ }
164
+
165
+ if (!in_array($value, $codes)) {
166
+ $value = null;
167
+ }
168
+ }
169
+
170
+ return $value;
171
+ }
172
+
173
+ public function getAvsResponse($payment)
174
+ {
175
+ $value = null;
176
+
177
+ if ($payment->getAdditionalInformation('paypal_avs_code')) {
178
+ $value = $payment->getAdditionalInformation('paypal_avs_code');
179
+ } else if ($payment->getAdditionalInformation('cc_avs_status')) {
180
+ $value = $payment->getAdditionalInformation('cc_avs_status');
181
+ }
182
+
183
+ return $this->formatAvs($value);
184
+ }
185
+
186
+ public function getCvvResponse($payment)
187
+ {
188
+ if ($payment->getAdditionalInformation('paypal_cvv2_match')) {
189
+ return $payment->getAdditionalInformation('paypal_cvv2_match');
190
+ }
191
+
192
+ return null;
193
+ }
194
+
195
+ private function getVersions()
196
+ {
197
+ $version = array();
198
+ $version['storePlatformVersion'] = Mage::getVersion();
199
+ $version['signifydClientApp'] = 'Magento';
200
+ $version['storePlatform'] = 'Magento';
201
+ $version['signifydClientAppVersion'] = (string)(Mage::getConfig()->getNode()->modules->Signifyd_Connect->version);
202
+ return $version;
203
+ }
204
+
205
+ private function getTransactionId($payment)
206
+ {
207
+ $transId = $payment->getCcTransId();
208
+ if(is_array($transId) && is_string($transId[0])) {
209
+ $transId = $transId[0];
210
+ } else if(!is_string($transId)) {
211
+ $transId = null;
212
+ }
213
+ return $transId;
214
+ }
215
+
216
+ public function getPurchase($order)
217
+ {
218
+ $purchase = array();
219
+ $payment = $order->getPayment();
220
+
221
+ // T715: Send null rather than false when we can't get the IP Address
222
+ $purchase['browserIpAddress'] = ($this->getIpAddress($order) ? $this->getIpAddress($order) : null);
223
+ $purchase['orderId'] = $order->getIncrementId();
224
+ $purchase['createdAt'] = date('c', strtotime($order->getCreatedAt())); // e.g: 2004-02-12T15:19:21+00:00
225
+ $purchase['currency'] = $order->getOrderCurrencyCode();
226
+ $purchase['totalPrice'] = floatval($order->getGrandTotal());
227
+ $purchase['shippingPrice'] = floatval($order->getShippingAmount());
228
+ $purchase['products'] = $this->getProducts($order);
229
+ $purchase['paymentGateway'] = $payment->getMethod();
230
+ $purchase['transactionId'] = $this->getTransactionId($payment);
231
+
232
+ $purchase['avsResponseCode'] = $this->getAvsResponse($payment);
233
+ $purchase['cvvResponseCode'] = $this->getCvvResponse($payment);
234
+
235
+ return $purchase;
236
+ }
237
+
238
+ public function isPaymentCC($payment)
239
+ {
240
+ // Although the payment structure only has the entity data for the payment
241
+ // the original payment method object is stored within the entity data.
242
+ // It's not a requirement, but every CC handler I've found subclasses
243
+ // from Mage_Payment_Model_Method_Cc, so we are using that as an
244
+ // assumption for whether a method is based on CC data
245
+ $method = $payment->getData('method_instance');
246
+ if($method)
247
+ {
248
+ return is_subclass_of($method, 'Mage_Payment_Model_Method_Cc');
249
+ }
250
+ return false;
251
+ }
252
+
253
+ public function getCard($order, $payment)
254
+ {
255
+ $billing = $order->getBillingAddress();
256
+
257
+ $card = array();
258
+
259
+ $card['cardHolderName'] = null;
260
+ $card['bin'] = null;
261
+ $card['last4'] = null;
262
+ $card['expiryMonth'] = null;
263
+ $card['expiryYear'] = null;
264
+ $card['hash'] = null;
265
+
266
+ $card['billingAddress'] = $this->getSignifydAddress($billing);
267
+
268
+ if ($payment->getCcOwner()) {
269
+ $card['cardHolderName'] = $payment->getCcOwner();
270
+ } else {
271
+ $card['cardHolderName'] = $billing->getFirstname() . ' ' . $billing->getLastname();
272
+ }
273
+
274
+ // Card data may be set on payment even if payment was not with card.
275
+ // If it is, we want to ignore the data
276
+ if(!$this->isPaymentCC($payment)) return $card;
277
+
278
+ if ($payment->getData('cc_last4')) {
279
+ $card['last4'] = $payment->getData('cc_last4');
280
+ }
281
+
282
+ if ($payment->getData('cc_exp_year')) {
283
+ $card['expiryYear'] = $payment->getData('cc_exp_year');
284
+ }
285
+
286
+ if ($payment->getData('cc_exp_month')) {
287
+ $card['expiryMonth'] = $payment->getData('cc_exp_month');
288
+ }
289
+
290
+ if ($payment->getData('cc_number_enc')) {
291
+ $card['hash'] = $payment->getData('cc_number_enc');
292
+ }
293
+
294
+ if ($payment->getData('cc_number') && is_numeric($payment->getData('cc_number')) && strlen((string)$payment->getData('cc_number')) > 6) {
295
+ $card['bin'] = substr((string)$payment->getData('cc_number'), 0, 6);
296
+ }
297
+
298
+ return $card;
299
+ }
300
+
301
+ public function getSignifydAddress($address_object)
302
+ {
303
+ $address = array();
304
+
305
+ $address['streetAddress'] = $address_object->getStreet1();
306
+ $address['unit'] = null;
307
+
308
+ if ($address_object->getStreet2()) {
309
+ $address['unit'] = $address_object->getStreet2();
310
+ }
311
+
312
+ $address['city'] = $address_object->getCity();
313
+
314
+ $address['provinceCode'] = $address_object->getRegionCode();
315
+ $address['postalCode'] = $address_object->getPostcode();
316
+ $address['countryCode'] = $address_object->getCountryId();
317
+
318
+ $address['latitude'] = null;
319
+ $address['longitude'] = null;
320
+
321
+ return $address;
322
+ }
323
+
324
+ public function getRecipient($order)
325
+ {
326
+ $recipient = array();
327
+
328
+ // In the case of non-shipped (ex: downloadable) orders, shipping address will be null so
329
+ // in that case, we need to avoid the exception.
330
+ $shipping_address = $order->getShippingAddress();
331
+ if($shipping_address) {
332
+ $recipient['deliveryAddress'] = $this->getSignifydAddress($shipping_address);
333
+ $recipient['fullName'] = $shipping_address->getFirstname() . ' ' . $shipping_address->getLastname();
334
+ $recipient['confirmationPhone'] = $shipping_address->getTelephone();
335
+ // Email: Note that this field is always the same for both addresses
336
+ $recipient['confirmationEmail'] = $shipping_address->getEmail();
337
+ }
338
+ // Some customers have reported seeing "n/a@na.na" come through instead of a valid or null address
339
+ // We suspect that it is due to an older version of Magento. If it becomes unnecessary, do remove the extra check.
340
+ if (!$recipient['confirmationEmail'] || $recipient['confirmationEmail'] == 'n/a@na.na') {
341
+ $recipient['confirmationEmail'] = $order->getCustomerEmail();
342
+ }
343
+
344
+ return $recipient;
345
+ }
346
+
347
+ public function getUserAccount($customer, $order)
348
+ {
349
+ $user = array(
350
+ "emailAddress" => null,
351
+ "username" => null,
352
+ "phone" => null,
353
+ "createdDate" => null,
354
+ "accountNumber" => null,
355
+ "lastOrderId" => null,
356
+ "aggregateOrderCount" => null,
357
+ "aggregateOrderDollars" => null,
358
+ "lastUpdateDate" => null
359
+ );
360
+
361
+ if ($customer && $customer->getId()) {
362
+ $user['emailAddress'] = $customer->getEmail();
363
+
364
+ $user['phone'] = $order->getBillingAddress()->getTelephone();
365
+
366
+ $user['createdDate'] = date('c', strtotime($customer->getCreatedAt()));
367
+ $user['lastUpdateDate'] = date('c', strtotime($customer->getUpdatedAt()));
368
+
369
+ $user['accountNumber'] = $customer->getId();
370
+
371
+ $last_order_id = null;
372
+
373
+ $orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customer->getId());
374
+ $orders->getSelect()->order('created_at DESC');
375
+
376
+ $aggregate_total = 0.;
377
+ $order_count = 0;
378
+
379
+ foreach ($orders as $order) {
380
+ if ($last_order_id === null) {
381
+ $last_order_id = $order->getIncrementId();
382
+ }
383
+
384
+ $aggregate_total += floatval($order->getGrandTotal());
385
+ $order_count += 1;
386
+ }
387
+
388
+ $user['lastOrderId'] = $last_order_id;
389
+ $user['aggregateOrderCount'] = $order_count;
390
+ $user['aggregateOrderDollars'] = floatval($aggregate_total);
391
+ }
392
+
393
+ return $user;
394
+ }
395
+
396
+ public function generateCase($order, $payment, $customer)
397
+ {
398
+ $case = array();
399
+
400
+ $case['purchase'] = $this->getPurchase($order);
401
+ $case['recipient'] = $this->getRecipient($order);
402
+ $case['card'] = $this->getCard($order, $payment);
403
+ $case['userAccount'] = $this->getUserAccount($customer, $order);
404
+ $case['clientVersion'] = $this->getVersions();
405
+
406
+ return $case;
407
+ }
408
+
409
+ public function submitCase($case, $url, $auth)
410
+ {
411
+ $case = json_encode($case);
412
+
413
+ return $this->request($url, $case, $auth, 'application/json');
414
+ }
415
+
416
+ public function getUrl()
417
+ {
418
+ // return Mage::getStoreConfig('signifyd_connect/settings/url') . '/cases';
419
+ return 'https://api.signifyd.com/v2/cases';
420
+ }
421
+
422
+ public function getAuth()
423
+ {
424
+ return Mage::getStoreConfig('signifyd_connect/settings/key');
425
+ }
426
+
427
+ public function sendOrderUpdateToSignifyd($order)
428
+ {
429
+ if ($order && $order->getId() && Mage::getStoreConfig('signifyd_connect/advanced/enable_payment_updates')) {
430
+ $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
431
+ $caseId = $case->getCode();
432
+
433
+ if (Mage::getStoreConfig('signifyd_connect/log/all')) {
434
+ Mage::log("Created new case: $caseId", null, 'signifyd_connect.log');
435
+ }
436
+
437
+ $updateData = array();
438
+ $payment = $order->getPayment();
439
+
440
+ // These are the only supported update fields
441
+ $purchase = array();
442
+ $purchase['paymentGateway'] = $payment->getMethod();
443
+ $purchase['transactionId'] = $this->getTransactionId($payment);
444
+ $purchase['avsResponseCode'] = $this->getAvsResponse($payment);
445
+ $purchase['cvvResponseCode'] = $this->getCvvResponse($payment);
446
+
447
+ // Do not make request if there is no data to send
448
+ if( $purchase['transactionId'] == null &&
449
+ $purchase['avsResponseCode'] == null &&
450
+ $purchase['cvvResponseCode'] == null)
451
+ {
452
+ return "nodata";
453
+ }
454
+ Mage::register('signifyd_action', 1); // Work will now take place
455
+
456
+ $updateData['purchase'] = $purchase;
457
+
458
+ $data = json_encode($updateData);
459
+
460
+ $response = $this->request($this->getUrl() . "/$caseId", $data, $this->getAuth(), 'application/json', null, true);
461
+
462
+ try {
463
+ $response_code = $response->getHttpCode();
464
+
465
+ if (substr($response_code, 0, 1) == '2') {
466
+ // Reload in case a substantial amount of time has passed
467
+ $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
468
+ $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
469
+ $case->setTransactionId($updateData['purchase']['transactionId']);
470
+ $case->save();
471
+ if (Mage::getStoreConfig('signifyd_connect/log/all')) {
472
+ Mage::log("Wrote case to database: $caseId", null, 'signifyd_connect.log');
473
+ }
474
+ return "sent";
475
+ }
476
+ } catch (Exception $e) {
477
+ Mage::log($e->__toString(), null, 'signifyd_connect.log');
478
+ return "error";
479
+ }
480
+ }
481
+ }
482
+
483
+ public function buildAndSendOrderToSignifyd($order, $forceSend = false)
484
+ {
485
+ if ($order && $order->getId()) {
486
+ $processStatus = $this->processedStatus($order);
487
+ if ($processStatus > 0 && !$forceSend) {
488
+ if($processStatus == self::TRANSACTION_SENT_STATUS) return "exists";
489
+ else return $this->sendOrderUpdateToSignifyd($order);
490
+ }
491
+
492
+ $payments = $order->getPaymentsCollection();
493
+ $last_payment = null;
494
+ foreach ($payments as $payment) {
495
+ $last_payment = $payment;
496
+ }
497
+
498
+ $state = $order->getState();
499
+
500
+ if (!$state || $state == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
501
+ return "notready"; // Note: would not be in the order grid if this were the case
502
+ }
503
+
504
+ if(is_null(Mage::registry('signifyd_action'))) {
505
+ Mage::register('signifyd_action', 1); // Work will now take place
506
+ }
507
+
508
+ $customer = null;
509
+ if ($order->getCustomer()) {
510
+ $customer = $order->getCustomer();
511
+ }
512
+
513
+ $case = $this->generateCase($order, $last_payment, $customer);
514
+
515
+ $case_object = $this->markProcessed($order);
516
+
517
+ $response = $this->submitCase($case, $this->getUrl(), $this->getAuth());
518
+
519
+ try {
520
+ $response_code = $response->getHttpCode();
521
+
522
+ if (substr($response_code, 0, 1) == '2') {
523
+ $response_data = json_decode($response->getRawResponse(), true);
524
+
525
+ $caseId = $response_data['investigationId'];
526
+ $case_object = Mage::getModel('signifyd_connect/case')->load($case_object->getOrderIncrement());
527
+ $case_object->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
528
+ $case_object->setCode($caseId);
529
+ $case_object->setTransactionId($case['purchase']['transactionId']);
530
+ $case_object->setMagentoStatus(self::IN_REVIEW_STATUS);
531
+ $case_object->save();
532
+
533
+ $order->addStatusHistoryComment("Signifyd: case $caseId created for order");
534
+ $order->save(); // Note: this will trigger recursion
535
+
536
+ return "sent";
537
+ }
538
+ } catch (Exception $e) {
539
+ Mage::log($e->__toString(), null, 'signifyd_connect.log');
540
+ }
541
+ //$this->unmarkProcessed($order);
542
+ return "error";
543
+ }
544
+ }
545
+
546
+ public function getProductUrl($product)
547
+ {
548
+ $url = null;
549
+
550
+ try {
551
+ $url = $product->getUrlModel()->getProductUrl($product);
552
+ } catch (Exception $e) {
553
+ $url = null;
554
+ }
555
+
556
+ return $url;
557
+ }
558
+
559
+ public function getCaseUrl($order_id)
560
+ {
561
+ $case = Mage::getModel('signifyd_connect/case')->load($order_id);
562
+
563
+ if ($case->getCode()) {
564
+ return "https://www.signifyd.com/cases/" . $case->getCode();
565
+ }
566
+ Mage::log('Case URL not found: '.$order_id, null, 'signifyd_connect.log');
567
+ return '';
568
+ }
569
+
570
+ public function getProductImage($product, $size="150")
571
+ {
572
+ $image = null;
573
+
574
+ try {
575
+ $image = (string)Mage::helper('catalog/image')->init($product, 'image')->resize($size, $size)->keepFrame(true)->keepAspectRatio(true);
576
+ } catch (Exception $e) {
577
+ $image = null;
578
+ }
579
+
580
+ return $image;
581
+ }
582
+
583
+ public function getStoreName()
584
+ {
585
+ return Mage::getStoreConfig('trans_email/ident_general/name', 0);
586
+ }
587
+
588
+ public function getStoreEmail()
589
+ {
590
+ return Mage::getStoreConfig('trans_email/ident_general/email', 0);
591
+ }
592
+
593
+ public function getStoreUrl()
594
+ {
595
+ return Mage::getBaseUrl();
596
+ }
597
+
598
+ public function processedStatus($order)
599
+ {
600
+ $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
601
+
602
+ if ($case->getTransactionId())
603
+ {
604
+ return self::TRANSACTION_SENT_STATUS;
605
+ }
606
+ else if ($case->getCode())
607
+ {
608
+ return self::CASE_CREATED_STATUS;
609
+ }
610
+ else if ($case->getId())
611
+ {
612
+ return self::ENTITY_CREATED_STATUS;
613
+ }
614
+
615
+ return self::UNPROCESSED_STATUS;
616
+ }
617
+
618
+ public function markProcessed($order)
619
+ {
620
+ $case = Mage::getModel('signifyd_connect/case');
621
+ $case->setOrderIncrement($order->getIncrementId());
622
+ $case->setCreated(strftime('%Y-%m-%d %H:%M:%S', time()));
623
+ $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
624
+ $case->save();
625
+
626
+ return $case;
627
+ }
628
+
629
+ public function unmarkProcessed($order)
630
+ {
631
+ $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
632
+ if($case && !$case->isObjectNew())
633
+ {
634
+ Mage::register('isSecureArea', true);
635
+ $case->delete();
636
+ Mage::unregister('isSecureArea');
637
+ }
638
+ }
639
+
640
+ public function cancelGuarantee($case)
641
+ {
642
+ $caseId = $case->getCode();
643
+ $url = $this->getUrl() . "/$caseId/guarantee";
644
+ $body = json_encode(array("guaranteeDisposition" => "CANCELED"));
645
+ $response = $this->request($url, $body, $this->getAuth(), 'application/json', null, true);
646
+ $code = $response->getHttpCode();
647
+ if(substr($code, 0, 1) == '2') {
648
+ $case->setGuarantee('CANCELED');
649
+ $case->save();
650
+ } else {
651
+ $this->logError("Guarantee cancel failed");
652
+ }
653
+ $this->logResponse("Received $code from guarantee cancel");
654
+ }
655
+
656
+ public function request($url, $data = null, $auth = null, $contenttype = "application/x-www-form-urlencoded",
657
+ $accept = null, $is_update = false)
658
+ {
659
+ if (Mage::getStoreConfig('signifyd_connect/log/all')) {
660
+ $authMask = preg_replace ( "/\S/", "*", $auth, strlen($auth) - 4 );
661
+ Mage::log("Request:\nURL: $url \nAuth: $authMask\nData: $data", null, 'signifyd_connect.log');
662
+ }
663
+
664
+ $curl = curl_init();
665
+ $response = new Varien_Object;
666
+ $headers = array();
667
+
668
+ curl_setopt($curl, CURLOPT_URL, $url);
669
+
670
+ if (stripos($url, 'https://') === 0) {
671
+ curl_setopt($curl, CURLOPT_PORT, 443);
672
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
673
+ }
674
+
675
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
676
+
677
+ if ($auth) {
678
+ curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
679
+ curl_setopt($curl, CURLOPT_USERPWD, $auth);
680
+ }
681
+
682
+ if ($accept) {
683
+ $headers[] = 'Accept: ' . $accept;
684
+ }
685
+
686
+ if ($data) {
687
+ if($is_update) curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
688
+ else curl_setopt($curl, CURLOPT_POST, 1);
689
+
690
+ $headers[] = "Content-Type: $contenttype";
691
+ $headers[] = "Content-length: " . strlen($data);
692
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
693
+ }
694
+
695
+ if (count($headers)) {
696
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
697
+ }
698
+
699
+ curl_setopt($curl, CURLOPT_TIMEOUT, 4);
700
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 4);
701
+
702
+ $raw_response = curl_exec($curl);
703
+ $response->setRawResponse($raw_response);
704
+
705
+ $response_data = curl_getinfo($curl);
706
+ $response->addData($response_data);
707
+
708
+ if (Mage::getStoreConfig('signifyd_connect/log/all')) {
709
+ Mage::log("Response ($url):\n " . print_r($response, true), null, 'signifyd_connect.log');
710
+ }
711
+
712
+ if ($raw_response === false || curl_errno($curl)) {
713
+ $error = curl_error($curl);
714
+
715
+ if (Mage::getStoreConfig('signifyd_connect/log/all')) {
716
+ Mage::log("ERROR ($url):\n$error", null, 'signifyd_connect.log');
717
+ }
718
+
719
+ $response->setData('error', $error);
720
+ }
721
+
722
+ curl_close($curl);
723
+
724
+ return $response;
725
+ }
726
+
727
+ /**
728
+ * Get the order payment status
729
+ * @param $order
730
+ * @return array
731
+ */
732
+ public function getOrderPaymentStatus($order)
733
+ {
734
+ $status = array('authorize' => false, 'capture' => false, 'credit_memo' => false);
735
+ $logger = Mage::helper('signifyd_connect/log');
736
+ $paymentMethod = $order->getPayment();
737
+ $paymentAuthorized = $paymentMethod->getBaseAmountAuthorized();
738
+ $baseTotalPaid = $order->getBaseTotalPaid();
739
+ $baseTotalRefunded = $order->getBaseTotalRefunded();
740
+ // Maybe used in the future
741
+ // $canVoid = $paymentMethod->canVoid($order);
742
+ // $amountPayed = $paymentMethod->getAmountPaid();
743
+ // $baseTotalCanceled = $order->getBaseTotalCanceled();
744
+ // $baseTotalInvoiced = $order->getBaseTotalInvoiced();
745
+
746
+ // Check authorization
747
+ if(!empty($paymentAuthorized)){
748
+ $status['authorize'] = true;
749
+ }
750
+
751
+ // Special case for Paypal payment type "order"
752
+ if($this->isPaypalOrder($paymentMethod)){
753
+ $paymentAdditional = $paymentMethod->getData('additional_information');
754
+ if(isset($paymentAdditional['is_order_action']) && $paymentAdditional['is_order_action']){
755
+ $status['authorize'] = true;
756
+ }
757
+ }
758
+
759
+ // Check capture
760
+ if(!empty($baseTotalPaid)){
761
+ $status['capture'] = true;
762
+ }
763
+
764
+ // Check credit memo
765
+ if(!empty($baseTotalRefunded)){
766
+ $status['credit_memo'] = true;
767
+ }
768
+
769
+ // Log status
770
+ $logger->addLog("Order: {$order->getIncrementId()} has a status of " . json_encode($status));
771
+
772
+ return $status;
773
+ }
774
+
775
+ /**
776
+ * Checking if the payment method si paypal_express
777
+ * @param $paymentMethod
778
+ * @return bool
779
+ */
780
+ public function isPaypalOrder($paymentMethod)
781
+ {
782
+ $code = $paymentMethod->getMethodInstance()->getCode();
783
+ return (stripos($code, 'paypal_express') !== false)? true : false;
784
+ }
785
+
786
+ public function isGuarantyDeclined($order)
787
+ {
788
+ $case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
789
+ return ($case->getGuarantee() == 'DECLINED')? true : false;
790
+ }
791
+
792
+ public function isEnabled()
793
+ {
794
+ return Mage::getStoreConfig('signifyd_connect/settings/enabled');
795
+ }
796
+ }
 
 
 
app/code/community/Signifyd/Connect/Helper/Log.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/Authnet.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Authnet extends Mage_Paygate_Model_Authorizenet
4
- {
5
- protected function _registercard(varien_object $response, mage_sales_model_order_payment $payment)
6
- {
7
- Mage::log(">: ".$response->getTransactionId(), null, 'signifyd_connect.log');
8
- $card = parent::_registercard($response,$payment);
9
- $card->setCcAvsResultCode($response->getAvsResultCode());
10
- $card->setCcResponseCode($response->getCardCodeResponseCode());
11
- $payment->setCcAvsStatus($response->getAvsResultCode());
12
- $payment->setCcCidStatus($response->getCardCodeResponseCode());
13
- $payment->setCcTransId($response->getTransactionId());
14
- $payment->getCcTransId();
15
- return $card;
16
- }
17
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Authnet extends Mage_Paygate_Model_Authorizenet
4
+ {
5
+ protected function _registercard(varien_object $response, mage_sales_model_order_payment $payment)
6
+ {
7
+ Mage::log(">: ".$response->getTransactionId(), null, 'signifyd_connect.log');
8
+ $card = parent::_registercard($response,$payment);
9
+ $card->setCcAvsResultCode($response->getAvsResultCode());
10
+ $card->setCcResponseCode($response->getCardCodeResponseCode());
11
+ $payment->setCcAvsStatus($response->getAvsResultCode());
12
+ $payment->setCcCidStatus($response->getCardCodeResponseCode());
13
+ $payment->setCcTransId($response->getTransactionId());
14
+ $payment->getCcTransId();
15
+ return $card;
16
+ }
17
+ }
app/code/community/Signifyd/Connect/Model/Case.php CHANGED
@@ -1,10 +1,29 @@
1
- <?php
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
+ }
app/code/community/Signifyd/Connect/Model/Cron.php CHANGED
@@ -1,9 +1,136 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Cron
4
- {
5
- public function update()
6
- {
7
- return; // Deprecated
8
- }
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 */
app/code/community/Signifyd/Connect/Model/Link.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Link
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
- }
1
+ <?php
2
+
3
+ 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><br />Use this URL to setup your Magento <a href="https://app.signifyd.com/settings/notifications">webhook</a> from the Signifyd console. You MUST setup the webhook to enable order workflows and syncing of guarantees back to Magento.';
8
+ }
9
+ }
app/code/community/Signifyd/Connect/Model/Observer.php CHANGED
@@ -1,320 +1,302 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Observer extends Varien_Object
4
- {
5
- public $joins = 0;
6
-
7
- public function openCase($observer)
8
- {
9
- try {
10
- if (!Mage::getStoreConfig('signifyd_connect/settings/enabled') && !$this->getEnabled()) {
11
- return;
12
- }
13
- if(Mage::registry('signifyd_action') == 1)
14
- {
15
- return;
16
- }
17
-
18
- $event = $observer->getEvent();
19
-
20
- if ($event->hasOrder()) {
21
- $order = $event->getOrder();
22
- } else if ($event->hasObject()) {
23
- $order = $event->getObject();
24
- }
25
-
26
- $order_model = get_class(Mage::getModel('sales/order'));
27
-
28
- if (!($order instanceof $order_model)) {
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)
57
- {
58
- // Used to capture data for testing with
59
-
60
- $order_data = json_encode($order->getData());
61
- $billing_data = json_encode($order->getBillingAddress()->getData());
62
- $shipping_data = json_encode($order->getShippingAddress()->getData());
63
- $customer_data = json_encode($order->getCustomer()->getData());
64
- $payment_data = json_encode($payment->getData());
65
- $quote_data = json_encode($quote->getData());
66
- $items = array();
67
- $products = array();
68
-
69
- foreach ($quote->getAllItems() as $item) {
70
- $items[$item->getId()] = $item->getData();
71
- $product = Mage::getModel('catalog/product')->load($item->getProductId());
72
- $products[$item->getId()] = $product->getData();
73
- }
74
-
75
- $items = json_encode($items);
76
- $products = json_encode($products);
77
-
78
- Mage::log("Order:\n $order_data", null, 'signifyd_connect_objects.log');
79
- Mage::log("Billing:\n $billing_data", null, 'signifyd_connect_objects.log');
80
- Mage::log("Shipping:\n $shipping_data", null, 'signifyd_connect_objects.log');
81
- Mage::log("Customer:\n $customer_data", null, 'signifyd_connect_objects.log');
82
- Mage::log("Payment:\n $payment_data", null, 'signifyd_connect_objects.log');
83
- Mage::log("Quote:\n $quote_data", null, 'signifyd_connect_objects.log');
84
- Mage::log("Items:\n $items", null, 'signifyd_connect_objects.log');
85
- Mage::log("Products:\n $products", null, 'signifyd_connect_objects.log');
86
- }
87
-
88
- public function getAdminRoute()
89
- {
90
- $route = false;
91
-
92
- try {
93
- // 1.4.0.0 support means we need to hard code these paths
94
- if ((bool)(string)Mage::getConfig()->getNode('default/admin/url/use_custom_path')) {
95
- $route = Mage::getConfig()->getNode('default/admin/url/custom_path');
96
- } else {
97
- $route = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
98
- }
99
- } catch (Exception $e) {
100
-
101
- }
102
-
103
- if (!$route) {
104
- $route = 'admin';
105
- }
106
-
107
- return $route;
108
- }
109
-
110
- public function eavCollectionAbstractLoadBefore($observer)
111
- {
112
- $x = $observer->getCollection();
113
-
114
- $request = Mage::app()->getRequest();
115
- $module = $request->getModuleName();
116
- $controller = $request->getControllerName();
117
-
118
- if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
119
- return;
120
- }
121
-
122
- $clss = get_class($x);
123
- if ($clss == 'Mage_Sales_Model_Mysql4_Order_Collection' || $clss == 'Mage_Sales_Model_Mysql4_Order_Grid_Collection') {
124
- $observer->setOrderGridCollection($x);
125
- return $this->salesOrderGridCollectionLoadBefore($observer);
126
- }
127
- }
128
-
129
- public function coreCollectionAbstractLoadBefore($observer)
130
- {
131
- $x = $observer->getCollection();
132
-
133
- $request = Mage::app()->getRequest();
134
- $module = $request->getModuleName();
135
- $controller = $request->getControllerName();
136
-
137
- if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
138
- return;
139
- }
140
-
141
- $clss = get_class($x);
142
-
143
- if ($clss == 'Mage_Sales_Model_Mysql4_Order_Collection' || $clss == 'Mage_Sales_Model_Mysql4_Order_Grid_Collection') {
144
- $observer->setOrderGridCollection($x);
145
- return $this->salesOrderGridCollectionLoadBefore($observer);
146
- }
147
- }
148
-
149
- public function isCe()
150
- {
151
- return !@class_exists('Enterprise_Cms_Helper_Data');
152
- }
153
-
154
- public function oldSupport()
155
- {
156
- $version = Mage::getVersion();
157
-
158
- if ($this->isCe()) {
159
- return version_compare($version, '1.4.1.0', '<');
160
- } else {
161
- return version_compare($version, '1.10.0.0', '<');
162
- }
163
-
164
- return false;
165
- }
166
-
167
- public function belowSix()
168
- {
169
- $version = Mage::getVersion();
170
-
171
- if ($this->isCe()) {
172
- return version_compare($version, '1.6.0.0', '<');
173
- } else {
174
- return version_compare($version, '1.11.0.0', '<');
175
- }
176
-
177
- return false;
178
- }
179
-
180
- public function salesOrderGridCollectionLoadBefore($observer)
181
- {
182
- $request = Mage::app()->getRequest();
183
- $module = $request->getModuleName();
184
- $controller = $request->getControllerName();
185
-
186
- if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
187
- return;
188
- }
189
-
190
- $collection = $observer->getOrderGridCollection();
191
- $select = $collection->getSelect();
192
-
193
- // This will prevent us from rejoining.
194
- if(strchr($select, 'signifyd')) {
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
-
287
- public function handleCancel($order)
288
- {
289
- $helper = Mage::helper('signifyd_connect');
290
- $case = Mage::getModel('signifyd_connect/case')->load($order);
291
- if($case->isObjectNew()) {
292
- $helper->logError("Guarantee cancel: Signifyd case for order $order does not exist in DB");
293
- return;
294
- }
295
- if($case->getGuarantee() == 'N/A' || $case->getGuarantee() == 'DECLINED') {
296
- $helper->logRequest("Guarantee cancel: Skipped. No guarantee active");
297
- return;
298
- }
299
-
300
- $helper->logRequest("Guarantee cancel for case " . $case->getCode());
301
- $helper->cancelGuarantee($case);
302
- }
303
-
304
- public function salesOrderPaymentCancel($observer)
305
- {
306
- $helper = Mage::helper('signifyd_connect');
307
- try {
308
- $event = $observer->getEvent();
309
- if($event->getPayment()->getOrder()) {
310
- $order = $event->getPayment()->getOrder()->getIncrementId();
311
- } else {
312
- $helper->logError("Event salesOrderPaymentCancel has no order");
313
- return;
314
- }
315
- $this->handleCancel($order);
316
- } catch(Exception $ex) {
317
- $helper->logError("Guarantee cancel: $ex");
318
- }
319
- }
320
- }
1
+ <?php
2
+
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 {
17
+ if (!Mage::getStoreConfig('signifyd_connect/settings/enabled') && !$this->getEnabled()) {
18
+ return;
19
+ }
20
+ if(Mage::registry('signifyd_action') == 1)
21
+ {
22
+ return;
23
+ }
24
+
25
+ $event = $observer->getEvent();
26
+
27
+ if ($event->hasOrder()) {
28
+ $order = $event->getOrder();
29
+ } else if ($event->hasObject()) {
30
+ $order = $event->getObject();
31
+ }
32
+
33
+ $order_model = get_class(Mage::getModel('sales/order'));
34
+
35
+ if (!($order instanceof $order_model)) {
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)
48
+ {
49
+ // Used to capture data for testing with
50
+
51
+ $order_data = json_encode($order->getData());
52
+ $billing_data = json_encode($order->getBillingAddress()->getData());
53
+ $shipping_data = json_encode($order->getShippingAddress()->getData());
54
+ $customer_data = json_encode($order->getCustomer()->getData());
55
+ $payment_data = json_encode($payment->getData());
56
+ $quote_data = json_encode($quote->getData());
57
+ $items = array();
58
+ $products = array();
59
+
60
+ foreach ($quote->getAllItems() as $item) {
61
+ $items[$item->getId()] = $item->getData();
62
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
63
+ $products[$item->getId()] = $product->getData();
64
+ }
65
+
66
+ $items = json_encode($items);
67
+ $products = json_encode($products);
68
+
69
+ Mage::log("Order:\n $order_data", null, 'signifyd_connect_objects.log');
70
+ Mage::log("Billing:\n $billing_data", null, 'signifyd_connect_objects.log');
71
+ Mage::log("Shipping:\n $shipping_data", null, 'signifyd_connect_objects.log');
72
+ Mage::log("Customer:\n $customer_data", null, 'signifyd_connect_objects.log');
73
+ Mage::log("Payment:\n $payment_data", null, 'signifyd_connect_objects.log');
74
+ Mage::log("Quote:\n $quote_data", null, 'signifyd_connect_objects.log');
75
+ Mage::log("Items:\n $items", null, 'signifyd_connect_objects.log');
76
+ Mage::log("Products:\n $products", null, 'signifyd_connect_objects.log');
77
+ }
78
+
79
+ public function getAdminRoute()
80
+ {
81
+ $route = false;
82
+
83
+ try {
84
+ // 1.4.0.0 support means we need to hard code these paths
85
+ if ((bool)(string)Mage::getConfig()->getNode('default/admin/url/use_custom_path')) {
86
+ $route = Mage::getConfig()->getNode('default/admin/url/custom_path');
87
+ } else {
88
+ $route = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
89
+ }
90
+ } catch (Exception $e) {
91
+
92
+ }
93
+
94
+ if (!$route) {
95
+ $route = 'admin';
96
+ }
97
+
98
+ return $route;
99
+ }
100
+
101
+ public function eavCollectionAbstractLoadBefore($observer)
102
+ {
103
+ $x = $observer->getCollection();
104
+
105
+ $request = Mage::app()->getRequest();
106
+ $module = $request->getModuleName();
107
+ $controller = $request->getControllerName();
108
+
109
+ if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
110
+ return;
111
+ }
112
+
113
+ $clss = get_class($x);
114
+ if ($clss == 'Mage_Sales_Model_Mysql4_Order_Collection' || $clss == 'Mage_Sales_Model_Mysql4_Order_Grid_Collection') {
115
+ $observer->setOrderGridCollection($x);
116
+ return $this->salesOrderGridCollectionLoadBefore($observer);
117
+ }
118
+ }
119
+
120
+ public function coreCollectionAbstractLoadBefore($observer)
121
+ {
122
+ $x = $observer->getCollection();
123
+
124
+ $request = Mage::app()->getRequest();
125
+ $module = $request->getModuleName();
126
+ $controller = $request->getControllerName();
127
+
128
+ if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
129
+ return;
130
+ }
131
+
132
+ $clss = get_class($x);
133
+
134
+ if ($clss == 'Mage_Sales_Model_Mysql4_Order_Collection' || $clss == 'Mage_Sales_Model_Mysql4_Order_Grid_Collection') {
135
+ $observer->setOrderGridCollection($x);
136
+ return $this->salesOrderGridCollectionLoadBefore($observer);
137
+ }
138
+ }
139
+
140
+ public function isCe()
141
+ {
142
+ return !@class_exists('Enterprise_Cms_Helper_Data');
143
+ }
144
+
145
+ public function oldSupport()
146
+ {
147
+ $version = Mage::getVersion();
148
+
149
+ if ($this->isCe()) {
150
+ return version_compare($version, '1.4.1.0', '<');
151
+ } else {
152
+ return version_compare($version, '1.10.0.0', '<');
153
+ }
154
+
155
+ return false;
156
+ }
157
+
158
+ public function belowSix()
159
+ {
160
+ $version = Mage::getVersion();
161
+
162
+ if ($this->isCe()) {
163
+ return version_compare($version, '1.6.0.0', '<');
164
+ } else {
165
+ return version_compare($version, '1.11.0.0', '<');
166
+ }
167
+
168
+ return false;
169
+ }
170
+
171
+ public function salesOrderGridCollectionLoadBefore($observer)
172
+ {
173
+ $request = Mage::app()->getRequest();
174
+ $module = $request->getModuleName();
175
+ $controller = $request->getControllerName();
176
+
177
+ if ($module != $this->getAdminRoute() || $controller != 'sales_order') {
178
+ return;
179
+ }
180
+
181
+ $collection = $observer->getOrderGridCollection();
182
+ $select = $collection->getSelect();
183
+
184
+ // This will prevent us from rejoining.
185
+ if(strchr($select, 'signifyd')) {
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
+
243
+ public function handleCancel($order)
244
+ {
245
+ $helper = Mage::helper('signifyd_connect');
246
+ $case = Mage::getModel('signifyd_connect/case')->load($order);
247
+ if($case->isObjectNew()) {
248
+ $helper->logError("Guarantee cancel: Signifyd case for order $order does not exist in DB");
249
+ return;
250
+ }
251
+ if($case->getGuarantee() == 'N/A' || $case->getGuarantee() == 'DECLINED') {
252
+ $helper->logRequest("Guarantee cancel: Skipped. No guarantee active");
253
+ return;
254
+ }
255
+
256
+ $helper->logRequest("Guarantee cancel for case " . $case->getCode());
257
+ $helper->cancelGuarantee($case);
258
+ }
259
+
260
+ public function salesOrderPaymentCancel($observer)
261
+ {
262
+ $helper = Mage::helper('signifyd_connect');
263
+ try {
264
+ $event = $observer->getEvent();
265
+ if($event->getPayment()->getOrder()) {
266
+ $order = $event->getPayment()->getOrder()->getIncrementId();
267
+ } else {
268
+ $helper->logError("Event salesOrderPaymentCancel has no order");
269
+ return;
270
+ }
271
+ $this->handleCancel($order);
272
+ } catch(Exception $ex) {
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
+ if(!Mage::helper('signifyd_connect')->isEnabled()){
285
+ return $this;
286
+ }
287
+ $order = $observer->getEvent()->getOrder();
288
+ if($order->canHold() === false){
289
+ $this->helper->logError("Order {$order->getIncrementId()} could not be held because Magento returned false for canHold");
290
+ }
291
+
292
+ try {
293
+ $order->hold();
294
+ $order->addStatusHistoryComment("Signifyd: order held after order place");
295
+ $order->save();
296
+ } catch (Exception $e){
297
+ $this->helper->logError("PutOrderOnHold Error: $e");
298
+ }
299
+
300
+ return $this;
301
+ }
302
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Signifyd/Connect/Model/Order.php ADDED
@@ -0,0 +1,412 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/all');
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 ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/Resource/Case.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Resource_Case extends Mage_Core_Model_Mysql4_Abstract
4
- {
5
- protected function _construct()
6
- {
7
- $this->_init('signifyd_connect/case', 'order_increment');
8
- $this->_isPkAutoIncrement = false;
9
- }
10
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Resource_Case extends Mage_Core_Model_Mysql4_Abstract
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/Resource/Case/Collection.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Resource_Case_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
- {
5
- public function _construct()
6
- {
7
- $this->_init('signifyd_connect/case');
8
- }
9
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Resource_Case_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('signifyd_connect/case');
8
+ }
9
+ }
app/code/community/Signifyd/Connect/Model/Resource/Retries.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Resource_Retries extends Mage_Core_Model_Mysql4_Abstract
4
- {
5
- protected function _construct()
6
- {
7
- $this->_init('signifyd_connect/retries', 'order_increment');
8
- $this->_isPkAutoIncrement = false;
9
- }
10
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Resource_Retries extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('signifyd_connect/retries', 'order_increment');
8
+ $this->_isPkAutoIncrement = false;
9
+ }
10
+ }
app/code/community/Signifyd/Connect/Model/Resource/Retries/Collection.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Resource_Retries_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
- {
5
- public function _construct()
6
- {
7
- $this->_init('signifyd_connect/retries');
8
- }
9
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Resource_Retries_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('signifyd_connect/retries');
8
+ }
9
+ }
app/code/community/Signifyd/Connect/Model/Retries.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Retries extends Mage_Core_Model_Abstract
4
- {
5
- protected function _construct()
6
- {
7
- $this->_init('signifyd_connect/retries');
8
- $this->_isPkAutoIncrement = false;
9
- }
10
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Retries extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('signifyd_connect/retries');
8
+ $this->_isPkAutoIncrement = false;
9
+ }
10
+ }
app/code/community/Signifyd/Connect/Model/Setup.php CHANGED
@@ -1,53 +1,53 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Model_Setup extends Mage_Core_Model_Resource_Setup
4
- {
5
- const REGISTER_URL = 'https://signifyd.com/magento/installs';
6
-
7
- public function register()
8
- {
9
- try {
10
- $helper = Mage::helper('signifyd_connect');
11
- Mage::getConfig()->reinit();
12
- $data = array(
13
- 'url' => $helper->getStoreUrl(),
14
- 'email' => $helper->getStoreEmail()
15
- );
16
-
17
- $helper->request(self::REGISTER_URL, json_encode($data), null, 'application/json');
18
- } catch (Exception $e) {}
19
- }
20
-
21
- public function checkColumns()
22
- {
23
- /* Attempt to add commonly missing columns, allow silent failure if present */
24
-
25
- try {
26
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `status` `signifyd_status` VARCHAR( 64 ) NOT NULL DEFAULT 'PENDING'");
27
- } catch (Exception $e) {};
28
-
29
- try {
30
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `signifyd_status` VARCHAR( 64 ) NOT NULL DEFAULT 'PENDING';");
31
- } catch (Exception $e) {};
32
-
33
- try {
34
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `code` VARCHAR(255) NOT NULL;");
35
- } catch (Exception $e) {};
36
-
37
- try {
38
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `score` FLOAT NULL DEFAULT NULL;");
39
- } catch (Exception $e) {};
40
-
41
- try {
42
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `entries` TEXT NULL DEFAULT NULL;");
43
- } catch (Exception $e) {};
44
-
45
- try {
46
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `created_at` TIMESTAMP NULL DEFAULT NULL;");
47
- } catch (Exception $e) {};
48
-
49
- try {
50
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `updated_at` TIMESTAMP NULL DEFAULT NULL;");
51
- } catch (Exception $e) {};
52
- }
53
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Setup extends Mage_Core_Model_Resource_Setup
4
+ {
5
+ const REGISTER_URL = 'https://signifyd.com/magento/installs';
6
+
7
+ public function register()
8
+ {
9
+ try {
10
+ $helper = Mage::helper('signifyd_connect');
11
+ Mage::getConfig()->reinit();
12
+ $data = array(
13
+ 'url' => $helper->getStoreUrl(),
14
+ 'email' => $helper->getStoreEmail()
15
+ );
16
+
17
+ $helper->request(self::REGISTER_URL, json_encode($data), null, 'application/json');
18
+ } catch (Exception $e) {}
19
+ }
20
+
21
+ public function checkColumns()
22
+ {
23
+ /* Attempt to add commonly missing columns, allow silent failure if present */
24
+
25
+ try {
26
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `status` `signifyd_status` VARCHAR( 64 ) NOT NULL DEFAULT 'PENDING'");
27
+ } catch (Exception $e) {};
28
+
29
+ try {
30
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `signifyd_status` VARCHAR( 64 ) NOT NULL DEFAULT 'PENDING';");
31
+ } catch (Exception $e) {};
32
+
33
+ try {
34
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `code` VARCHAR(255) NOT NULL;");
35
+ } catch (Exception $e) {};
36
+
37
+ try {
38
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `score` FLOAT NULL DEFAULT NULL;");
39
+ } catch (Exception $e) {};
40
+
41
+ try {
42
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `entries` TEXT NULL DEFAULT NULL;");
43
+ } catch (Exception $e) {};
44
+
45
+ try {
46
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `created_at` TIMESTAMP NULL DEFAULT NULL;");
47
+ } catch (Exception $e) {};
48
+
49
+ try {
50
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `updated_at` TIMESTAMP NULL DEFAULT NULL;");
51
+ } catch (Exception $e) {};
52
+ }
53
+ }
app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Accepted.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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' => 2,
11
+ 'label' => 'Leave On Hold'
12
+ ),
13
+ array(
14
+ 'value' => 1,
15
+ 'label' => 'Unhold Order'
16
+ )
17
+ );
18
+ }
19
+ }
app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Declined.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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' => 'Leave On Hold'
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 DELETED
@@ -1,22 +0,0 @@
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 DELETED
@@ -1,18 +0,0 @@
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
@@ -1,27 +1,22 @@
1
- <?php
2
-
3
- class Signifyd_Connect_Adminhtml_SignifydController extends Mage_Adminhtml_Controller_Action
4
- {
5
- public function indexAction()
6
- {
7
- $this->_title($this->__('Sales'))->_title($this->__('Signifyd Scores'));
8
- $this->loadLayout();
9
- $this->_setActiveMenu('sales/sales');
10
- $this->_addContent($this->getLayout()->createBlock('signifyd_connect/adminhtml_sales_order'));
11
- $this->renderLayout();
12
- }
13
-
14
- public function gridAction()
15
- {
16
- $this->loadLayout();
17
- $this->getResponse()->setBody(
18
- $this->getLayout()->createBlock('signifyd_connect/adminhtml_sales_order_grid')->toHtml()
19
- );
20
- }
21
-
22
- public function sendAction()
23
- {
24
- Mage::helper('signifyd_connect')->bulkSend($this);
25
- $this->_redirectReferer();
26
- }
27
- }
1
+ <?php
2
+
3
+ class Signifyd_Connect_Adminhtml_SignifydController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->_title($this->__('Sales'))->_title($this->__('Signifyd Scores'));
8
+ $this->loadLayout();
9
+ $this->_setActiveMenu('sales/sales');
10
+ $this->_addContent($this->getLayout()->createBlock('signifyd_connect/adminhtml_sales_order'));
11
+ $this->renderLayout();
12
+ }
13
+
14
+ public function gridAction()
15
+ {
16
+ $this->loadLayout();
17
+ $this->getResponse()->setBody(
18
+ $this->getLayout()->createBlock('signifyd_connect/adminhtml_sales_order_grid')->toHtml()
19
+ );
20
+ }
21
+
22
+ }
 
 
 
 
 
app/code/community/Signifyd/Connect/controllers/ConnectController.php CHANGED
@@ -1,641 +1,523 @@
1
- <?php
2
-
3
- class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Action
4
- {
5
- public $_request = array();
6
- public $_topic = false;
7
- public $_order = false;
8
- public $_store_id = null;
9
- public $_case = false;
10
- public $_previousGuarantee = false;
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()
63
- {
64
- return Mage::getStoreConfig('signifyd_connect/log/error');
65
- }
66
-
67
- public function logRequest()
68
- {
69
- return Mage::getStoreConfig('signifyd_connect/log/request');
70
- }
71
-
72
- public function getRawPost()
73
- {
74
- if (isset($HTTP_RAW_POST_DATA) && $HTTP_RAW_POST_DATA) {
75
- return $HTTP_RAW_POST_DATA;
76
- }
77
-
78
- $post = file_get_contents("php://input");
79
-
80
- if ($post) {
81
- return $post;
82
- }
83
-
84
- return '';
85
- }
86
-
87
- public function getDefaultMessage()
88
- {
89
- 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';
90
- }
91
-
92
- public function getDisabledMessage()
93
- {
94
- 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.';
95
- }
96
-
97
- public function unsupported()
98
- {
99
- Mage::app()->getResponse()
100
- ->setHeader('HTTP/1.1', '403 Forbidden')
101
- ->sendResponse();
102
- echo 'This request type is currently unsupported';
103
- exit;
104
- }
105
-
106
- public function complete()
107
- {
108
- Mage::app()->getResponse()
109
- ->setHeader('HTTP/1.1', '200 Ok')
110
- ->sendResponse();
111
-
112
- exit;
113
- }
114
-
115
- public function conflict()
116
- {
117
- Mage::app()->getResponse()
118
- ->setHeader('HTTP/1.1', '409 Conflict')
119
- ->sendResponse();
120
- exit;
121
- }
122
-
123
- private function updateScore($case)
124
- {
125
- if (isset($this->_request['score'])) {
126
- $case->setScore($this->_request['score']);
127
-
128
- if ($this->logRequest()) {
129
- Mage::log('Set score to ' . $this->_request['score'], null, 'signifyd_connect.log');
130
- }
131
- } else {
132
- if ($this->logRequest()) {
133
- Mage::log('No score value available', null, 'signifyd_connect.log');
134
- }
135
- }
136
- }
137
-
138
- private function updateStatus($case)
139
- {
140
- if (isset($this->_request['status'])) {
141
- $case->setSignifydStatus($this->_request['status']);
142
-
143
- if ($this->logRequest()) {
144
- Mage::log('Set status to ' . $this->_request['status'], null, 'signifyd_connect.log');
145
- }
146
- } else {
147
- if ($this->logRequest()) {
148
- Mage::log('No status value available', null, 'signifyd_connect.log');
149
- }
150
- }
151
- }
152
-
153
- private function updateGuarantee($case)
154
- {
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,
161
- 'signifyd_connect.log');
162
- }
163
- }
164
- } catch(Exception $e) {
165
- if ($this->logErrors()) {
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)
175
- {
176
- $check = base64_encode(hash_hmac('sha256', $request, $this->getApiKey(), true));
177
-
178
- if ($this->logRequest()) {
179
- Mage::log('API request hash check: ' . $check, null, 'signifyd_connect.log');
180
- }
181
-
182
- if ($check == $hash) {
183
- return true;
184
- }
185
- else if ($this->getHeader('X-SIGNIFYD-TOPIC') == "cases/test"){
186
- // In the case that this is a webhook test, the encoding ABCDE is allowed
187
- $check = base64_encode(hash_hmac('sha256', $request, 'ABCDE', true));
188
- if ($check == $hash) {
189
- return true;
190
- }
191
- }
192
-
193
- return false;
194
- }
195
-
196
- public function initCase($order_increment)
197
- {
198
- $case = false;
199
-
200
- if (isset($this->_request['orderId']))
201
- {
202
- $case = Mage::getModel('signifyd_connect/case')->load($this->_request['orderId']);
203
- if($case->isObjectNew()) {
204
- if ($this->logErrors()) {
205
- Mage::log('Case not yet in DB. Likely timing issue. order_increment: ' . $this->_request['orderId'], null, 'signifyd_connect.log');
206
- }
207
- $this->conflict();
208
- }
209
- }
210
-
211
- return $case;
212
- }
213
-
214
- public function initRequest($request)
215
- {
216
- $this->_request = json_decode($request, true);
217
-
218
- $topic = $this->getHeader('X-SIGNIFYD-TOPIC');
219
-
220
- $this->_topic = $topic;
221
-
222
- // For the webhook test, all of the request data will be invalid
223
- if ($topic == "cases/test") return;
224
-
225
- $this->_case = $this->initCase($this->_request['orderId']);
226
- $this->_previousGuarantee = $this->_case->getGuarantee();
227
- $this->_previousScore = $this->_case->getScore();
228
-
229
- $this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_request['orderId']);
230
-
231
- if ($this->_order && $this->_order->getId()) {
232
- $this->_store_id = $this->_order->getStoreId();
233
- }
234
-
235
- if (!$this->_case && $this->logRequest()) {
236
- Mage::log('No matching case was found for this request. order_increment: ' . $this->_request['orderId'], null, 'signifyd_connect.log');
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
- }
388
-
389
- public function processCreation()
390
- {
391
- $case = $this->_case;
392
-
393
- if (!$case) {
394
- return;
395
- }
396
-
397
- $this->updateScore($case);
398
- $this->updateStatus($case);
399
- $this->updateGuarantee($case);
400
-
401
- $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
402
- $case->save();
403
-
404
- if ($this->logRequest()) {
405
- Mage::log('Case ' . $case->getId() . ' created with status ' . $case->getSignifydStatus() . ' and score ' . $case->getScore(), null, 'signifyd_connect.log');
406
- }
407
-
408
- $this->processAdditional($case);
409
- }
410
-
411
- public function processReview()
412
- {
413
- $case = $this->_case;
414
-
415
- if (!$case) {
416
- return;
417
- }
418
-
419
- $original_status = $case->getSignifydStatus();
420
-
421
- $this->updateScore($case);
422
- $this->updateStatus($case);
423
- $this->updateGuarantee($case);
424
-
425
- $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
426
- $case->save();
427
-
428
- $this->processAdditional($case, $original_status);
429
- }
430
-
431
- public function processGuarantee()
432
- {
433
- $case = $this->_case;
434
-
435
- if (!$case) {
436
- return;
437
- }
438
-
439
- $original_status = $case->getSignifydStatus();
440
-
441
- $this->updateScore($case);
442
- $this->updateStatus($case);
443
- $this->updateGuarantee($case);
444
-
445
- $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
446
- $case->save();
447
-
448
- $this->processAdditional($case, $original_status);
449
- }
450
-
451
- public function caseLookup()
452
- {
453
- $result = false;
454
- $case = $this->_case;
455
-
456
- try {
457
- $url = $this->getUrl($case->getCode());
458
-
459
- $response = Mage::helper('signifyd_connect')->request($url, null, $this->getApiKey(), null, 'application/json');
460
-
461
- $response_code = $response->getHttpCode();
462
-
463
- if (substr($response_code, 0, 1) == '2') {
464
- $result = json_decode($response->getRawResponse(), true);
465
- } else {
466
- if ($this->logRequest()) {
467
- Mage::log('Fallback request received a ' . $response_code . ' response from Signifyd', null, 'signifyd_connect.log');
468
- }
469
- }
470
- } catch (Exception $e) {
471
- if ($this->logErrors()) {
472
- Mage::log('Fallback issue: ' . $e->__toString(), null, 'signifyd_connect.log');
473
- }
474
- }
475
-
476
- return $result;
477
- }
478
-
479
- public function processFallback($request)
480
- {
481
- if ($this->logRequest()) {
482
- Mage::log('Attempting auth via fallback request', null, 'signifyd_connect.log');
483
- }
484
-
485
- $request = json_decode($request, true);
486
-
487
- $this->_topic = "cases/review"; // Topic header is most likely not available
488
-
489
- if (is_array($request) && isset($request['orderId']))
490
- {
491
- $this->_case = Mage::getModel('signifyd_connect/case')->load($request['orderId']);
492
- }
493
-
494
- $this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_request['orderId']);
495
-
496
- if ($this->_order && $this->_order->getId()) {
497
- $this->_store_id = $this->_order->getStoreId();
498
- }
499
-
500
- if ($this->_case) {
501
- $lookup = $this->caseLookup();
502
-
503
- if ($lookup && is_array($lookup)) {
504
- $this->_request = $lookup;
505
-
506
- $this->processReview();
507
- } else {
508
- if ($this->logRequest()) {
509
- Mage::log('Fallback failed with an invalid response from Signifyd', null, 'signifyd_connect.log');
510
- }
511
- }
512
- } else {
513
- if ($this->logRequest()) {
514
- Mage::log('Fallback failed with no matching case found', null, 'signifyd_connect.log');
515
- }
516
- }
517
- }
518
-
519
- public function getHeader($header)
520
- {
521
- // T379: Some frameworks add an extra HTTP_ before the header, so check for both names
522
- // Header values stored in the $_SERVER variable have dashes converted to underscores, hence str_replace
523
- $direct = strtoupper(str_replace('-', '_', $header));
524
- $extraHttp = 'HTTP_' . $direct;
525
-
526
- // Check the $_SERVER global
527
- if (isset($_SERVER[$direct])) {
528
- return $_SERVER[$direct];
529
- } else if (isset($_SERVER[$extraHttp])) {
530
- return $_SERVER[$extraHttp];
531
- }
532
-
533
- Mage::log('Valid Header Not Found: ' . $header, null, 'signifyd_connect.log');
534
- return '';
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
-
574
- $hash = $this->getHeader('X-SIGNIFYD-SEC-HMAC-SHA256');
575
-
576
- if ($this->logRequest()) {
577
- Mage::log('API request: ' . $request, null, 'signifyd_connect.log');
578
- Mage::log('API request hash: ' . $hash, null, 'signifyd_connect.log');
579
- }
580
-
581
- if ($request) {
582
- if ($this->validRequest($request, $hash)) {
583
- $this->initRequest($request);
584
-
585
- $topic = $this->_topic;
586
-
587
- if ($this->logRequest()) {
588
- Mage::log('API request topic: ' . $topic, null, 'signifyd_connect.log');
589
- }
590
-
591
- switch ($topic) {
592
- case "cases/creation":
593
- try {
594
- $this->processCreation($request);
595
- } catch (Exception $e) {
596
- if ($this->logErrors()) {
597
- Mage::log('Case scoring issue: ' . $e->__toString(), null, 'signifyd_connect.log');
598
- }
599
- }
600
- break;
601
- case "cases/rescore":
602
- case "cases/review":
603
- try {
604
- $this->processReview($request);
605
- } catch (Exception $e) {
606
- if ($this->logErrors()) {
607
- Mage::log('Case review issue: ' . $e->__toString(), null, 'signifyd_connect.log');
608
- }
609
- }
610
- break;
611
- case "guarantees/completion":
612
- try {
613
- $this->processGuarantee($request);
614
- } catch (Exception $ex) {
615
- if ($this->logErrors()) {
616
- Mage::log('Case guarantee issue: ' . $ex->__toString(), null, 'signifyd_connect.log');
617
- }
618
- }
619
- break;
620
- case "cases/test":
621
- // Test is only verifying that the endpoint is reachable. So we just complete here
622
- break;
623
-
624
- default:
625
- $this->unsupported();
626
- }
627
- } else {
628
- if ($this->logRequest()) {
629
- Mage::log('API request failed auth', null, 'signifyd_connect.log');
630
- }
631
-
632
- $this->processFallback($request);
633
- }
634
- } else {
635
- echo $this->getDefaultMessage();
636
- }
637
-
638
- $this->complete();
639
- }
640
-
641
- }
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();
12
+ public $_topic = false;
13
+ public $_order = false;
14
+ public $_store_id = null;
15
+ public $_case = false;
16
+ public $_previousGuarantee = false;
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()
50
+ {
51
+ return Mage::getStoreConfig('signifyd_connect/log/all');
52
+ }
53
+
54
+ public function logRequest()
55
+ {
56
+ return Mage::getStoreConfig('signifyd_connect/log/all');
57
+ }
58
+
59
+ public function getRawPost()
60
+ {
61
+ if (isset($HTTP_RAW_POST_DATA) && $HTTP_RAW_POST_DATA) {
62
+ return $HTTP_RAW_POST_DATA;
63
+ }
64
+
65
+ $post = file_get_contents("php://input");
66
+
67
+ if ($post) {
68
+ return $post;
69
+ }
70
+
71
+ return '';
72
+ }
73
+
74
+ public function getDefaultMessage()
75
+ {
76
+ 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';
77
+ }
78
+
79
+ public function getDisabledMessage()
80
+ {
81
+ 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.';
82
+ }
83
+
84
+ public function unsupported()
85
+ {
86
+ Mage::app()->getResponse()
87
+ ->setHeader('HTTP/1.1', '403 Forbidden')
88
+ ->sendResponse();
89
+ echo 'This request type is currently unsupported';
90
+ exit;
91
+ }
92
+
93
+ public function complete()
94
+ {
95
+ Mage::app()->getResponse()
96
+ ->setHeader('HTTP/1.1', '200 Ok')
97
+ ->sendResponse();
98
+
99
+ exit;
100
+ }
101
+
102
+ public function conflict()
103
+ {
104
+ Mage::app()->getResponse()
105
+ ->setHeader('HTTP/1.1', '409 Conflict')
106
+ ->sendResponse();
107
+ exit;
108
+ }
109
+
110
+ private function updateScore($case)
111
+ {
112
+ if (isset($this->_request['score'])) {
113
+ $case->setScore($this->_request['score']);
114
+
115
+ if ($this->logRequest()) {
116
+ Mage::log('Set score to ' . $this->_request['score'], null, 'signifyd_connect.log');
117
+ }
118
+ } else {
119
+ if ($this->logRequest()) {
120
+ Mage::log('No score value available', null, 'signifyd_connect.log');
121
+ }
122
+ }
123
+ }
124
+
125
+ private function updateStatus($case)
126
+ {
127
+ if (isset($this->_request['status'])) {
128
+ $case->setSignifydStatus($this->_request['status']);
129
+
130
+ if ($this->logRequest()) {
131
+ Mage::log('Set status to ' . $this->_request['status'], null, 'signifyd_connect.log');
132
+ }
133
+ } else {
134
+ if ($this->logRequest()) {
135
+ Mage::log('No status value available', null, 'signifyd_connect.log');
136
+ }
137
+ }
138
+ }
139
+
140
+ private function updateGuarantee($case)
141
+ {
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,
149
+ 'signifyd_connect.log');
150
+ }
151
+ }
152
+ } catch(Exception $e) {
153
+ if ($this->logErrors()) {
154
+ Mage::log('ERROR ON WEBHOOK: ' . $e->__toString(), null, 'signifyd_connect.log');
155
+ }
156
+ }
157
+ }
158
+
159
+ public function validRequest($request, $hash)
160
+ {
161
+ $check = base64_encode(hash_hmac('sha256', $request, $this->getApiKey(), true));
162
+
163
+ if ($this->logRequest()) {
164
+ Mage::log('API request hash check: ' . $check, null, 'signifyd_connect.log');
165
+ }
166
+
167
+ if ($check == $hash) {
168
+ return true;
169
+ }
170
+ else if ($this->getHeader('X-SIGNIFYD-TOPIC') == "cases/test"){
171
+ // In the case that this is a webhook test, the encoding ABCDE is allowed
172
+ $check = base64_encode(hash_hmac('sha256', $request, 'ABCDE', true));
173
+ if ($check == $hash) {
174
+ return true;
175
+ }
176
+ }
177
+
178
+ return false;
179
+ }
180
+
181
+ public function initCase($order_increment)
182
+ {
183
+ $case = false;
184
+
185
+ if (isset($this->_request['orderId']))
186
+ {
187
+ $case = Mage::getModel('signifyd_connect/case')->load($this->_request['orderId']);
188
+ if($case->isObjectNew()) {
189
+ if ($this->logErrors()) {
190
+ Mage::log('Case not yet in DB. Likely timing issue. order_increment: ' . $this->_request['orderId'], null, 'signifyd_connect.log');
191
+ }
192
+ $this->conflict();
193
+ }
194
+ }
195
+
196
+ return $case;
197
+ }
198
+
199
+ public function initRequest($request)
200
+ {
201
+ $this->_request = json_decode($request, true);
202
+
203
+ $topic = $this->getHeader('X-SIGNIFYD-TOPIC');
204
+
205
+ $this->_topic = $topic;
206
+
207
+ // For the webhook test, all of the request data will be invalid
208
+ if ($topic == "cases/test") return;
209
+
210
+ $this->_case = $this->initCase($this->_request['orderId']);
211
+ $this->_previousGuarantee = $this->_case->getGuarantee();
212
+ $this->_previousScore = $this->_case->getScore();
213
+
214
+ $this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_request['orderId']);
215
+
216
+ if ($this->_order && $this->_order->getId()) {
217
+ $this->_store_id = $this->_order->getStoreId();
218
+ }
219
+
220
+ if (!$this->_case && $this->logRequest()) {
221
+ Mage::log('No matching case was found for this request. order_increment: ' . $this->_request['orderId'], null, 'signifyd_connect.log');
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
+ }
281
+
282
+ public function processCreation()
283
+ {
284
+ $case = $this->_case;
285
+
286
+ if (!$case) {
287
+ return;
288
+ }
289
+
290
+ $this->updateScore($case);
291
+ $this->updateStatus($case);
292
+ $this->updateGuarantee($case);
293
+
294
+ $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
295
+ $case->save();
296
+
297
+ if ($this->logRequest()) {
298
+ Mage::log('Case ' . $case->getId() . ' created with status ' . $case->getSignifydStatus() . ' and score ' . $case->getScore(), null, 'signifyd_connect.log');
299
+ }
300
+
301
+ $this->processAdditional($case);
302
+ }
303
+
304
+ public function processReview()
305
+ {
306
+ $case = $this->_case;
307
+
308
+ if (!$case) {
309
+ return;
310
+ }
311
+
312
+ $original_status = $case->getSignifydStatus();
313
+
314
+ $this->updateScore($case);
315
+ $this->updateStatus($case);
316
+ $this->updateGuarantee($case);
317
+
318
+ $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
319
+ $case->save();
320
+
321
+ $this->processAdditional($case, $original_status);
322
+ }
323
+
324
+ public function processGuarantee()
325
+ {
326
+ $case = $this->_case;
327
+
328
+ if (!$case) {
329
+ return;
330
+ }
331
+
332
+ $original_status = $case->getSignifydStatus();
333
+
334
+ $this->updateScore($case);
335
+ $this->updateStatus($case);
336
+ $this->updateGuarantee($case);
337
+
338
+ $case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
339
+ $case->save();
340
+
341
+ $this->processAdditional($case, $original_status);
342
+ }
343
+
344
+ public function caseLookup()
345
+ {
346
+ $result = false;
347
+ $case = $this->_case;
348
+
349
+ try {
350
+ $url = $this->getUrl($case->getCode());
351
+
352
+ $response = Mage::helper('signifyd_connect')->request($url, null, $this->getApiKey(), null, 'application/json');
353
+
354
+ $response_code = $response->getHttpCode();
355
+
356
+ if (substr($response_code, 0, 1) == '2') {
357
+ $result = json_decode($response->getRawResponse(), true);
358
+ } else {
359
+ if ($this->logRequest()) {
360
+ Mage::log('Fallback request received a ' . $response_code . ' response from Signifyd', null, 'signifyd_connect.log');
361
+ }
362
+ }
363
+ } catch (Exception $e) {
364
+ if ($this->logErrors()) {
365
+ Mage::log('Fallback issue: ' . $e->__toString(), null, 'signifyd_connect.log');
366
+ }
367
+ }
368
+
369
+ return $result;
370
+ }
371
+
372
+ public function processFallback($request)
373
+ {
374
+ if ($this->logRequest()) {
375
+ Mage::log('Attempting auth via fallback request', null, 'signifyd_connect.log');
376
+ }
377
+
378
+ $request = json_decode($request, true);
379
+
380
+ $this->_topic = "cases/review"; // Topic header is most likely not available
381
+
382
+ if (is_array($request) && isset($request['orderId']))
383
+ {
384
+ $this->_case = Mage::getModel('signifyd_connect/case')->load($request['orderId']);
385
+ }
386
+
387
+ $this->_order = Mage::getModel('sales/order')->loadByIncrementId($this->_request['orderId']);
388
+
389
+ if ($this->_order && $this->_order->getId()) {
390
+ $this->_store_id = $this->_order->getStoreId();
391
+ }
392
+
393
+ if ($this->_case) {
394
+ $lookup = $this->caseLookup();
395
+
396
+ if ($lookup && is_array($lookup)) {
397
+ $this->_request = $lookup;
398
+
399
+ $this->processReview();
400
+ } else {
401
+ if ($this->logRequest()) {
402
+ Mage::log('Fallback failed with an invalid response from Signifyd', null, 'signifyd_connect.log');
403
+ }
404
+ }
405
+ } else {
406
+ if ($this->logRequest()) {
407
+ Mage::log('Fallback failed with no matching case found', null, 'signifyd_connect.log');
408
+ }
409
+ }
410
+ }
411
+
412
+ public function getHeader($header)
413
+ {
414
+ // T379: Some frameworks add an extra HTTP_ before the header, so check for both names
415
+ // Header values stored in the $_SERVER variable have dashes converted to underscores, hence str_replace
416
+ $direct = strtoupper(str_replace('-', '_', $header));
417
+ $extraHttp = 'HTTP_' . $direct;
418
+
419
+ // Check the $_SERVER global
420
+ if (isset($_SERVER[$direct])) {
421
+ return $_SERVER[$direct];
422
+ } else if (isset($_SERVER[$extraHttp])) {
423
+ return $_SERVER[$extraHttp];
424
+ }
425
+
426
+ Mage::log('Valid Header Not Found: ' . $header, null, 'signifyd_connect.log');
427
+ return '';
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
+
448
+ $hash = $this->getHeader('X-SIGNIFYD-SEC-HMAC-SHA256');
449
+
450
+ if ($this->logRequest()) {
451
+ Mage::log('API request: ' . $request, null, 'signifyd_connect.log');
452
+ Mage::log('API request hash: ' . $hash, null, 'signifyd_connect.log');
453
+ }
454
+
455
+ if ($request) {
456
+ if ($this->validRequest($request, $hash)) {
457
+ $this->initRequest($request);
458
+
459
+ $topic = $this->_topic;
460
+
461
+ if ($this->logRequest()) {
462
+ Mage::log('API request topic: ' . $topic, null, 'signifyd_connect.log');
463
+ }
464
+
465
+ switch ($topic) {
466
+ case "cases/creation":
467
+ try {
468
+ $this->processCreation($request);
469
+ } catch (Exception $e) {
470
+ if ($this->logErrors()) {
471
+ Mage::log('Case scoring issue: ' . $e->__toString(), null, 'signifyd_connect.log');
472
+ }
473
+ }
474
+ break;
475
+ case "cases/rescore":
476
+ case "cases/review":
477
+ try {
478
+ $this->processReview($request);
479
+ } catch (Exception $e) {
480
+ if ($this->logErrors()) {
481
+ Mage::log('Case review issue: ' . $e->__toString(), null, 'signifyd_connect.log');
482
+ }
483
+ }
484
+ break;
485
+ case "guarantees/completion":
486
+ try {
487
+ $this->processGuarantee($request);
488
+ } catch (Exception $ex) {
489
+ if ($this->logErrors()) {
490
+ Mage::log('Case guarantee issue: ' . $ex->__toString(), null, 'signifyd_connect.log');
491
+ }
492
+ }
493
+ break;
494
+ case "cases/test":
495
+ // Test is only verifying that the endpoint is reachable. So we just complete here
496
+ break;
497
+
498
+ default:
499
+ $this->unsupported();
500
+ }
501
+ } else {
502
+ if ($this->logRequest()) {
503
+ Mage::log('API request failed auth', null, 'signifyd_connect.log');
504
+ }
505
+
506
+ $this->processFallback($request);
507
+ }
508
+ } else {
509
+ echo $this->getDefaultMessage();
510
+ }
511
+
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 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Signifyd/Connect/etc/adminhtml.xml CHANGED
@@ -1,16 +1,16 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <!--
4
- <menu>
5
- <sales>
6
- <children>
7
- <signifyd_connect translate="title" module="signifyd_connect">
8
- <sort_order>50</sort_order>
9
- <title>Signifyd Scores</title>
10
- <action>adminhtml/signifyd/</action>
11
- </signifyd_connect>
12
- </children>
13
- </sales>
14
- </menu>
15
- -->
16
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <!--
4
+ <menu>
5
+ <sales>
6
+ <children>
7
+ <signifyd_connect translate="title" module="signifyd_connect">
8
+ <sort_order>50</sort_order>
9
+ <title>Signifyd Scores</title>
10
+ <action>adminhtml/signifyd/</action>
11
+ </signifyd_connect>
12
+ </children>
13
+ </sales>
14
+ </menu>
15
+ -->
16
+ </config>
app/code/community/Signifyd/Connect/etc/config.xml CHANGED
@@ -1,199 +1,224 @@
1
- <?xml version="1.0"?>
2
-
3
- <config>
4
- <modules>
5
- <Signifyd_Connect>
6
- <version>3.15.1</version>
7
- </Signifyd_Connect>
8
- </modules>
9
- <global>
10
- <models>
11
- <paygate>
12
- <rewrite>
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>
19
- </signifyd_connect>
20
- <signifyd_connect_resource>
21
- <class>Signifyd_Connect_Model_Resource</class>
22
- <entities>
23
- <case>
24
- <table>signifyd_connect_case</table>
25
- </case>
26
- <retries>
27
- <table>signifyd_connect_retries</table>
28
- </retries>
29
- </entities>
30
- </signifyd_connect_resource>
31
- </models>
32
- <resources>
33
- <signifyd_connect_setup>
34
- <setup>
35
- <module>Signifyd_Connect</module>
36
- <class>Signifyd_Connect_Model_Setup</class>
37
- </setup>
38
- <connection>
39
- <use>core_setup</use>
40
- </connection>
41
- </signifyd_connect_setup>
42
- <signifyd_connect_write>
43
- <connection>
44
- <use>core_write</use>
45
- </connection>
46
- </signifyd_connect_write>
47
- <signifyd_connect_read>
48
- <connection>
49
- <use>core_read</use>
50
- </connection>
51
- </signifyd_connect_read>
52
- </resources>
53
- <helpers>
54
- <signifyd_connect>
55
- <class>Signifyd_Connect_Helper</class>
56
- </signifyd_connect>
57
- </helpers>
58
- <blocks>
59
- <signifyd_connect>
60
- <class>Signifyd_Connect_Block</class>
61
- </signifyd_connect>
62
- </blocks>
63
- <events>
64
- <model_save_after>
65
- <observers>
66
- <signifyd_connect>
67
- <class>signifyd_connect/observer</class>
68
- <method>openCase</method>
69
- </signifyd_connect>
70
- </observers>
71
- </model_save_after>
72
- </events>
73
- </global>
74
- <frontend>
75
- <routers>
76
- <signifyd_connect>
77
- <use>standard</use>
78
- <args>
79
- <module>Signifyd_Connect</module>
80
- <frontName>signifyd</frontName>
81
- </args>
82
- </signifyd_connect>
83
- </routers>
84
- </frontend>
85
- <default>
86
- <signifyd_connect>
87
- <settings>
88
- <enabled>0</enabled>
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>
97
- </advanced>
98
- <log>
99
- <request>1</request>
100
- <response>1</response>
101
- <error>1</error>
102
- </log>
103
- </signifyd_connect>
104
- </default>
105
- <admin>
106
- <routers>
107
- <adminhtml>
108
- <args>
109
- <modules>
110
- <signifyd_connect before="Mage_Adminhtml">Signifyd_Connect_Adminhtml</signifyd_connect>
111
- </modules>
112
- </args>
113
- </adminhtml>
114
- </routers>
115
- </admin>
116
- <adminhtml>
117
- <acl>
118
- <resources>
119
- <all>
120
- <title>Allow Everything</title>
121
- </all>
122
- <admin>
123
- <children>
124
- <system>
125
- <children>
126
- <config>
127
- <children>
128
- <signifyd_connect>
129
- <title>Signifyd</title>
130
- <sort_order>9999</sort_order>
131
- </signifyd_connect>
132
- </children>
133
- </config>
134
- </children>
135
- </system>
136
- <sales>
137
- <children>
138
- <signifyd_connect>
139
- <sort_order>50</sort_order>
140
- <title>Signifyd Scores</title>
141
- </signifyd_connect>
142
- </children>
143
- </sales>
144
- </children>
145
- </admin>
146
- </resources>
147
- </acl>
148
- <events>
149
- <eav_collection_abstract_load_before>
150
- <observers>
151
- <signifyd_connect>
152
- <model>signifyd_connect/observer</model>
153
- <method>coreCollectionAbstractLoadBefore</method>
154
- </signifyd_connect>
155
- </observers>
156
- </eav_collection_abstract_load_before>
157
- <core_collection_abstract_load_before>
158
- <observers>
159
- <signifyd_connect>
160
- <model>signifyd_connect/observer</model>
161
- <method>coreCollectionAbstractLoadBefore</method>
162
- </signifyd_connect>
163
- </observers>
164
- </core_collection_abstract_load_before>
165
- <sales_order_grid_collection_load_before>
166
- <observers>
167
- <signifyd_connect>
168
- <model>signifyd_connect/observer</model>
169
- <method>salesOrderGridCollectionLoadBefore</method>
170
- </signifyd_connect>
171
- </observers>
172
- </sales_order_grid_collection_load_before>
173
- <sales_order_payment_cancel>
174
- <observers>
175
- <signifyd_connect>
176
- <model>signifyd_connect/observer</model>
177
- <method>salesOrderPaymentCancel</method>
178
- </signifyd_connect>
179
- </observers>
180
- </sales_order_payment_cancel>
181
- <core_block_abstract_to_html_before>
182
- <observers>
183
- <signifyd_connect>
184
- <model>signifyd_connect/observer</model>
185
- <method>coreBlockAbstractToHtmlBefore</method>
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Signifyd_Connect>
6
+ <version>3.16.1</version>
7
+ </Signifyd_Connect>
8
+ </modules>
9
+ <global>
10
+ <models>
11
+ <paygate>
12
+ <rewrite>
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>
24
+ </signifyd_connect>
25
+ <signifyd_connect_resource>
26
+ <class>Signifyd_Connect_Model_Resource</class>
27
+ <entities>
28
+ <case>
29
+ <table>signifyd_connect_case</table>
30
+ </case>
31
+ <retries>
32
+ <table>signifyd_connect_retries</table>
33
+ </retries>
34
+ </entities>
35
+ </signifyd_connect_resource>
36
+ </models>
37
+ <resources>
38
+ <signifyd_connect_setup>
39
+ <setup>
40
+ <module>Signifyd_Connect</module>
41
+ <class>Signifyd_Connect_Model_Setup</class>
42
+ </setup>
43
+ <connection>
44
+ <use>core_setup</use>
45
+ </connection>
46
+ </signifyd_connect_setup>
47
+ <signifyd_connect_write>
48
+ <connection>
49
+ <use>core_write</use>
50
+ </connection>
51
+ </signifyd_connect_write>
52
+ <signifyd_connect_read>
53
+ <connection>
54
+ <use>core_read</use>
55
+ </connection>
56
+ </signifyd_connect_read>
57
+ </resources>
58
+ <helpers>
59
+ <signifyd_connect>
60
+ <class>Signifyd_Connect_Helper</class>
61
+ </signifyd_connect>
62
+ </helpers>
63
+ <blocks>
64
+ <signifyd_connect>
65
+ <class>Signifyd_Connect_Block</class>
66
+ </signifyd_connect>
67
+ </blocks>
68
+ <events>
69
+ <model_save_after>
70
+ <observers>
71
+ <signifyd_connect>
72
+ <class>signifyd_connect/observer</class>
73
+ <method>openCase</method>
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>
102
+ <use>standard</use>
103
+ <args>
104
+ <module>Signifyd_Connect</module>
105
+ <frontName>signifyd</frontName>
106
+ </args>
107
+ </signifyd_connect>
108
+ </routers>
109
+ </frontend>
110
+ <default>
111
+ <signifyd_connect>
112
+ <settings>
113
+ <enabled>0</enabled>
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>
120
+ </advanced>
121
+ <log>
122
+ <request>1</request>
123
+ <response>1</response>
124
+ <error>1</error>
125
+ </log>
126
+ </signifyd_connect>
127
+ </default>
128
+ <admin>
129
+ <routers>
130
+ <adminhtml>
131
+ <args>
132
+ <modules>
133
+ <signifyd_connect before="Mage_Adminhtml">Signifyd_Connect_Adminhtml</signifyd_connect>
134
+ </modules>
135
+ </args>
136
+ </adminhtml>
137
+ </routers>
138
+ </admin>
139
+ <adminhtml>
140
+ <acl>
141
+ <resources>
142
+ <all>
143
+ <title>Allow Everything</title>
144
+ </all>
145
+ <admin>
146
+ <children>
147
+ <system>
148
+ <children>
149
+ <config>
150
+ <children>
151
+ <signifyd_connect>
152
+ <title>Signifyd</title>
153
+ <sort_order>9999</sort_order>
154
+ </signifyd_connect>
155
+ </children>
156
+ </config>
157
+ </children>
158
+ </system>
159
+ <sales>
160
+ <children>
161
+ <signifyd_connect>
162
+ <sort_order>50</sort_order>
163
+ <title>Signifyd Scores</title>
164
+ </signifyd_connect>
165
+ </children>
166
+ </sales>
167
+ </children>
168
+ </admin>
169
+ </resources>
170
+ </acl>
171
+ <events>
172
+ <eav_collection_abstract_load_before>
173
+ <observers>
174
+ <signifyd_connect>
175
+ <model>signifyd_connect/observer</model>
176
+ <method>coreCollectionAbstractLoadBefore</method>
177
+ </signifyd_connect>
178
+ </observers>
179
+ </eav_collection_abstract_load_before>
180
+ <core_collection_abstract_load_before>
181
+ <observers>
182
+ <signifyd_connect>
183
+ <model>signifyd_connect/observer</model>
184
+ <method>coreCollectionAbstractLoadBefore</method>
185
+ </signifyd_connect>
186
+ </observers>
187
+ </core_collection_abstract_load_before>
188
+ <sales_order_grid_collection_load_before>
189
+ <observers>
190
+ <signifyd_connect>
191
+ <model>signifyd_connect/observer</model>
192
+ <method>salesOrderGridCollectionLoadBefore</method>
193
+ </signifyd_connect>
194
+ </observers>
195
+ </sales_order_grid_collection_load_before>
196
+ <sales_order_payment_cancel>
197
+ <observers>
198
+ <signifyd_connect>
199
+ <model>signifyd_connect/observer</model>
200
+ <method>salesOrderPaymentCancel</method>
201
+ </signifyd_connect>
202
+ </observers>
203
+ </sales_order_payment_cancel>
204
+ <core_block_abstract_to_html_before>
205
+ <observers>
206
+ <signifyd_connect>
207
+ <model>signifyd_connect/observer</model>
208
+ <method>coreBlockAbstractToHtmlBefore</method>
209
+ </signifyd_connect>
210
+ </observers>
211
+ </core_block_abstract_to_html_before>
212
+ </events>
213
+ </adminhtml>
214
+ <default>
215
+ <signifyd_connect>
216
+ <settings>
217
+ <enabled>0</enabled>
218
+ </settings>
219
+ <log>
220
+ <all>1</all>
221
+ </log>
222
+ </signifyd_connect>
223
+ </default>
224
+ </config>
app/code/community/Signifyd/Connect/etc/system.xml CHANGED
@@ -1,222 +1,127 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <tabs>
4
- <signifyd translate="label" module="signifyd_connect">
5
- <label>Signifyd</label>
6
- <sort_order>999999</sort_order>
7
- </signifyd>
8
- </tabs>
9
- <sections>
10
- <signifyd_connect translate="label" module="signifyd_connect">
11
- <label>Signifyd</label>
12
- <tab>signifyd</tab>
13
- <frontend_type>text</frontend_type>
14
- <sort_order>99999</sort_order>
15
- <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
- <show_in_store>1</show_in_store>
18
- <groups>
19
- <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>
24
- <show_in_website>1</show_in_website>
25
- <show_in_store>1</show_in_store>
26
- <fields>
27
- <enabled translate="label">
28
- <label>Enable extension</label>
29
- <frontend_type>select</frontend_type>
30
- <source_model>adminhtml/system_config_source_yesno</source_model>
31
- <sort_order>10</sort_order>
32
- <show_in_default>1</show_in_default>
33
- <show_in_website>1</show_in_website>
34
- <show_in_store>1</show_in_store>
35
- <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>
192
- <frontend_type>select</frontend_type>
193
- <source_model>adminhtml/system_config_source_yesno</source_model>
194
- <sort_order>1</sort_order>
195
- <show_in_default>1</show_in_default>
196
- <show_in_website>1</show_in_website>
197
- <show_in_store>1</show_in_store>
198
- </request>
199
- <response>
200
- <label>Log responses</label>
201
- <frontend_type>select</frontend_type>
202
- <source_model>adminhtml/system_config_source_yesno</source_model>
203
- <sort_order>2</sort_order>
204
- <show_in_default>1</show_in_default>
205
- <show_in_website>1</show_in_website>
206
- <show_in_store>1</show_in_store>
207
- </response>
208
- <error>
209
- <label>Log errors</label>
210
- <frontend_type>select</frontend_type>
211
- <source_model>adminhtml/system_config_source_yesno</source_model>
212
- <sort_order>3</sort_order>
213
- <show_in_default>1</show_in_default>
214
- <show_in_website>1</show_in_website>
215
- <show_in_store>1</show_in_store>
216
- </error>
217
- </fields>
218
- </log>
219
- </groups>
220
- </signifyd_connect>
221
- </sections>
222
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <signifyd translate="label" module="signifyd_connect">
5
+ <label>Signifyd</label>
6
+ <sort_order>999999</sort_order>
7
+ </signifyd>
8
+ </tabs>
9
+ <sections>
10
+ <signifyd_connect translate="label" module="signifyd_connect">
11
+ <label>Signifyd</label>
12
+ <tab>signifyd</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>99999</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <hint>
20
+ <frontend_model>signifyd_connect/adminhtml_system_config_fieldset_hint</frontend_model>
21
+ <sort_order>0</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ </hint>
26
+ <settings translate="label">
27
+ <label>General</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>1</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <fields>
34
+ <enabled translate="label">
35
+ <label>Enable extension</label>
36
+ <frontend_type>select</frontend_type>
37
+ <source_model>adminhtml/system_config_source_yesno</source_model>
38
+ <sort_order>10</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ <comment><![CDATA[Enables the syncing of Magento orders to Signifyd. Enable this setting ONLY AFTER you've completed the configuration of the plugin.]]></comment>
43
+ </enabled>
44
+ <key translate="label">
45
+ <label>API Key</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>20</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ <comment><![CDATA[Your API key can be found on the <a href="https://app.signifyd.com/settings" target="_blank" title="This external link will open in a new window">settings</a> page in the Signifyd console. Don't have an account? Contact us to <a href="https://www.signifyd.com?trialRequest=true" target="_blank" title="This external link will open in a new window">request a free a trial account</a>.]]></comment>
52
+ </key>
53
+ </fields>
54
+ </settings>
55
+ <advanced>
56
+ <label>Order Workflow</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>2</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
+ <fields>
63
+ <accepted_from_guaranty translate="label">
64
+ <label>When an order is approved for Guarantee:</label>
65
+ <frontend_type>select</frontend_type>
66
+ <source_model>signifyd_connect/system_config_source_options_accepted</source_model>
67
+ <sort_order>20</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
+ <comment><![CDATA[Select what status the Magento order should be updated to when approved for guarantee.]]></comment>
72
+ </accepted_from_guaranty>
73
+ <declined_from_guaranty translate="label">
74
+ <label>When an order is declined for Guarantee:</label>
75
+ <frontend_type>select</frontend_type>
76
+ <source_model>signifyd_connect/system_config_source_options_declined</source_model>
77
+ <sort_order>30</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
+ <comment><![CDATA[Select what status the Magento order should be updated to when declined for guarantee.]]></comment>
82
+ </declined_from_guaranty>
83
+ </fields>
84
+ </advanced>
85
+ <webhook>
86
+ <label>Webhook URL</label>
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>3</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ <fields>
93
+ <url translate="label">
94
+ <label>Webhook URL</label>
95
+ <frontend_type>label</frontend_type>
96
+ <sort_order>30</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
+ <comment><model>signifyd_connect/link</model></comment>
101
+ </url>
102
+ </fields>
103
+ </webhook>
104
+ <log translate="label">
105
+ <label>Logging</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>4</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ <fields>
112
+ <all>
113
+ <label>Enable Logging</label>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>adminhtml/system_config_source_yesno</source_model>
116
+ <sort_order>1</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ <comment><![CDATA[Enables logging of errors related to the plugin for debugging and troubleshooting issues.]]></comment>
121
+ </all>
122
+ </fields>
123
+ </log>
124
+ </groups>
125
+ </signifyd_connect>
126
+ </sections>
127
+ </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.1.1.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
-
3
- $this->startSetup();
4
- $this->register();
5
- $this->run("
6
- DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
- CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
- `case_id` int(10) unsigned NOT NULL auto_increment,
9
- `order_increment` varchar(255) NOT NULL,
10
- PRIMARY KEY (`case_id`)
11
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
12
- ");
13
- $this->endSetup();
1
+ <?php
2
+
3
+ $this->startSetup();
4
+ $this->register();
5
+ $this->run("
6
+ DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
+ `case_id` int(10) unsigned NOT NULL auto_increment,
9
+ `order_increment` varchar(255) NOT NULL,
10
+ PRIMARY KEY (`case_id`)
11
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
12
+ ");
13
+ $this->endSetup();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.12.0.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
-
3
- $this->startSetup();
4
- $this->register();
5
- $this->run("
6
- DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
- DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_retries')}`;
8
- CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
9
- `order_increment` varchar(255) NOT NULL,
10
- `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
- `code` varchar(255) NOT NULL,
12
- `score` float DEFAULT NULL,
13
- `guarantee` VARCHAR( 64 ) NOT NULL DEFAULT 'N/A',
14
- `entries` text NOT NULL,
15
- `transaction_id` varchar(64) NULL,
16
- `created` timestamp NULL DEFAULT NULL,
17
- `updated` timestamp NULL DEFAULT NULL,
18
- PRIMARY KEY (`order_increment`)
19
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
20
- CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_retries')}` (
21
- `order_increment` varchar(255) NOT NULL,
22
- `created` timestamp NULL DEFAULT NULL,
23
- PRIMARY KEY (`order_increment`)
24
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
25
- ");
26
- $this->endSetup();
1
+ <?php
2
+
3
+ $this->startSetup();
4
+ $this->register();
5
+ $this->run("
6
+ DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
+ DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_retries')}`;
8
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
9
+ `order_increment` varchar(255) NOT NULL,
10
+ `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
+ `code` varchar(255) NOT NULL,
12
+ `score` float DEFAULT NULL,
13
+ `guarantee` VARCHAR( 64 ) NOT NULL DEFAULT 'N/A',
14
+ `entries` text NOT NULL,
15
+ `transaction_id` varchar(64) NULL,
16
+ `created` timestamp NULL DEFAULT NULL,
17
+ `updated` timestamp NULL DEFAULT NULL,
18
+ PRIMARY KEY (`order_increment`)
19
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
20
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_retries')}` (
21
+ `order_increment` varchar(255) NOT NULL,
22
+ `created` timestamp NULL DEFAULT NULL,
23
+ PRIMARY KEY (`order_increment`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
25
+ ");
26
+ $this->endSetup();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.3.0.php CHANGED
@@ -1,19 +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
- `case_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
9
- `order_increment` varchar(255) NOT NULL,
10
- `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
- `code` varchar(255) NOT NULL,
12
- `score` float DEFAULT NULL,
13
- `entries` text NOT NULL,
14
- `created_at` timestamp NULL DEFAULT NULL,
15
- `updated_at` timestamp NULL DEFAULT NULL,
16
- PRIMARY KEY (`case_id`)
17
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
18
- ");
19
- $this->endSetup();
1
+ <?php
2
+
3
+ $this->startSetup();
4
+ $this->register();
5
+ $this->run("
6
+ DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
+ `case_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
9
+ `order_increment` varchar(255) NOT NULL,
10
+ `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
+ `code` varchar(255) NOT NULL,
12
+ `score` float DEFAULT NULL,
13
+ `entries` text NOT NULL,
14
+ `created_at` timestamp NULL DEFAULT NULL,
15
+ `updated_at` timestamp NULL DEFAULT NULL,
16
+ PRIMARY KEY (`case_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
18
+ ");
19
+ $this->endSetup();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.4.0.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
-
3
- $this->startSetup();
4
- $this->register();
5
- $this->run("
6
- DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
- CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
- `case_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
9
- `order_increment` varchar(255) NOT NULL,
10
- `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
- `code` varchar(255) NOT NULL,
12
- `score` float DEFAULT NULL,
13
- `entries` text NOT NULL,
14
- `created_at` timestamp NULL DEFAULT NULL,
15
- `updated_at` timestamp NULL DEFAULT NULL,
16
- PRIMARY KEY (`case_id`)
17
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
18
-
19
- CREATE INDEX signifyd_connect_case_order ON `{$this->getTable('signifyd_connect_case')}` (order_increment);
20
- ");
21
- $this->endSetup();
1
+ <?php
2
+
3
+ $this->startSetup();
4
+ $this->register();
5
+ $this->run("
6
+ DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
+ `case_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
9
+ `order_increment` varchar(255) NOT NULL,
10
+ `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
+ `code` varchar(255) NOT NULL,
12
+ `score` float DEFAULT NULL,
13
+ `entries` text NOT NULL,
14
+ `created_at` timestamp NULL DEFAULT NULL,
15
+ `updated_at` timestamp NULL DEFAULT NULL,
16
+ PRIMARY KEY (`case_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
18
+
19
+ CREATE INDEX signifyd_connect_case_order ON `{$this->getTable('signifyd_connect_case')}` (order_increment);
20
+ ");
21
+ $this->endSetup();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.4.5.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
-
3
- $this->startSetup();
4
- $this->register();
5
- $this->run("
6
- DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
- CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
- `case_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
9
- `order_increment` varchar(255) NOT NULL,
10
- `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
- `code` varchar(255) NOT NULL,
12
- `score` float DEFAULT NULL,
13
- `entries` text NOT NULL,
14
- `created` timestamp NULL DEFAULT NULL,
15
- `updated` timestamp NULL DEFAULT NULL,
16
- PRIMARY KEY (`case_id`)
17
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
18
-
19
- CREATE INDEX signifyd_connect_case_order ON `{$this->getTable('signifyd_connect_case')}` (order_increment);
20
- ");
21
- $this->endSetup();
1
+ <?php
2
+
3
+ $this->startSetup();
4
+ $this->register();
5
+ $this->run("
6
+ DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
+ `case_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
9
+ `order_increment` varchar(255) NOT NULL,
10
+ `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
+ `code` varchar(255) NOT NULL,
12
+ `score` float DEFAULT NULL,
13
+ `entries` text NOT NULL,
14
+ `created` timestamp NULL DEFAULT NULL,
15
+ `updated` timestamp NULL DEFAULT NULL,
16
+ PRIMARY KEY (`case_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
18
+
19
+ CREATE INDEX signifyd_connect_case_order ON `{$this->getTable('signifyd_connect_case')}` (order_increment);
20
+ ");
21
+ $this->endSetup();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.7.0.php CHANGED
@@ -1,18 +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();
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 CHANGED
@@ -1,19 +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();
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.10.0-3.10.1.php CHANGED
@@ -1,8 +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
- }
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.10.1-3.11.0.php CHANGED
@@ -1,8 +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
- }
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.11.0-3.11.1.php CHANGED
@@ -1,8 +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
- }
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.11.1-3.12.0.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
-
3
- try {
4
- $this->startSetup();
5
- $this->run("
6
- ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `transaction_id` VARCHAR(64) NULL;
7
-
8
- CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_retries')}` (
9
- `order_increment` varchar(255) NOT NULL,
10
- `created` timestamp NULL DEFAULT NULL,
11
- PRIMARY KEY (`order_increment`)
12
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
13
- ");
14
- $this->endSetup();
15
- } catch (Exception $e) {
16
- Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
17
- }
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->run("
6
+ ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `transaction_id` VARCHAR(64) NULL;
7
+
8
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_retries')}` (
9
+ `order_increment` varchar(255) NOT NULL,
10
+ `created` timestamp NULL DEFAULT NULL,
11
+ PRIMARY KEY (`order_increment`)
12
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
13
+ ");
14
+ $this->endSetup();
15
+ } catch (Exception $e) {
16
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
17
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.12.0-3.13.0.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
-
3
- try {
4
- $this->startSetup();
5
- $this->run("
6
- CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_retries')}` (
7
- `order_increment` varchar(255) NOT NULL,
8
- `created` timestamp NULL DEFAULT NULL,
9
- PRIMARY KEY (`order_increment`)
10
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
11
- ");
12
- $this->endSetup();
13
- } catch (Exception $e) {
14
- Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
15
- }
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->run("
6
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_retries')}` (
7
+ `order_increment` varchar(255) NOT NULL,
8
+ `created` timestamp NULL DEFAULT NULL,
9
+ PRIMARY KEY (`order_increment`)
10
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
11
+ ");
12
+ $this->endSetup();
13
+ } catch (Exception $e) {
14
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
15
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.15.1-3.16.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 `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
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.0-3.2.1.php CHANGED
@@ -1,5 +1,5 @@
1
- <?php
2
-
3
- $this->startSetup();
4
- Mage::getConfig()->saveConfig('signifyd_connect/settings/url', "https://api.signifyd.com/v2", 'default', 0);
5
- $this->endSetup();
1
+ <?php
2
+
3
+ $this->startSetup();
4
+ Mage::getConfig()->saveConfig('signifyd_connect/settings/url', "https://api.signifyd.com/v2", 'default', 0);
5
+ $this->endSetup();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.1-3.2.2.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
-
3
- try {
4
- $this->startSetup();
5
- $this->register();
6
- $this->run("
7
- ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `status` VARCHAR( 64 ) NOT NULL DEFAULT 'PENDING',
8
- ADD `code` varchar(255) NOT NULL,
9
- ADD `score` FLOAT NULL DEFAULT NULL ,
10
- ADD `entries` TEXT NOT NULL ,
11
- ADD `created_at` TIMESTAMP NULL DEFAULT NULL ,
12
- ADD `updated_at` TIMESTAMP NULL DEFAULT NULL ;
13
- ");
14
- $this->endSetup();
15
- } catch (Exception $e) {
16
- Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
17
- }
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->register();
6
+ $this->run("
7
+ ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD `status` VARCHAR( 64 ) NOT NULL DEFAULT 'PENDING',
8
+ ADD `code` varchar(255) NOT NULL,
9
+ ADD `score` FLOAT NULL DEFAULT NULL ,
10
+ ADD `entries` TEXT NOT NULL ,
11
+ ADD `created_at` TIMESTAMP NULL DEFAULT NULL ,
12
+ ADD `updated_at` TIMESTAMP NULL DEFAULT NULL ;
13
+ ");
14
+ $this->endSetup();
15
+ } catch (Exception $e) {
16
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
17
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.2-3.2.3.php CHANGED
@@ -1,8 +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
- }
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.2.3-3.3.0.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- try {
4
- $this->startSetup();
5
- $this->register();
6
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `status` `signifyd_status` VARCHAR( 64 ) NOT NULL DEFAULT 'PENDING'");
7
- $this->endSetup();
8
- } catch (Exception $e) {
9
- Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
10
- }
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->register();
6
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `status` `signifyd_status` VARCHAR( 64 ) NOT NULL DEFAULT 'PENDING'");
7
+ $this->endSetup();
8
+ } catch (Exception $e) {
9
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
10
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.3.0-3.4.0.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
-
3
- try {
4
- $this->startSetup();
5
- $this->register();
6
- $this->checkColumns();
7
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD INDEX ( `order_increment` );");
8
- $this->endSetup();
9
- } catch (Exception $e) {
10
- Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
11
- }
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->register();
6
+ $this->checkColumns();
7
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` ADD INDEX ( `order_increment` );");
8
+ $this->endSetup();
9
+ } catch (Exception $e) {
10
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
11
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.0-3.4.1.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- try {
4
- $this->startSetup();
5
- $this->register();
6
- $this->checkColumns();
7
- $this->endSetup();
8
- } catch (Exception $e) {
9
- Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
10
- }
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->register();
6
+ $this->checkColumns();
7
+ $this->endSetup();
8
+ } catch (Exception $e) {
9
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
10
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.1-3.4.2.php CHANGED
@@ -1,8 +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
- }
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.4.2-3.4.3.php CHANGED
@@ -1,8 +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
- }
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.4.3-3.4.4.php CHANGED
@@ -1,8 +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
- }
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.4.4-3.4.5.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
-
3
- try {
4
- $this->startSetup();
5
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `created_at` `created` timestamp NULL DEFAULT NULL");
6
- $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `updated_at` `updated` timestamp NULL DEFAULT NULL");
7
- Mage::getConfig()->saveConfig('signifyd_connect/advanced/retrieve_score', 0, 'default', 0);
8
- Mage::getConfig()->saveConfig('signifyd_connect/advanced/show_scores', 0, 'default', 0);
9
- Mage::getConfig()->saveConfig('signifyd_connect/advanced/hold_orders', 0, 'default', 0);
10
- $this->endSetup();
11
- } catch (Exception $e) {
12
- Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
13
- }
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `created_at` `created` timestamp NULL DEFAULT NULL");
6
+ $this->run("ALTER TABLE `{$this->getTable('signifyd_connect_case')}` CHANGE `updated_at` `updated` timestamp NULL DEFAULT NULL");
7
+ Mage::getConfig()->saveConfig('signifyd_connect/advanced/retrieve_score', 0, 'default', 0);
8
+ Mage::getConfig()->saveConfig('signifyd_connect/advanced/show_scores', 0, 'default', 0);
9
+ Mage::getConfig()->saveConfig('signifyd_connect/advanced/hold_orders', 0, 'default', 0);
10
+ $this->endSetup();
11
+ } catch (Exception $e) {
12
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
13
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.5-3.4.6.php CHANGED
@@ -1,8 +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
- }
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.4.6-3.4.7.php CHANGED
@@ -1,8 +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
- }
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.4.7-3.4.8.php CHANGED
@@ -1,8 +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
- }
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.4.8-3.5.0.php CHANGED
@@ -1,8 +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
- }
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 CHANGED
@@ -1,8 +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
- }
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 CHANGED
@@ -1,8 +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
- }
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 CHANGED
@@ -1,8 +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
- }
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 CHANGED
@@ -1,8 +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
- }
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 CHANGED
@@ -1,31 +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
- }
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 CHANGED
@@ -1,10 +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
- }
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
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.8.0-3.9.0.php CHANGED
@@ -1,8 +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
- }
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.9.0-3.10.0.php CHANGED
@@ -1,8 +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
- }
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/design/adminhtml/default/default/template/signifyd/connect/config/hint.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see Signifyd_Connect_Block_Adminhtml_System_Config_Fieldset_Hint
4
+ */
5
+ ?>
6
+ <div class="signifyd-hint">
7
+ <svg width="126px" height="18px" viewBox="0 0 330 47" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
8
+ <defs>
9
+ <path id="path-1" d="M0,0.016 L329.449,0.016 L329.449,47 L0,47"></path>
10
+ <path id="path-3" d="M0,0.016 L329.449,0.016 L329.449,47 L0,47 L0,0.016 Z"></path>
11
+ </defs>
12
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
13
+ <g>
14
+ <path d="M23.6245,46.7956 L43.9335,46.7956 C44.0535,40.7156 44.0535,34.1476 43.9335,28.0686 C37.1655,28.1166 30.2015,27.9776 23.5515,28.1366 C23.6025,34.3356 23.4555,40.7156 23.6245,46.7956" id="Fill-1" fill="#EFA900" sketch:type="MSShapeGroup"></path>
15
+ <path d="M9.3623,39.3621 L20.3843,39.3621 L20.3843,28.4891 C16.6863,28.5371 12.7963,28.3991 9.2153,28.5601 L9.2153,39.1521 C9.2153,39.2731 9.2713,39.3311 9.3623,39.3621" id="Fill-3" fill="#1F3E78" sketch:type="MSShapeGroup"></path>
16
+ <path d="M0,25.8232 C6.772,25.7782 13.732,25.9192 20.383,25.7552 C20.335,19.5622 20.478,13.1752 20.312,7.0992 L0,7.0992 L0,25.8232 Z" id="Fill-5" fill="#EFA900" sketch:type="MSShapeGroup"></path>
17
+ <path d="M52.4332,0.1557 L23.5502,0.1557 C23.6012,8.5707 23.4572,17.1747 23.6232,25.4717 C25.2512,25.5757 26.7372,24.8597 28.3052,24.2817 C28.9862,24.0317 29.7212,23.7107 30.3952,23.4387 C31.1542,23.1327 31.9342,22.9207 32.4112,22.5307 C32.8582,22.1597 33.4232,21.3027 33.4892,20.7777 C33.5672,20.1877 33.3402,19.4837 33.2752,18.8127 C33.2082,18.1607 33.1602,17.4787 33.1332,16.7777 C31.7322,17.0737 31.3822,14.7427 31.4022,13.5527 C31.4092,13.0777 31.6572,12.6447 31.6892,12.2167 C31.7482,11.4797 31.5832,10.7457 31.6162,10.0447 C31.7452,7.5807 32.5552,5.1697 34.1402,3.7317 C34.9582,2.9877 36.2502,2.2607 37.8832,2.2577 C42.1932,2.2507 44.8112,6.4677 43.7922,12.0047 C43.7852,12.2257 44.0212,12.2217 44.1522,12.3587 C44.6572,12.8857 44.3542,13.8447 44.1522,14.8147 C43.9322,15.8497 43.8142,16.6067 43.1422,16.7777 C43.0172,17.0127 42.5882,16.5487 42.5642,16.9197 C42.2442,18.1937 41.7472,19.6697 41.9912,21.1297 C42.1002,21.7827 42.6562,22.7287 43.0702,23.0167 C43.4932,23.3157 44.3222,23.4177 44.8692,23.6507 C46.1212,24.1827 47.1382,24.5467 48.4742,24.9127 C49.1222,25.0887 49.7982,25.3997 50.3462,25.4717 C50.7192,25.5237 52.3012,25.5537 52.4332,25.4017 C52.4982,25.3287 52.4332,24.4147 52.4332,23.8597 L52.4332,0.1557 Z" id="Fill-7" fill="#1F3E78" sketch:type="MSShapeGroup"></path>
18
+ <mask id="mask-2" fill="white">
19
+ <use xlink:href="#path-1"></use>
20
+ </mask>
21
+ <g id="Clip-10"></g>
22
+ <path d="M80.9784,47 C78.1834,47 75.5994,46.716 73.2954,46.155 C71.0094,45.593 68.8054,44.82 66.7424,43.856 L66.0154,43.516 L66.0154,35.283 L68.0754,36.965 C69.9874,38.526 72.0314,39.61 74.1484,40.185 C77.8864,41.198 82.3734,41.328 85.7904,40.663 C87.1614,40.401 88.3554,39.983 89.3424,39.419 C90.2554,38.897 90.9704,38.212 91.4694,37.385 C91.9614,36.573 92.2104,35.534 92.2104,34.296 C92.2104,33.317 92.0204,32.495 91.6284,31.783 C91.2164,31.039 90.6494,30.373 89.9434,29.81 C89.1844,29.2 88.2794,28.652 87.2484,28.18 C86.1424,27.671 84.9714,27.197 83.7644,26.77 C82.5174,26.329 81.2324,25.896 79.9024,25.473 C78.5324,25.038 77.2014,24.566 75.9154,24.056 C74.6024,23.535 73.3474,22.945 72.1864,22.305 C70.9554,21.626 69.8634,20.815 68.9434,19.893 C67.9954,18.947 67.2354,17.839 66.6814,16.6 C66.1184,15.346 65.8324,13.882 65.8324,12.251 C65.8324,10.679 66.0554,9.252 66.4964,8.011 C66.9394,6.759 67.5644,5.653 68.3544,4.728 C69.1384,3.811 70.0594,3.036 71.0934,2.42 C72.1154,1.814 73.2074,1.334 74.3394,0.989 C75.4454,0.651 76.6234,0.4 77.8374,0.243 C80.3064,-0.072 82.8204,-0.048 84.9824,0.245 C86.1084,0.397 87.1954,0.596 88.2444,0.842 C89.2874,1.09 90.3064,1.376 91.3014,1.699 C92.2754,2.01 93.2624,2.349 94.2634,2.708 L95.1004,3.007 L95.1004,10.749 L93.1354,9.434 C92.5634,9.051 91.9074,8.648 91.1594,8.218 C90.4494,7.809 89.6244,7.437 88.7104,7.111 C87.7934,6.785 86.7244,6.502 85.5354,6.272 C82.9524,5.781 79.4034,5.852 76.9684,6.348 C75.6854,6.608 74.5974,7.009 73.7334,7.541 C72.9174,8.044 72.3174,8.655 71.8974,9.407 C71.4804,10.148 71.2694,11.062 71.2694,12.126 C71.2694,12.98 71.4524,13.692 71.8254,14.305 C72.2314,14.974 72.7944,15.576 73.5044,16.101 C74.2634,16.664 75.1814,17.189 76.2324,17.663 C77.3324,18.159 78.5014,18.623 79.7334,19.058 C80.9964,19.503 82.2984,19.956 83.6354,20.41 C85.0094,20.877 86.3444,21.382 87.6384,21.924 C88.9594,22.475 90.2184,23.097 91.3814,23.771 C92.6054,24.48 93.6954,25.324 94.6164,26.279 C95.5544,27.245 96.3134,28.377 96.8714,29.64 C97.4324,30.921 97.7174,32.402 97.7174,34.046 C97.7174,35.789 97.4684,37.347 96.9764,38.676 C96.4884,40.008 95.8084,41.18 94.9584,42.156 C94.1174,43.124 93.1174,43.939 91.9844,44.575 C90.8974,45.193 89.7184,45.69 88.4874,46.045 C87.2864,46.394 86.0194,46.644 84.7254,46.789 C83.4394,46.929 82.1784,47 80.9784,47" id="Fill-9" fill="#EFA900" sketch:type="MSShapeGroup" mask="url(#mask-2)"></path>
23
+ <mask id="mask-4" fill="white">
24
+ <use xlink:href="#path-3"></use>
25
+ </mask>
26
+ <g id="Clip-13"></g>
27
+ <path d="M109.371,46.16 L104.003,46.16 L104.003,0.796 L109.371,0.796 L109.371,46.16 Z" id="Fill-12" fill="#EFA900" sketch:type="MSShapeGroup" mask="url(#mask-4)"></path>
28
+ <path d="M137.105,46.999 C134.025,46.999 131.124,46.517 128.485,45.566 C125.803,44.604 123.445,43.122 121.477,41.159 C119.512,39.197 117.955,36.711 116.851,33.771 C115.756,30.862 115.201,27.409 115.201,23.507 C115.201,20.906 115.456,18.497 115.96,16.345 C116.472,14.176 117.205,12.196 118.14,10.453 C119.077,8.703 120.234,7.148 121.576,5.832 C122.904,4.529 124.405,3.434 126.038,2.575 C127.645,1.732 129.404,1.086 131.267,0.655 C134.485,-0.087 138.251,-0.156 141.288,0.326 C142.596,0.535 143.861,0.834 145.045,1.213 C146.228,1.59 147.398,2.051 148.523,2.581 C149.633,3.108 150.742,3.688 151.865,4.326 L152.503,4.688 L152.503,12.927 L150.416,11.118 C149.599,10.41 148.706,9.726 147.762,9.084 C146.847,8.463 145.848,7.913 144.8,7.451 C143.756,6.99 142.609,6.617 141.385,6.341 C140.182,6.072 138.867,5.935 137.483,5.935 C134.614,5.935 132.092,6.347 129.988,7.16 C127.915,7.962 126.174,9.114 124.811,10.584 C123.442,12.06 122.397,13.895 121.703,16.039 C120.995,18.228 120.637,20.741 120.637,23.507 C120.637,26.086 120.988,28.489 121.682,30.649 C122.362,32.769 123.4,34.614 124.768,36.133 C126.13,37.648 127.865,38.851 129.926,39.71 C132.005,40.574 134.502,41.012 137.348,41.012 C138.49,41.012 139.629,40.953 140.733,40.836 C141.857,40.713 142.918,40.559 143.919,40.366 C144.917,40.177 145.823,39.968 146.641,39.738 C147.095,39.61 147.508,39.481 147.884,39.351 L147.884,27.225 L153.253,27.225 L153.253,43.195 L152.538,43.539 C151.375,44.098 150.19,44.597 149.02,45.022 C147.858,45.445 146.615,45.811 145.324,46.11 C144.064,46.399 142.738,46.622 141.377,46.775 C140.019,46.924 138.582,46.999 137.105,46.999" id="Fill-14" fill="#EFA900" sketch:type="MSShapeGroup" mask="url(#mask-4)"></path>
29
+ <path d="M195.4496,46.1573 L190.4466,46.1573 L165.1766,11.0793 L165.1766,46.1573 L159.8086,46.1573 L159.8086,0.7923 L164.8626,0.7923 L190.1286,35.9843 L190.1286,0.7923 L195.4496,0.7923 L195.4496,46.1573 Z" id="Fill-15" fill="#1F3E78" sketch:type="MSShapeGroup" mask="url(#mask-4)"></path>
30
+ <path d="M208.811,46.16 L203.443,46.16 L203.443,0.796 L208.811,0.796 L208.811,46.16 Z" id="Fill-16" fill="#1F3E78" sketch:type="MSShapeGroup" mask="url(#mask-4)"></path>
31
+ <path d="M222.1918,46.1561 L216.8238,46.1561 L216.8238,0.7951 L244.1108,0.7951 L244.1108,6.9661 L222.1918,6.9661 L222.1918,19.1881 L242.9968,19.1881 L242.9968,25.2661 L222.1918,25.2661 L222.1918,46.1561 Z" id="Fill-17" fill="#1F3E78" sketch:type="MSShapeGroup" mask="url(#mask-4)"></path>
32
+ <path d="M271.1635,46.1561 L265.7955,46.1561 L265.7955,27.0961 L250.1565,0.7941 L256.4855,0.7941 L268.4865,21.0291 L280.4485,0.7941 L286.7995,0.7941 L271.1635,27.0961 L271.1635,46.1561 Z" id="Fill-18" fill="#1F3E78" sketch:type="MSShapeGroup" mask="url(#mask-4)"></path>
33
+ <path d="M310.1823,46.1561 L297.0383,46.1561 L297.0383,40.0791 L310.1453,40.0791 C312.2453,40.0791 314.1873,39.8181 315.9153,39.3041 C317.5743,38.8111 318.9573,37.9791 320.1423,36.7621 C321.3303,35.5471 322.2763,33.8641 322.9573,31.7631 C323.6573,29.6021 324.0113,26.8081 324.0113,23.4581 C324.0113,21.2201 323.8513,19.2221 323.5343,17.5131 C323.2183,15.8341 322.7673,14.3671 322.1953,13.1551 C321.6413,11.9741 320.9583,10.9761 320.1673,10.1861 C319.3683,9.3881 318.4613,8.7401 317.4733,8.2581 C316.4673,7.7631 315.3513,7.4061 314.1453,7.1971 C312.9083,6.9821 311.5623,6.8721 310.1453,6.8721 L298.1523,6.8721 L298.1523,20.5591 L292.7843,20.5591 L292.7843,0.7941 L310.1383,0.7941 C312.8143,0.7941 315.3463,1.1601 317.6603,1.8811 C320.0513,2.6251 322.1533,3.9131 323.9113,5.7101 C325.6533,7.4921 327.0313,9.8731 328.0073,12.7861 C328.9633,15.6441 329.4493,19.2291 329.4493,23.4431 C329.4493,26.2521 329.2293,28.7951 328.7983,30.9981 C328.3673,33.2171 327.7383,35.1931 326.9323,36.8661 C326.1193,38.5651 325.1083,40.0311 323.9303,41.2291 C322.7453,42.4291 321.4163,43.4031 319.9773,44.1231 C318.5503,44.8361 316.9853,45.3611 315.3263,45.6841 C313.7023,45.9971 311.9713,46.1561 310.1823,46.1561" id="Fill-19" fill="#1F3E78" sketch:type="MSShapeGroup" mask="url(#mask-4)"></path>
34
+ </g>
35
+ </g>
36
+ </svg>
37
+ <h4>
38
+ <?php echo Mage::helper('signifyd_connect')->__('For installation instructions please refer to our ') .
39
+ '<a href="https://www.signifyd.com/resources/manual/magento-1/installation/" target="_blank" title="' .
40
+ Mage::helper('signifyd_connect')->__('This external link will open in a new window') . '"> ' .
41
+ Mage::helper('signifyd_connect')->__('product manual') . '</a>. ' .
42
+ Mage::helper('signifyd_connect')->__('If you have questions or need assistance please contact ') .
43
+ '<a class="dly-gmail" href="mailto:support@signifyd.com">' .
44
+ Mage::helper('signifyd_connect')->__('support') . '</a>.'; ?>
45
+ </h4>
46
+ </div>
app/etc/modules/Signifyd_Connect.xml CHANGED
@@ -1,9 +1,9 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Signifyd_Connect>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Signifyd_Connect>
8
- </modules>
9
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Signifyd_Connect>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Signifyd_Connect>
8
+ </modules>
9
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
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,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-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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Signifyd_Connect</name>
4
+ <version>3.16.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-11-09</date>
14
+ <time>09:27:09</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="2c2e8af2c67a09c041d5015c26eff587"/></dir><file name="Order.php" hash="e49f869c0aa5fb3ab6b70fb5752049ac"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="c83481d3f9f01e629bb48d34358a53f6"/></dir></dir></dir></dir><file name="Renderer.php" hash="b16dfa77aad966640705f55f09304fc2"/><file name="Url.php" hash="dbe3e967879a69a2c943056f820e4688"/></dir><dir name="Helper"><file name="Data.php" hash="241fc27fefd644f3c3e9caa53a981035"/><file name="Log.php" hash="96f1286eb9c273f637178ffd94a04d42"/></dir><dir name="Model"><file name="Authnet.php" hash="0387e631fb232778cdc82c0c72c16781"/><file name="Case.php" hash="12f39bf0b1d962a8b0cdabe6c401a9ae"/><file name="Cron.php" hash="8080b5e259ee8763beaa44fe98b92876"/><file name="Link.php" hash="c8a690bfe4b0ab789c02173a347f0f13"/><file name="Observer.php" hash="110cde415010768235322ed2a2143aab"/><dir name="Order"><file name="Payment.php" hash="a0ad3107170b7bae94b8402960b5cf48"/></dir><file name="Order.php" hash="991a2f535825328fa44cbc2bbbf8bd51"/><dir name="Resource"><dir name="Case"><file name="Collection.php" hash="b7dac9979a0c81db56294d1548570fc2"/></dir><file name="Case.php" hash="60d14407c9c90148aad543ce6868f343"/><dir name="Retries"><file name="Collection.php" hash="bd94e095c3a6367d20f5ebdd756740c8"/></dir><file name="Retries.php" hash="8027995f79188f624b6a681e4868d2e6"/></dir><file name="Retries.php" hash="28780c04867b083b1d51878e59fa380b"/><file name="Setup.php" hash="e803ffb4b86c7d8ec1d149e665d65877"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Options"><file name="Accepted.php" hash="bfa242f435e794f77843f38f11122691"/><file name="Declined.php" hash="f48482c1a78be0568b7b60cd5042906e"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="SignifydController.php" hash="c241dc4434631e3eb345c731c8cf177d"/></dir><file name="ConnectController.php" hash="7e3f80117b0a4703e65b79130c9ed7cf"/></dir><dir name="etc"><file name="adminhtml.xml" hash="894bd3f5ac76e9f602ab6ab592648b03"/><file name="config.xml" hash="327cd17e7b051ccf5df8dbcbddf15d58"/><file name="system.xml" hash="5b89a88ea3510e2ee6623582f639910e"/></dir><dir name="sql"><dir name="signifyd_connect_setup"><file name="mysql4-install-3.1.1.php" hash="7fb2ccaf8352eea26e626ace6de53d80"/><file name="mysql4-install-3.12.0.php" hash="e4ec4d7445fbbc13a7008bcd69c529c4"/><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.10.0-3.10.1.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.10.1-3.11.0.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.11.0-3.11.1.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.11.1-3.12.0.php" hash="df5447c6223f66c03ddeacefc64322b8"/><file name="mysql4-upgrade-3.12.0-3.13.0.php" hash="f2e8ccb1fd199a0a678b3e34181aac18"/><file name="mysql4-upgrade-3.15.1-3.16.0.php" hash="7cde716fe0e3e849c1f82bbd7bf8ec3a"/><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"/><file name="mysql4-upgrade-3.8.0-3.9.0.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.9.0-3.10.0.php" hash="3ceb86495f33475774d4fc8727254cfc"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="signifyd"><dir name="connect"><dir name="config"><file name="hint.phtml" hash="e1f1d39ed2980473f1fef0aeb73a7e1c"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>5.6.26</max></php></required></dependencies>
18
  </package>