Version Notes
* Breaking changes:
** Approved orders will now have "Approved (Riskified)" status (still "processing" state by default)
** Declined orders will now have "Declined (Riskified)" status instead of "Suspected Fraud" (still "canceled" state by default but can be changed in settings page)
* Added configurable states for approved/declined order (see settings page)
* Introduced new Magento statuses for approved and declined (with migrations)
* Bug fixes for previous database migrations
Download this release
Release Info
Developer | Riskified_Mage |
Extension | riskified_magento |
Version | 1.0.6.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.5.5 to 1.0.6.0
- app/code/community/Riskified/Full/.DS_Store +0 -0
- app/code/community/Riskified/Full/Helper/Data.php +8 -0
- app/code/community/Riskified/Full/Helper/Order.php +6 -3
- app/code/community/Riskified/Full/Helper/Order/Status.php +74 -2
- app/code/community/Riskified/Full/Model/Observer.php +14 -8
- app/code/community/Riskified/Full/Model/System/Config/Source/ApprovedState.php +15 -0
- app/code/community/Riskified/Full/Model/System/Config/Source/DeclinedState.php +15 -0
- app/code/community/Riskified/Full/controllers/ResponseController.php +1 -1
- app/code/community/Riskified/Full/etc/config.xml +1 -1
- app/code/community/Riskified/Full/etc/system.xml +62 -34
- app/code/community/Riskified/Full/sql/riskified_full_setup/{mysql4-install-1.0.2.1.php → mysql4-upgrade-1.0.2.0-1.0.2.1.php} +0 -0
- app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.5.5-1.0.6.0.php +49 -0
- lib/riskified_php_sdk/src/Riskified/.DS_Store +0 -0
- lib/riskified_php_sdk/src/Riskified/Common/Riskified.php +1 -1
- lib/riskified_php_sdk/src/Riskified/DecisionNotification/Model/Notification.php +10 -2
- package.xml +11 -5
app/code/community/Riskified/Full/.DS_Store
DELETED
Binary file
|
app/code/community/Riskified/Full/Helper/Data.php
CHANGED
@@ -37,6 +37,14 @@ class Riskified_Full_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
37 |
public function getExtensionVersion(){
|
38 |
return (string) Mage::getConfig()->getNode()->modules->Riskified_Full->version;
|
39 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
public function getSessionId(){
|
42 |
$visitorData = Mage::getSingleton('core/session')->getVisitorData();
|
37 |
public function getExtensionVersion(){
|
38 |
return (string) Mage::getConfig()->getNode()->modules->Riskified_Full->version;
|
39 |
}
|
40 |
+
|
41 |
+
public function getDeclinedState() {
|
42 |
+
return Mage::getStoreConfig('fullsection/full/declined_state');
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getApprovedState() {
|
46 |
+
return Mage::getStoreConfig('fullsection/full/approved_state');
|
47 |
+
}
|
48 |
|
49 |
public function getSessionId(){
|
50 |
$visitorData = Mage::getSingleton('core/session')->getVisitorData();
|
app/code/community/Riskified/Full/Helper/Order.php
CHANGED
@@ -71,7 +71,7 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
71 |
Mage::helper('full/log')->logException($curlException);
|
72 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $curlException->getMessage());
|
73 |
|
74 |
-
$this->updateOrder($order, 'error', 'Error transferring order data to Riskified');
|
75 |
$this->scheduleSubmissionRetry($order, $action);
|
76 |
|
77 |
Mage::dispatchEvent(
|
@@ -120,15 +120,18 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
120 |
*
|
121 |
* @param Mage_Sales_Model_Order $order
|
122 |
* @param string $status
|
|
|
123 |
* @param string $description
|
124 |
* @return void
|
125 |
*/
|
126 |
-
public function updateOrder($order, $status, $description) {
|
127 |
-
Mage::helper('full/log')->log('Dispatching event for order ' . $order->getId() . ' with status "' . $status .
|
|
|
128 |
|
129 |
$eventData = array(
|
130 |
'order' => $order,
|
131 |
'status' => $status,
|
|
|
132 |
'description' => $description
|
133 |
);
|
134 |
|
71 |
Mage::helper('full/log')->logException($curlException);
|
72 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $curlException->getMessage());
|
73 |
|
74 |
+
$this->updateOrder($order, 'error',nil, 'Error transferring order data to Riskified');
|
75 |
$this->scheduleSubmissionRetry($order, $action);
|
76 |
|
77 |
Mage::dispatchEvent(
|
120 |
*
|
121 |
* @param Mage_Sales_Model_Order $order
|
122 |
* @param string $status
|
123 |
+
* @param string $oldStatus
|
124 |
* @param string $description
|
125 |
* @return void
|
126 |
*/
|
127 |
+
public function updateOrder($order, $status, $oldStatus, $description) {
|
128 |
+
Mage::helper('full/log')->log('Dispatching event for order ' . $order->getId() . ' with status "' . $status .
|
129 |
+
'" old status "' . $oldStatus . '" and description "' . $description . '"');
|
130 |
|
131 |
$eventData = array(
|
132 |
'order' => $order,
|
133 |
'status' => $status,
|
134 |
+
'old_status' => $oldStatus,
|
135 |
'description' => $description
|
136 |
);
|
137 |
|
app/code/community/Riskified/Full/Helper/Order/Status.php
CHANGED
@@ -19,7 +19,7 @@ class Riskified_Full_Helper_Order_Status extends Mage_Core_Helper_Abstract
|
|
19 |
*/
|
20 |
public function getOnHoldStatusLabel()
|
21 |
{
|
22 |
-
return '
|
23 |
}
|
24 |
|
25 |
/**
|
@@ -39,6 +39,78 @@ class Riskified_Full_Helper_Order_Status extends Mage_Core_Helper_Abstract
|
|
39 |
*/
|
40 |
public function getTransportErrorStatusLabel()
|
41 |
{
|
42 |
-
return '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
}
|
19 |
*/
|
20 |
public function getOnHoldStatusLabel()
|
21 |
{
|
22 |
+
return 'Under Review (Riskified)';
|
23 |
}
|
24 |
|
25 |
/**
|
39 |
*/
|
40 |
public function getTransportErrorStatusLabel()
|
41 |
{
|
42 |
+
return 'Transport Error (Riskified)';
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get Riskified's custom "declined" status code
|
47 |
+
*
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
public function getRiskifiedDeclinedStatusCode()
|
51 |
+
{
|
52 |
+
return 'riskified_declined';
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Get Riskified's custom "declined" status label
|
57 |
+
*
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function getRiskifiedDeclinedStatusLabel()
|
61 |
+
{
|
62 |
+
return 'Declined (Riskified)';
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get Riskified's custom "declined" status code
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
public function getRiskifiedApprovedStatusCode()
|
71 |
+
{
|
72 |
+
return 'riskified_approved';
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get Riskified's custom "approved" status label
|
77 |
+
*
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
public function getRiskifiedApprovedStatusLabel()
|
81 |
+
{
|
82 |
+
return 'Approved (Riskified)';
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get the current approved state from the configuration
|
87 |
+
*
|
88 |
+
* @return string
|
89 |
+
*/
|
90 |
+
public function getSelectedApprovedState()
|
91 |
+
{
|
92 |
+
$state = Mage::getStoreConfig('fullsection/full/approved_state');
|
93 |
+
|
94 |
+
if (!in_array($state, array(Mage_Sales_Model_Order::STATE_PROCESSING,Mage_Sales_Model_Order::STATE_HOLDED))) {
|
95 |
+
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
|
96 |
+
}
|
97 |
+
|
98 |
+
return $state;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Get the current declined state from the configuration
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function getSelectedDeclinedState()
|
107 |
+
{
|
108 |
+
$state = Mage::getStoreConfig('fullsection/full/declined_state');
|
109 |
+
|
110 |
+
if (!in_array($state, array(Mage_Sales_Model_Order::STATE_CANCELED,Mage_Sales_Model_Order::STATE_HOLDED))) {
|
111 |
+
$state = Mage_Sales_Model_Order::STATE_CANCELED;
|
112 |
+
}
|
113 |
+
|
114 |
+
return $state;
|
115 |
}
|
116 |
}
|
app/code/community/Riskified/Full/Model/Observer.php
CHANGED
@@ -150,21 +150,23 @@ class Riskified_Full_Model_Observer {
|
|
150 |
$riskifiedOrderStatusHelper = Mage::helper('full/order_status');
|
151 |
$riskifiedInvoiceHelper = Mage::helper('full/order_invoice');
|
152 |
$order = $observer->getOrder();
|
153 |
-
$
|
|
|
154 |
$description = (string) $observer->getDescription();
|
155 |
$newState = $newStatus = null;
|
156 |
$currentState = $order->getState();
|
157 |
$currentStatus = $order->getStatus();
|
158 |
|
159 |
Mage::helper('full/log')->log("Checking if should update order '" . $order->getId() . "' from state: '$currentState' and status: '$currentStatus'");
|
|
|
160 |
|
161 |
-
switch ($
|
162 |
case 'approved':
|
163 |
if ($currentState == Mage_Sales_Model_Order::STATE_HOLDED
|
164 |
&& ($currentStatus == $riskifiedOrderStatusHelper->getOnHoldStatusCode()
|
165 |
|| $currentStatus == $riskifiedOrderStatusHelper->getTransportErrorStatusCode())) {
|
166 |
-
$newState =
|
167 |
-
$newStatus =
|
168 |
}
|
169 |
|
170 |
break;
|
@@ -172,8 +174,8 @@ class Riskified_Full_Model_Observer {
|
|
172 |
if ($currentState == Mage_Sales_Model_Order::STATE_HOLDED
|
173 |
&& ($currentStatus == $riskifiedOrderStatusHelper->getOnHoldStatusCode()
|
174 |
|| $currentStatus == $riskifiedOrderStatusHelper->getTransportErrorStatusCode())) {
|
175 |
-
$newState =
|
176 |
-
$newStatus =
|
177 |
}
|
178 |
|
179 |
break;
|
@@ -203,12 +205,15 @@ class Riskified_Full_Model_Observer {
|
|
203 |
$order->setState($newState, $newStatus, $description);
|
204 |
Mage::helper('full/log')->log("Updating order '" . $order->getId() . "' to: state: '$newState', status: '$newStatus', description: '$description'");
|
205 |
$changed=true;
|
206 |
-
} elseif ($description) {
|
207 |
Mage::helper('full/log')->log("Updating order " . $order->getId() . " history comment to: " . $description);
|
208 |
$order->addStatusHistoryComment($description);
|
209 |
$changed=true;
|
|
|
|
|
210 |
}
|
211 |
|
|
|
212 |
if ($changed) {
|
213 |
try {
|
214 |
$order->save();
|
@@ -320,6 +325,7 @@ class Riskified_Full_Model_Observer {
|
|
320 |
if (isset($response->order)) {
|
321 |
$orderId = $response->order->id;
|
322 |
$status = $response->order->status;
|
|
|
323 |
$description = $response->order->description;
|
324 |
|
325 |
if (!$description) {
|
@@ -327,7 +333,7 @@ class Riskified_Full_Model_Observer {
|
|
327 |
}
|
328 |
|
329 |
if ($orderId && $status) {
|
330 |
-
Mage::helper('full/order')->updateOrder($order, $status, $description);
|
331 |
}
|
332 |
|
333 |
$origId = $order->getId();
|
150 |
$riskifiedOrderStatusHelper = Mage::helper('full/order_status');
|
151 |
$riskifiedInvoiceHelper = Mage::helper('full/order_invoice');
|
152 |
$order = $observer->getOrder();
|
153 |
+
$riskifiedStatus = (string) $observer->getStatus();
|
154 |
+
$riskifiedOldStatus = (string) $observer->getOldStatus();
|
155 |
$description = (string) $observer->getDescription();
|
156 |
$newState = $newStatus = null;
|
157 |
$currentState = $order->getState();
|
158 |
$currentStatus = $order->getStatus();
|
159 |
|
160 |
Mage::helper('full/log')->log("Checking if should update order '" . $order->getId() . "' from state: '$currentState' and status: '$currentStatus'");
|
161 |
+
Mage::helper('full/log')->log("Data received from riskified: status: " . $riskifiedStatus . ", old_status: " . $riskifiedOldStatus . ", description: " . $description);
|
162 |
|
163 |
+
switch ($riskifiedStatus) {
|
164 |
case 'approved':
|
165 |
if ($currentState == Mage_Sales_Model_Order::STATE_HOLDED
|
166 |
&& ($currentStatus == $riskifiedOrderStatusHelper->getOnHoldStatusCode()
|
167 |
|| $currentStatus == $riskifiedOrderStatusHelper->getTransportErrorStatusCode())) {
|
168 |
+
$newState = $riskifiedOrderStatusHelper->getSelectedApprovedState();
|
169 |
+
$newStatus = $riskifiedOrderStatusHelper->getRiskifiedApprovedStatusCode();
|
170 |
}
|
171 |
|
172 |
break;
|
174 |
if ($currentState == Mage_Sales_Model_Order::STATE_HOLDED
|
175 |
&& ($currentStatus == $riskifiedOrderStatusHelper->getOnHoldStatusCode()
|
176 |
|| $currentStatus == $riskifiedOrderStatusHelper->getTransportErrorStatusCode())) {
|
177 |
+
$newState = $riskifiedOrderStatusHelper->getSelectedDeclinedState();
|
178 |
+
$newStatus = $riskifiedOrderStatusHelper->getRiskifiedDeclinedStatusCode();
|
179 |
}
|
180 |
|
181 |
break;
|
205 |
$order->setState($newState, $newStatus, $description);
|
206 |
Mage::helper('full/log')->log("Updating order '" . $order->getId() . "' to: state: '$newState', status: '$newStatus', description: '$description'");
|
207 |
$changed=true;
|
208 |
+
} elseif ($description && $riskifiedStatus != $riskifiedOldStatus) {
|
209 |
Mage::helper('full/log')->log("Updating order " . $order->getId() . " history comment to: " . $description);
|
210 |
$order->addStatusHistoryComment($description);
|
211 |
$changed=true;
|
212 |
+
} else {
|
213 |
+
Mage::helper('full/log')->log("No update to state,status,comments is required for " . $order->getId());
|
214 |
}
|
215 |
|
216 |
+
|
217 |
if ($changed) {
|
218 |
try {
|
219 |
$order->save();
|
325 |
if (isset($response->order)) {
|
326 |
$orderId = $response->order->id;
|
327 |
$status = $response->order->status;
|
328 |
+
$oldStatus = $response->order->old_status;
|
329 |
$description = $response->order->description;
|
330 |
|
331 |
if (!$description) {
|
333 |
}
|
334 |
|
335 |
if ($orderId && $status) {
|
336 |
+
Mage::helper('full/order')->updateOrder($order, $status, $oldStatus, $description);
|
337 |
}
|
338 |
|
339 |
$origId = $order->getId();
|
app/code/community/Riskified/Full/Model/System/Config/Source/ApprovedState.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Riskified_Full_Model_System_Config_Source_ApprovedState
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @return array
|
7 |
+
*/
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
array('value' => Mage_Sales_Model_Order::STATE_PROCESSING, 'label' => Mage::helper('full')->__(Mage_Sales_Model_Order::STATE_PROCESSING)),
|
12 |
+
array('value' => Mage_Sales_Model_Order::STATE_HOLDED, 'label' => Mage::helper('full')->__(Mage_Sales_Model_Order::STATE_HOLDED))
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Riskified/Full/Model/System/Config/Source/DeclinedState.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Riskified_Full_Model_System_Config_Source_DeclinedState
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @return array
|
7 |
+
*/
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
array('value' => Mage_Sales_Model_Order::STATE_CANCELED, 'label' => Mage::helper('full')->__(Mage_Sales_Model_Order::STATE_CANCELED)),
|
12 |
+
array('value' => Mage_Sales_Model_Order::STATE_HOLDED, 'label' => Mage::helper('full')->__(Mage_Sales_Model_Order::STATE_HOLDED))
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Riskified/Full/controllers/ResponseController.php
CHANGED
@@ -24,7 +24,7 @@ class Riskified_Full_ResponseController extends Mage_Core_Controller_Front_Actio
|
|
24 |
$statusCode = 400;
|
25 |
$msg = 'Could not find order to update.';
|
26 |
} else {
|
27 |
-
$helper->updateOrder($order, $notification->status, $notification->description);
|
28 |
$statusCode = 200;
|
29 |
$msg = 'Order-Update event triggered.';
|
30 |
}
|
24 |
$statusCode = 400;
|
25 |
$msg = 'Could not find order to update.';
|
26 |
} else {
|
27 |
+
$helper->updateOrder($order, $notification->status,$notification->oldStatus, $notification->description);
|
28 |
$statusCode = 200;
|
29 |
$msg = 'Order-Update event triggered.';
|
30 |
}
|
app/code/community/Riskified/Full/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Riskified_Full>
|
5 |
-
<version>1.0.
|
6 |
</Riskified_Full>
|
7 |
</modules>
|
8 |
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Riskified_Full>
|
5 |
+
<version>1.0.6.0</version>
|
6 |
</Riskified_Full>
|
7 |
</modules>
|
8 |
|
app/code/community/Riskified/Full/etc/system.xml
CHANGED
@@ -24,60 +24,88 @@
|
|
24 |
<show_in_website>0</show_in_website>
|
25 |
<show_in_store>0</show_in_store>
|
26 |
<fields>
|
27 |
-
<order_status_sync translate="label comment">
|
28 |
-
<label>Order Status Sync</label>
|
29 |
-
<comment><![CDATA[ Enable/Disable automatic changes to Order status by Riskified's review process.
|
30 |
-
<br>Requires the <i>Order notification endpoint</i> to be configured correctly in your Riskified Settings page.
|
31 |
-
<br>Using the following mapping:
|
32 |
-
<br>'submit' => 'on hold' <br>'approve' => 'processing'<br>'decline' => 'canceled'
|
33 |
-
<br><b>Important:</b> Might affect other extensions that are dependent on an Order's status.
|
34 |
-
]]></comment>
|
35 |
-
<frontend_type>select</frontend_type>
|
36 |
-
<sort_order>1</sort_order>
|
37 |
-
<show_in_default>1</show_in_default>
|
38 |
-
<show_in_website>1</show_in_website>
|
39 |
-
<show_in_store>1</show_in_store>
|
40 |
-
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
41 |
-
</order_status_sync>
|
42 |
<env translate="label comment">
|
43 |
<label>Riskified environment</label>
|
44 |
<frontend_type>select</frontend_type>
|
45 |
<source_model>full/system_config_source_env</source_model>
|
46 |
-
<sort_order>
|
47 |
<show_in_default>1</show_in_default>
|
48 |
-
<show_in_website>
|
49 |
-
<show_in_store>
|
50 |
<comment><![CDATA[Select Riskified's environment.<br> You can use sandbox for testing.
|
51 |
<br>If you don't have a sandbox account please contact support@riskified.com ]]></comment>
|
52 |
</env>
|
53 |
-
<!--<activationstatus>
|
54 |
-
<comment></comment>
|
55 |
-
<frontend_type>text</frontend_type>
|
56 |
-
<sort_order>4</sort_order>
|
57 |
-
<class>riskified_activationstatus</class>
|
58 |
-
<show_in_default>1</show_in_default>
|
59 |
-
<show_in_website>1</show_in_website>
|
60 |
-
<show_in_store>1</show_in_store>
|
61 |
-
</activationstatus>-->
|
62 |
<domain translate="label comment">
|
63 |
<label>Shop Domain</label>
|
64 |
<frontend_type>Text</frontend_type>
|
65 |
-
<sort_order>
|
66 |
<show_in_default>1</show_in_default>
|
67 |
-
<show_in_website>
|
68 |
-
<show_in_store>
|
69 |
<comment><![CDATA[This is your Riskified's account username]]></comment>
|
70 |
</domain>
|
71 |
<key translate="label comment">
|
72 |
<label>Auth token</label>
|
73 |
<frontend_type>Text</frontend_type>
|
74 |
-
<sort_order>
|
75 |
<show_in_default>1</show_in_default>
|
76 |
-
<show_in_website>
|
77 |
-
<show_in_store>
|
78 |
<comment><![CDATA[ Your <i>secret</i> auth token can be found in your Riskified Settings page. ]]></comment>
|
79 |
</key>
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
<auto_invoice_enabled translate="label comment">
|
82 |
<label>Enable Auto-Invoice</label>
|
83 |
<frontend_type>select</frontend_type>
|
24 |
<show_in_website>0</show_in_website>
|
25 |
<show_in_store>0</show_in_store>
|
26 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
<env translate="label comment">
|
28 |
<label>Riskified environment</label>
|
29 |
<frontend_type>select</frontend_type>
|
30 |
<source_model>full/system_config_source_env</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>0</show_in_website>
|
34 |
+
<show_in_store>0</show_in_store>
|
35 |
<comment><![CDATA[Select Riskified's environment.<br> You can use sandbox for testing.
|
36 |
<br>If you don't have a sandbox account please contact support@riskified.com ]]></comment>
|
37 |
</env>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
<domain translate="label comment">
|
39 |
<label>Shop Domain</label>
|
40 |
<frontend_type>Text</frontend_type>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>0</show_in_website>
|
44 |
+
<show_in_store>0</show_in_store>
|
45 |
<comment><![CDATA[This is your Riskified's account username]]></comment>
|
46 |
</domain>
|
47 |
<key translate="label comment">
|
48 |
<label>Auth token</label>
|
49 |
<frontend_type>Text</frontend_type>
|
50 |
+
<sort_order>3</sort_order>
|
51 |
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>0</show_in_website>
|
53 |
+
<show_in_store>0</show_in_store>
|
54 |
<comment><![CDATA[ Your <i>secret</i> auth token can be found in your Riskified Settings page. ]]></comment>
|
55 |
</key>
|
56 |
+
<order_status_sync translate="label comment">
|
57 |
+
<label>Order Status Sync</label>
|
58 |
+
<comment><![CDATA[ Enable/Disable automatic changes to Order status by Riskified's review process.
|
59 |
+
<br>Requires the <i>Order notification endpoint</i> to be configured correctly in your Riskified Settings page.
|
60 |
+
<br>Using the following mapping:
|
61 |
+
<br>'submit' => state: 'On Hold', status: 'On Hold (Riskified)'
|
62 |
+
<br>'approve' => state: [defined bellow by 'Approved State' value], status: 'Approved by Riskified'
|
63 |
+
<br>'decline' => state: [defined bellow by 'Declined State' value], status: 'Declined by Riskified'
|
64 |
+
<br> in case of transfer error => state: 'On Hold, status: 'On Hold (Riskified Transport Error)'
|
65 |
+
<br><b>Important:</b> Might affect other extensions that are dependent on an Order's status.
|
66 |
+
]]></comment>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<sort_order>10</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>0</show_in_website>
|
71 |
+
<show_in_store>0</show_in_store>
|
72 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
73 |
+
</order_status_sync>
|
74 |
+
<approved_state translate="label comment">
|
75 |
+
<label>Approved State</label>
|
76 |
+
<frontend_type>select</frontend_type>
|
77 |
+
<sort_order>11</sort_order>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>0</show_in_website>
|
80 |
+
<show_in_store>0</show_in_store>
|
81 |
+
<comment><![CDATA[The Magento state to move to when an order is approved]]></comment>
|
82 |
+
<source_model>full/system_config_source_approvedState</source_model>
|
83 |
+
<depends>
|
84 |
+
<order_status_sync>1</order_status_sync>
|
85 |
+
</depends>
|
86 |
+
</approved_state>
|
87 |
+
<declined_state translate="label comment">
|
88 |
+
<label>Declined State</label>
|
89 |
+
<frontend_type>select</frontend_type>
|
90 |
+
<sort_order>12</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>0</show_in_website>
|
93 |
+
<show_in_store>0</show_in_store>
|
94 |
+
<comment><![CDATA[The Magento state to move to when an order is declined]]></comment>
|
95 |
+
<source_model>full/system_config_source_declinedState</source_model>
|
96 |
+
<depends>
|
97 |
+
<order_status_sync>1</order_status_sync>
|
98 |
+
</depends>
|
99 |
+
</declined_state>
|
100 |
+
<!--<activationstatus>
|
101 |
+
<comment></comment>
|
102 |
+
<frontend_type>text</frontend_type>
|
103 |
+
<sort_order>4</sort_order>
|
104 |
+
<class>riskified_activationstatus</class>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>0</show_in_website>
|
107 |
+
<show_in_store>0</show_in_store>
|
108 |
+
</activationstatus>-->
|
109 |
<auto_invoice_enabled translate="label comment">
|
110 |
<label>Enable Auto-Invoice</label>
|
111 |
<frontend_type>select</frontend_type>
|
app/code/community/Riskified/Full/sql/riskified_full_setup/{mysql4-install-1.0.2.1.php → mysql4-upgrade-1.0.2.0-1.0.2.1.php}
RENAMED
File without changes
|
app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.5.5-1.0.6.0.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$helper = Mage::helper('full/order_status');
|
8 |
+
|
9 |
+
// create new approved and declined statuses
|
10 |
+
|
11 |
+
Mage::getModel('sales/order_status')
|
12 |
+
->setStatus($helper->getRiskifiedDeclinedStatusCode())
|
13 |
+
->setLabel($helper->getRiskifiedDeclinedStatusLabel())
|
14 |
+
->assignState(Mage_Sales_Model_Order::STATE_HOLDED)
|
15 |
+
->save();
|
16 |
+
|
17 |
+
Mage::getModel('sales/order_status')
|
18 |
+
->setStatus($helper->getRiskifiedDeclinedStatusCode())
|
19 |
+
->setLabel($helper->getRiskifiedDeclinedStatusLabel())
|
20 |
+
->assignState(Mage_Sales_Model_Order::STATE_CANCELED)
|
21 |
+
->save();
|
22 |
+
|
23 |
+
Mage::getModel('sales/order_status')
|
24 |
+
->setStatus($helper->getRiskifiedApprovedStatusCode())
|
25 |
+
->setLabel($helper->getRiskifiedApprovedStatusLabel())
|
26 |
+
->assignState(Mage_Sales_Model_Order::STATE_HOLDED)
|
27 |
+
->save();
|
28 |
+
|
29 |
+
Mage::getModel('sales/order_status')
|
30 |
+
->setStatus($helper->getRiskifiedApprovedStatusCode())
|
31 |
+
->setLabel($helper->getRiskifiedApprovedStatusLabel())
|
32 |
+
->assignState(Mage_Sales_Model_Order::STATE_PROCESSING)
|
33 |
+
->save();
|
34 |
+
|
35 |
+
// update or create existing on hold for review and transport error labels and statuses
|
36 |
+
Mage::getModel('sales/order_status')
|
37 |
+
->setStatus($helper->getOnHoldStatusCode())
|
38 |
+
->setLabel($helper->getOnHoldStatusLabel())
|
39 |
+
->assignState(Mage_Sales_Model_Order::STATE_HOLDED)
|
40 |
+
->save();
|
41 |
+
|
42 |
+
Mage::getModel('sales/order_status')
|
43 |
+
->setStatus($helper->getTransportErrorStatusCode())
|
44 |
+
->setLabel($helper->getTransportErrorStatusLabel())
|
45 |
+
->assignState(Mage_Sales_Model_Order::STATE_HOLDED)
|
46 |
+
->save();
|
47 |
+
|
48 |
+
|
49 |
+
$installer->endSetup();
|
lib/riskified_php_sdk/src/Riskified/.DS_Store
DELETED
Binary file
|
lib/riskified_php_sdk/src/Riskified/Common/Riskified.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
* @package Riskified\Common
|
21 |
*/
|
22 |
class Riskified {
|
23 |
-
const VERSION = '1.1.
|
24 |
const API_VERSION = '2';
|
25 |
|
26 |
/**
|
20 |
* @package Riskified\Common
|
21 |
*/
|
22 |
class Riskified {
|
23 |
+
const VERSION = '1.1.1';
|
24 |
const API_VERSION = '2';
|
25 |
|
26 |
/**
|
lib/riskified_php_sdk/src/Riskified/DecisionNotification/Model/Notification.php
CHANGED
@@ -31,6 +31,10 @@ class Notification {
|
|
31 |
* @var string Status of Order
|
32 |
*/
|
33 |
public $status;
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* @var string Description of Decision
|
36 |
*/
|
@@ -81,7 +85,11 @@ class Notification {
|
|
81 |
if (!array_key_exists('id', $order) || !array_key_exists('status', $order))
|
82 |
throw new Exception\BadPostJsonException($this->headers, $this->body);
|
83 |
|
84 |
-
foreach($order as $key => $value)
|
85 |
-
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
}
|
31 |
* @var string Status of Order
|
32 |
*/
|
33 |
public $status;
|
34 |
+
/**
|
35 |
+
* @var string Status of Order
|
36 |
+
*/
|
37 |
+
public $oldStatus;
|
38 |
/**
|
39 |
* @var string Description of Decision
|
40 |
*/
|
85 |
if (!array_key_exists('id', $order) || !array_key_exists('status', $order))
|
86 |
throw new Exception\BadPostJsonException($this->headers, $this->body);
|
87 |
|
88 |
+
//foreach($order as $key => $value)
|
89 |
+
// $this->$key = $value;
|
90 |
+
$this->id = $order->{'id'};
|
91 |
+
$this->status = $order->{'status'};
|
92 |
+
$this->oldStatus = $order->{'old_status'};
|
93 |
+
$this->description = $order->{'description'};
|
94 |
}
|
95 |
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>riskified_magento</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -9,12 +9,18 @@
|
|
9 |
<summary>Riskified Magento extension</summary>
|
10 |
<description>Riskified reviews, approves & guarantees
|
11 |
transactions you would otherwise decline.</description>
|
12 |
-
<notes>*
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
</notes>
|
14 |
<authors><author><name>Riskified_Mage</name><user>Riskified_Mage</user><email>support@riskified.com</email></author></authors>
|
15 |
-
<date>2014-11-
|
16 |
-
<time>14:
|
17 |
-
<contents><target name="magecommunity"><dir name="Riskified"><dir name="Full"><dir><dir name="Helper"><file name="Data.php" hash="
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>4.4.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>riskified_magento</name>
|
4 |
+
<version>1.0.6.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Riskified Magento extension</summary>
|
10 |
<description>Riskified reviews, approves & guarantees
|
11 |
transactions you would otherwise decline.</description>
|
12 |
+
<notes>* Breaking changes:
|
13 |
+
** Approved orders will now have "Approved (Riskified)" status (still "processing" state by default)
|
14 |
+
** Declined orders will now have "Declined (Riskified)" status instead of "Suspected Fraud" (still "canceled" state by default but can be changed in settings page)
|
15 |
+
* Added configurable states for approved/declined order (see settings page)
|
16 |
+
* Introduced new Magento statuses for approved and declined (with migrations)
|
17 |
+
* Bug fixes for previous database migrations
|
18 |
+

|
19 |
</notes>
|
20 |
<authors><author><name>Riskified_Mage</name><user>Riskified_Mage</user><email>support@riskified.com</email></author></authors>
|
21 |
+
<date>2014-11-18</date>
|
22 |
+
<time>14:42:41</time>
|
23 |
+
<contents><target name="magecommunity"><dir name="Riskified"><dir name="Full"><dir><dir name="Helper"><file name="Data.php" hash="2ba009dd16b8d53ffc7cd2893f1b7a01"/><file name="Debug.php" hash="18335d988a142ee639ea59dbecafa15c"/><file name="Log.php" hash="14125243576ab5b08f40066d24b7241d"/><dir name="Order"><file name="Invoice.php" hash="fd6fcbdedd44551785eddd0e1a482e80"/><file name="Status.php" hash="201a5c07c1d0d0b0a15d3bfb94a46d4b"/></dir><file name="Order.php" hash="ffc5fad598f0d0243825715c1ab3399d"/></dir><dir name="Model"><file name="Authorizenet.php" hash="bd42f62d06a036b9da7709d2e40fc8f1"/><file name="Cron.php" hash="187b86ebe9238ff132ed0337f05a8ae9"/><file name="Observer.php" hash="883dc58af1df8c2b010ca42e52707e80"/><dir name="Resource"><dir name="Retry"><file name="Collection.php" hash="fd62ad4e4cdd8d372751bfa9988cc3a9"/></dir><file name="Retry.php" hash="3be3db7e54bd8bb45e0faffa1941f515"/></dir><file name="Retry.php" hash="89e7344139affa4fe0b9a252a5d1c592"/><dir name="System"><dir name="Config"><dir name="Source"><file name="ApprovedState.php" hash="5c620d1039347218354bd58c2238ecb4"/><file name="CaptureCase.php" hash="daafa6f53c65fa6e6e7ffbb067dbbbba"/><file name="DeclinedState.php" hash="a00907072c06ade079483e3db03bb94f"/><file name="Env.php" hash="4d923355b3e56fac95c2a9b3c353ab76"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="General.php" hash="a5d4950c5655960879e7d75c06977941"/></dir><dir name="Helper"><dir name="General"><dir name="fixtures"><file name="extensionConfigEnabled.yaml" hash="eec8c8d8a1d5de49897b19740cf8e074"/></dir></dir><file name="General.php" hash="607c9711656be48084f6688e114b6bf6"/></dir><dir name="Model"><file name="Environments.php" hash="f3fc028d17c82b9b84b709b932e64eae"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FullController.php" hash="f80e78a808e99f11a7bc00bd02be3f2e"/></dir><file name="ResponseController.php" hash="f94e138bbd1e0b358db4252e8b029390"/></dir><dir name="etc"><file name="config.xml" hash="7c99b1c5a3670b4af89c3f4b08465eba"/><file name="system.xml" hash="9ed5ff1209c08a7babb0e286804c1f9b"/></dir><dir name="sql"><dir name="riskified_full_setup"><file name="mysql4-install-1.0.1.php" hash="6d29dde79353e8bfefa6ea7bc2ef562a"/><file name="mysql4-upgrade-1.0.2.0-1.0.2.1.php" hash="822e85326678a320f141a3ae948e4a24"/><file name="mysql4-upgrade-1.0.4-1.0.5.0.php" hash="557115e1a978d9b194b2cd1cfb8b5a95"/><file name="mysql4-upgrade-1.0.5.5-1.0.6.0.php" hash="0318846fbe8f3e56d8f7d3fdc750e102"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Riskified_Full.xml" hash="d684caecdf710e5d0173ca07e5c5d1c0"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="full.xml" hash="8dbb3dd16fcb5821eb07e9b5d978d55c"/></dir><dir name="template"><dir name="full"><file name="jsinit.phtml" hash="1fa1a2c756390efab5d74835c14d743e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="full.xml" hash="9497753e5c3d2860062c5446c058b4bc"/></dir><dir name="template"><dir name="full"><file name="riskified.phtml" hash="fe4a577c6ef98316d906c36c17f11406"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="riskified"><file name="logo.jpg" hash="0ac96bf07aa8b8ecb3ff06c2ccbf0827"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="riskified_php_sdk"><file name="README.md" hash="f37118baa641e4ef6d670bb1c0298482"/><dir><dir name="sample"><file name="callback.php" hash="e0e206ca3553f2c0922a15a7481cb8f4"/><file name="order_webhook.php" hash="cf8e01be41300977badd171849bf8022"/><file name="run_callback_server.sh" hash="4094bd7d6579f1e5d3a50f8c7b59d5ec"/><file name="upload_historical.php" hash="7ab3a6d71d49067cd612f9ea9b5c4d61"/></dir><dir name="src"><dir name="Riskified"><dir name="Common"><file name="Env.php" hash="84e45f0aa5bd289db005825a8180a10d"/><dir name="Exception"><file name="BaseException.php" hash="6b0c99663a9464b1d94a70647762fbbd"/></dir><file name="Riskified.php" hash="179b51abb6c86b1ca2df4eeb6ce92ea8"/><dir name="Signature"><file name="HttpDataSignature.php" hash="1dd9e2860b72a950129915e31b8098d7"/></dir></dir><dir name="DecisionNotification"><dir name="Exception"><file name="AuthorizationException.php" hash="d0afa3159091dee8dfc2edbf78605e4b"/><file name="BadHeaderException.php" hash="a9ad232eccc5f3fbf2385229b3917fdc"/><file name="BadPostJsonException.php" hash="e9c6c80fc14f61b6f4dc679268cc9a62"/><file name="NotificationException.php" hash="e7471ba97940647607f6d93e04634694"/></dir><dir name="Model"><file name="Notification.php" hash="7a6222da40d7080e6a3f717d8df0bcfe"/></dir></dir><dir name="OrderWebhook"><dir name="Exception"><file name="ClassMismatchPropertyException.php" hash="0b61463eecd2b4b237c50efc90ea5651"/><file name="CurlException.php" hash="c98029e1388f37a891f5beb43518267b"/><file name="FormatMismatchPropertyException.php" hash="d7577cc5fe88341118a489c3e153da63"/><file name="InvalidPropertyException.php" hash="331144340d634a5c100ca9c4f85347c8"/><file name="MalformedJsonException.php" hash="168231cdde49266f7f35b8c122a2aa10"/><file name="MissingPropertyException.php" hash="3f905c4999f3d31b2ee798cbd09cb12f"/><file name="MultiplePropertiesException.php" hash="d6d6e681bed74a479ccf271b2a77a73a"/><file name="PropertyException.php" hash="dbe58dcc08acdc52d5619340257ca193"/><file name="TypeMismatchPropertyException.php" hash="df81b3eb45b8979466dd2bafc205b4e8"/><file name="UnsuccessfulActionException.php" hash="a7c0ceb6ad717fe4aadddd737dc229e9"/></dir><dir name="Model"><file name="AbstractModel.php" hash="e29ec55ba50896ea098fdfd088708dbb"/><file name="Address.php" hash="9aa66915feaa94c38c5e06c7e33bd136"/><file name="Attribute.php" hash="621d144b627f5be7850e14e557397270"/><file name="ClientDetails.php" hash="64257d1b717a9bfd1505f7b647aba488"/><file name="Customer.php" hash="907022894f3ed02029ac5eee839d62a6"/><file name="DiscountCode.php" hash="8c6aedd5ca895deb3df6de23e985f505"/><file name="Fulfillment.php" hash="fc008b1b39f2d459637a1b9d32246ab8"/><file name="LineItem.php" hash="06895618140d24fb8d9f0530d7b5d278"/><file name="Order.php" hash="6d1b11d9d5ccaf405bc8fceb01348519"/><file name="OrderCancellation.php" hash="1cf46df75a02e2e28df30b38518ce11c"/><file name="PaymentDetails.php" hash="a0fd3db455eb045241b3fd9b49ab3a18"/><file name="Refund.php" hash="2730565ede65b148da38cee4b3d28c9c"/><file name="RefundDetails.php" hash="cb307e6893fcb68666d0e00ff1fa52b5"/><file name="ShippingLine.php" hash="67df5f3ae5dc14b0751a0ee1824511cc"/><file name="TaxLine.php" hash="f5ebdea62d786c06766609d9d7aa4fc8"/></dir><dir name="Transport"><file name="AbstractTransport.php" hash="f11f1ec189b2940cd89c01dde0ddfe12"/><file name="CurlTransport.php" hash="50f4f69ef329bcc552b546393d8fe86e"/></dir></dir><file name="autoloader.php" hash="67658efe459a30d30e30f7bb52ccdedf"/></dir></dir></dir><file name=".gitignore" hash="73f01e1298c44b6cc3e24a70cad8c56c"/></dir></target></contents>
|
24 |
<compatible/>
|
25 |
<dependencies><required><php><min>4.4.0</min><max>6.0.0</max></php></required></dependencies>
|
26 |
</package>
|