Signifyd_Connect - Version 3.4.2

Version Notes

Supports all versions of Magento

Download this release

Release Info

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


Version 3.4.2

Files changed (24) hide show
  1. app/code/community/Signifyd/Connect/Block/Renderer.php +24 -0
  2. app/code/community/Signifyd/Connect/Helper/Data.php +156 -0
  3. app/code/community/Signifyd/Connect/Model/Case.php +9 -0
  4. app/code/community/Signifyd/Connect/Model/Cron.php +9 -0
  5. app/code/community/Signifyd/Connect/Model/Link.php +9 -0
  6. app/code/community/Signifyd/Connect/Model/Observer.php +596 -0
  7. app/code/community/Signifyd/Connect/Model/Resource/Case.php +9 -0
  8. app/code/community/Signifyd/Connect/Model/Resource/Case/Collection.php +9 -0
  9. app/code/community/Signifyd/Connect/Model/Setup.php +53 -0
  10. app/code/community/Signifyd/Connect/controllers/ConnectController.php +366 -0
  11. app/code/community/Signifyd/Connect/etc/config.xml +155 -0
  12. app/code/community/Signifyd/Connect/etc/system.xml +149 -0
  13. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.1.1.php +13 -0
  14. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.3.0.php +19 -0
  15. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.4.0.php +21 -0
  16. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.0-3.2.1.php +5 -0
  17. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.1-3.2.2.php +17 -0
  18. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.2-3.2.3.php +8 -0
  19. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.3-3.3.0.php +10 -0
  20. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.3.0-3.4.0.php +11 -0
  21. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.0-3.4.1.php +10 -0
  22. app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.1-3.4.2.php +8 -0
  23. app/etc/modules/Signifyd_Connect.xml +9 -0
  24. package.xml +18 -0
app/code/community/Signifyd/Connect/Block/Renderer.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $helper = Mage::helper('signifyd_connect');
9
+
10
+ $url = $helper->getCaseUrl($row->getIncrementId());
11
+
12
+ if (!is_numeric($value)) {
13
+ return $helper->__('N/A');
14
+ }
15
+
16
+ $value = floor($value);
17
+
18
+ if ($url) {
19
+ $value = "<a href=\"$url\" target=\"_blank\">$value</a>";
20
+ }
21
+
22
+ return $value;
23
+ }
24
+ }
app/code/community/Signifyd/Connect/Helper/Data.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Signifyd_Connect_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function getProductUrl($product)
6
+ {
7
+ $url = null;
8
+
9
+ try {
10
+ $url = $product->getUrlModel()->getProductUrl($product);
11
+ } catch (Exception $e) {
12
+ $url = null;
13
+ }
14
+
15
+ return $url;
16
+ }
17
+
18
+ public function getCaseUrl($order_id)
19
+ {
20
+ $collection = Mage::getModel('signifyd_connect/case')->getCollection()->addFieldToFilter('order_increment', $order_id);
21
+
22
+ foreach ($collection as $case) {
23
+ if ($case->getCode()) {
24
+ return "https://www.signifyd.com/cases/" . $case->getCode();
25
+ }
26
+ }
27
+ }
28
+
29
+ public function getProductImage($product, $size="150")
30
+ {
31
+ $image = null;
32
+
33
+ try {
34
+ $image = (string)Mage::helper('catalog/image')->init($product, 'image')->resize($size, $size)->keepFrame(true)->keepAspectRatio(true);
35
+ } catch (Exception $e) {
36
+ $image = null;
37
+ }
38
+
39
+ return $image;
40
+ }
41
+
42
+ public function getStoreName()
43
+ {
44
+ $store = Mage::app()->getStore();
45
+
46
+ return Mage::getStoreConfig('trans_email/ident_general/name', 0);
47
+ }
48
+
49
+ public function getStoreEmail()
50
+ {
51
+ return Mage::getStoreConfig('trans_email/ident_general/email', 0);
52
+ }
53
+
54
+ public function getStoreUrl()
55
+ {
56
+ return Mage::getBaseUrl();
57
+ }
58
+
59
+ public function isProcessed($order)
60
+ {
61
+ $collection = Mage::getModel('signifyd_connect/case')->getCollection()->addFieldToFilter('order_increment', $order->getIncrementId());
62
+
63
+ if (count($collection)) {
64
+ return true;
65
+ }
66
+
67
+ return false;
68
+ }
69
+
70
+ public function markProcessed($order)
71
+ {
72
+ $case = Mage::getModel('signifyd_connect/case');
73
+ $case->setOrderIncrement($order->getIncrementId());
74
+ $case->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
75
+ $case->setUpdatedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
76
+ $case->save();
77
+
78
+ return $case;
79
+ }
80
+
81
+ public function unmarkProcessed($order)
82
+ {
83
+ $collection = Mage::getModel('signifyd_connect/case')->getCollection()->addFieldToFilter('order_increment', $order->getIncrementId());
84
+
85
+ foreach ($collection as $case) {
86
+ $case->delete();
87
+ }
88
+ }
89
+
90
+ public function request($url, $data=null, $auth=null, $contenttype="application/x-www-form-urlencoded", $accept=null)
91
+ {
92
+ if (Mage::getStoreConfig('signifyd_connect/log/request')) {
93
+ Mage::log("Request:\nURL: $url \nAuth: $auth\nData: $data", null, 'signifyd_connect.log');
94
+ }
95
+
96
+ $curl = curl_init();
97
+ $response = new Varien_Object;
98
+ $headers = array();
99
+
100
+ curl_setopt($curl, CURLOPT_URL, $url);
101
+
102
+ if (stripos($url, 'https://') === 0) {
103
+ curl_setopt($curl, CURLOPT_PORT, 443);
104
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
105
+ }
106
+
107
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
108
+
109
+ if ($auth) {
110
+ curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
111
+ curl_setopt($curl, CURLOPT_USERPWD, $auth);
112
+ }
113
+
114
+ if ($accept) {
115
+ $headers[] = 'Accept: ' . $accept;
116
+ }
117
+
118
+ if ($data) {
119
+ curl_setopt($curl, CURLOPT_POST, 1);
120
+ $headers[] = "Content-Type: $contenttype";
121
+ $headers[] = "Content-length: " . strlen($data);
122
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
123
+ }
124
+
125
+ if (count($headers)) {
126
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
127
+ }
128
+
129
+ curl_setopt($curl, CURLOPT_TIMEOUT, 4);
130
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 4);
131
+
132
+ $raw_response = curl_exec($curl);
133
+ $response->setRawResponse($raw_response);
134
+
135
+ $response_data = curl_getinfo($curl);
136
+ $response->addData($response_data);
137
+
138
+ if (Mage::getStoreConfig('signifyd_connect/log/response')) {
139
+ Mage::log("Response ($url):\n " . print_r($response, true), null, 'signifyd_connect.log');
140
+ }
141
+
142
+ if ($raw_response === false || curl_errno($curl)) {
143
+ $error = curl_error($curl);
144
+
145
+ if (Mage::getStoreConfig('signifyd_connect/log/error')) {
146
+ Mage::log("ERROR ($url):\n$error", null, 'signifyd_connect.log');
147
+ }
148
+
149
+ $response->setData('error', $error);
150
+ }
151
+
152
+ curl_close($curl);
153
+
154
+ return $response;
155
+ }
156
+ }
app/code/community/Signifyd/Connect/Model/Case.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Case extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('signifyd_connect/case');
8
+ }
9
+ }
app/code/community/Signifyd/Connect/Model/Cron.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Cron
4
+ {
5
+ public function update()
6
+ {
7
+ return; // Deprecated
8
+ }
9
+ }
app/code/community/Signifyd/Connect/Model/Link.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Link
4
+ {
5
+ public function getCommentText()
6
+ {
7
+ return "Turn this on if you would like to receive signifyd scores. Visit this url to confirm the callback functionality is working: <a href=\"" . Mage::getUrl('signifyd/connect/api') . "\" target=\"_blank\">" . Mage::getUrl('signifyd/connect/api') . "</a>";
8
+ }
9
+ }
app/code/community/Signifyd/Connect/Model/Observer.php ADDED
@@ -0,0 +1,596 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Signifyd_Connect_Model_Observer extends Varien_Object
4
+ {
5
+ public $customer = null;
6
+ public $order = null;
7
+ public $payment = null;
8
+ public $quote = null;
9
+ public $shipping_address = null;
10
+ public $billing_address = null;
11
+
12
+ public function getProducts()
13
+ {
14
+ $products = array();
15
+ $helper = Mage::helper('signifyd_connect');
16
+
17
+ foreach ($this->quote->getAllItems() as $item) {
18
+ if (!$item->getProductType() || $item->getProductType() == 'simple') {
19
+ $product_object = $item->getData('product');
20
+
21
+ if (!$product_object || !$product_object->getId()) {
22
+ $product_object = Mage::getModel('catalog/product')->load($item->getProductId());
23
+ }
24
+
25
+ if ($product_object) {
26
+ $product = array();
27
+
28
+ $product['itemId'] = $item->getSku();
29
+ $product['itemName'] = $item->getName();
30
+ $product['itemUrl'] = $helper->getProductUrl($product_object);
31
+ $product['itemImage'] = $helper->getProductImage($product_object);
32
+
33
+ $qty = 1;
34
+ if ($item->getQty()) {
35
+ $qty = $item->getQty();
36
+ } else if ($item->getQtyOrdered()) {
37
+ $qty = $item->getQtyOrdered();
38
+ }
39
+
40
+ $price = 0;
41
+ if ($item->getBasePrice() > 0) {
42
+ $price = $item->getBasePrice();
43
+ } else if ($item->getPrice() > 0) {
44
+ $price = $item->getPrice();
45
+ } else if ($product_object->getData('price') > 0) {
46
+ $price = $product_object->getData('price');
47
+ } else {
48
+ $parent = $item->getData('parent');
49
+
50
+ if (!$parent) {
51
+ $parent = $item->getParentItem();
52
+ }
53
+
54
+ if ($parent) {
55
+ if ($parent->getBasePrice() > 0) {
56
+ $price = $parent->getBasePrice();
57
+ } else if ($parent->getPrice()) {
58
+ $price = $parent->getPrice();
59
+ }
60
+ }
61
+ }
62
+
63
+ $weight = 0;
64
+ if ($item->hasWeight()) {
65
+ $weight = $item->getWeight();
66
+ } else if ($product_object->hasWeight()) {
67
+ $weight = $product_object->getWeight();
68
+ }
69
+
70
+ $product['itemQuantity'] = intval($qty);
71
+ $product['itemPrice'] = floatval($price);
72
+ $product['itemWeight'] = floatval($weight);
73
+
74
+ $products[] = $product;
75
+ }
76
+ }
77
+ }
78
+
79
+ return $products;
80
+ }
81
+
82
+ public function getIPAddress()
83
+ {
84
+ if ($this->order->getRemoteIp()) {
85
+ if ($this->order->getXForwardedFor()) {
86
+ return $this->order->getXForwardedFor();
87
+ }
88
+
89
+ return $this->order->getRemoteIp();
90
+ }
91
+
92
+ // Checks each configured value in app/etc/local.xml & falls back to REMOTE_ADDR. See app/etc/local.xml.additional for examples.
93
+ return Mage::helper('core/http')->getRemoteAddr(false);
94
+ }
95
+
96
+ public function formatAvs($value)
97
+ {
98
+ // http://www.emsecommerce.net/avs_cvv2_response_codes.htm
99
+ $codes = array('X', 'Y', 'A', 'W', 'Z', 'N', 'U', 'R', 'E', 'S', 'D', 'M', 'B', 'P', 'C', 'I', 'G');
100
+
101
+ if ($value) {
102
+ $value = strtoupper($value);
103
+
104
+ if (strlen($value) > 1) {
105
+ if (preg_match('/\([A-Z]\)/', $value)) {
106
+ $matches = array();
107
+
108
+ preg_match('/\([A-Z]\)/', $value, $matches);
109
+
110
+ foreach ($matches as $match) {
111
+ $match = preg_replace('/[^A-Z]/', '', $match);
112
+
113
+ if (in_array($match, $codes)) {
114
+ $value = $match;
115
+ }
116
+ }
117
+ }
118
+ }
119
+
120
+ if (strlen($value) > 1) {
121
+ $value = substr($value, 0, 1);
122
+ }
123
+
124
+ if (!in_array($value, $codes)) {
125
+ $value = null;
126
+ }
127
+ }
128
+
129
+ return $value;
130
+ }
131
+
132
+ public function getAvsResponse()
133
+ {
134
+ $payment = $this->payment;
135
+
136
+ $value = null;
137
+
138
+ if ($payment->getAdditionalInformation('paypal_avs_code')) {
139
+ $value = $payment->getAdditionalInformation('paypal_avs_code');
140
+ } else if ($payment->getAdditionalInformation('cc_avs_status')) {
141
+ $value = $payment->getAdditionalInformation('cc_avs_status');
142
+ }
143
+
144
+ return $this->formatAvs($value);
145
+ }
146
+
147
+ public function getCvvResponse()
148
+ {
149
+ $payment = $this->payment;
150
+
151
+ if ($payment->getAdditionalInformation('paypal_cvv2_match')) {
152
+ return $payment->getAdditionalInformation('paypal_cvv2_match');
153
+ }
154
+
155
+ return null;
156
+ }
157
+
158
+ public function getPaymentMethod()
159
+ {
160
+ return $this->payment->getMethod();
161
+ }
162
+
163
+ public function getPurchase()
164
+ {
165
+ $purchase = array();
166
+
167
+ $purchase['browserIpAddress'] = $this->getIpAddress();
168
+ $purchase['orderId'] = $this->order->getIncrementId();
169
+ $purchase['createdAt'] = date('c', strtotime($this->order->getCreatedAt())); // e.g: 2004-02-12T15:19:21+00:00
170
+ $purchase['currency'] = $this->order->getBaseCurrencyCode();
171
+ $purchase['totalPrice'] = floatval($this->order->getGrandTotal());
172
+ $purchase['shippingPrice'] = floatval($this->order->getShippingAmount());
173
+ $purchase['products'] = $this->getProducts();
174
+ $purchase['paymentGateway'] = $this->getPaymentMethod();
175
+
176
+ $purchase['avsResponseCode'] = $this->getAvsResponse();
177
+ $purchase['cvvResponseCode'] = $this->getCvvResponse();
178
+
179
+ return $purchase;
180
+ }
181
+
182
+ public function getCard()
183
+ {
184
+ $payment = $this->payment;
185
+ $billing = $this->billing_address;
186
+
187
+ $card = array();
188
+
189
+ $card['cardHolderName'] = null;
190
+ $card['bin'] = null;
191
+ $card['last4'] = null;
192
+ $card['expiryMonth'] = null;
193
+ $card['expiryYear'] = null;
194
+ $card['hash'] = null;
195
+
196
+ $card['billingAddress'] = $this->getBillingAddress();
197
+
198
+ if ($payment->getData('cc_last4')) {
199
+ $card['last4'] = $payment->getData('cc_last4');
200
+ }
201
+
202
+ if ($payment->getData('cc_exp_year')) {
203
+ $card['expiryYear'] = $payment->getData('cc_exp_year');
204
+ }
205
+
206
+ if ($payment->getData('cc_exp_month')) {
207
+ $card['expiryMonth'] = $payment->getData('cc_exp_month');
208
+ }
209
+
210
+ if ($payment->getData('cc_number_enc')) {
211
+ $card['hash'] = $payment->getData('cc_number_enc');
212
+ }
213
+
214
+ if ($payment->getData('cc_number') && is_numeric($payment->getData('cc_number')) && strlen((string)$payment->getData('cc_number')) > 6) {
215
+ $card['bin'] = substr((string)$payment->getData('cc_number'), 0, 6);
216
+ }
217
+
218
+ if ($payment->getCcOwner()) {
219
+ $card['cardHolderName'] = $payment->getCcOwner();
220
+ } else {
221
+ $card['cardHolderName'] = $billing->getFirstname() . ' ' . $billing->getLastname();
222
+ }
223
+
224
+ return $card;
225
+ }
226
+
227
+ public function getAddress($address_object)
228
+ {
229
+ $address = array();
230
+
231
+ $address['streetAddress'] = $address_object->getStreet1();
232
+ $address['unit'] = null;
233
+
234
+ if ($address_object->getStreet2()) {
235
+ $address['unit'] = $address_object->getStreet2();
236
+ }
237
+
238
+ $address['city'] = $address_object->getCity();
239
+
240
+ $address['provinceCode'] = $address_object->getRegionCode();
241
+ $address['postalCode'] = $address_object->getPostcode();
242
+ $address['countryCode'] = $address_object->getCountryId();
243
+
244
+ $address['latitude'] = null;
245
+ $address['longitude'] = null;
246
+
247
+ return $address;
248
+ }
249
+
250
+ public function getBillingAddress()
251
+ {
252
+ return $this->getAddress($this->billing_address);
253
+ }
254
+
255
+ public function getShippingAddress()
256
+ {
257
+ return $this->getAddress($this->shipping_address);
258
+ }
259
+
260
+ public function getRecipient()
261
+ {
262
+ $recipient = array();
263
+
264
+ $recipient['fullName'] = $this->shipping_address->getFirstname() . ' ' . $this->shipping_address->getLastname();
265
+ // Email: Note that this field is always the same for both addresses
266
+ $recipient['confirmationEmail'] = $this->shipping_address->getEmail();
267
+ if (!$recipient['confirmationEmail']) {
268
+ $recipient['confirmationEmail'] = $this->order->getCustomerEmail();
269
+ }
270
+ $recipient['confirmationPhone'] = $this->shipping_address->getTelephone();
271
+
272
+ $recipient['deliveryAddress'] = $this->getShippingAddress();
273
+
274
+ return $recipient;
275
+ }
276
+
277
+ public function getUserAccount()
278
+ {
279
+ $customer = $this->customer;
280
+
281
+ $user = array(
282
+ "emailAddress" => null,
283
+ "username" => null,
284
+ "phone" => null,
285
+ "createdDate" => null,
286
+ "accountNumber" => null,
287
+ "lastOrderId" => null,
288
+ "aggregateOrderCount" => null,
289
+ "aggregateOrderDollars" => null,
290
+ "lastUpdateDate" => null
291
+ );
292
+
293
+ if ($customer && $customer->getId()) {
294
+ $user['emailAddress'] = $customer->getEmail();
295
+
296
+ $user['phone'] = $this->billing_address->getTelephone();
297
+
298
+ $user['createdDate'] = date('c', strtotime($customer->getCreatedAt()));
299
+ $user['lastUpdateDate'] = date('c', strtotime($customer->getUpdatedAt()));
300
+
301
+ $user['accountNumber'] = $customer->getId();
302
+
303
+ $last_order_id = null;
304
+
305
+ $orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customer->getId());
306
+ $orders->getSelect()->order('created_at DESC');
307
+
308
+ $aggregate_total = 0.;
309
+ $order_count = 0;
310
+
311
+ foreach ($orders as $order) {
312
+ if ($last_order_id === null) {
313
+ $last_order_id = $order->getIncrementId();
314
+ }
315
+
316
+ $aggregate_total += floatval($order->getGrandTotal());
317
+ $order_count += 1;
318
+ }
319
+
320
+ $user['lastOrderId'] = $last_order_id;
321
+ $user['aggregateOrderCount'] = $order_count;
322
+ $user['aggregateOrderDollars'] = floatval($aggregate_total);
323
+ }
324
+
325
+ return $user;
326
+ }
327
+
328
+ public function getUrl()
329
+ {
330
+ if ($this->hasData('url')) {
331
+ return $this->getData('url');
332
+ }
333
+
334
+ return Mage::getStoreConfig('signifyd_connect/settings/url') . '/cases';
335
+ }
336
+
337
+ public function getAuth()
338
+ {
339
+ if ($this->hasData('auth')) {
340
+ return $this->getData('auth');
341
+ }
342
+
343
+ return Mage::getStoreConfig('signifyd_connect/settings/key');
344
+ }
345
+
346
+ public function submitCase($case)
347
+ {
348
+ $case = json_encode($case);
349
+
350
+ return Mage::helper('signifyd_connect')->request($this->getUrl(), $case, $this->getAuth(), 'application/json');
351
+ }
352
+
353
+ public function generateCase()
354
+ {
355
+ $case = array();
356
+
357
+ $case['purchase'] = $this->getPurchase();
358
+ $case['recipient'] = $this->getRecipient();
359
+ $case['card'] = $this->getCard();
360
+ $case['userAccount'] = $this->getUserAccount();
361
+
362
+ return $case;
363
+ }
364
+
365
+ public function getInvoiced($order)
366
+ {
367
+ $collection = $order->getInvoiceCollection();
368
+
369
+ foreach ($collection as $invoice) {
370
+ return true;
371
+ }
372
+
373
+ return false;
374
+ }
375
+
376
+ public function openCase($observer)
377
+ {
378
+ try {
379
+ if (!Mage::getStoreConfig('signifyd_connect/settings/enabled') && !$this->getEnabled()) {
380
+ return;
381
+ }
382
+
383
+ $event = $observer->getEvent();
384
+
385
+ if ($event->hasOrder()) {
386
+ $order = $event->getOrder();
387
+ } else if ($event->hasObject()) {
388
+ $order = $event->getObject();
389
+ }
390
+
391
+ $order_model = get_class(Mage::getModel('sales/order'));
392
+
393
+ if (!($order instanceof $order_model)) {
394
+ return;
395
+ }
396
+
397
+ if ($order && $order->getId()) {
398
+ if (Mage::helper('signifyd_connect')->isProcessed($order) && !$this->getForceProcess()) {
399
+ return;
400
+ }
401
+
402
+ $payments = $order->getPaymentsCollection();
403
+
404
+ foreach ($payments as $payment) {
405
+ $this->payment = $payment;
406
+ }
407
+
408
+ $method = $this->payment->getMethod();
409
+
410
+ $state = $order->getState();
411
+
412
+ if (!$state || $state == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
413
+ return;
414
+ }
415
+
416
+ $this->order = $order;
417
+ $this->billing_address = $order->getBillingAddress();
418
+ $this->shipping_address = $order->getShippingAddress();
419
+
420
+ if (!$this->shipping_address) {
421
+ $this->shipping_address = $this->billing_address;
422
+ }
423
+
424
+ if ($order->getCustomer()) {
425
+ $this->customer = $order->getCustomer();
426
+ }
427
+
428
+ $this->quote = $order->getQuote();
429
+
430
+ if (!$this->quote) {
431
+ $this->quote = $order;
432
+ }
433
+
434
+ $case = $this->generateCase();
435
+
436
+ $response = $this->submitCase($case);
437
+
438
+ $case_object = Mage::helper('signifyd_connect')->markProcessed($order);
439
+
440
+ try {
441
+ $response_code = $response->getHttpCode();
442
+
443
+ if (substr($response_code, 0, 1) == '2') {
444
+ $response_data = json_decode($response->getRawResponse(), true);
445
+
446
+ $case_object->setCode($response_data['investigationId']);
447
+ $case_object->save();
448
+ }
449
+ } catch (Exception $e) {
450
+
451
+ }
452
+ }
453
+ } catch (Exception $e) {
454
+ Mage::log($e->__toString(), null, 'signifyd_connect.log');
455
+ }
456
+ }
457
+
458
+ public function logData()
459
+ {
460
+ // Used to capture data for testing with
461
+
462
+ $order_data = json_encode($this->order->getData());
463
+ $billing_data = json_encode($this->order->getBillingAddress()->getData());
464
+ $shipping_data = json_encode($this->order->getShippingAddress()->getData());
465
+ $customer_data = json_encode($this->customer->getData());
466
+ $payment_data = json_encode($this->payment->getData());
467
+ $quote_data = json_encode($this->quote->getData());
468
+ $items = array();
469
+ $products = array();
470
+
471
+ foreach ($this->quote->getAllItems() as $item) {
472
+ $items[$item->getId()] = $item->getData();
473
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
474
+ $products[$item->getId()] = $product->getData();
475
+ }
476
+
477
+ $items = json_encode($items);
478
+ $products = json_encode($products);
479
+
480
+ Mage::log("Order:\n $order_data", null, 'signifyd_connect_objects.log');
481
+ Mage::log("Billing:\n $billing_data", null, 'signifyd_connect_objects.log');
482
+ Mage::log("Shipping:\n $shipping_data", null, 'signifyd_connect_objects.log');
483
+ Mage::log("Customer:\n $customer_data", null, 'signifyd_connect_objects.log');
484
+ Mage::log("Payment:\n $payment_data", null, 'signifyd_connect_objects.log');
485
+ Mage::log("Quote:\n $quote_data", null, 'signifyd_connect_objects.log');
486
+ Mage::log("Items:\n $items", null, 'signifyd_connect_objects.log');
487
+ Mage::log("Products:\n $products", null, 'signifyd_connect_objects.log');
488
+ }
489
+
490
+ public function eavCollectionAbstractLoadBefore($observer)
491
+ {
492
+ $x = $observer->getCollection();
493
+
494
+ $request = Mage::app()->getRequest();
495
+ $module = $request->getModuleName();
496
+ $controller = $request->getControllerName();
497
+ $action = $request->getActionName();
498
+
499
+ if ($module != 'admin' || $controller != 'sales_order') {
500
+ return;
501
+ }
502
+
503
+ $clss = get_class($x);
504
+ if ($clss == 'Mage_Sales_Model_Mysql4_Order_Collection') {
505
+ $observer->setOrderGridCollection($x);
506
+ return $this->salesOrderGridCollectionLoadBefore($observer);
507
+ }
508
+ }
509
+
510
+ public function coreCollectionAbstractLoadBefore($observer)
511
+ {
512
+ $x = $observer->getCollection();
513
+
514
+ $request = Mage::app()->getRequest();
515
+ $module = $request->getModuleName();
516
+ $controller = $request->getControllerName();
517
+ $action = $request->getActionName();
518
+
519
+ if ($module != 'admin' || $controller != 'sales_order') {
520
+ return;
521
+ }
522
+
523
+ $clss = get_class($x);
524
+ if ($clss == 'Mage_Sales_Model_Mysql4_Order_Collection') {
525
+ $observer->setOrderGridCollection($x);
526
+ return $this->salesOrderGridCollectionLoadBefore($observer);
527
+ }
528
+ }
529
+
530
+ public function isCe()
531
+ {
532
+ return !@class_exists('Enterprise_Cms_Helper_Data');
533
+ }
534
+
535
+ public function belowSix()
536
+ {
537
+ $version = Mage::getVersion();
538
+
539
+ if ($this->isCe()) {
540
+ return version_compare($version, '1.6.0.0', '<');
541
+ } else {
542
+ return version_compare($version, '1.11.0.0', '<');
543
+ }
544
+
545
+ return false;
546
+ }
547
+
548
+ public function salesOrderGridCollectionLoadBefore($observer)
549
+ {
550
+ $request = Mage::app()->getRequest();
551
+ $module = $request->getModuleName();
552
+ $controller = $request->getControllerName();
553
+ $action = $request->getActionName();
554
+
555
+ if ($module != 'admin' || $controller != 'sales_order') {
556
+ return;
557
+ }
558
+
559
+ $collection = $observer->getOrderGridCollection();
560
+ $select = $collection->getSelect();
561
+
562
+ if (Mage::getStoreConfig('signifyd_connect/advanced/show_scores')) {
563
+ if ($this->belowSix()) {
564
+ $select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=e.increment_id', array('score'=>'score'));
565
+ } else {
566
+ $select->joinLeft(array('signifyd'=>$collection->getTable('signifyd_connect/case')), 'signifyd.order_increment=main_table.increment_id', array('score'=>'score'));
567
+ }
568
+ }
569
+ }
570
+
571
+ public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer)
572
+ {
573
+ if (Mage::getStoreConfig('signifyd_connect/advanced/show_scores')) {
574
+ $helper = Mage::helper('signifyd_connect');
575
+ $block = $observer->getEvent()->getBlock();
576
+
577
+ if ($block->getId() == 'sales_order_grid') {
578
+ $block->addColumnAfter(
579
+ 'score',
580
+ array(
581
+ 'header' => $helper->__('Signifyd Score'),
582
+ 'align' => 'left',
583
+ 'type' => 'text',
584
+ 'index' => 'score',
585
+ 'filter_index' => 'score',
586
+ 'renderer' => 'signifyd_connect/renderer',
587
+ 'width' => '100px',
588
+ ),
589
+ 'status'
590
+ );
591
+
592
+ $block->sortColumnsByOrder();
593
+ }
594
+ }
595
+ }
596
+ }
app/code/community/Signifyd/Connect/Model/Resource/Case.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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', 'case_id');
8
+ }
9
+ }
app/code/community/Signifyd/Connect/Model/Resource/Case/Collection.php ADDED
@@ -0,0 +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
+ }
app/code/community/Signifyd/Connect/Model/Setup.php ADDED
@@ -0,0 +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
+ }
app/code/community/Signifyd/Connect/controllers/ConnectController.php ADDED
@@ -0,0 +1,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Signifyd_Connect_ConnectController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public $_request = array();
6
+ public $_topic = false;
7
+ public $_order = false;
8
+ public $_case = false;
9
+
10
+ public function getApiKey()
11
+ {
12
+ return Mage::getStoreConfig('signifyd_connect/settings/key');
13
+ }
14
+
15
+ public function holdThreshold()
16
+ {
17
+ return (int)Mage::getStoreConfig('signifyd_connect/advanced/hold_orders_threshold');
18
+ }
19
+
20
+ public function canHold()
21
+ {
22
+ return Mage::getStoreConfig('signifyd_connect/advanced/hold_orders');
23
+ }
24
+
25
+ public function enabled()
26
+ {
27
+ $retrieve_scores = Mage::getStoreConfig('signifyd_connect/advanced/retrieve_score');
28
+ $enabled = Mage::getStoreConfig('signifyd_connect/settings/enabled');
29
+
30
+ return $enabled && $retrieve_scores;
31
+ }
32
+
33
+ public function logErrors()
34
+ {
35
+ return Mage::getStoreConfig('signifyd_connect/log/error');
36
+ }
37
+
38
+ public function logRequest()
39
+ {
40
+ return Mage::getStoreConfig('signifyd_connect/log/request');
41
+ }
42
+
43
+ public function getRawPost()
44
+ {
45
+ if (isset($HTTP_RAW_POST_DATA) && $HTTP_RAW_POST_DATA) {
46
+ return $HTTP_RAW_POST_DATA;
47
+ }
48
+
49
+ $post = file_get_contents("php://input");
50
+
51
+ if ($post) {
52
+ return $post;
53
+ }
54
+
55
+ return '';
56
+ }
57
+
58
+ public function getDefaultMessage()
59
+ {
60
+ 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';
61
+ }
62
+
63
+ public function getDisabledMessage()
64
+ {
65
+ 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.';
66
+ }
67
+
68
+ public function unsupported()
69
+ {
70
+ echo 'This request type is currently unsupported';
71
+
72
+ Mage::app()->getResponse()
73
+ ->setHeader('HTTP/1.1','403 Forbidden')
74
+ ->sendResponse();
75
+
76
+ exit;
77
+ }
78
+
79
+ public function complete()
80
+ {
81
+ Mage::app()->getResponse()
82
+ ->setHeader('HTTP/1.1','200 Ok')
83
+ ->sendResponse();
84
+
85
+ exit;
86
+ }
87
+
88
+ public function validRequest($request, $hash)
89
+ {
90
+ $check = base64_encode(hash_hmac('sha256', $request, $this->getApiKey(), true));
91
+
92
+ if ($this->logRequest()) {
93
+ Mage::log('API request hash check: ' . $check, null, 'signifyd_connect.log');
94
+ }
95
+
96
+ if ($check == $hash) {
97
+ return true;
98
+ }
99
+
100
+ return false;
101
+ }
102
+
103
+ public function initRequest($request)
104
+ {
105
+ $this->_request = json_decode($request, true);
106
+
107
+ $topic = $this->getHeader('HTTP_X_SIGNIFYD_WEBHOOK_TOPIC');
108
+
109
+ $this->_topic = $topic;
110
+
111
+ if (isset($this->_request['orderId'])) {
112
+ $cases = Mage::getModel('signifyd_connect/case')->getCollection();
113
+ $cases->addFieldToFilter('order_increment', $this->_request['orderId']);
114
+
115
+ foreach ($cases as $case) {
116
+ $this->_case = $case;
117
+ break;
118
+ }
119
+ }
120
+ }
121
+
122
+ public function processCreation()
123
+ {
124
+ $case = $this->_case;
125
+
126
+ if (!$case) {
127
+ return;
128
+ }
129
+
130
+ if (isset($this->_request['score'])) {
131
+ $case->setScore($this->_request['score']);
132
+ }
133
+
134
+ if (isset($this->_request['status'])) {
135
+ $case->setStatus($this->_request['status']);
136
+ }
137
+
138
+ $case->setUpdatedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
139
+ $case->save();
140
+
141
+ if ($this->logRequest()) {
142
+ Mage::log('Case ' . $case->getId() . ' created with status ' . $case->getStatus() . ' and score ' . $case->getScore(), null, 'signifyd_connect.log');
143
+ }
144
+
145
+ if ($this->canHold()) {
146
+ $order = Mage::getModel('sales/order')->loadByIncrementId($case->getOrderIncrement());
147
+
148
+ $threshold = $this->holdThreshold();
149
+ if ($threshold && $case->getScore() <= $threshold) {
150
+ if ($order->canHold()) {
151
+ $order->hold();
152
+ $order->save();
153
+
154
+ if ($this->logRequest()) {
155
+ Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
161
+
162
+ public function processReview()
163
+ {
164
+ $case = $this->_case;
165
+
166
+ if (!$case) {
167
+ return;
168
+ }
169
+
170
+ $original_status = $case->getSignifydStatus();
171
+
172
+ if (isset($this->_request['score'])) {
173
+ $case->setScore($this->_request['score']);
174
+ }
175
+
176
+ if (isset($this->_request['status'])) {
177
+ $case->setSignifydStatus($this->_request['status']);
178
+ }
179
+
180
+ $case->setUpdatedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
181
+ $case->save();
182
+
183
+ if ($this->canHold()) {
184
+ $order = Mage::getModel('sales/order')->loadByIncrementId($case->getOrderIncrement());
185
+
186
+ if ($original_status == 'PENDING') { // i.e. First update
187
+ $threshold = $this->holdThreshold();
188
+ if ($threshold && $case->getScore() <= $threshold) {
189
+ if ($order->canHold()) {
190
+ $order->hold();
191
+ $order->save();
192
+
193
+ if ($this->logRequest()) {
194
+ Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
195
+ }
196
+ }
197
+ }
198
+ } else {
199
+ if ($this->_request['reviewDisposition'] == 'FRAUDULENT') {
200
+ if ($order->canHold()) {
201
+ $order->hold();
202
+ $order->save();
203
+
204
+ if ($this->logRequest()) {
205
+ Mage::log('Order ' . $order->getId() . ' held', null, 'signifyd_connect.log');
206
+ }
207
+ }
208
+ } else if ($this->_request['reviewDisposition'] == 'GOOD') {
209
+ if ($order->canUnhold()) {
210
+ $order->unhold();
211
+ $order->save();
212
+
213
+ if ($this->logRequest()) {
214
+ Mage::log('Order ' . $order->getId() . ' unheld', null, 'signifyd_connect.log');
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+
222
+ public function getUrl($code)
223
+ {
224
+ return Mage::getStoreConfig('signifyd_connect/settings/url') . '/cases/' . $code;
225
+ }
226
+
227
+ public function caseLookup()
228
+ {
229
+ $result = false;
230
+ $case = $this->_case;
231
+
232
+ try {
233
+ $url = $this->getUrl($case->getCode());
234
+
235
+ $response = Mage::helper('signifyd_connect')->request($url, null, $this->getApiKey(), null, 'application/json');
236
+
237
+ $response_code = $response->getHttpCode();
238
+
239
+ if (substr($response_code, 0, 1) == '2') {
240
+ $result = json_decode($response->getRawResponse(), true);
241
+ } else {
242
+ if ($this->logRequest()) {
243
+ Mage::log('Fallback request received a ' . $response_code . ' response from Signifyd', null, 'signifyd_connect.log');
244
+ }
245
+ }
246
+ } catch (Exception $e) {
247
+ if ($this->logErrors()) {
248
+ Mage::log('Fallback issue: ' . $e->__toString(), null, 'signifyd_connect.log');
249
+ }
250
+ }
251
+
252
+ return $result;
253
+ }
254
+
255
+ public function processFallback($request)
256
+ {
257
+ if ($this->logRequest()) {
258
+ Mage::log('Attempting auth via fallback request', null, 'signifyd_connect.log');
259
+ }
260
+
261
+ $request = json_decode($request, true);
262
+
263
+ $this->_topic = "cases/review"; // Topic header is most likely not available
264
+
265
+ if (is_array($request) && isset($request['orderId'])) {
266
+ $cases = Mage::getModel('signifyd_connect/case')->getCollection();
267
+ $cases->addFieldToFilter('order_increment', $request['orderId']);
268
+
269
+ foreach ($cases as $case) {
270
+ $this->_case = $case;
271
+ break;
272
+ }
273
+ }
274
+
275
+ if ($this->_case) {
276
+ $lookup = $this->caseLookup();
277
+
278
+ if ($lookup && is_array($lookup)) {
279
+ $this->_request = $lookup;
280
+
281
+ $this->processReview();
282
+ } else {
283
+ if ($this->logRequest()) {
284
+ Mage::log('Fallback failed with an invalid response from Signifyd', null, 'signifyd_connect.log');
285
+ }
286
+ }
287
+ } else {
288
+ if ($this->logRequest()) {
289
+ Mage::log('Fallback failed with no matching case found', null, 'signifyd_connect.log');
290
+ }
291
+ }
292
+ }
293
+
294
+ public function getHeader($header)
295
+ {
296
+ $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header));
297
+ if (isset($_SERVER[$temp])) {
298
+ return $_SERVER[$temp];
299
+ }
300
+
301
+ return '';
302
+ }
303
+
304
+ public function apiAction()
305
+ {
306
+ if (!$this->enabled()) {
307
+ echo $this->getDisabledMessage();
308
+
309
+ return;
310
+ }
311
+
312
+ $request = $this->getRawPost();
313
+
314
+ $hash = $this->getHeader('HTTP_X_SIGNIFYD_HMAC_SHA256');
315
+
316
+ if ($this->logRequest()) {
317
+ Mage::log('API request: ' . $request, null, 'signifyd_connect.log');
318
+ Mage::log('API request hash: ' . $hash, null, 'signifyd_connect.log');
319
+ }
320
+
321
+ if ($request) {
322
+ if ($this->validRequest($request, $hash)) {
323
+ $this->initRequest($request);
324
+
325
+ $topic = $this->_topic;
326
+
327
+ if ($this->logRequest()) {
328
+ Mage::log('API request topic: ' . $topic, null, 'signifyd_connect.log');
329
+ }
330
+
331
+ switch ($topic) {
332
+ case "cases/creation":
333
+ try {
334
+ $this->processCreation($request);
335
+ } catch (Exception $e) {
336
+ if ($this->logErrors()) {
337
+ Mage::log('Case scoring issue: ' . $e->__toString(), null, 'signifyd_connect.log');
338
+ }
339
+ }
340
+ break;
341
+ case "cases/review":
342
+ try {
343
+ $this->processReview($request);
344
+ } catch (Exception $e) {
345
+ if ($this->logErrors()) {
346
+ Mage::log('Case review issue: ' . $e->__toString(), null, 'signifyd_connect.log');
347
+ }
348
+ }
349
+ break;
350
+ default:
351
+ $this->unsupported();
352
+ }
353
+ } else {
354
+ if ($this->logRequest()) {
355
+ Mage::log('API request failed auth', null, 'signifyd_connect.log');
356
+ }
357
+
358
+ $this->processFallback($request);
359
+ }
360
+ } else {
361
+ echo $this->getDefaultMessage();
362
+ }
363
+
364
+ $this->complete();
365
+ }
366
+ }
app/code/community/Signifyd/Connect/etc/config.xml ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Signifyd_Connect>
6
+ <version>3.4.2</version>
7
+ </Signifyd_Connect>
8
+ </modules>
9
+ <global>
10
+ <models>
11
+ <signifyd_connect>
12
+ <class>Signifyd_Connect_Model</class>
13
+ <resourceModel>signifyd_connect_resource</resourceModel>
14
+ </signifyd_connect>
15
+ <signifyd_connect_resource>
16
+ <class>Signifyd_Connect_Model_Resource</class>
17
+ <entities>
18
+ <case>
19
+ <table>signifyd_connect_case</table>
20
+ </case>
21
+ </entities>
22
+ </signifyd_connect_resource>
23
+ </models>
24
+ <resources>
25
+ <signifyd_connect_setup>
26
+ <setup>
27
+ <module>Signifyd_Connect</module>
28
+ <class>Signifyd_Connect_Model_Setup</class>
29
+ </setup>
30
+ <connection>
31
+ <use>core_setup</use>
32
+ </connection>
33
+ </signifyd_connect_setup>
34
+ <signifyd_connect_write>
35
+ <connection>
36
+ <use>core_write</use>
37
+ </connection>
38
+ </signifyd_connect_write>
39
+ <signifyd_connect_read>
40
+ <connection>
41
+ <use>core_read</use>
42
+ </connection>
43
+ </signifyd_connect_read>
44
+ </resources>
45
+ <helpers>
46
+ <signifyd_connect>
47
+ <class>Signifyd_Connect_Helper</class>
48
+ </signifyd_connect>
49
+ </helpers>
50
+ <blocks>
51
+ <signifyd_connect>
52
+ <class>Signifyd_Connect_Block</class>
53
+ </signifyd_connect>
54
+ </blocks>
55
+ <events>
56
+ <model_save_after>
57
+ <observers>
58
+ <signifyd_connect>
59
+ <class>signifyd_connect/observer</class>
60
+ <method>openCase</method>
61
+ </signifyd_connect>
62
+ </observers>
63
+ </model_save_after>
64
+ </events>
65
+ </global>
66
+ <frontend>
67
+ <routers>
68
+ <signifyd_connect>
69
+ <use>standard</use>
70
+ <args>
71
+ <module>Signifyd_Connect</module>
72
+ <frontName>signifyd</frontName>
73
+ </args>
74
+ </signifyd_connect>
75
+ </routers>
76
+ </frontend>
77
+ <default>
78
+ <signifyd_connect>
79
+ <settings>
80
+ <enabled>0</enabled>
81
+ <url>https://api.signifyd.com/v2</url>
82
+ </settings>
83
+ <advanced>
84
+ <retrieve_score>0</retrieve_score>
85
+ <show_scores>0</show_scores>
86
+ <hold_orders>0</hold_orders>
87
+ <hold_orders_threshold>500</hold_orders_threshold>
88
+ </advanced>
89
+ <log>
90
+ <request>0</request>
91
+ <response>0</response>
92
+ <error>1</error>
93
+ </log>
94
+ </signifyd_connect>
95
+ </default>
96
+ <adminhtml>
97
+ <acl>
98
+ <resources>
99
+ <all>
100
+ <title>Allow Everything</title>
101
+ </all>
102
+ <admin>
103
+ <children>
104
+ <system>
105
+ <children>
106
+ <config>
107
+ <children>
108
+ <signifyd_connect>
109
+ <title>Signifyd</title>
110
+ <sort_order>9999</sort_order>
111
+ </signifyd_connect>
112
+ </children>
113
+ </config>
114
+ </children>
115
+ </system>
116
+ </children>
117
+ </admin>
118
+ </resources>
119
+ </acl>
120
+ <events>
121
+ <eav_collection_abstract_load_before>
122
+ <observers>
123
+ <signifyd_connect>
124
+ <model>signifyd_connect/observer</model>
125
+ <method>eavCollectionAbstractLoadBefore</method>
126
+ </signifyd_connect>
127
+ </observers>
128
+ </eav_collection_abstract_load_before>
129
+ <core_collection_abstract_load_before>
130
+ <observers>
131
+ <signifyd_connect>
132
+ <model>signifyd_connect/observer</model>
133
+ <method>coreCollectionAbstractLoadBefore</method>
134
+ </signifyd_connect>
135
+ </observers>
136
+ </core_collection_abstract_load_before>
137
+ <sales_order_grid_collection_load_before>
138
+ <observers>
139
+ <signifyd_connect>
140
+ <model>signifyd_connect/observer</model>
141
+ <method>salesOrderGridCollectionLoadBefore</method>
142
+ </signifyd_connect>
143
+ </observers>
144
+ </sales_order_grid_collection_load_before>
145
+ <core_block_abstract_to_html_before>
146
+ <observers>
147
+ <signifyd_connect>
148
+ <model>signifyd_connect/observer</model>
149
+ <method>coreBlockAbstractToHtmlBefore</method>
150
+ </signifyd_connect>
151
+ </observers>
152
+ </core_block_abstract_to_html_before>
153
+ </events>
154
+ </adminhtml>
155
+ </config>
app/code/community/Signifyd/Connect/etc/system.xml ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <signifyd translate="label" module="signifyd_connect">
5
+ <label>Signifyd</label>
6
+ <sort_order>999999</sort_order>
7
+ </signifyd>
8
+ </tabs>
9
+ <sections>
10
+ <signifyd_connect translate="label" module="signifyd_connect">
11
+ <label>Signifyd</label>
12
+ <tab>signifyd</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>99999</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <settings translate="label">
20
+ <label>General Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>2</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enabled translate="label">
28
+ <label>Enable extension</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment><![CDATA[This enables or disables the Signifyd extension]]></comment>
36
+ </enabled>
37
+ <key translate="label">
38
+ <label>Signifyd API Key</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>20</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <comment><![CDATA[You will find this in <a href="http://signifyd.com/settings/teams">http://signifyd.com/settings/teams</a> after you create a Signifyd account]]></comment>
45
+ </key>
46
+ <url translate="label">
47
+ <label>Signifyd API URL</label>
48
+ <frontend_type>text</frontend_type>
49
+ <sort_order>30</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ <comment><![CDATA[This is set by default. Don’t change unless asked to do so.]]></comment>
54
+ </url>
55
+ </fields>
56
+ </settings>
57
+ <advanced>
58
+ <label>Advanced</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>2</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <fields>
65
+ <retrieve_score translate="label">
66
+ <label>Retrieve Signifyd scores</label>
67
+ <frontend_type>select</frontend_type>
68
+ <source_model>adminhtml/system_config_source_yesno</source_model>
69
+ <sort_order>50</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ <comment><model>signifyd_connect/link</model></comment>
74
+ </retrieve_score>
75
+ <show_scores translate="label">
76
+ <label>Show Scores in Magento Order Grid</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_yesno</source_model>
79
+ <sort_order>55</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ <depends><retrieve_score>1</retrieve_score></depends>
84
+ <comment><![CDATA[Your scores will show in the Magento Order Grid once enabled]]></comment>
85
+ </show_scores>
86
+ <hold_orders translate="label">
87
+ <label>Place hold on orders below score threshold</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>adminhtml/system_config_source_yesno</source_model>
90
+ <sort_order>60</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <depends><retrieve_score>1</retrieve_score></depends>
95
+ <comment><![CDATA[Orders will be placed on hold below a threshold specified by you. We recommend a threshold of 500. Clicking Thumbs Up will Unhold the Order and Thumbs down will leave the Order on Hold. ]]></comment>
96
+ </hold_orders>
97
+ <hold_orders_threshold translate="label">
98
+ <label>Hold score threshold</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>70</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ <comment><![CDATA[0-1000. Threshold at which orders get put on HOLD. Default is 500.]]></comment>
105
+ <depends><hold_orders>1</hold_orders></depends>
106
+ </hold_orders_threshold>
107
+ </fields>
108
+ </advanced>
109
+ <log translate="label">
110
+ <label>Log Settings</label>
111
+ <frontend_type>text</frontend_type>
112
+ <sort_order>3</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ <fields>
117
+ <request>
118
+ <label>Log requests</label>
119
+ <frontend_type>select</frontend_type>
120
+ <source_model>adminhtml/system_config_source_yesno</source_model>
121
+ <sort_order>1</sort_order>
122
+ <show_in_default>1</show_in_default>
123
+ <show_in_website>1</show_in_website>
124
+ <show_in_store>1</show_in_store>
125
+ </request>
126
+ <response>
127
+ <label>Log responses</label>
128
+ <frontend_type>select</frontend_type>
129
+ <source_model>adminhtml/system_config_source_yesno</source_model>
130
+ <sort_order>2</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ </response>
135
+ <error>
136
+ <label>Log errors</label>
137
+ <frontend_type>select</frontend_type>
138
+ <source_model>adminhtml/system_config_source_yesno</source_model>
139
+ <sort_order>3</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>1</show_in_store>
143
+ </error>
144
+ </fields>
145
+ </log>
146
+ </groups>
147
+ </signifyd_connect>
148
+ </sections>
149
+ </config>
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.1.1.php ADDED
@@ -0,0 +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();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-install-3.3.0.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $this->startSetup();
4
+ $this->register();
5
+ $this->run("
6
+ DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
+ `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 ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $this->startSetup();
4
+ $this->register();
5
+ $this->run("
6
+ DROP TABLE IF EXISTS `{$this->getTable('signifyd_connect_case')}`;
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('signifyd_connect_case')}` (
8
+ `case_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
9
+ `order_increment` varchar(255) NOT NULL,
10
+ `signifyd_status` varchar(64) NOT NULL DEFAULT 'PENDING',
11
+ `code` varchar(255) NOT NULL,
12
+ `score` float DEFAULT NULL,
13
+ `entries` text NOT NULL,
14
+ `created_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-upgrade-3.2.0-3.2.1.php ADDED
@@ -0,0 +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();
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.1-3.2.2.php ADDED
@@ -0,0 +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
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.2-3.2.3.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->endSetup();
6
+ } catch (Exception $e) {
7
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
8
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.2.3-3.3.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')}` 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 ADDED
@@ -0,0 +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
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.0-3.4.1.php ADDED
@@ -0,0 +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
+ }
app/code/community/Signifyd/Connect/sql/signifyd_connect_setup/mysql4-upgrade-3.4.1-3.4.2.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ try {
4
+ $this->startSetup();
5
+ $this->endSetup();
6
+ } catch (Exception $e) {
7
+ Mage::log('Signifyd_Connect upgrade: ' . $e->__toString(), null, 'signifyd_connect.log');
8
+ }
app/etc/modules/Signifyd_Connect.xml ADDED
@@ -0,0 +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>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Signifyd_Connect</name>
4
+ <version>3.4.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
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>auto-converted</user><email>manelis@signifyd.com</email></author></authors>
13
+ <date>2014-08-07</date>
14
+ <time>02:37:17</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Signifyd_Connect.xml" hash="bcd998a24567eba8a20423c40fba2adf"/></dir></target><target name="magecommunity"><dir name="Signifyd"><dir name="Connect"><dir name="Block"><file name="Renderer.php" hash="5564e9c6926afbbdade26a6fe746948a"/></dir><dir name="Helper"><file name="Data.php" hash="588992f023fe4bc648fbe3be64773208"/></dir><dir name="Model"><dir name="Resource"><dir name="Case"><file name="Collection.php" hash="b7dac9979a0c81db56294d1548570fc2"/></dir><file name="Case.php" hash="621fb50264bd0cdeba720dee6949a0bf"/></dir><file name="Case.php" hash="92e044f7414eddfe084320b4a2098cee"/><file name="Cron.php" hash="51665978bd2bcf67b493f2a2b450d1b8"/><file name="Link.php" hash="0027fc75ef766aa1f51a004305987937"/><file name="Observer.php" hash="a7e6bf24b7e116920bea8e4b429875d8"/><file name="Setup.php" hash="e803ffb4b86c7d8ec1d149e665d65877"/></dir><dir name="controllers"><file name="ConnectController.php" hash="876e7b8a1108edb60b4aad1daaf2ef4e"/></dir><dir name="etc"><file name="config.xml" hash="e35b830b2696567ed39c6dafaec1c9d7"/><file name="system.xml" hash="525d089399d5abe3845ffea2e66e50ff"/></dir><dir name="sql"><dir name="signifyd_connect_setup"><file name="mysql4-install-3.1.1.php" hash="7fb2ccaf8352eea26e626ace6de53d80"/><file name="mysql4-install-3.3.0.php" hash="f61d0c018b28ae04d8d14b38556d18ad"/><file name="mysql4-install-3.4.0.php" hash="109cc5ca60974d0c4755dcb0f5ade3e7"/><file name="mysql4-upgrade-3.2.0-3.2.1.php" hash="9e36c608afd6e30e3052334e085eeff4"/><file name="mysql4-upgrade-3.2.1-3.2.2.php" hash="efcc5d46a41e549e508a693f1e77bf44"/><file name="mysql4-upgrade-3.2.2-3.2.3.php" hash="3ceb86495f33475774d4fc8727254cfc"/><file name="mysql4-upgrade-3.2.3-3.3.0.php" hash="94b907c2cacde5fb9831408ce9a06190"/><file name="mysql4-upgrade-3.3.0-3.4.0.php" hash="6eb18705081483bb8d9c14adcdefd095"/><file name="mysql4-upgrade-3.4.0-3.4.1.php" hash="79f2064f1fa20d646e66aa3e7912d2a0"/><file name="mysql4-upgrade-3.4.1-3.4.2.php" hash="3ceb86495f33475774d4fc8727254cfc"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>