Version Notes
Supports all versions of Magento
Download this release
Release Info
Developer | signifyd |
Extension | Signifyd_Connect |
Version | 3.15.0 |
Comparing to | |
See all releases |
Code changes from version 3.13.1 to 3.15.0
- app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order.php +13 -13
- app/code/community/Signifyd/Connect/Block/Adminhtml/Sales/Order/Grid.php +134 -134
- app/code/community/Signifyd/Connect/Block/Renderer.php +28 -28
- app/code/community/Signifyd/Connect/Block/Url.php +10 -0
- app/code/community/Signifyd/Connect/Helper/Data.php +790 -794
- app/code/community/Signifyd/Connect/Helper/Log.php +25 -0
- app/code/community/Signifyd/Connect/Model/Authnet.php +17 -17
- app/code/community/Signifyd/Connect/Model/Case.php +29 -10
- app/code/community/Signifyd/Connect/Model/Cron.php +136 -9
- app/code/community/Signifyd/Connect/Model/Link.php +9 -9
- app/code/community/Signifyd/Connect/Model/Observer.php +299 -316
- app/code/community/Signifyd/Connect/Model/Order.php +412 -0
- app/code/community/Signifyd/Connect/Model/Order/Payment.php +29 -0
- app/code/community/Signifyd/Connect/Model/Resource/Case.php +10 -10
- app/code/community/Signifyd/Connect/Model/Resource/Case/Collection.php +9 -9
- app/code/community/Signifyd/Connect/Model/Resource/Retries.php +10 -10
- app/code/community/Signifyd/Connect/Model/Resource/Retries/Collection.php +9 -9
- app/code/community/Signifyd/Connect/Model/Retries.php +10 -10
- app/code/community/Signifyd/Connect/Model/Setup.php +53 -53
- app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Accepted.php +19 -0
- app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Declined.php +19 -0
- app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Negative.php +0 -22
- app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Positive.php +0 -18
- app/code/community/Signifyd/Connect/controllers/Adminhtml/SignifydController.php +22 -27
- app/code/community/Signifyd/Connect/controllers/ConnectController.php +523 -593
- app/code/community/Signifyd/Connect/etc/adminhtml.xml +16 -16
- app/code/community/Signifyd/Connect/etc/config.xml +214 -199
- app/code/community/Signifyd/Connect/etc/system.xml +133 -222
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.1.1.php +13 -13
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.12.0.php +26 -26
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.3.0.php +19 -19
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.4.0.php +21 -21
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.4.5.php +21 -21
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.7.0.php +18 -18
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.8.0.php +19 -19
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.10.0-3.10.1.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.10.1-3.11.0.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.11.0-3.11.1.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.11.1-3.12.0.php +17 -17
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.12.0-3.13.0.php +15 -15
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.14.0-3.15.0.php +10 -0
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.0-3.2.1.php +5 -5
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.1-3.2.2.php +17 -17
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.2-3.2.3.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.3-3.3.0.php +10 -10
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.3.0-3.4.0.php +11 -11
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.0-3.4.1.php +10 -10
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.1-3.4.2.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.2-3.4.3.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.3-3.4.4.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.4-3.4.5.php +13 -13
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.5-3.4.6.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.6-3.4.7.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.7-3.4.8.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.8-3.5.0.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.0-3.5.1.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.1-3.5.2.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.2-3.5.3.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.5.3-3.6.0.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.6.0-3.7.0.php +31 -31
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.7.0-3.8.0.php +10 -10
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.8.0-3.9.0.php +8 -8
- app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.9.0-3.10.0.php +8 -8
- app/etc/modules/Signifyd_Connect.xml +9 -9
- package.xml +6 -6
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/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,794 +1,790 @@
|
|
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 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
$
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
$
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
}
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
$
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
$purchase
|
218 |
-
$
|
219 |
-
|
220 |
-
|
221 |
-
$purchase['
|
222 |
-
$purchase['
|
223 |
-
$purchase['
|
224 |
-
|
225 |
-
$purchase['
|
226 |
-
$purchase['
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
$
|
255 |
-
|
256 |
-
$card
|
257 |
-
|
258 |
-
|
259 |
-
$card['
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
if
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
$address['
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
$address['
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
"
|
350 |
-
"
|
351 |
-
"
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
$
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
$
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
$case
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
$
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
$
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
$
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
->
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
$
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
if
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
{
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
$
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
$
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
$
|
734 |
-
$
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
}
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
}
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
$
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
return $response;
|
793 |
-
}
|
794 |
-
}
|
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/request')) {
|
18 |
+
Mage::log($message, null, 'signifyd_connect.log');
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
public function logResponse($message)
|
23 |
+
{
|
24 |
+
if (Mage::getStoreConfig('signifyd_connect/log/response')) {
|
25 |
+
Mage::log($message, null, 'signifyd_connect.log');
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
public function logError($message)
|
30 |
+
{
|
31 |
+
if (Mage::getStoreConfig('signifyd_connect/log/error')) {
|
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['platform'] = 'magento';
|
199 |
+
$version['platformVersion'] = Mage::getVersion();
|
200 |
+
$version['pluginVersion'] = (string)(Mage::getConfig()->getNode()->modules->Signifyd_Connect->version);
|
201 |
+
return $version;
|
202 |
+
}
|
203 |
+
|
204 |
+
private function getTransactionId($payment)
|
205 |
+
{
|
206 |
+
$transId = $payment->getCcTransId();
|
207 |
+
if(is_array($transId) && is_string($transId[0])) {
|
208 |
+
$transId = $transId[0];
|
209 |
+
} else if(!is_string($transId)) {
|
210 |
+
$transId = null;
|
211 |
+
}
|
212 |
+
return $transId;
|
213 |
+
}
|
214 |
+
|
215 |
+
public function getPurchase($order)
|
216 |
+
{
|
217 |
+
$purchase = array();
|
218 |
+
$payment = $order->getPayment();
|
219 |
+
|
220 |
+
// T715: Send null rather than false when we can't get the IP Address
|
221 |
+
$purchase['browserIpAddress'] = ($this->getIpAddress($order) ? $this->getIpAddress($order) : null);
|
222 |
+
$purchase['orderId'] = $order->getIncrementId();
|
223 |
+
$purchase['createdAt'] = date('c', strtotime($order->getCreatedAt())); // e.g: 2004-02-12T15:19:21+00:00
|
224 |
+
$purchase['currency'] = $order->getOrderCurrencyCode();
|
225 |
+
$purchase['totalPrice'] = floatval($order->getGrandTotal());
|
226 |
+
$purchase['shippingPrice'] = floatval($order->getShippingAmount());
|
227 |
+
$purchase['products'] = $this->getProducts($order);
|
228 |
+
$purchase['paymentGateway'] = $payment->getMethod();
|
229 |
+
$purchase['transactionId'] = $this->getTransactionId($payment);
|
230 |
+
|
231 |
+
$purchase['avsResponseCode'] = $this->getAvsResponse($payment);
|
232 |
+
$purchase['cvvResponseCode'] = $this->getCvvResponse($payment);
|
233 |
+
|
234 |
+
return $purchase;
|
235 |
+
}
|
236 |
+
|
237 |
+
public function isPaymentCC($payment)
|
238 |
+
{
|
239 |
+
// Although the payment structure only has the entity data for the payment
|
240 |
+
// the original payment method object is stored within the entity data.
|
241 |
+
// It's not a requirement, but every CC handler I've found subclasses
|
242 |
+
// from Mage_Payment_Model_Method_Cc, so we are using that as an
|
243 |
+
// assumption for whether a method is based on CC data
|
244 |
+
$method = $payment->getData('method_instance');
|
245 |
+
if($method)
|
246 |
+
{
|
247 |
+
return is_subclass_of($method, 'Mage_Payment_Model_Method_Cc');
|
248 |
+
}
|
249 |
+
return false;
|
250 |
+
}
|
251 |
+
|
252 |
+
public function getCard($order, $payment)
|
253 |
+
{
|
254 |
+
$billing = $order->getBillingAddress();
|
255 |
+
|
256 |
+
$card = array();
|
257 |
+
|
258 |
+
$card['cardHolderName'] = null;
|
259 |
+
$card['bin'] = null;
|
260 |
+
$card['last4'] = null;
|
261 |
+
$card['expiryMonth'] = null;
|
262 |
+
$card['expiryYear'] = null;
|
263 |
+
$card['hash'] = null;
|
264 |
+
|
265 |
+
$card['billingAddress'] = $this->getSignifydAddress($billing);
|
266 |
+
|
267 |
+
if ($payment->getCcOwner()) {
|
268 |
+
$card['cardHolderName'] = $payment->getCcOwner();
|
269 |
+
} else {
|
270 |
+
$card['cardHolderName'] = $billing->getFirstname() . ' ' . $billing->getLastname();
|
271 |
+
}
|
272 |
+
|
273 |
+
// Card data may be set on payment even if payment was not with card.
|
274 |
+
// If it is, we want to ignore the data
|
275 |
+
if(!$this->isPaymentCC($payment)) return $card;
|
276 |
+
|
277 |
+
if ($payment->getData('cc_last4')) {
|
278 |
+
$card['last4'] = $payment->getData('cc_last4');
|
279 |
+
}
|
280 |
+
|
281 |
+
if ($payment->getData('cc_exp_year')) {
|
282 |
+
$card['expiryYear'] = $payment->getData('cc_exp_year');
|
283 |
+
}
|
284 |
+
|
285 |
+
if ($payment->getData('cc_exp_month')) {
|
286 |
+
$card['expiryMonth'] = $payment->getData('cc_exp_month');
|
287 |
+
}
|
288 |
+
|
289 |
+
if ($payment->getData('cc_number_enc')) {
|
290 |
+
$card['hash'] = $payment->getData('cc_number_enc');
|
291 |
+
}
|
292 |
+
|
293 |
+
if ($payment->getData('cc_number') && is_numeric($payment->getData('cc_number')) && strlen((string)$payment->getData('cc_number')) > 6) {
|
294 |
+
$card['bin'] = substr((string)$payment->getData('cc_number'), 0, 6);
|
295 |
+
}
|
296 |
+
|
297 |
+
return $card;
|
298 |
+
}
|
299 |
+
|
300 |
+
public function getSignifydAddress($address_object)
|
301 |
+
{
|
302 |
+
$address = array();
|
303 |
+
|
304 |
+
$address['streetAddress'] = $address_object->getStreet1();
|
305 |
+
$address['unit'] = null;
|
306 |
+
|
307 |
+
if ($address_object->getStreet2()) {
|
308 |
+
$address['unit'] = $address_object->getStreet2();
|
309 |
+
}
|
310 |
+
|
311 |
+
$address['city'] = $address_object->getCity();
|
312 |
+
|
313 |
+
$address['provinceCode'] = $address_object->getRegionCode();
|
314 |
+
$address['postalCode'] = $address_object->getPostcode();
|
315 |
+
$address['countryCode'] = $address_object->getCountryId();
|
316 |
+
|
317 |
+
$address['latitude'] = null;
|
318 |
+
$address['longitude'] = null;
|
319 |
+
|
320 |
+
return $address;
|
321 |
+
}
|
322 |
+
|
323 |
+
public function getRecipient($order)
|
324 |
+
{
|
325 |
+
$recipient = array();
|
326 |
+
|
327 |
+
// In the case of non-shipped (ex: downloadable) orders, shipping address will be null so
|
328 |
+
// in that case, we need to avoid the exception.
|
329 |
+
$shipping_address = $order->getShippingAddress();
|
330 |
+
if($shipping_address) {
|
331 |
+
$recipient['deliveryAddress'] = $this->getSignifydAddress($shipping_address);
|
332 |
+
$recipient['fullName'] = $shipping_address->getFirstname() . ' ' . $shipping_address->getLastname();
|
333 |
+
$recipient['confirmationPhone'] = $shipping_address->getTelephone();
|
334 |
+
// Email: Note that this field is always the same for both addresses
|
335 |
+
$recipient['confirmationEmail'] = $shipping_address->getEmail();
|
336 |
+
}
|
337 |
+
// Some customers have reported seeing "n/a@na.na" come through instead of a valid or null address
|
338 |
+
// We suspect that it is due to an older version of Magento. If it becomes unnecessary, do remove the extra check.
|
339 |
+
if (!$recipient['confirmationEmail'] || $recipient['confirmationEmail'] == 'n/a@na.na') {
|
340 |
+
$recipient['confirmationEmail'] = $order->getCustomerEmail();
|
341 |
+
}
|
342 |
+
|
343 |
+
return $recipient;
|
344 |
+
}
|
345 |
+
|
346 |
+
public function getUserAccount($customer, $order)
|
347 |
+
{
|
348 |
+
$user = array(
|
349 |
+
"emailAddress" => null,
|
350 |
+
"username" => null,
|
351 |
+
"phone" => null,
|
352 |
+
"createdDate" => null,
|
353 |
+
"accountNumber" => null,
|
354 |
+
"lastOrderId" => null,
|
355 |
+
"aggregateOrderCount" => null,
|
356 |
+
"aggregateOrderDollars" => null,
|
357 |
+
"lastUpdateDate" => null
|
358 |
+
);
|
359 |
+
|
360 |
+
if ($customer && $customer->getId()) {
|
361 |
+
$user['emailAddress'] = $customer->getEmail();
|
362 |
+
|
363 |
+
$user['phone'] = $order->getBillingAddress()->getTelephone();
|
364 |
+
|
365 |
+
$user['createdDate'] = date('c', strtotime($customer->getCreatedAt()));
|
366 |
+
$user['lastUpdateDate'] = date('c', strtotime($customer->getUpdatedAt()));
|
367 |
+
|
368 |
+
$user['accountNumber'] = $customer->getId();
|
369 |
+
|
370 |
+
$last_order_id = null;
|
371 |
+
|
372 |
+
$orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customer->getId());
|
373 |
+
$orders->getSelect()->order('created_at DESC');
|
374 |
+
|
375 |
+
$aggregate_total = 0.;
|
376 |
+
$order_count = 0;
|
377 |
+
|
378 |
+
foreach ($orders as $order) {
|
379 |
+
if ($last_order_id === null) {
|
380 |
+
$last_order_id = $order->getIncrementId();
|
381 |
+
}
|
382 |
+
|
383 |
+
$aggregate_total += floatval($order->getGrandTotal());
|
384 |
+
$order_count += 1;
|
385 |
+
}
|
386 |
+
|
387 |
+
$user['lastOrderId'] = $last_order_id;
|
388 |
+
$user['aggregateOrderCount'] = $order_count;
|
389 |
+
$user['aggregateOrderDollars'] = floatval($aggregate_total);
|
390 |
+
}
|
391 |
+
|
392 |
+
return $user;
|
393 |
+
}
|
394 |
+
|
395 |
+
public function generateCase($order, $payment, $customer)
|
396 |
+
{
|
397 |
+
$case = array();
|
398 |
+
|
399 |
+
$case['purchase'] = $this->getPurchase($order);
|
400 |
+
$case['recipient'] = $this->getRecipient($order);
|
401 |
+
$case['card'] = $this->getCard($order, $payment);
|
402 |
+
$case['userAccount'] = $this->getUserAccount($customer, $order);
|
403 |
+
$case['clientVersion'] = $this->getVersions();
|
404 |
+
|
405 |
+
return $case;
|
406 |
+
}
|
407 |
+
|
408 |
+
public function submitCase($case, $url, $auth)
|
409 |
+
{
|
410 |
+
$case = json_encode($case);
|
411 |
+
|
412 |
+
return $this->request($url, $case, $auth, 'application/json');
|
413 |
+
}
|
414 |
+
|
415 |
+
public function getUrl()
|
416 |
+
{
|
417 |
+
// return Mage::getStoreConfig('signifyd_connect/settings/url') . '/cases';
|
418 |
+
return 'https://api.signifyd.com/v2/cases/';
|
419 |
+
}
|
420 |
+
|
421 |
+
public function getAuth()
|
422 |
+
{
|
423 |
+
return Mage::getStoreConfig('signifyd_connect/settings/key');
|
424 |
+
}
|
425 |
+
|
426 |
+
public function sendOrderUpdateToSignifyd($order)
|
427 |
+
{
|
428 |
+
if ($order && $order->getId() && Mage::getStoreConfig('signifyd_connect/advanced/enable_payment_updates')) {
|
429 |
+
$case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
|
430 |
+
$caseId = $case->getCode();
|
431 |
+
|
432 |
+
if (Mage::getStoreConfig('signifyd_connect/log/request')) {
|
433 |
+
Mage::log("Created new case: $caseId", null, 'signifyd_connect.log');
|
434 |
+
}
|
435 |
+
|
436 |
+
$updateData = array();
|
437 |
+
$payment = $order->getPayment();
|
438 |
+
|
439 |
+
// These are the only supported update fields
|
440 |
+
$purchase = array();
|
441 |
+
$purchase['paymentGateway'] = $payment->getMethod();
|
442 |
+
$purchase['transactionId'] = $this->getTransactionId($payment);
|
443 |
+
$purchase['avsResponseCode'] = $this->getAvsResponse($payment);
|
444 |
+
$purchase['cvvResponseCode'] = $this->getCvvResponse($payment);
|
445 |
+
|
446 |
+
// Do not make request if there is no data to send
|
447 |
+
if( $purchase['transactionId'] == null &&
|
448 |
+
$purchase['avsResponseCode'] == null &&
|
449 |
+
$purchase['cvvResponseCode'] == null)
|
450 |
+
{
|
451 |
+
return "nodata";
|
452 |
+
}
|
453 |
+
Mage::register('signifyd_action', 1); // Work will now take place
|
454 |
+
|
455 |
+
$updateData['purchase'] = $purchase;
|
456 |
+
|
457 |
+
$data = json_encode($updateData);
|
458 |
+
|
459 |
+
$response = $this->request($this->getUrl() . "/$caseId", $data, $this->getAuth(), 'application/json', null, true);
|
460 |
+
|
461 |
+
try {
|
462 |
+
$response_code = $response->getHttpCode();
|
463 |
+
|
464 |
+
if (substr($response_code, 0, 1) == '2') {
|
465 |
+
// Reload in case a substantial amount of time has passed
|
466 |
+
$case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
|
467 |
+
$case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
468 |
+
$case->setTransactionId($updateData['purchase']['transactionId']);
|
469 |
+
$case->save();
|
470 |
+
if (Mage::getStoreConfig('signifyd_connect/log/request')) {
|
471 |
+
Mage::log("Wrote case to database: $caseId", null, 'signifyd_connect.log');
|
472 |
+
}
|
473 |
+
return "sent";
|
474 |
+
}
|
475 |
+
} catch (Exception $e) {
|
476 |
+
Mage::log($e->__toString(), null, 'signifyd_connect.log');
|
477 |
+
return "error";
|
478 |
+
}
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
+
public function buildAndSendOrderToSignifyd($order, $forceSend = false)
|
483 |
+
{
|
484 |
+
if ($order && $order->getId()) {
|
485 |
+
$processStatus = $this->processedStatus($order);
|
486 |
+
if ($processStatus > 0 && !$forceSend) {
|
487 |
+
if($processStatus == self::TRANSACTION_SENT_STATUS) return "exists";
|
488 |
+
else return $this->sendOrderUpdateToSignifyd($order);
|
489 |
+
}
|
490 |
+
|
491 |
+
$payments = $order->getPaymentsCollection();
|
492 |
+
$last_payment = null;
|
493 |
+
foreach ($payments as $payment) {
|
494 |
+
$last_payment = $payment;
|
495 |
+
}
|
496 |
+
|
497 |
+
$state = $order->getState();
|
498 |
+
|
499 |
+
if (!$state || $state == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
500 |
+
return "notready"; // Note: would not be in the order grid if this were the case
|
501 |
+
}
|
502 |
+
|
503 |
+
if(is_null(Mage::registry('signifyd_action'))) {
|
504 |
+
Mage::register('signifyd_action', 1); // Work will now take place
|
505 |
+
}
|
506 |
+
|
507 |
+
$customer = null;
|
508 |
+
if ($order->getCustomer()) {
|
509 |
+
$customer = $order->getCustomer();
|
510 |
+
}
|
511 |
+
|
512 |
+
$case = $this->generateCase($order, $last_payment, $customer);
|
513 |
+
|
514 |
+
$case_object = $this->markProcessed($order);
|
515 |
+
|
516 |
+
$response = $this->submitCase($case, $this->getUrl(), $this->getAuth());
|
517 |
+
|
518 |
+
try {
|
519 |
+
$response_code = $response->getHttpCode();
|
520 |
+
|
521 |
+
if (substr($response_code, 0, 1) == '2') {
|
522 |
+
$response_data = json_decode($response->getRawResponse(), true);
|
523 |
+
|
524 |
+
$caseId = $response_data['investigationId'];
|
525 |
+
$case_object = Mage::getModel('signifyd_connect/case')->load($case_object->getOrderIncrement());
|
526 |
+
$case_object->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
527 |
+
$case_object->setCode($caseId);
|
528 |
+
$case_object->setTransactionId($case['purchase']['transactionId']);
|
529 |
+
$case_object->setMagentoStatus(self::IN_REVIEW_STATUS);
|
530 |
+
$case_object->save();
|
531 |
+
|
532 |
+
$order->addStatusHistoryComment("Signifyd: case $caseId created for order");
|
533 |
+
$order->save(); // Note: this will trigger recursion
|
534 |
+
|
535 |
+
return "sent";
|
536 |
+
}
|
537 |
+
} catch (Exception $e) {
|
538 |
+
Mage::log($e->__toString(), null, 'signifyd_connect.log');
|
539 |
+
}
|
540 |
+
//$this->unmarkProcessed($order);
|
541 |
+
return "error";
|
542 |
+
}
|
543 |
+
}
|
544 |
+
|
545 |
+
public function getProductUrl($product)
|
546 |
+
{
|
547 |
+
$url = null;
|
548 |
+
|
549 |
+
try {
|
550 |
+
$url = $product->getUrlModel()->getProductUrl($product);
|
551 |
+
} catch (Exception $e) {
|
552 |
+
$url = null;
|
553 |
+
}
|
554 |
+
|
555 |
+
return $url;
|
556 |
+
}
|
557 |
+
|
558 |
+
public function getCaseUrl($order_id)
|
559 |
+
{
|
560 |
+
$case = Mage::getModel('signifyd_connect/case')->load($order_id);
|
561 |
+
|
562 |
+
if ($case->getCode()) {
|
563 |
+
return "https://www.signifyd.com/cases/" . $case->getCode();
|
564 |
+
}
|
565 |
+
Mage::log('Case URL not found: '.$order_id, null, 'signifyd_connect.log');
|
566 |
+
return '';
|
567 |
+
}
|
568 |
+
|
569 |
+
public function getProductImage($product, $size="150")
|
570 |
+
{
|
571 |
+
$image = null;
|
572 |
+
|
573 |
+
try {
|
574 |
+
$image = (string)Mage::helper('catalog/image')->init($product, 'image')->resize($size, $size)->keepFrame(true)->keepAspectRatio(true);
|
575 |
+
} catch (Exception $e) {
|
576 |
+
$image = null;
|
577 |
+
}
|
578 |
+
|
579 |
+
return $image;
|
580 |
+
}
|
581 |
+
|
582 |
+
public function getStoreName()
|
583 |
+
{
|
584 |
+
return Mage::getStoreConfig('trans_email/ident_general/name', 0);
|
585 |
+
}
|
586 |
+
|
587 |
+
public function getStoreEmail()
|
588 |
+
{
|
589 |
+
return Mage::getStoreConfig('trans_email/ident_general/email', 0);
|
590 |
+
}
|
591 |
+
|
592 |
+
public function getStoreUrl()
|
593 |
+
{
|
594 |
+
return Mage::getBaseUrl();
|
595 |
+
}
|
596 |
+
|
597 |
+
public function processedStatus($order)
|
598 |
+
{
|
599 |
+
$case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
|
600 |
+
|
601 |
+
if ($case->getTransactionId())
|
602 |
+
{
|
603 |
+
return self::TRANSACTION_SENT_STATUS;
|
604 |
+
}
|
605 |
+
else if ($case->getCode())
|
606 |
+
{
|
607 |
+
return self::CASE_CREATED_STATUS;
|
608 |
+
}
|
609 |
+
else if ($case->getId())
|
610 |
+
{
|
611 |
+
return self::ENTITY_CREATED_STATUS;
|
612 |
+
}
|
613 |
+
|
614 |
+
return self::UNPROCESSED_STATUS;
|
615 |
+
}
|
616 |
+
|
617 |
+
public function markProcessed($order)
|
618 |
+
{
|
619 |
+
$case = Mage::getModel('signifyd_connect/case');
|
620 |
+
$case->setOrderIncrement($order->getIncrementId());
|
621 |
+
$case->setCreated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
622 |
+
$case->setUpdated(strftime('%Y-%m-%d %H:%M:%S', time()));
|
623 |
+
$case->save();
|
624 |
+
|
625 |
+
return $case;
|
626 |
+
}
|
627 |
+
|
628 |
+
public function unmarkProcessed($order)
|
629 |
+
{
|
630 |
+
$case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
|
631 |
+
if($case && !$case->isObjectNew())
|
632 |
+
{
|
633 |
+
Mage::register('isSecureArea', true);
|
634 |
+
$case->delete();
|
635 |
+
Mage::unregister('isSecureArea');
|
636 |
+
}
|
637 |
+
}
|
638 |
+
|
639 |
+
public function cancelGuarantee($case)
|
640 |
+
{
|
641 |
+
$caseId = $case->getCode();
|
642 |
+
$url = $this->getUrl() . "/$caseId/guarantee";
|
643 |
+
$body = json_encode(array("guaranteeDisposition" => "CANCELED"));
|
644 |
+
$response = $this->request($url, $body, $this->getAuth(), 'application/json', null, true);
|
645 |
+
$code = $response->getHttpCode();
|
646 |
+
if(substr($code, 0, 1) == '2') {
|
647 |
+
$case->setGuarantee('CANCELED');
|
648 |
+
$case->save();
|
649 |
+
} else {
|
650 |
+
$this->logError("Guarantee cancel failed");
|
651 |
+
}
|
652 |
+
$this->logResponse("Received $code from guarantee cancel");
|
653 |
+
}
|
654 |
+
|
655 |
+
public function request($url, $data = null, $auth = null, $contenttype = "application/x-www-form-urlencoded",
|
656 |
+
$accept = null, $is_update = false)
|
657 |
+
{
|
658 |
+
if (Mage::getStoreConfig('signifyd_connect/log/request')) {
|
659 |
+
$authMask = preg_replace ( "/\S/", "*", $auth, strlen($auth) - 4 );
|
660 |
+
Mage::log("Request:\nURL: $url \nAuth: $authMask\nData: $data", null, 'signifyd_connect.log');
|
661 |
+
}
|
662 |
+
|
663 |
+
$curl = curl_init();
|
664 |
+
$response = new Varien_Object;
|
665 |
+
$headers = array();
|
666 |
+
|
667 |
+
curl_setopt($curl, CURLOPT_URL, $url);
|
668 |
+
|
669 |
+
if (stripos($url, 'https://') === 0) {
|
670 |
+
curl_setopt($curl, CURLOPT_PORT, 443);
|
671 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
672 |
+
}
|
673 |
+
|
674 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
675 |
+
|
676 |
+
if ($auth) {
|
677 |
+
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
678 |
+
curl_setopt($curl, CURLOPT_USERPWD, $auth);
|
679 |
+
}
|
680 |
+
|
681 |
+
if ($accept) {
|
682 |
+
$headers[] = 'Accept: ' . $accept;
|
683 |
+
}
|
684 |
+
|
685 |
+
if ($data) {
|
686 |
+
if($is_update) curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
687 |
+
else curl_setopt($curl, CURLOPT_POST, 1);
|
688 |
+
|
689 |
+
$headers[] = "Content-Type: $contenttype";
|
690 |
+
$headers[] = "Content-length: " . strlen($data);
|
691 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
692 |
+
}
|
693 |
+
|
694 |
+
if (count($headers)) {
|
695 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
696 |
+
}
|
697 |
+
|
698 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 4);
|
699 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 4);
|
700 |
+
|
701 |
+
$raw_response = curl_exec($curl);
|
702 |
+
$response->setRawResponse($raw_response);
|
703 |
+
|
704 |
+
$response_data = curl_getinfo($curl);
|
705 |
+
$response->addData($response_data);
|
706 |
+
|
707 |
+
if (Mage::getStoreConfig('signifyd_connect/log/response')) {
|
708 |
+
Mage::log("Response ($url):\n " . print_r($response, true), null, 'signifyd_connect.log');
|
709 |
+
}
|
710 |
+
|
711 |
+
if ($raw_response === false || curl_errno($curl)) {
|
712 |
+
$error = curl_error($curl);
|
713 |
+
|
714 |
+
if (Mage::getStoreConfig('signifyd_connect/log/error')) {
|
715 |
+
Mage::log("ERROR ($url):\n$error", null, 'signifyd_connect.log');
|
716 |
+
}
|
717 |
+
|
718 |
+
$response->setData('error', $error);
|
719 |
+
}
|
720 |
+
|
721 |
+
curl_close($curl);
|
722 |
+
|
723 |
+
return $response;
|
724 |
+
}
|
725 |
+
|
726 |
+
/**
|
727 |
+
* Get the order payment status
|
728 |
+
* @param $order
|
729 |
+
* @return array
|
730 |
+
*/
|
731 |
+
public function getOrderPaymentStatus($order)
|
732 |
+
{
|
733 |
+
$status = array('authorize' => false, 'capture' => false, 'credit_memo' => false);
|
734 |
+
$logger = Mage::helper('signifyd_connect/log');
|
735 |
+
$paymentMethod = $order->getPayment();
|
736 |
+
$paymentAuthorized = $paymentMethod->getBaseAmountAuthorized();
|
737 |
+
$baseTotalPaid = $order->getBaseTotalPaid();
|
738 |
+
$baseTotalRefunded = $order->getBaseTotalRefunded();
|
739 |
+
// Maybe used in the future
|
740 |
+
// $canVoid = $paymentMethod->canVoid($order);
|
741 |
+
// $amountPayed = $paymentMethod->getAmountPaid();
|
742 |
+
// $baseTotalCanceled = $order->getBaseTotalCanceled();
|
743 |
+
// $baseTotalInvoiced = $order->getBaseTotalInvoiced();
|
744 |
+
|
745 |
+
// Check authorization
|
746 |
+
if(!empty($paymentAuthorized)){
|
747 |
+
$status['authorize'] = true;
|
748 |
+
}
|
749 |
+
|
750 |
+
// Special case for Paypal payment type "order"
|
751 |
+
if($this->isPaypalOrder($paymentMethod)){
|
752 |
+
$paymentAdditional = $paymentMethod->getData('additional_information');
|
753 |
+
if(isset($paymentAdditional['is_order_action']) && $paymentAdditional['is_order_action']){
|
754 |
+
$status['authorize'] = true;
|
755 |
+
}
|
756 |
+
}
|
757 |
+
|
758 |
+
// Check capture
|
759 |
+
if(!empty($baseTotalPaid)){
|
760 |
+
$status['capture'] = true;
|
761 |
+
}
|
762 |
+
|
763 |
+
// Check credit memo
|
764 |
+
if(!empty($baseTotalRefunded)){
|
765 |
+
$status['credit_memo'] = true;
|
766 |
+
}
|
767 |
+
|
768 |
+
// Log status
|
769 |
+
$logger->addLog("Order: {$order->getIncrementId()} has a status of " . json_encode($status));
|
770 |
+
|
771 |
+
return $status;
|
772 |
+
}
|
773 |
+
|
774 |
+
/**
|
775 |
+
* Checking if the payment method si paypal_express
|
776 |
+
* @param $paymentMethod
|
777 |
+
* @return bool
|
778 |
+
*/
|
779 |
+
public function isPaypalOrder($paymentMethod)
|
780 |
+
{
|
781 |
+
$code = $paymentMethod->getMethodInstance()->getCode();
|
782 |
+
return (stripos($code, 'paypal_express') !== false)? true : false;
|
783 |
+
}
|
784 |
+
|
785 |
+
public function isGuarantyDeclined($order)
|
786 |
+
{
|
787 |
+
$case = Mage::getModel('signifyd_connect/case')->load($order->getIncrementId());
|
788 |
+
return ($case->getGuarantee() == 'DECLINED')? true : false;
|
789 |
+
}
|
790 |
+
}
|
|
|
|
|
|
|
|
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
|
6 |
-
|
7 |
-
|
8 |
-
|
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 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
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 "
|
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>";
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Signifyd/Connect/Model/Observer.php
CHANGED
@@ -1,316 +1,299 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Signifyd_Connect_Model_Observer extends Varien_Object
|
4 |
-
{
|
5 |
-
public $joins = 0;
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
if($
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
$
|
57 |
-
$
|
58 |
-
$
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
$
|
72 |
-
$
|
73 |
-
|
74 |
-
Mage::log("
|
75 |
-
Mage::log("
|
76 |
-
Mage::log("
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
if ($
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
-
public function
|
146 |
-
{
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
}
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
$
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
$
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
$
|
298 |
-
}
|
299 |
-
|
300 |
-
public function salesOrderPaymentCancel($observer)
|
301 |
-
{
|
302 |
-
$helper = Mage::helper('signifyd_connect');
|
303 |
-
try {
|
304 |
-
$event = $observer->getEvent();
|
305 |
-
if($event->getPayment()->getOrder()) {
|
306 |
-
$order = $event->getPayment()->getOrder()->getIncrementId();
|
307 |
-
} else {
|
308 |
-
$helper->logError("Event salesOrderPaymentCancel has no order");
|
309 |
-
return;
|
310 |
-
}
|
311 |
-
$this->handleCancel($order);
|
312 |
-
} catch(Exception $ex) {
|
313 |
-
$helper->logError("Guarantee cancel: $ex");
|
314 |
-
}
|
315 |
-
}
|
316 |
-
}
|
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 |
+
$order = $observer->getEvent()->getOrder();
|
285 |
+
if($order->canHold() === false){
|
286 |
+
$this->helper->logError("Order {$order->getIncrementId()} could not be held because Magento returned false for canHold");
|
287 |
+
}
|
288 |
+
|
289 |
+
try {
|
290 |
+
$order->hold();
|
291 |
+
$order->addStatusHistoryComment("Signifyd: order held after order place");
|
292 |
+
$order->save();
|
293 |
+
} catch (Exception $e){
|
294 |
+
$this->helper->logError("PutOrderOnHold Error: $e");
|
295 |
+
}
|
296 |
+
|
297 |
+
return $this;
|
298 |
+
}
|
299 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/request');
|
28 |
+
parent::_construct();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Method to authorize an order after order place
|
33 |
+
* @param $order
|
34 |
+
* @return bool
|
35 |
+
*/
|
36 |
+
public function authorizeOrder($order)
|
37 |
+
{
|
38 |
+
// Get the payment status for this order
|
39 |
+
$status = $this->dataHelper->getOrderPaymentStatus($order);
|
40 |
+
if($status['authorize']){
|
41 |
+
$this->logger->addLog("Order {$order->getIncrementId()} is already authorize");
|
42 |
+
return true;
|
43 |
+
}
|
44 |
+
$payment = $order->getPayment();
|
45 |
+
$method = $payment->getMethodInstance();
|
46 |
+
if(!$method->canAuthorize()){
|
47 |
+
$this->logger->addLog("Order {$order->getIncrementId()} can not be authorize");
|
48 |
+
return true;
|
49 |
+
}
|
50 |
+
|
51 |
+
$amount = $order->getData('grand_total');
|
52 |
+
|
53 |
+
try{
|
54 |
+
// check if method authorize returns anything usefully
|
55 |
+
$method->authorize($payment, $amount);
|
56 |
+
$this->logger->addLog("Authorize order {$order->getIncrementId()} was successful");
|
57 |
+
} catch (Exception $e) {
|
58 |
+
$this->logger->addLog("Authorize order {$order->getIncrementId()} was not authorized:");
|
59 |
+
$this->logger->addLog($e->__toString());
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
return true;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Method to generate the invoice after a order was placed
|
68 |
+
* @param $order
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function generateInvoice($order)
|
72 |
+
{
|
73 |
+
if(!$order->canInvoice()){
|
74 |
+
$this->logger->addLog("Order {$order->getIncrementId()} can not be invoiced");
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
|
78 |
+
try {
|
79 |
+
|
80 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
81 |
+
|
82 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
83 |
+
$invoice->register();
|
84 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
85 |
+
->addObject($invoice)
|
86 |
+
->addObject($invoice->getOrder());
|
87 |
+
$transactionSave->save();
|
88 |
+
$this->logger->addLog("Invoice was created for order: {$order->getIncrementId()}");
|
89 |
+
|
90 |
+
$invoice->addComment('Automatic Invoice', false);
|
91 |
+
$invoice->sendEmail();
|
92 |
+
$invoice->setEmailSent(true);
|
93 |
+
$invoice->save();
|
94 |
+
|
95 |
+
$order->addStatusHistoryComment('Automatic Invoice: '.$invoice->getIncrementId());
|
96 |
+
$order->save();
|
97 |
+
} catch (Exception $e) {
|
98 |
+
$this->logger->addLog('Exception while creating invoice: ' . $e->__toString());
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
|
102 |
+
return true;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Method to walk the flow for an order when the config is set to unhold, invoice and capture.
|
107 |
+
* When guaranty is approved
|
108 |
+
* @param $order
|
109 |
+
* @param $reason
|
110 |
+
* @return bool
|
111 |
+
*/
|
112 |
+
public function unholdOrderAndCapture($order, $reason)
|
113 |
+
{
|
114 |
+
if(is_null($order->getId())){
|
115 |
+
$this->logger->addLog("Order was not found");
|
116 |
+
return false;
|
117 |
+
}
|
118 |
+
|
119 |
+
if(!$order->canUnhold()){
|
120 |
+
$this->logger->addLog("Order {$order->getIncrementId()} can not be unheld");
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
$status = $this->dataHelper->getOrderPaymentStatus($order);
|
124 |
+
|
125 |
+
try {
|
126 |
+
$order->unhold();
|
127 |
+
$order->addStatusHistoryComment("Signifyd: order unheld because $reason");
|
128 |
+
$order->save();
|
129 |
+
|
130 |
+
if ($this->logRequest) {
|
131 |
+
$this->logger->addLog("Order {$order->getIncrementId()} unheld because {$reason}");
|
132 |
+
}
|
133 |
+
|
134 |
+
// Authorize the order
|
135 |
+
$result = $this->authorizeOrder($order);
|
136 |
+
if($result === false){
|
137 |
+
$this->holdOrder($order, 'Fail to Authorize Order');
|
138 |
+
}
|
139 |
+
|
140 |
+
// Generate the invoice
|
141 |
+
if($status['capture'] !== true){
|
142 |
+
$result = $this->generateInvoice($order);
|
143 |
+
if($result === false){
|
144 |
+
$this->holdOrder($order, 'Fail to generate Invoice');
|
145 |
+
}
|
146 |
+
}
|
147 |
+
} catch (Exception $e) {
|
148 |
+
$this->logger->addLog("Order {$order->getIncrementId()} unable to be saved because {$e->getMessage()}");
|
149 |
+
$this->logger->addLog("Order {$order->getIncrementId()} was not unheld.");
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
|
153 |
+
return true;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Method to walk the flow for an order when the config is set to unhold only.
|
158 |
+
* When guaranty is approved
|
159 |
+
* @param $order
|
160 |
+
* @param $reason
|
161 |
+
* @return bool
|
162 |
+
*/
|
163 |
+
public function unholdOrder($order, $reason)
|
164 |
+
{
|
165 |
+
if(is_null($order->getId())){
|
166 |
+
$this->logger->addLog("Order was not found");
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
|
170 |
+
if(!$order->canUnhold()){
|
171 |
+
$this->logger->addLog("Order {$order->getIncrementId()} can not be unheld");
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
+
try {
|
176 |
+
$order->unhold();
|
177 |
+
$order->addStatusHistoryComment("Signifyd: order unheld because $reason");
|
178 |
+
$order->save();
|
179 |
+
|
180 |
+
// Authorize the order
|
181 |
+
// $result = $this->authorizeOrder($order);
|
182 |
+
// if($result === false){
|
183 |
+
// $this->holdOrder($order, 'Fail to Authorize Order');
|
184 |
+
// }
|
185 |
+
|
186 |
+
if ($this->logRequest) {
|
187 |
+
$this->logger->addLog("Order {$order->getIncrementId()} unheld because {$reason}");
|
188 |
+
}
|
189 |
+
} catch (Exception $e) {
|
190 |
+
$this->logger->addLog("Order {$order->getIncrementId()} unable to be saved because {$e->getMessage()}");
|
191 |
+
$this->logger->addLog("Order {$order->getIncrementId()} was not unheld.");
|
192 |
+
return false;
|
193 |
+
}
|
194 |
+
return true;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Method to hold the order whe the guaranty is declined
|
199 |
+
* @param $order
|
200 |
+
* @param $reason
|
201 |
+
* @return bool
|
202 |
+
*/
|
203 |
+
public function holdOrder($order, $reason)
|
204 |
+
{
|
205 |
+
if(is_null($order->getId())){
|
206 |
+
$this->logger->addLog("Order was not found");
|
207 |
+
return false;
|
208 |
+
}
|
209 |
+
|
210 |
+
if(!$order->canHold()){
|
211 |
+
$this->logger->addLog("Order {$order->getIncrementId()} can not be held");
|
212 |
+
return false;
|
213 |
+
}
|
214 |
+
|
215 |
+
try {
|
216 |
+
$order->hold();
|
217 |
+
$order->addStatusHistoryComment("Signifyd: order held because {$reason}");
|
218 |
+
$order->save();
|
219 |
+
|
220 |
+
if ($this->logRequest) {
|
221 |
+
$this->logger->addLog("Order {$order->getIncrementId()} held because {$reason}");
|
222 |
+
}
|
223 |
+
} catch (Exception $e){
|
224 |
+
$this->logger->addLog("Order {$order->getIncrementId()} unable to be saved because {$e->getMessage()}");
|
225 |
+
$this->logger->addLog("Order {$order->getIncrementId()} was not held.");
|
226 |
+
return false;
|
227 |
+
}
|
228 |
+
|
229 |
+
return true;
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Method to hold the order whe the guaranty is declined and magento config is set to cancel the order
|
234 |
+
* @param $order
|
235 |
+
* @param $reason
|
236 |
+
* @return bool
|
237 |
+
*/
|
238 |
+
public function cancelOrder($order, $reason)
|
239 |
+
{
|
240 |
+
if(is_null($order->getId())){
|
241 |
+
$this->logger->addLog("Order was not found");
|
242 |
+
return false;
|
243 |
+
}
|
244 |
+
|
245 |
+
if ($order->getState() === $order::STATE_HOLDED) {
|
246 |
+
$this->unholdOrder($order, $reason);
|
247 |
+
}
|
248 |
+
|
249 |
+
if(!$order->canCancel()){
|
250 |
+
$this->logger->addLog("Order {$order->getIncrementId()} can not be canceled");
|
251 |
+
return false;
|
252 |
+
}
|
253 |
+
|
254 |
+
try {
|
255 |
+
$order->cancel();
|
256 |
+
$order->addStatusHistoryComment("Signifyd: order canceled because $reason");
|
257 |
+
$order->save();
|
258 |
+
|
259 |
+
if ($this->logRequest) {
|
260 |
+
$this->logger->addLog("Order {$order->getIncrementId()} cancelled because {$reason}");
|
261 |
+
}
|
262 |
+
} catch (Exception $e){
|
263 |
+
$this->logger->addLog("Order {$order->getIncrementId()} unable to be saved because {$e->getMessage()}");
|
264 |
+
$this->logger->addLog("Order {$order->getIncrementId()} was not canceled.");
|
265 |
+
return false;
|
266 |
+
}
|
267 |
+
|
268 |
+
return true;
|
269 |
+
}
|
270 |
+
/*
|
271 |
+
public function voidOrderPayment($order, $reason)
|
272 |
+
{
|
273 |
+
if(is_null($order->getId())){
|
274 |
+
$this->logger->addLog("Order was not found");
|
275 |
+
return false;
|
276 |
+
}
|
277 |
+
$payment = $order->getPayment();
|
278 |
+
$method = $payment->getMethodInstance();
|
279 |
+
|
280 |
+
if(!$method->canVoid($payment)){
|
281 |
+
$this->logger->addLog("Payment for order {$order->getIncrementId()} can not be voided");
|
282 |
+
return false;
|
283 |
+
}
|
284 |
+
|
285 |
+
try{
|
286 |
+
$method->void($payment);
|
287 |
+
$order->save();
|
288 |
+
$this->cancelOrder($order, $reason);
|
289 |
+
$this->logger->addLog("Void order payment {$order->getIncrementId()} was successful");
|
290 |
+
} catch (Exception $e) {
|
291 |
+
$this->holdOrder($order, 'Signifyd: Failed to void order payment');
|
292 |
+
$this->logger->addLog("Void order payment {$order->getIncrementId()} was not authorized:");
|
293 |
+
$this->logger->addLog($e->__toString());
|
294 |
+
return false;
|
295 |
+
}
|
296 |
+
|
297 |
+
return true;
|
298 |
+
}
|
299 |
+
*/
|
300 |
+
|
301 |
+
public function keepOrderOnHold($order, $reason)
|
302 |
+
{
|
303 |
+
if(is_null($order->getId())){
|
304 |
+
$this->logger->addLog("Order was not found");
|
305 |
+
return false;
|
306 |
+
}
|
307 |
+
|
308 |
+
if($order->getStatus() != Mage_Sales_Model_Order::STATE_HOLDED){
|
309 |
+
try{
|
310 |
+
$this->holdOrder($order, $reason);
|
311 |
+
}catch (Exception $e){
|
312 |
+
$this->logger->addLog($e->__toString());
|
313 |
+
}
|
314 |
+
}
|
315 |
+
$this->logger->addLog("Order {$order->getIncrementId()} was kept on hold because {$reason}");
|
316 |
+
|
317 |
+
return true;
|
318 |
+
}
|
319 |
+
|
320 |
+
public function cancelCloseOrder($order, $reason)
|
321 |
+
{
|
322 |
+
$status = $this->dataHelper->getOrderPaymentStatus($order);
|
323 |
+
if(is_null($order->getId())){
|
324 |
+
$this->logger->addLog("Order was not found");
|
325 |
+
return false;
|
326 |
+
}
|
327 |
+
if(!$order->canUnhold()){
|
328 |
+
$this->logger->addLog("Order {$order->getIncrementId()} can not be unheld");
|
329 |
+
return false;
|
330 |
+
}
|
331 |
+
try {
|
332 |
+
$order->unhold();
|
333 |
+
$order->addStatusHistoryComment("Signifyd: order unheld because $reason");
|
334 |
+
$order->save();
|
335 |
+
$this->logger->addLog("Order {$order->getIncrementId()} unheld in order to cancel it");
|
336 |
+
} catch (Exception $e){
|
337 |
+
|
338 |
+
$this->logger->addLog("Order {$order->getIncrementId()} can not be unheld");
|
339 |
+
$this->logger->addLog($e->__toString());
|
340 |
+
return false;
|
341 |
+
}
|
342 |
+
|
343 |
+
// if($status['authorize'] === true && $status['capture'] === false) {
|
344 |
+
// $this->logger->addLog("cancel close order5");
|
345 |
+
// $this->voidOrderPayment($order, $reason);
|
346 |
+
if($status['authorize'] === true && $status['capture'] === true) {
|
347 |
+
$result = $this->canNotCancel($order, $reason);
|
348 |
+
} else {
|
349 |
+
$result = $this->cancelOrder($order, $reason);
|
350 |
+
}
|
351 |
+
if($result === false){
|
352 |
+
$this->holdOrder($order, 'Fail to Cancel/Close Order');
|
353 |
+
}
|
354 |
+
return true;
|
355 |
+
}
|
356 |
+
|
357 |
+
public function checkStatus($order, $status)
|
358 |
+
{
|
359 |
+
$theOrder = Mage::getModel('sales/order')->load($order->getId());
|
360 |
+
return ($theOrder->getStatus() == $status)? true : false;
|
361 |
+
}
|
362 |
+
|
363 |
+
public function finalStatus($order, $type, $case)
|
364 |
+
{
|
365 |
+
$id = (is_array($case))? $case['order_increment'] : $case->getId();
|
366 |
+
try {
|
367 |
+
$holdStatus = $this->checkStatus($order, Mage_Sales_Model_Order::STATE_HOLDED);
|
368 |
+
$caseModel = Mage::getModel('signifyd_connect/case');
|
369 |
+
// type refers to the need to by held or not held: 1 needs to be held, 2 needs to be not held
|
370 |
+
if($type == 1){
|
371 |
+
// needs to be true
|
372 |
+
if($holdStatus === true){
|
373 |
+
$caseModel->setMagentoStatusTo($case, Signifyd_Connect_Helper_Data::COMPLETED_STATUS);
|
374 |
+
}
|
375 |
+
} elseif($type == 2) {
|
376 |
+
// needs to be false
|
377 |
+
if($holdStatus === false){
|
378 |
+
$caseModel->setMagentoStatusTo($case, Signifyd_Connect_Helper_Data::COMPLETED_STATUS);
|
379 |
+
}
|
380 |
+
} else {
|
381 |
+
$this->logger->addLog('Final status unknown type');
|
382 |
+
}
|
383 |
+
|
384 |
+
$this->logger->addLog("Case no:{$id}, set status to complete successful.");
|
385 |
+
} catch (Exception $e){
|
386 |
+
$this->logger->addLog("Case no:{$id}, set status to complete fail: " . $e->__toString());
|
387 |
+
return false;
|
388 |
+
}
|
389 |
+
|
390 |
+
return true;
|
391 |
+
}
|
392 |
+
|
393 |
+
public function canNotCancel($order, $reason)
|
394 |
+
{
|
395 |
+
try {
|
396 |
+
$order->hold();
|
397 |
+
$order->addStatusHistoryComment("Signifyd: order held because $reason");
|
398 |
+
$order->addStatusHistoryComment("Signifyd: order can not be canceled because it has a sum already captured, Please do a manual refund.");
|
399 |
+
$order->save();
|
400 |
+
$this->logger->addLog("Order {$order->getIncrementId()} was held because {$reason}");
|
401 |
+
} catch (Exception $e){
|
402 |
+
$this->logger->addLog("Order {$order->getIncrementId()} could not be held: " . $e->__toString());
|
403 |
+
return false;
|
404 |
+
}
|
405 |
+
|
406 |
+
return true;
|
407 |
+
}
|
408 |
+
|
409 |
+
}
|
410 |
+
|
411 |
+
/* Filename: Order.php */
|
412 |
+
/* Location: ../app/code/Community/Signifyd/Connect/Model/Order.php */
|
app/code/community/Signifyd/Connect/Model/Order/Payment.php
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' => 1,
|
11 |
+
'label' => 'Do nothing'
|
12 |
+
),
|
13 |
+
array(
|
14 |
+
'value' => 2,
|
15 |
+
'label' => 'Capture and Invoice'
|
16 |
+
)
|
17 |
+
);
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Declined.php
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' => 'Do nothing'
|
12 |
+
),
|
13 |
+
array(
|
14 |
+
'value' => 2,
|
15 |
+
'label' => 'Cancel and Void'
|
16 |
+
)
|
17 |
+
);
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Signifyd/Connect/Model/System/Config/Source/Options/Negative.php
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 |
-
|
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,593 +1,523 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
public $
|
12 |
-
|
13 |
-
public
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
public
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
{
|
35 |
-
return Mage::getStoreConfig('signifyd_connect/advanced/
|
36 |
-
}
|
37 |
-
|
38 |
-
public function
|
39 |
-
{
|
40 |
-
return Mage::getStoreConfig('signifyd_connect/
|
41 |
-
}
|
42 |
-
|
43 |
-
public function
|
44 |
-
{
|
45 |
-
return Mage::getStoreConfig('signifyd_connect/
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
$
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
if ($
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
}
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
$
|
379 |
-
|
380 |
-
$
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
public function
|
435 |
-
{
|
436 |
-
if (
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
$
|
453 |
-
}
|
454 |
-
|
455 |
-
if ($
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
$
|
460 |
-
|
461 |
-
$this->
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
}
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
$request = $this->getRawPost();
|
525 |
-
|
526 |
-
$hash = $this->getHeader('X-SIGNIFYD-SEC-HMAC-SHA256');
|
527 |
-
|
528 |
-
if ($this->logRequest()) {
|
529 |
-
Mage::log('API request: ' . $request, null, 'signifyd_connect.log');
|
530 |
-
Mage::log('API request hash: ' . $hash, null, 'signifyd_connect.log');
|
531 |
-
}
|
532 |
-
|
533 |
-
if ($request) {
|
534 |
-
if ($this->validRequest($request, $hash)) {
|
535 |
-
$this->initRequest($request);
|
536 |
-
|
537 |
-
$topic = $this->_topic;
|
538 |
-
|
539 |
-
if ($this->logRequest()) {
|
540 |
-
Mage::log('API request topic: ' . $topic, null, 'signifyd_connect.log');
|
541 |
-
}
|
542 |
-
|
543 |
-
switch ($topic) {
|
544 |
-
case "cases/creation":
|
545 |
-
try {
|
546 |
-
$this->processCreation($request);
|
547 |
-
} catch (Exception $e) {
|
548 |
-
if ($this->logErrors()) {
|
549 |
-
Mage::log('Case scoring issue: ' . $e->__toString(), null, 'signifyd_connect.log');
|
550 |
-
}
|
551 |
-
}
|
552 |
-
break;
|
553 |
-
case "cases/rescore":
|
554 |
-
case "cases/review":
|
555 |
-
try {
|
556 |
-
$this->processReview($request);
|
557 |
-
} catch (Exception $e) {
|
558 |
-
if ($this->logErrors()) {
|
559 |
-
Mage::log('Case review issue: ' . $e->__toString(), null, 'signifyd_connect.log');
|
560 |
-
}
|
561 |
-
}
|
562 |
-
break;
|
563 |
-
case "guarantees/completion":
|
564 |
-
try {
|
565 |
-
$this->processGuarantee($request);
|
566 |
-
} catch (Exception $ex) {
|
567 |
-
if ($this->logErrors()) {
|
568 |
-
Mage::log('Case guarantee issue: ' . $ex->__toString(), null, 'signifyd_connect.log');
|
569 |
-
}
|
570 |
-
}
|
571 |
-
break;
|
572 |
-
case "cases/test":
|
573 |
-
// Test is only verifying that the endpoint is reachable. So we just complete here
|
574 |
-
break;
|
575 |
-
|
576 |
-
default:
|
577 |
-
$this->unsupported();
|
578 |
-
}
|
579 |
-
} else {
|
580 |
-
if ($this->logRequest()) {
|
581 |
-
Mage::log('API request failed auth', null, 'signifyd_connect.log');
|
582 |
-
}
|
583 |
-
|
584 |
-
$this->processFallback($request);
|
585 |
-
}
|
586 |
-
} else {
|
587 |
-
echo $this->getDefaultMessage();
|
588 |
-
}
|
589 |
-
|
590 |
-
$this->complete();
|
591 |
-
}
|
592 |
-
|
593 |
-
}
|
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/error');
|
52 |
+
}
|
53 |
+
|
54 |
+
public function logRequest()
|
55 |
+
{
|
56 |
+
return Mage::getStoreConfig('signifyd_connect/log/request');
|
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,214 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<config>
|
4 |
-
<modules>
|
5 |
-
<Signifyd_Connect>
|
6 |
-
<version>3.
|
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 |
-
<
|
17 |
-
<
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
<
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
<connection>
|
44 |
-
<use>
|
45 |
-
</connection>
|
46 |
-
</
|
47 |
-
<
|
48 |
-
<connection>
|
49 |
-
<use>
|
50 |
-
</connection>
|
51 |
-
</
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
</
|
57 |
-
</
|
58 |
-
<
|
59 |
-
<signifyd_connect>
|
60 |
-
<class>
|
61 |
-
</signifyd_connect>
|
62 |
-
</
|
63 |
-
<
|
64 |
-
<
|
65 |
-
<
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
<
|
79 |
-
<
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
<
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
<
|
120 |
-
|
121 |
-
|
122 |
-
<
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
<
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
<
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
<
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Signifyd_Connect>
|
6 |
+
<version>3.15.0</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 |
+
</config>
|
app/code/community/Signifyd/Connect/etc/system.xml
CHANGED
@@ -1,222 +1,133 @@
|
|
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
|
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>
|
34 |
-
<show_in_store>
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
<
|
39 |
-
<
|
40 |
-
<
|
41 |
-
<
|
42 |
-
<
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
<
|
67 |
-
<
|
68 |
-
<
|
69 |
-
<
|
70 |
-
<
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
<
|
84 |
-
<
|
85 |
-
|
86 |
-
|
87 |
-
<
|
88 |
-
<
|
89 |
-
<
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
<
|
103 |
-
<
|
104 |
-
<
|
105 |
-
<
|
106 |
-
|
107 |
-
|
108 |
-
<
|
109 |
-
|
110 |
-
|
111 |
-
<
|
112 |
-
<
|
113 |
-
<
|
114 |
-
<
|
115 |
-
<
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
<
|
121 |
-
<
|
122 |
-
<
|
123 |
-
<
|
124 |
-
<
|
125 |
-
<
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
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>0</show_in_website>
|
197 |
-
<show_in_store>0</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>0</show_in_website>
|
206 |
-
<show_in_store>0</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>0</show_in_website>
|
215 |
-
<show_in_store>0</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 |
+
<settings translate="label">
|
20 |
+
<label>General</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>2</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
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 |
+
</enabled>
|
36 |
+
<key translate="label">
|
37 |
+
<label>API Key</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>20</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</key>
|
44 |
+
</fields>
|
45 |
+
</settings>
|
46 |
+
<advanced>
|
47 |
+
<label>Order Workflow</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>2</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
<fields>
|
54 |
+
<accepted_from_guaranty translate="label">
|
55 |
+
<label>When an order is approved for Guarantee:</label>
|
56 |
+
<frontend_type>select</frontend_type>
|
57 |
+
<source_model>signifyd_connect/system_config_source_options_accepted</source_model>
|
58 |
+
<sort_order>20</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</accepted_from_guaranty>
|
63 |
+
<declined_from_guaranty translate="label">
|
64 |
+
<label>When an order is declined for Guarantee:</label>
|
65 |
+
<frontend_type>select</frontend_type>
|
66 |
+
<source_model>signifyd_connect/system_config_source_options_declined</source_model>
|
67 |
+
<sort_order>30</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
</declined_from_guaranty>
|
72 |
+
</fields>
|
73 |
+
</advanced>
|
74 |
+
<webhook>
|
75 |
+
<label>Webhook URL</label>
|
76 |
+
<frontend_type>text</frontend_type>
|
77 |
+
<sort_order>3</sort_order>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>1</show_in_website>
|
80 |
+
<show_in_store>1</show_in_store>
|
81 |
+
<fields>
|
82 |
+
<url translate="label">
|
83 |
+
<label>Webhook URL</label>
|
84 |
+
<frontend_type>label</frontend_type>
|
85 |
+
<sort_order>30</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>1</show_in_store>
|
89 |
+
<comment><model>signifyd_connect/link</model></comment>
|
90 |
+
</url>
|
91 |
+
</fields>
|
92 |
+
</webhook>
|
93 |
+
<log translate="label">
|
94 |
+
<label>Logging</label>
|
95 |
+
<frontend_type>text</frontend_type>
|
96 |
+
<sort_order>4</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
<fields>
|
101 |
+
<request>
|
102 |
+
<label>Log requests</label>
|
103 |
+
<frontend_type>select</frontend_type>
|
104 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
105 |
+
<sort_order>1</sort_order>
|
106 |
+
<show_in_default>1</show_in_default>
|
107 |
+
<show_in_website>1</show_in_website>
|
108 |
+
<show_in_store>1</show_in_store>
|
109 |
+
</request>
|
110 |
+
<response>
|
111 |
+
<label>Log responses</label>
|
112 |
+
<frontend_type>select</frontend_type>
|
113 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
114 |
+
<sort_order>2</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>1</show_in_website>
|
117 |
+
<show_in_store>1</show_in_store>
|
118 |
+
</response>
|
119 |
+
<error>
|
120 |
+
<label>Log errors</label>
|
121 |
+
<frontend_type>select</frontend_type>
|
122 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
123 |
+
<sort_order>3</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>1</show_in_website>
|
126 |
+
<show_in_store>1</show_in_store>
|
127 |
+
</error>
|
128 |
+
</fields>
|
129 |
+
</log>
|
130 |
+
</groups>
|
131 |
+
</signifyd_connect>
|
132 |
+
</sections>
|
133 |
+
</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.14.0-3.15.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/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.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
@@ -9,10 +9,10 @@
|
|
9 |
<summary>Signifyd protects e-commerce merchants from fraudulent buyers.</summary>
|
10 |
<description>Supports all versions of Magento</description>
|
11 |
<notes>Supports all versions of Magento</notes>
|
12 |
-
<authors><author><name>signifyd</name><user>
|
13 |
-
<date>2016-
|
14 |
-
<time>
|
15 |
-
<contents><target name="
|
16 |
<compatible/>
|
17 |
-
<dependencies
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Signifyd_Connect</name>
|
4 |
+
<version>3.15.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Signifyd protects e-commerce merchants from fraudulent buyers.</summary>
|
10 |
<description>Supports all versions of Magento</description>
|
11 |
<notes>Supports all versions of Magento</notes>
|
12 |
+
<authors><author><name>signifyd</name><user>signifyd</user><email>manelis@signifyd.com</email></author></authors>
|
13 |
+
<date>2016-09-07</date>
|
14 |
+
<time>12:07:40</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Signifyd"><dir name="Connect"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="eed53eab290b65da639e22fe195f9fcb"/></dir><file name="Order.php" hash="89619b9c5c9795e98e7637b4c5396888"/></dir></dir><file name="Renderer.php" hash="dce3cc400745afa31806e7de6dbf9d02"/><file name="Url.php" hash="dbe3e967879a69a2c943056f820e4688"/></dir><dir name="Helper"><file name="Data.php" hash="e4584d73cb17e75f871759c47daabb53"/><file name="Log.php" hash="96f1286eb9c273f637178ffd94a04d42"/></dir><dir name="Model"><file name="Authnet.php" hash="876c96e26693d26adf194e889c1a802e"/><file name="Case.php" hash="db5387f02172996e6ee83b00a687820f"/><file name="Cron.php" hash="fddfc61904a2d844c35a78593a6712b8"/><file name="Link.php" hash="989876b57bd340597372e20570086abe"/><file name="Observer.php" hash="46b0b3d8908ce19f81bd9f381b14d96c"/><dir name="Order"><file name="Payment.php" hash="a0ad3107170b7bae94b8402960b5cf48"/></dir><file name="Order.php" hash="9c7a8fa528a95fbcf42b7231909a4496"/><dir name="Resource"><dir name="Case"><file name="Collection.php" hash="a1ed45e9bde8f823384009c6d1a6be64"/></dir><file name="Case.php" hash="19ae43ac4339a6efa4c5399b7524c61a"/><dir name="Retries"><file name="Collection.php" hash="04e0aa690b9887b7c24c48c92adc62b5"/></dir><file name="Retries.php" hash="ab59ce50d0b089a0b001250d49377719"/></dir><file name="Retries.php" hash="3a945234c76244d2d8cccf8a2b67309c"/><file name="Setup.php" hash="89df3e016fa0a582f9eb94c55dee1ede"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Options"><file name="Accepted.php" hash="1dcb358d451c75f297921bbf84e9bd3b"/><file name="Declined.php" hash="ed2441579a7bad4e7505a6f0a3f530ac"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="SignifydController.php" hash="145877221ca9e5b0fd3adbefb1b42315"/></dir><file name="ConnectController.php" hash="c3eed72ff1b813ffda0b4ac69c11271f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bfe6943cf5eab707f64694f555b9f2c1"/><file name="config.xml" hash="266f892e6d108970a9be55a9577df1d0"/><file name="system.xml" hash="bc12ac0cc5f189d95b2127e2414a25a4"/></dir><dir name="sql"><dir name="signifyd_connect_setup"><file name="mysql4-install-3.1.1.php" hash="119e423f67c7e47c345374eddbb1dfe5"/><file name="mysql4-install-3.12.0.php" hash="3dd59c1e20105629157dfe134193dcb9"/><file name="mysql4-install-3.3.0.php" hash="455c92d22c1e5c55661f050ca19f82f6"/><file name="mysql4-install-3.4.0.php" hash="383226cc656aa9e0db194178be7dfc10"/><file name="mysql4-install-3.4.5.php" hash="f8eaec5f235b7bb16777720e0e999268"/><file name="mysql4-install-3.7.0.php" hash="cdc3701ad0793bc360addfec51466605"/><file name="mysql4-install-3.8.0.php" hash="f74e65329444df9b088c00d5837f4593"/><file name="mysql4-upgrade-3.10.0-3.10.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.10.1-3.11.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.11.0-3.11.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.11.1-3.12.0.php" hash="703ddd745468f40c75758cd8066d63fe"/><file name="mysql4-upgrade-3.12.0-3.13.0.php" hash="333f7116c34aa765f4e7efaf8be5feda"/><file name="mysql4-upgrade-3.14.0-3.15.0.php" hash="7cde716fe0e3e849c1f82bbd7bf8ec3a"/><file name="mysql4-upgrade-3.2.0-3.2.1.php" hash="26f702c9c4d38873e0050657b003ffd4"/><file name="mysql4-upgrade-3.2.1-3.2.2.php" hash="4a5fe35d03268d0a8448a1accaf64958"/><file name="mysql4-upgrade-3.2.2-3.2.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.2.3-3.3.0.php" hash="7b5c5ae2ac87cc7fef2ac99bc28b27ae"/><file name="mysql4-upgrade-3.3.0-3.4.0.php" hash="8faecf3097eaf538fece8fe91b575356"/><file name="mysql4-upgrade-3.4.0-3.4.1.php" hash="11ad4be0af110283e2ce34b1315721f1"/><file name="mysql4-upgrade-3.4.1-3.4.2.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.2-3.4.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.3-3.4.4.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.4-3.4.5.php" hash="5320d366b6f72258f4e27a046ba04c3c"/><file name="mysql4-upgrade-3.4.5-3.4.6.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.6-3.4.7.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.7-3.4.8.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.4.8-3.5.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.0-3.5.1.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.1-3.5.2.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.2-3.5.3.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.5.3-3.6.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.6.0-3.7.0.php" hash="1462d8ccaf0d0480d31a47afb3a00f63"/><file name="mysql4-upgrade-3.7.0-3.8.0.php" hash="758799806d039277d8d509e017c64535"/><file name="mysql4-upgrade-3.8.0-3.9.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/><file name="mysql4-upgrade-3.9.0-3.10.0.php" hash="51c0d94a292f36f373d1a14eb1ce6468"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Signifyd_Connect.xml" hash="0f6a1fe90c078db114746aa381208982"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|