Version Notes
* Beacon with FPC hole punching capabilities
* Better support for status transitions with order status sync
* Voiding payments at the gateway on decline when state set to canceled.
Download this release
Release Info
| Developer | Riskified_Mage |
| Extension | riskified_magento |
| Version | 1.0.8.3 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.8.0 to 1.0.8.3
- app/code/community/Riskified/Full/Block/Beacon.php +16 -0
- app/code/community/Riskified/Full/Helper/Customer/Order.php +34 -0
- app/code/community/Riskified/Full/Helper/Data.php +47 -30
- app/code/community/Riskified/Full/Helper/Debug.php +3 -4
- app/code/community/Riskified/Full/Helper/Log.php +4 -4
- app/code/community/Riskified/Full/Helper/Order.php +216 -166
- app/code/community/Riskified/Full/Helper/Order/Invoice.php +22 -22
- app/code/community/Riskified/Full/Helper/Order/Status.php +23 -23
- app/code/community/Riskified/Full/Model/Authorizenet.php +4 -29
- app/code/community/Riskified/Full/Model/Container/Beacon.php +30 -0
- app/code/community/Riskified/Full/Model/Cron.php +15 -16
- app/code/community/Riskified/Full/Model/Observer.php +188 -151
- app/code/community/Riskified/Full/Model/System/Config/Source/ApprovedState.php +10 -10
- app/code/community/Riskified/Full/Model/System/Config/Source/CanceledStateStatuses.php +2 -2
- app/code/community/Riskified/Full/Model/System/Config/Source/CaptureCase.php +10 -10
- app/code/community/Riskified/Full/Model/System/Config/Source/DeclinedState.php +10 -10
- app/code/community/Riskified/Full/Model/System/Config/Source/Env.php +1 -1
- app/code/community/Riskified/Full/Model/System/Config/Source/HoldedStateStatuses.php +2 -2
- app/code/community/Riskified/Full/Model/System/Config/Source/ProcessingStateStatuses.php +2 -2
- app/code/community/Riskified/Full/controllers/Adminhtml/RiskifiedfullController.php +2 -2
- app/code/community/Riskified/Full/controllers/ResponseController.php +7 -7
- app/code/community/Riskified/Full/etc/adminhtml.xml +47 -0
- app/code/community/Riskified/Full/etc/cache.xml +10 -0
- app/code/community/Riskified/Full/etc/config.xml +18 -41
- app/code/community/Riskified/Full/etc/system.xml +6 -3
- app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-install-1.0.1.php +3 -3
- app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.2.0-1.0.2.1.php +3 -3
- app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.4-1.0.5.0.php +12 -13
- app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.5.5-1.0.6.0.php +3 -3
- app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.8.0-1.0.8.1.php +18 -0
- app/design/frontend/base/default/layout/full.xml +1 -1
- app/design/frontend/base/default/template/full/{riskified.phtml → beacon.phtml} +4 -6
- package.xml +7 -5
app/code/community/Riskified/Full/Block/Beacon.php
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Riskified_Full_Block_Beacon extends Mage_Core_Block_Template
|
| 4 |
+
{
|
| 5 |
+
protected $sessionId, $shopDomain, $extensionVersion, $beaconUrl, $time;
|
| 6 |
+
|
| 7 |
+
protected function _construct()
|
| 8 |
+
{
|
| 9 |
+
$this->setTemplate('full/beacon.phtml');
|
| 10 |
+
$helper = Mage::helper('full');
|
| 11 |
+
$this->sessionId = $helper->getSessionId();
|
| 12 |
+
$this->shopDomain = $helper->getShopDomain();
|
| 13 |
+
$this->extensionVersion = $helper->getExtensionVersion();
|
| 14 |
+
$this->beaconUrl = $helper->getConfigBeaconUrl();
|
| 15 |
+
}
|
| 16 |
+
}
|
app/code/community/Riskified/Full/Helper/Customer/Order.php
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Riskified_Full_Helper_Customer_Order extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
private $_orders = array();
|
| 6 |
+
|
| 7 |
+
private function _prepare($customer_id) {
|
| 8 |
+
return Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customer_id);
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
public function getCustomerOrders($customer_id) {
|
| 12 |
+
if(!isset($this->_orders[$customer_id])) {
|
| 13 |
+
$customer_orders = $this->_prepare($customer_id);
|
| 14 |
+
$size = $customer_orders->getSize();
|
| 15 |
+
|
| 16 |
+
if ($size) {
|
| 17 |
+
$last_id = $customer_orders->getLastItem()->getId();
|
| 18 |
+
|
| 19 |
+
$total = $customer_orders
|
| 20 |
+
->addExpressionFieldToSelect('sum_total', 'SUM(base_grand_total)', 'base_grand_total')
|
| 21 |
+
->addOrder('entity_id')
|
| 22 |
+
->fetchItem()->getSumTotal();
|
| 23 |
+
|
| 24 |
+
$this->_orders[$customer_id] = array(
|
| 25 |
+
'last_order_id' => $last_id,
|
| 26 |
+
'total_spent' => $total,
|
| 27 |
+
'orders_count' => $size,
|
| 28 |
+
);
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
return $this->_orders[$customer_id];
|
| 33 |
+
}
|
| 34 |
+
}
|
app/code/community/Riskified/Full/Helper/Data.php
CHANGED
|
@@ -2,74 +2,91 @@
|
|
| 2 |
|
| 3 |
require_once(Mage::getBaseDir('lib') . DIRECTORY_SEPARATOR . 'riskified_php_sdk' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Riskified' . DIRECTORY_SEPARATOR . 'autoloader.php');
|
| 4 |
|
| 5 |
-
class Riskified_Full_Helper_Data extends Mage_Core_Helper_Abstract
|
|
|
|
| 6 |
|
| 7 |
-
public function getAdminUrl()
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
-
public function getAuthToken()
|
| 18 |
-
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
-
public function getConfigStatusControlActive()
|
|
|
|
| 22 |
return Mage::getStoreConfig('fullsection/full/order_status_sync');
|
| 23 |
}
|
| 24 |
|
| 25 |
-
public function getConfigEnv()
|
|
|
|
| 26 |
return 'Riskified\Common\Env::' . Mage::getStoreConfig('fullsection/full/env');
|
| 27 |
}
|
| 28 |
|
| 29 |
-
public function getConfigEnableAutoInvoice()
|
|
|
|
| 30 |
return Mage::getStoreConfig('fullsection/full/auto_invoice_enabled');
|
| 31 |
}
|
| 32 |
|
| 33 |
-
public function getConfigAutoInvoiceCaptureCase()
|
|
|
|
| 34 |
return Mage::getStoreConfig('fullsection/full/auto_invoice_capture_case');
|
| 35 |
}
|
| 36 |
|
| 37 |
-
public function getConfigBeaconUrl()
|
|
|
|
| 38 |
return Mage::getStoreConfig('fullsection/full/beaconurl');
|
| 39 |
}
|
| 40 |
|
| 41 |
-
public function getShopDomain()
|
| 42 |
-
|
|
|
|
| 43 |
}
|
| 44 |
|
| 45 |
-
public function getExtensionVersion()
|
| 46 |
-
|
|
|
|
| 47 |
}
|
| 48 |
|
| 49 |
-
public function getDeclinedState()
|
|
|
|
| 50 |
return Mage::getStoreConfig('fullsection/full/declined_state');
|
| 51 |
}
|
| 52 |
|
| 53 |
-
public function getDeclinedStatus()
|
|
|
|
| 54 |
$state = $this->getDeclinedState();
|
| 55 |
-
return Mage::getStoreConfig('fullsection/full/declined_status_'
|
| 56 |
}
|
| 57 |
|
| 58 |
-
public function getApprovedState()
|
|
|
|
| 59 |
return Mage::getStoreConfig('fullsection/full/approved_state');
|
| 60 |
}
|
| 61 |
|
| 62 |
-
public function getApprovedStatus()
|
|
|
|
| 63 |
$state = $this->getApprovedState();
|
| 64 |
-
return Mage::getStoreConfig('fullsection/full/approved_status_'
|
| 65 |
}
|
| 66 |
|
| 67 |
-
public function isDebugLogsEnabled()
|
| 68 |
-
|
|
|
|
| 69 |
}
|
| 70 |
|
| 71 |
public function getSessionId(){
|
| 72 |
-
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
/**
|
|
@@ -87,4 +104,4 @@ class Riskified_Full_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
| 87 |
{
|
| 88 |
return Riskified\Common\Riskified::API_VERSION;
|
| 89 |
}
|
| 90 |
-
}
|
| 2 |
|
| 3 |
require_once(Mage::getBaseDir('lib') . DIRECTORY_SEPARATOR . 'riskified_php_sdk' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Riskified' . DIRECTORY_SEPARATOR . 'autoloader.php');
|
| 4 |
|
| 5 |
+
class Riskified_Full_Helper_Data extends Mage_Core_Helper_Abstract
|
| 6 |
+
{
|
| 7 |
|
| 8 |
+
public function getAdminUrl()
|
| 9 |
+
{
|
| 10 |
+
$out = null;
|
| 11 |
+
$match = preg_match("/(.*)full\/response\/getresponse.*/i", Mage::helper('adminhtml')->getUrl('full/response/getresponse'), $out);
|
| 12 |
+
if ($match) {
|
| 13 |
+
return $out[1];
|
| 14 |
+
} else {
|
| 15 |
+
return "";
|
| 16 |
+
}
|
| 17 |
}
|
| 18 |
|
| 19 |
+
public function getAuthToken()
|
| 20 |
+
{
|
| 21 |
+
return Mage::getStoreConfig('fullsection/full/key', Mage::app()->getStore());
|
| 22 |
}
|
| 23 |
|
| 24 |
+
public function getConfigStatusControlActive()
|
| 25 |
+
{
|
| 26 |
return Mage::getStoreConfig('fullsection/full/order_status_sync');
|
| 27 |
}
|
| 28 |
|
| 29 |
+
public function getConfigEnv()
|
| 30 |
+
{
|
| 31 |
return 'Riskified\Common\Env::' . Mage::getStoreConfig('fullsection/full/env');
|
| 32 |
}
|
| 33 |
|
| 34 |
+
public function getConfigEnableAutoInvoice()
|
| 35 |
+
{
|
| 36 |
return Mage::getStoreConfig('fullsection/full/auto_invoice_enabled');
|
| 37 |
}
|
| 38 |
|
| 39 |
+
public function getConfigAutoInvoiceCaptureCase()
|
| 40 |
+
{
|
| 41 |
return Mage::getStoreConfig('fullsection/full/auto_invoice_capture_case');
|
| 42 |
}
|
| 43 |
|
| 44 |
+
public function getConfigBeaconUrl()
|
| 45 |
+
{
|
| 46 |
return Mage::getStoreConfig('fullsection/full/beaconurl');
|
| 47 |
}
|
| 48 |
|
| 49 |
+
public function getShopDomain()
|
| 50 |
+
{
|
| 51 |
+
return Mage::getStoreConfig('fullsection/full/domain');
|
| 52 |
}
|
| 53 |
|
| 54 |
+
public function getExtensionVersion()
|
| 55 |
+
{
|
| 56 |
+
return (string)Mage::getConfig()->getNode()->modules->Riskified_Full->version;
|
| 57 |
}
|
| 58 |
|
| 59 |
+
public function getDeclinedState()
|
| 60 |
+
{
|
| 61 |
return Mage::getStoreConfig('fullsection/full/declined_state');
|
| 62 |
}
|
| 63 |
|
| 64 |
+
public function getDeclinedStatus()
|
| 65 |
+
{
|
| 66 |
$state = $this->getDeclinedState();
|
| 67 |
+
return Mage::getStoreConfig('fullsection/full/declined_status_' . $state);
|
| 68 |
}
|
| 69 |
|
| 70 |
+
public function getApprovedState()
|
| 71 |
+
{
|
| 72 |
return Mage::getStoreConfig('fullsection/full/approved_state');
|
| 73 |
}
|
| 74 |
|
| 75 |
+
public function getApprovedStatus()
|
| 76 |
+
{
|
| 77 |
$state = $this->getApprovedState();
|
| 78 |
+
return Mage::getStoreConfig('fullsection/full/approved_status_' . $state);
|
| 79 |
}
|
| 80 |
|
| 81 |
+
public function isDebugLogsEnabled()
|
| 82 |
+
{
|
| 83 |
+
return (bool)Mage::getStoreConfig('fullsection/full/debug_logs');
|
| 84 |
}
|
| 85 |
|
| 86 |
public function getSessionId(){
|
| 87 |
+
//return Mage::getSingleton("core/session")->getEncryptedSessionId();
|
| 88 |
+
//return Mage::getModel('core/cookie')->get('rCookie');
|
| 89 |
+
return Mage::getSingleton("core/session")->getSessionId();
|
| 90 |
}
|
| 91 |
|
| 92 |
/**
|
| 104 |
{
|
| 105 |
return Riskified\Common\Riskified::API_VERSION;
|
| 106 |
}
|
| 107 |
+
}
|
app/code/community/Riskified/Full/Helper/Debug.php
CHANGED
|
@@ -22,8 +22,7 @@ class Riskified_Full_Helper_Debug extends Mage_Core_Helper_Abstract
|
|
| 22 |
|
| 23 |
try {
|
| 24 |
$mail->send();
|
| 25 |
-
}
|
| 26 |
-
catch (Exception $e) {
|
| 27 |
Mage::helper('full/log')->logException($e);
|
| 28 |
}
|
| 29 |
}
|
|
@@ -47,8 +46,8 @@ class Riskified_Full_Helper_Debug extends Mage_Core_Helper_Abstract
|
|
| 47 |
// All Riskified config values
|
| 48 |
$configGroups = Mage::getStoreConfig(self::CONFIG_SECTION);
|
| 49 |
|
| 50 |
-
foreach($configGroups as $groupName => $group) {
|
| 51 |
-
foreach($group as $fieldName => $field) {
|
| 52 |
$data['magentoConfig-' . self::CONFIG_SECTION . '/' . $groupName . '/' . $fieldName] = $field;
|
| 53 |
}
|
| 54 |
}
|
| 22 |
|
| 23 |
try {
|
| 24 |
$mail->send();
|
| 25 |
+
} catch (Exception $e) {
|
|
|
|
| 26 |
Mage::helper('full/log')->logException($e);
|
| 27 |
}
|
| 28 |
}
|
| 46 |
// All Riskified config values
|
| 47 |
$configGroups = Mage::getStoreConfig(self::CONFIG_SECTION);
|
| 48 |
|
| 49 |
+
foreach ($configGroups as $groupName => $group) {
|
| 50 |
+
foreach ($group as $fieldName => $field) {
|
| 51 |
$data['magentoConfig-' . self::CONFIG_SECTION . '/' . $groupName . '/' . $fieldName] = $field;
|
| 52 |
}
|
| 53 |
}
|
app/code/community/Riskified/Full/Helper/Log.php
CHANGED
|
@@ -2,10 +2,10 @@
|
|
| 2 |
|
| 3 |
class Riskified_Full_Helper_Log extends Mage_Core_Helper_Abstract
|
| 4 |
{
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
| 10 |
public function logException($e)
|
| 11 |
{
|
| 2 |
|
| 3 |
class Riskified_Full_Helper_Log extends Mage_Core_Helper_Abstract
|
| 4 |
{
|
| 5 |
+
public function log($message, $level = null)
|
| 6 |
+
{
|
| 7 |
+
Mage::log($message, $level, 'riskified_full.log');
|
| 8 |
+
}
|
| 9 |
|
| 10 |
public function logException($e)
|
| 11 |
{
|
app/code/community/Riskified/Full/Helper/Order.php
CHANGED
|
@@ -9,13 +9,17 @@ use Riskified\OrderWebhook\Transport;
|
|
| 9 |
use Riskified\DecisionNotification\Model\Notification as DecisionNotification;
|
| 10 |
|
| 11 |
|
| 12 |
-
class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract
|
|
|
|
| 13 |
const ACTION_CREATE = 'create';
|
| 14 |
const ACTION_UPDATE = 'update';
|
| 15 |
const ACTION_SUBMIT = 'submit';
|
| 16 |
const ACTION_CANCEL = 'cancel';
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
$this->initSdk();
|
| 20 |
}
|
| 21 |
|
|
@@ -25,7 +29,8 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 25 |
* @return stdClass
|
| 26 |
* @throws Exception
|
| 27 |
*/
|
| 28 |
-
public function updateMerchantSettings($settings)
|
|
|
|
| 29 |
$transport = $this->getTransport();
|
| 30 |
Mage::helper('full/log')->log('updateMerchantSettings');
|
| 31 |
|
|
@@ -33,19 +38,18 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 33 |
$response = $transport->updateMerchantSettings($settings);
|
| 34 |
|
| 35 |
Mage::helper('full/log')->log('Merchant Settings posted successfully');
|
| 36 |
-
} catch(\Riskified\OrderWebhook\Exception\UnsuccessfulActionException $uae) {
|
| 37 |
if ($uae->statusCode == '401') {
|
| 38 |
Mage::helper('full/log')->logException($uae);
|
| 39 |
Mage::getSingleton('adminhtml/session')->addError('Make sure you have the correct Auth token as it appears in Riskified advanced settings.');
|
| 40 |
}
|
| 41 |
throw $uae;
|
| 42 |
-
} catch(\Riskified\OrderWebhook\Exception\CurlException $curlException) {
|
| 43 |
Mage::helper('full/log')->logException($curlException);
|
| 44 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $curlException->getMessage());
|
| 45 |
|
| 46 |
throw $curlException;
|
| 47 |
-
}
|
| 48 |
-
catch (Exception $e) {
|
| 49 |
Mage::helper('full/log')->logException($e);
|
| 50 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $e->getMessage());
|
| 51 |
|
|
@@ -54,6 +58,7 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 54 |
return $response;
|
| 55 |
|
| 56 |
}
|
|
|
|
| 57 |
/**
|
| 58 |
* Submit an order to Riskified.
|
| 59 |
*
|
|
@@ -62,11 +67,12 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 62 |
* @return stdClass
|
| 63 |
* @throws Exception
|
| 64 |
*/
|
| 65 |
-
public function postOrder($order, $action)
|
|
|
|
| 66 |
$transport = $this->getTransport();
|
| 67 |
$headers = $this->getHeaders();
|
| 68 |
|
| 69 |
-
|
| 70 |
|
| 71 |
$eventData = array(
|
| 72 |
'order' => $order,
|
|
@@ -105,11 +111,11 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 105 |
'riskified_full_post_order_success',
|
| 106 |
$eventData
|
| 107 |
);
|
| 108 |
-
} catch(\Riskified\OrderWebhook\Exception\CurlException $curlException) {
|
| 109 |
Mage::helper('full/log')->logException($curlException);
|
| 110 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $curlException->getMessage());
|
| 111 |
|
| 112 |
-
$this->updateOrder($order, 'error',null, 'Error transferring order data to Riskified');
|
| 113 |
$this->scheduleSubmissionRetry($order, $action);
|
| 114 |
|
| 115 |
Mage::dispatchEvent(
|
|
@@ -118,8 +124,7 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 118 |
);
|
| 119 |
|
| 120 |
throw $curlException;
|
| 121 |
-
}
|
| 122 |
-
catch (Exception $e) {
|
| 123 |
Mage::helper('full/log')->logException($e);
|
| 124 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $e->getMessage());
|
| 125 |
|
|
@@ -134,71 +139,76 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 134 |
return $response;
|
| 135 |
}
|
| 136 |
|
| 137 |
-
public function postHistoricalOrders($models)
|
|
|
|
| 138 |
$orders = array();
|
| 139 |
foreach ($models as $model) {
|
| 140 |
$orders[] = $this->getOrder($model);
|
| 141 |
}
|
| 142 |
|
| 143 |
$msgs = $this->getTransport()->sendHistoricalOrders($orders);
|
| 144 |
-
return "Successfully uploaded ".count($msgs)." orders.".PHP_EOL;
|
| 145 |
}
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
* - riskified_order_update_error
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
* @param string $oldStatus
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
|
|
|
| 167 |
'" old status "' . $oldStatus . '" and description "' . $description . '"');
|
| 168 |
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
'old_status' => $oldStatus,
|
| 173 |
-
|
| 174 |
-
|
| 175 |
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
|
| 182 |
-
|
| 183 |
-
|
| 184 |
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
|
| 190 |
-
|
| 191 |
}
|
| 192 |
|
| 193 |
-
public function getRiskifiedDomain()
|
|
|
|
| 194 |
return Riskified::getHostByEnv();
|
| 195 |
}
|
| 196 |
|
| 197 |
-
public function getRiskifiedApp()
|
|
|
|
| 198 |
return str_replace("wh", "app", $this->getRiskifiedDomain());
|
| 199 |
}
|
| 200 |
|
| 201 |
-
public function parseRequest($request)
|
|
|
|
| 202 |
$header_name = Signature\HttpDataSignature::HMAC_HEADER_NAME;
|
| 203 |
$headers = array($header_name => $request->getHeader($header_name));
|
| 204 |
$body = $request->getRawBody();
|
|
@@ -206,8 +216,9 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 206 |
return new DecisionNotification(new Signature\HttpDataSignature(), $headers, $body);
|
| 207 |
}
|
| 208 |
|
| 209 |
-
public function getOrderOrigId($order)
|
| 210 |
-
|
|
|
|
| 211 |
return null;
|
| 212 |
}
|
| 213 |
return $order->getId() . '_' . $order->getIncrementId();
|
|
@@ -215,7 +226,8 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 215 |
|
| 216 |
private $version;
|
| 217 |
|
| 218 |
-
private function initSdk()
|
|
|
|
| 219 |
$helper = Mage::helper('full');
|
| 220 |
$authToken = $helper->getAuthToken();
|
| 221 |
$env = constant($helper->getConfigEnv());
|
|
@@ -223,33 +235,37 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 223 |
$this->version = $helper->getExtensionVersion();
|
| 224 |
$sdkVersion = Riskified::VERSION;
|
| 225 |
|
| 226 |
-
|
| 227 |
Riskified::init($shopDomain, $authToken, $env, Validations::SKIP);
|
| 228 |
}
|
| 229 |
|
| 230 |
-
private function getHeaders()
|
| 231 |
-
|
|
|
|
| 232 |
}
|
| 233 |
|
| 234 |
-
private function getTransport()
|
|
|
|
| 235 |
$transport = new Transport\CurlTransport(new Signature\HttpDataSignature());
|
| 236 |
$transport->timeout = 15;
|
| 237 |
return $transport;
|
| 238 |
}
|
| 239 |
|
| 240 |
-
private function getOrderCancellation($model)
|
|
|
|
| 241 |
$orderCancellation = new Model\OrderCancellation(array_filter(array(
|
| 242 |
'id' => $this->getOrderOrigId($model),
|
| 243 |
'cancelled_at' => $this->formatDateAsIso8601($this->getCancelledAt($model)),
|
| 244 |
'cancel_reason' => 'Cancelled by merchant'
|
| 245 |
)));
|
| 246 |
|
| 247 |
-
Mage::helper('full/log')->log("getOrderCancellation(): ".PHP_EOL.json_encode(json_decode($orderCancellation->toJson())));
|
| 248 |
|
| 249 |
return $orderCancellation;
|
| 250 |
}
|
| 251 |
|
| 252 |
-
private function getOrder($model)
|
|
|
|
| 253 |
$gateway = 'unavailable';
|
| 254 |
if ($model->getPayment()) {
|
| 255 |
$gateway = $model->getPayment()->getMethod();
|
|
@@ -269,7 +285,7 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 269 |
'total_price' => $model->getGrandTotal(),
|
| 270 |
'total_discounts' => $model->getDiscountAmount(),
|
| 271 |
'subtotal_price' => $model->getBaseSubtotalInclTax(),
|
| 272 |
-
'discount_codes'
|
| 273 |
'taxes_included' => true,
|
| 274 |
'total_tax' => $model->getBaseTaxAmount(),
|
| 275 |
'total_weight' => $model->getWeight(),
|
|
@@ -285,7 +301,7 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 285 |
unset($order_array['cart_token']);
|
| 286 |
}
|
| 287 |
|
| 288 |
-
$order = new Model\Order(array_filter($order_array,'strlen'));
|
| 289 |
|
| 290 |
$order->customer = $this->getCustomer($model);
|
| 291 |
$order->shipping_address = $this->getShippingAddress($model);
|
|
@@ -298,12 +314,13 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 298 |
$order->client_details = $this->getClientDetails($model);
|
| 299 |
}
|
| 300 |
|
| 301 |
-
|
| 302 |
|
| 303 |
return $order;
|
| 304 |
}
|
| 305 |
|
| 306 |
-
private function getCustomer($model)
|
|
|
|
| 307 |
$customer_id = $model->getCustomerId();
|
| 308 |
$customer_props = array(
|
| 309 |
'id' => $customer_id,
|
|
@@ -315,112 +332,118 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 315 |
);
|
| 316 |
|
| 317 |
if ($customer_id) {
|
| 318 |
-
$customer_details =
|
| 319 |
$customer_props['created_at'] = $this->formatDateAsIso8601($customer_details->getCreatedAt());
|
| 320 |
$customer_props['updated_at'] = $this->formatDateAsIso8601($customer_details->getUpdatedAt());
|
| 321 |
|
| 322 |
try {
|
| 323 |
-
$
|
| 324 |
-
$
|
| 325 |
-
|
| 326 |
-
$customer_props['
|
| 327 |
-
if ($customer_orders_count) {
|
| 328 |
-
$customer_props['last_order_id'] = $customer_orders->getLastItem()->getId();
|
| 329 |
-
$total_spent = $customer_orders
|
| 330 |
-
->addExpressionFieldToSelect('sum_total', 'SUM(base_grand_total)', 'base_grand_total')
|
| 331 |
-
->fetchItem()->getSumTotal();
|
| 332 |
-
$customer_props['total_spent'] = $total_spent;
|
| 333 |
-
}
|
| 334 |
} catch (Exception $e) {
|
| 335 |
Mage::helper('full/log')->logException($e);
|
| 336 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $e->getMessage());
|
| 337 |
}
|
| 338 |
}
|
| 339 |
|
| 340 |
-
return new Model\Customer(array_filter($customer_props,'strlen'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
}
|
| 342 |
|
| 343 |
-
private function getShippingAddress($model)
|
|
|
|
| 344 |
$mageAddr = $model->getShippingAddress();
|
| 345 |
return $this->getAddress($mageAddr);
|
| 346 |
}
|
| 347 |
|
| 348 |
-
private function getBillingAddress($model)
|
|
|
|
| 349 |
$mageAddr = $model->getBillingAddress();
|
| 350 |
return $this->getAddress($mageAddr);
|
| 351 |
}
|
| 352 |
|
| 353 |
-
private function logPaymentData($model)
|
|
|
|
| 354 |
Mage::helper('full/log')->log("Payment info debug Logs:");
|
| 355 |
try {
|
| 356 |
$payment = $model->getPayment();
|
| 357 |
$gatewayName = $payment->getMethod();
|
| 358 |
-
Mage::helper('full/log')->log("Payment Gateway: "
|
| 359 |
-
Mage::helper('full/log')->log("payment->getCcLast4(): "
|
| 360 |
-
Mage::helper('full/log')->log("payment->getCcType(): "
|
| 361 |
-
Mage::helper('full/log')->log("payment->getCcCidStatus(): "
|
| 362 |
-
Mage::helper('full/log')->log("payment->getCcAvsStatus(): "
|
| 363 |
-
Mage::helper('full/log')->log("payment->getAdditionalInformation(): ".PHP_EOL.var_export($payment->getAdditionalInformation(), 1));
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
Mage::helper('full/log')->log("payment->getAdyenPspReference(): "
|
| 367 |
-
Mage::helper('full/log')->log("payment->getAdyenKlarnaNumber(): "
|
| 368 |
-
Mage::helper('full/log')->log("payment->getAdyenAvsResult(): "
|
| 369 |
-
Mage::helper('full/log')->log("payment->getAdyenCvcResult(): "
|
| 370 |
-
Mage::helper('full/log')->log("payment->getAdyenBoletoPaidAmount(): "
|
| 371 |
-
Mage::helper('full/log')->log("payment->getAdyenTotalFraudScore(): "
|
| 372 |
-
Mage::helper('full/log')->log("payment->getAdyenRefusalReasonRaw(): "
|
| 373 |
-
Mage::helper('full/log')->log("payment->getAdyenAcquirerReference(): "
|
| 374 |
-
Mage::helper('full/log')->log("payment->getAdyenAuthCode(): "
|
| 375 |
-
|
| 376 |
-
Mage::helper('full/log')->log("payment->getInfo(): ".PHP_EOL.var_export($payment->getInfo(), 1));
|
| 377 |
|
| 378 |
# paypal_avs_code,paypal_cvv2_match,paypal_fraud_filters,avs_result,cvv2_check_result,address_verification,
|
| 379 |
# postcode_verification,payment_status,pending_reason,payer_id,payer_status,email,credit_card_cvv2,
|
| 380 |
# cc_avs_status,cc_approval,cc_last4,cc_owner,cc_exp_month,cc_exp_year,
|
| 381 |
$sage = $model->getSagepayInfo();
|
| 382 |
-
if(is_object($sage)) {
|
| 383 |
#####,postcode_result,avscv2,address_status,payer_status
|
| 384 |
-
Mage::helper('full/log')->log("sagepay->getLastFourDigits(): "
|
| 385 |
-
Mage::helper('full/log')->log("sagepay->last_four_digits: "
|
| 386 |
-
Mage::helper('full/log')->log("sagepay->getCardType(): "
|
| 387 |
-
Mage::helper('full/log')->log("sagepay->card_type: "
|
| 388 |
-
Mage::helper('full/log')->log("sagepay->getAvsCv2Status: "
|
| 389 |
-
Mage::helper('full/log')->log("sagepay->address_result: "
|
| 390 |
-
Mage::helper('full/log')->log("sagepay->getCv2result: "
|
| 391 |
-
Mage::helper('full/log')->log("sagepay->cv2result: "
|
| 392 |
-
Mage::helper('full/log')->log("sagepay->getAvscv2: "
|
| 393 |
-
Mage::helper('full/log')->log("sagepay->getAddressResult: "
|
| 394 |
-
Mage::helper('full/log')->log("sagepay->getPostcodeResult: "
|
| 395 |
-
Mage::helper('full/log')->log("sagepay->getDeclineCode: "
|
| 396 |
-
Mage::helper('full/log')->log("sagepay->getBankAuthCode: "
|
| 397 |
-
Mage::helper('full/log')->log("sagepay->getPayerStatus: "
|
| 398 |
}
|
| 399 |
-
if($gatewayName == "optimal_hosted") {
|
| 400 |
$optimalTransaction = unserialize($payment->getAdditionalInformation('transaction'));
|
| 401 |
-
if($optimalTransaction) {
|
| 402 |
Mage::helper('full/log')->log("Optimal transaction: ");
|
| 403 |
-
Mage::helper('full/log')->log("transaction->cvdVerification: "
|
| 404 |
-
Mage::helper('full/log')->log("transaction->houseNumberVerification: "
|
| 405 |
-
Mage::helper('full/log')->log("transaction->zipVerification: "
|
| 406 |
-
}
|
| 407 |
-
else {
|
| 408 |
Mage::helper('full/log')->log("Optimal gateway but no transaction found");
|
| 409 |
}
|
| 410 |
}
|
| 411 |
|
| 412 |
-
} catch(Exception $e) {
|
| 413 |
Mage::helper('full/log')->logException($e);
|
| 414 |
}
|
| 415 |
}
|
| 416 |
|
| 417 |
-
private function getPaymentDetails($model)
|
|
|
|
| 418 |
$payment = $model->getPayment();
|
| 419 |
-
if(!$payment) {
|
| 420 |
return null;
|
| 421 |
}
|
| 422 |
|
| 423 |
-
if(Mage::helper('full')->isDebugLogsEnabled()) {
|
| 424 |
$this->logPaymentData($model);
|
| 425 |
}
|
| 426 |
|
|
@@ -432,14 +455,22 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 432 |
switch ($gatewayName) {
|
| 433 |
case 'authorizenet':
|
| 434 |
$authorize_data = $payment->getAdditionalInformation('authorize_cards');
|
| 435 |
-
if($authorize_data && is_array($authorize_data)) {
|
| 436 |
$cards_data = array_values($authorize_data);
|
| 437 |
if ($cards_data && $cards_data[0]) {
|
| 438 |
$card_data = $cards_data[0];
|
| 439 |
-
if(isset($card_data['cc_last4'])) {
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
if(isset($card_data['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
}
|
| 444 |
}
|
| 445 |
break;
|
|
@@ -456,8 +487,8 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 456 |
$houseVerification = $optimalTransaction->houseNumberVerification;
|
| 457 |
$zipVerification = $optimalTransaction->zipVerification;
|
| 458 |
$avsResultCode = $houseVerification . ',' . $zipVerification;
|
| 459 |
-
} catch(Exception $e) {
|
| 460 |
-
Mage::helper('full/log')->log("optimal payment ("
|
| 461 |
}
|
| 462 |
break;
|
| 463 |
case 'paypal_express':
|
|
@@ -495,17 +526,16 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 495 |
$creditCardNumber = $sage->getData('last_four_digits');
|
| 496 |
$creditCardCompany = $sage->getData('card_type');
|
| 497 |
//Mage::helper('full/log')->log("sagepay payment (".$gatewayName.") additional info: ".PHP_EOL.var_export($sage->getAdditionalInformation(), 1));
|
| 498 |
-
Mage::helper('full/log')->log("sagepay payment ("
|
| 499 |
-
}
|
| 500 |
-
|
| 501 |
-
Mage::helper('full/log')->log("sagepay payment (".$gatewayName.") - getSagepayInfo returned null object");
|
| 502 |
}
|
| 503 |
break;
|
| 504 |
|
| 505 |
case 'transarmor':
|
| 506 |
$avsResultCode = $payment->getAdditionalInformation('avs_response');
|
| 507 |
$cvvResultCode = $payment->getAdditionalInformation('cvv2_response');
|
| 508 |
-
Mage::helper('full/log')->log("transarmor payment additional info: ".PHP_EOL.var_export($payment->getAdditionalInformation(), 1));
|
| 509 |
break;
|
| 510 |
|
| 511 |
case 'braintreevzero':
|
|
@@ -516,9 +546,16 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 516 |
$avsResultCode = $houseVerification . ',' . $zipVerification;
|
| 517 |
break;
|
| 518 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 519 |
default:
|
| 520 |
Mage::helper('full/log')->log("unknown gateway:" . $gatewayName);
|
| 521 |
-
Mage::helper('full/log')->log("Gateway payment ("
|
| 522 |
break;
|
| 523 |
}
|
| 524 |
} catch (Exception $e) {
|
|
@@ -553,35 +590,40 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 553 |
'credit_card_number' => $creditCardNumber,
|
| 554 |
'credit_card_company' => $creditCardCompany,
|
| 555 |
'credit_card_bin' => $creditCardBin
|
| 556 |
-
),'strlen'));
|
| 557 |
}
|
| 558 |
|
| 559 |
-
private function getLineItems($model)
|
|
|
|
| 560 |
$lineItems = array();
|
| 561 |
foreach ($model->getAllVisibleItems() as $key => $val) {
|
| 562 |
$prodType = null;
|
| 563 |
$category = null;
|
| 564 |
$subCategories = null;
|
|
|
|
| 565 |
$product = $val->getProduct();
|
| 566 |
-
if($product) {
|
| 567 |
$prodType = $val->getProduct()->getTypeId();
|
| 568 |
$categoryIds = $product->getCategoryIds();
|
| 569 |
foreach ($categoryIds as $categoryId) {
|
| 570 |
$cat = Mage::getModel('catalog/category')->load($categoryId);
|
| 571 |
$catName = $cat->getName();
|
| 572 |
if (!empty($catName)) {
|
| 573 |
-
if(empty($category)) {
|
| 574 |
$category = $catName;
|
| 575 |
-
}
|
| 576 |
-
else if(empty($subCategories)) {
|
| 577 |
$subCategories = $catName;
|
| 578 |
-
}
|
| 579 |
-
else {
|
| 580 |
$subCategories = $subCategories . '|' . $catName;
|
| 581 |
}
|
| 582 |
|
| 583 |
}
|
| 584 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
}
|
| 586 |
$lineItems[] = new Model\LineItem(array_filter(array(
|
| 587 |
'price' => $val->getPrice(),
|
|
@@ -592,31 +634,35 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 592 |
'grams' => $val->getWeight(),
|
| 593 |
'product_type' => $prodType,
|
| 594 |
'category' => $category,
|
|
|
|
| 595 |
//'sub_category' => $subCategories
|
| 596 |
-
),'strlen'));
|
| 597 |
}
|
| 598 |
|
| 599 |
return $lineItems;
|
| 600 |
}
|
| 601 |
|
| 602 |
-
private function getShippingLines($model)
|
|
|
|
| 603 |
return new Model\ShippingLine(array_filter(array(
|
| 604 |
'price' => $model->getShippingAmount(),
|
| 605 |
'title' => $model->getShippingDescription(),
|
| 606 |
'code' => $model->getShippingMethod()
|
| 607 |
-
),'strlen'));
|
| 608 |
}
|
| 609 |
|
| 610 |
-
private function getClientDetails($model)
|
|
|
|
| 611 |
return new Model\ClientDetails(array_filter(array(
|
| 612 |
'accept_language' => Mage::app()->getLocale()->getLocaleCode(),
|
| 613 |
//'browser_ip' => $this->getRemoteIp($model),
|
| 614 |
'user_agent' => Mage::helper('core/http')->getHttpUserAgent()
|
| 615 |
-
),'strlen'));
|
| 616 |
}
|
| 617 |
|
| 618 |
-
private function getAddress($address)
|
| 619 |
-
|
|
|
|
| 620 |
return null;
|
| 621 |
}
|
| 622 |
|
|
@@ -624,7 +670,7 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 624 |
$address_1 = (!is_null($street) && array_key_exists('0', $street)) ? $street['0'] : null;
|
| 625 |
$address_2 = (!is_null($street) && array_key_exists('1', $street)) ? $street['1'] : null;
|
| 626 |
|
| 627 |
-
$addrArray =
|
| 628 |
'first_name' => $address->getFirstname(),
|
| 629 |
'last_name' => $address->getLastname(),
|
| 630 |
'name' => $address->getFirstname() . " " . $address->getLastname(),
|
|
@@ -639,13 +685,14 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 639 |
'phone' => $address->getTelephone(),
|
| 640 |
), 'strlen');
|
| 641 |
|
| 642 |
-
if(!$addrArray) {
|
| 643 |
return null;
|
| 644 |
}
|
| 645 |
return new Model\Address($addrArray);
|
| 646 |
}
|
| 647 |
|
| 648 |
-
private function getDiscountCodes($model)
|
|
|
|
| 649 |
$code = $model->getDiscountDescription();
|
| 650 |
$amount = $model->getDiscountAmount();
|
| 651 |
if ($amount && $code)
|
|
@@ -656,7 +703,8 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 656 |
return null;
|
| 657 |
}
|
| 658 |
|
| 659 |
-
private function getCancelledAt($model)
|
|
|
|
| 660 |
$commentCollection = $model->getStatusHistoryCollection();
|
| 661 |
foreach ($commentCollection as $comment) {
|
| 662 |
if ($comment->getStatus() == Mage_Sales_Model_Order::STATE_CANCELED) {
|
|
@@ -666,20 +714,22 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 666 |
return null;
|
| 667 |
}
|
| 668 |
|
| 669 |
-
private function formatDateAsIso8601($dateStr)
|
| 670 |
-
|
|
|
|
| 671 |
}
|
| 672 |
|
| 673 |
-
private function getRemoteIp($model)
|
|
|
|
| 674 |
Mage::helper('full/log')->log("remote ip: " . $model->getRemoteIp() . ", x-forwarded-ip: " . $model->getXForwardedFor());
|
| 675 |
|
| 676 |
$forwardedIp = $model->getXForwardedFor();
|
| 677 |
-
$forwardeds = preg_split("/,/"
|
| 678 |
if (!empty($forwardeds)) {
|
| 679 |
return trim($forwardeds[0]);
|
| 680 |
}
|
| 681 |
$remoteIp = $model->getRemoteIp();
|
| 682 |
-
$remotes = preg_split("/,/"
|
| 683 |
if (!empty($remotes)) {
|
| 684 |
return trim($remotes[0]);
|
| 685 |
}
|
|
@@ -706,7 +756,7 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
| 706 |
// Only schedule a retry if one doesn't exist for this order/action combination.
|
| 707 |
// If one already exists it will be updated in Riskified_Full_Model_Cron::retrySubmissions() so
|
| 708 |
// there is no need to do anything here (eg update the existing retry).
|
| 709 |
-
if ($existingRetries->
|
| 710 |
Mage::getModel('full/retry')
|
| 711 |
->addData(array(
|
| 712 |
'order_id' => $order->getId(),
|
| 9 |
use Riskified\DecisionNotification\Model\Notification as DecisionNotification;
|
| 10 |
|
| 11 |
|
| 12 |
+
class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract
|
| 13 |
+
{
|
| 14 |
const ACTION_CREATE = 'create';
|
| 15 |
const ACTION_UPDATE = 'update';
|
| 16 |
const ACTION_SUBMIT = 'submit';
|
| 17 |
const ACTION_CANCEL = 'cancel';
|
| 18 |
|
| 19 |
+
private $_customer = array();
|
| 20 |
+
|
| 21 |
+
public function __construct()
|
| 22 |
+
{
|
| 23 |
$this->initSdk();
|
| 24 |
}
|
| 25 |
|
| 29 |
* @return stdClass
|
| 30 |
* @throws Exception
|
| 31 |
*/
|
| 32 |
+
public function updateMerchantSettings($settings)
|
| 33 |
+
{
|
| 34 |
$transport = $this->getTransport();
|
| 35 |
Mage::helper('full/log')->log('updateMerchantSettings');
|
| 36 |
|
| 38 |
$response = $transport->updateMerchantSettings($settings);
|
| 39 |
|
| 40 |
Mage::helper('full/log')->log('Merchant Settings posted successfully');
|
| 41 |
+
} catch (\Riskified\OrderWebhook\Exception\UnsuccessfulActionException $uae) {
|
| 42 |
if ($uae->statusCode == '401') {
|
| 43 |
Mage::helper('full/log')->logException($uae);
|
| 44 |
Mage::getSingleton('adminhtml/session')->addError('Make sure you have the correct Auth token as it appears in Riskified advanced settings.');
|
| 45 |
}
|
| 46 |
throw $uae;
|
| 47 |
+
} catch (\Riskified\OrderWebhook\Exception\CurlException $curlException) {
|
| 48 |
Mage::helper('full/log')->logException($curlException);
|
| 49 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $curlException->getMessage());
|
| 50 |
|
| 51 |
throw $curlException;
|
| 52 |
+
} catch (Exception $e) {
|
|
|
|
| 53 |
Mage::helper('full/log')->logException($e);
|
| 54 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $e->getMessage());
|
| 55 |
|
| 58 |
return $response;
|
| 59 |
|
| 60 |
}
|
| 61 |
+
|
| 62 |
/**
|
| 63 |
* Submit an order to Riskified.
|
| 64 |
*
|
| 67 |
* @return stdClass
|
| 68 |
* @throws Exception
|
| 69 |
*/
|
| 70 |
+
public function postOrder($order, $action)
|
| 71 |
+
{
|
| 72 |
$transport = $this->getTransport();
|
| 73 |
$headers = $this->getHeaders();
|
| 74 |
|
| 75 |
+
Mage::helper('full/log')->log('postOrder ' . serialize($headers) . ' - ' . $action);
|
| 76 |
|
| 77 |
$eventData = array(
|
| 78 |
'order' => $order,
|
| 111 |
'riskified_full_post_order_success',
|
| 112 |
$eventData
|
| 113 |
);
|
| 114 |
+
} catch (\Riskified\OrderWebhook\Exception\CurlException $curlException) {
|
| 115 |
Mage::helper('full/log')->logException($curlException);
|
| 116 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $curlException->getMessage());
|
| 117 |
|
| 118 |
+
$this->updateOrder($order, 'error', null, 'Error transferring order data to Riskified');
|
| 119 |
$this->scheduleSubmissionRetry($order, $action);
|
| 120 |
|
| 121 |
Mage::dispatchEvent(
|
| 124 |
);
|
| 125 |
|
| 126 |
throw $curlException;
|
| 127 |
+
} catch (Exception $e) {
|
|
|
|
| 128 |
Mage::helper('full/log')->logException($e);
|
| 129 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $e->getMessage());
|
| 130 |
|
| 139 |
return $response;
|
| 140 |
}
|
| 141 |
|
| 142 |
+
public function postHistoricalOrders($models)
|
| 143 |
+
{
|
| 144 |
$orders = array();
|
| 145 |
foreach ($models as $model) {
|
| 146 |
$orders[] = $this->getOrder($model);
|
| 147 |
}
|
| 148 |
|
| 149 |
$msgs = $this->getTransport()->sendHistoricalOrders($orders);
|
| 150 |
+
return "Successfully uploaded " . count($msgs) . " orders." . PHP_EOL;
|
| 151 |
}
|
| 152 |
|
| 153 |
+
/**
|
| 154 |
+
* Dispatch events for order update handling
|
| 155 |
+
*
|
| 156 |
+
* Possible events are:
|
| 157 |
+
* - riskified_order_update
|
| 158 |
+
* - riskified_order_update_approved
|
| 159 |
+
* - riskified_order_update_declined
|
| 160 |
+
* - riskified_order_update_submitted
|
| 161 |
+
* - riskified_order_update_captured
|
| 162 |
* - riskified_order_update_error
|
| 163 |
+
* - riskified_order_update_?
|
| 164 |
+
*
|
| 165 |
+
* @param Mage_Sales_Model_Order $order
|
| 166 |
+
* @param string $status
|
| 167 |
* @param string $oldStatus
|
| 168 |
+
* @param string $description
|
| 169 |
+
* @return void
|
| 170 |
+
*/
|
| 171 |
+
public function updateOrder($order, $status, $oldStatus, $description)
|
| 172 |
+
{
|
| 173 |
+
Mage::helper('full/log')->log('Dispatching event for order ' . $order->getId() . ' with status "' . $status .
|
| 174 |
'" old status "' . $oldStatus . '" and description "' . $description . '"');
|
| 175 |
|
| 176 |
+
$eventData = array(
|
| 177 |
+
'order' => $order,
|
| 178 |
+
'status' => $status,
|
| 179 |
'old_status' => $oldStatus,
|
| 180 |
+
'description' => $description
|
| 181 |
+
);
|
| 182 |
|
| 183 |
+
// A generic event for all updates
|
| 184 |
+
Mage::dispatchEvent(
|
| 185 |
+
'riskified_full_order_update',
|
| 186 |
+
$eventData
|
| 187 |
+
);
|
| 188 |
|
| 189 |
+
// A status-specific event
|
| 190 |
+
$eventIdentifier = preg_replace("/[^a-z]/", '_', strtolower($status));
|
| 191 |
|
| 192 |
+
Mage::dispatchEvent(
|
| 193 |
+
'riskified_full_order_update_' . $eventIdentifier,
|
| 194 |
+
$eventData
|
| 195 |
+
);
|
| 196 |
|
| 197 |
+
return;
|
| 198 |
}
|
| 199 |
|
| 200 |
+
public function getRiskifiedDomain()
|
| 201 |
+
{
|
| 202 |
return Riskified::getHostByEnv();
|
| 203 |
}
|
| 204 |
|
| 205 |
+
public function getRiskifiedApp()
|
| 206 |
+
{
|
| 207 |
return str_replace("wh", "app", $this->getRiskifiedDomain());
|
| 208 |
}
|
| 209 |
|
| 210 |
+
public function parseRequest($request)
|
| 211 |
+
{
|
| 212 |
$header_name = Signature\HttpDataSignature::HMAC_HEADER_NAME;
|
| 213 |
$headers = array($header_name => $request->getHeader($header_name));
|
| 214 |
$body = $request->getRawBody();
|
| 216 |
return new DecisionNotification(new Signature\HttpDataSignature(), $headers, $body);
|
| 217 |
}
|
| 218 |
|
| 219 |
+
public function getOrderOrigId($order)
|
| 220 |
+
{
|
| 221 |
+
if (!$order) {
|
| 222 |
return null;
|
| 223 |
}
|
| 224 |
return $order->getId() . '_' . $order->getIncrementId();
|
| 226 |
|
| 227 |
private $version;
|
| 228 |
|
| 229 |
+
private function initSdk()
|
| 230 |
+
{
|
| 231 |
$helper = Mage::helper('full');
|
| 232 |
$authToken = $helper->getAuthToken();
|
| 233 |
$env = constant($helper->getConfigEnv());
|
| 235 |
$this->version = $helper->getExtensionVersion();
|
| 236 |
$sdkVersion = Riskified::VERSION;
|
| 237 |
|
| 238 |
+
Mage::helper('full/log')->log("Riskified initSdk() - shop: $shopDomain, env: $env, token: $authToken, extension_version: $this->version, sdk_version: $sdkVersion");
|
| 239 |
Riskified::init($shopDomain, $authToken, $env, Validations::SKIP);
|
| 240 |
}
|
| 241 |
|
| 242 |
+
private function getHeaders()
|
| 243 |
+
{
|
| 244 |
+
return array('headers' => array('X_RISKIFIED_VERSION:' . $this->version));
|
| 245 |
}
|
| 246 |
|
| 247 |
+
private function getTransport()
|
| 248 |
+
{
|
| 249 |
$transport = new Transport\CurlTransport(new Signature\HttpDataSignature());
|
| 250 |
$transport->timeout = 15;
|
| 251 |
return $transport;
|
| 252 |
}
|
| 253 |
|
| 254 |
+
private function getOrderCancellation($model)
|
| 255 |
+
{
|
| 256 |
$orderCancellation = new Model\OrderCancellation(array_filter(array(
|
| 257 |
'id' => $this->getOrderOrigId($model),
|
| 258 |
'cancelled_at' => $this->formatDateAsIso8601($this->getCancelledAt($model)),
|
| 259 |
'cancel_reason' => 'Cancelled by merchant'
|
| 260 |
)));
|
| 261 |
|
| 262 |
+
Mage::helper('full/log')->log("getOrderCancellation(): " . PHP_EOL . json_encode(json_decode($orderCancellation->toJson())));
|
| 263 |
|
| 264 |
return $orderCancellation;
|
| 265 |
}
|
| 266 |
|
| 267 |
+
private function getOrder($model)
|
| 268 |
+
{
|
| 269 |
$gateway = 'unavailable';
|
| 270 |
if ($model->getPayment()) {
|
| 271 |
$gateway = $model->getPayment()->getMethod();
|
| 285 |
'total_price' => $model->getGrandTotal(),
|
| 286 |
'total_discounts' => $model->getDiscountAmount(),
|
| 287 |
'subtotal_price' => $model->getBaseSubtotalInclTax(),
|
| 288 |
+
'discount_codes' => $this->getDiscountCodes($model),
|
| 289 |
'taxes_included' => true,
|
| 290 |
'total_tax' => $model->getBaseTaxAmount(),
|
| 291 |
'total_weight' => $model->getWeight(),
|
| 301 |
unset($order_array['cart_token']);
|
| 302 |
}
|
| 303 |
|
| 304 |
+
$order = new Model\Order(array_filter($order_array, 'strlen'));
|
| 305 |
|
| 306 |
$order->customer = $this->getCustomer($model);
|
| 307 |
$order->shipping_address = $this->getShippingAddress($model);
|
| 314 |
$order->client_details = $this->getClientDetails($model);
|
| 315 |
}
|
| 316 |
|
| 317 |
+
Mage::helper('full/log')->log("getOrder(): " . PHP_EOL . json_encode(json_decode($order->toJson())));
|
| 318 |
|
| 319 |
return $order;
|
| 320 |
}
|
| 321 |
|
| 322 |
+
private function getCustomer($model)
|
| 323 |
+
{
|
| 324 |
$customer_id = $model->getCustomerId();
|
| 325 |
$customer_props = array(
|
| 326 |
'id' => $customer_id,
|
| 332 |
);
|
| 333 |
|
| 334 |
if ($customer_id) {
|
| 335 |
+
$customer_details = $this->_getCustomerObject($model->getCustomerId());
|
| 336 |
$customer_props['created_at'] = $this->formatDateAsIso8601($customer_details->getCreatedAt());
|
| 337 |
$customer_props['updated_at'] = $this->formatDateAsIso8601($customer_details->getUpdatedAt());
|
| 338 |
|
| 339 |
try {
|
| 340 |
+
$customer_data = Mage::helper('full/customer_order')->getCustomerOrders($model->getCustomerId());
|
| 341 |
+
$customer_props['total_spent'] = $customer_data['total_spent'];
|
| 342 |
+
$customer_props['orders_count'] = $customer_data['orders_count'];
|
| 343 |
+
$customer_props['last_order_id'] = $customer_data['last_order_id'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
} catch (Exception $e) {
|
| 345 |
Mage::helper('full/log')->logException($e);
|
| 346 |
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $e->getMessage());
|
| 347 |
}
|
| 348 |
}
|
| 349 |
|
| 350 |
+
return new Model\Customer(array_filter($customer_props, 'strlen'));
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
private function _getCustomerObject($customer_id) {
|
| 354 |
+
if(!isset($this->_customer[$customer_id])) {
|
| 355 |
+
$collection = Mage::getModel('customer/customer')->getCollection();
|
| 356 |
+
$collection->addAttributeToFilter('entity_id', $customer_id);
|
| 357 |
+
$this->_customer[$customer_id] = $collection->getFirstItem();
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
return $this->_customer[$customer_id];
|
| 361 |
}
|
| 362 |
|
| 363 |
+
private function getShippingAddress($model)
|
| 364 |
+
{
|
| 365 |
$mageAddr = $model->getShippingAddress();
|
| 366 |
return $this->getAddress($mageAddr);
|
| 367 |
}
|
| 368 |
|
| 369 |
+
private function getBillingAddress($model)
|
| 370 |
+
{
|
| 371 |
$mageAddr = $model->getBillingAddress();
|
| 372 |
return $this->getAddress($mageAddr);
|
| 373 |
}
|
| 374 |
|
| 375 |
+
private function logPaymentData($model)
|
| 376 |
+
{
|
| 377 |
Mage::helper('full/log')->log("Payment info debug Logs:");
|
| 378 |
try {
|
| 379 |
$payment = $model->getPayment();
|
| 380 |
$gatewayName = $payment->getMethod();
|
| 381 |
+
Mage::helper('full/log')->log("Payment Gateway: " . $gatewayName);
|
| 382 |
+
Mage::helper('full/log')->log("payment->getCcLast4(): " . $payment->getCcLast4());
|
| 383 |
+
Mage::helper('full/log')->log("payment->getCcType(): " . $payment->getCcType());
|
| 384 |
+
Mage::helper('full/log')->log("payment->getCcCidStatus(): " . $payment->getCcCidStatus());
|
| 385 |
+
Mage::helper('full/log')->log("payment->getCcAvsStatus(): " . $payment->getCcAvsStatus());
|
| 386 |
+
Mage::helper('full/log')->log("payment->getAdditionalInformation(): " . PHP_EOL . var_export($payment->getAdditionalInformation(), 1));
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
Mage::helper('full/log')->log("payment->getAdyenPspReference(): " . $payment->getAdyenPspReference());
|
| 390 |
+
Mage::helper('full/log')->log("payment->getAdyenKlarnaNumber(): " . $payment->getAdyenKlarnaNumber());
|
| 391 |
+
Mage::helper('full/log')->log("payment->getAdyenAvsResult(): " . $payment->getAdyenAvsResult());
|
| 392 |
+
Mage::helper('full/log')->log("payment->getAdyenCvcResult(): " . $payment->getAdyenCvcResult());
|
| 393 |
+
Mage::helper('full/log')->log("payment->getAdyenBoletoPaidAmount(): " . $payment->getAdyenBoletoPaidAmount());
|
| 394 |
+
Mage::helper('full/log')->log("payment->getAdyenTotalFraudScore(): " . $payment->getAdyenTotalFraudScore());
|
| 395 |
+
Mage::helper('full/log')->log("payment->getAdyenRefusalReasonRaw(): " . $payment->getAdyenRefusalReasonRaw());
|
| 396 |
+
Mage::helper('full/log')->log("payment->getAdyenAcquirerReference(): " . $payment->getAdyenAcquirerReference());
|
| 397 |
+
Mage::helper('full/log')->log("(possibly BIN?) payment->getAdyenAuthCode(): " . $payment->getAdyenAuthCode());
|
| 398 |
+
|
| 399 |
+
Mage::helper('full/log')->log("payment->getInfo(): " . PHP_EOL . var_export($payment->getInfo(), 1));
|
| 400 |
|
| 401 |
# paypal_avs_code,paypal_cvv2_match,paypal_fraud_filters,avs_result,cvv2_check_result,address_verification,
|
| 402 |
# postcode_verification,payment_status,pending_reason,payer_id,payer_status,email,credit_card_cvv2,
|
| 403 |
# cc_avs_status,cc_approval,cc_last4,cc_owner,cc_exp_month,cc_exp_year,
|
| 404 |
$sage = $model->getSagepayInfo();
|
| 405 |
+
if (is_object($sage)) {
|
| 406 |
#####,postcode_result,avscv2,address_status,payer_status
|
| 407 |
+
Mage::helper('full/log')->log("sagepay->getLastFourDigits(): " . $sage->getLastFourDigits());
|
| 408 |
+
Mage::helper('full/log')->log("sagepay->last_four_digits: " . $sage->getData('last_four_digits'));
|
| 409 |
+
Mage::helper('full/log')->log("sagepay->getCardType(): " . $sage->getCardType());
|
| 410 |
+
Mage::helper('full/log')->log("sagepay->card_type: " . $sage->getData('card_type'));
|
| 411 |
+
Mage::helper('full/log')->log("sagepay->getAvsCv2Status: " . $sage->getAvsCv2Status());
|
| 412 |
+
Mage::helper('full/log')->log("sagepay->address_result: " . $sage->getData('address_result'));
|
| 413 |
+
Mage::helper('full/log')->log("sagepay->getCv2result: " . $sage->getCv2result());
|
| 414 |
+
Mage::helper('full/log')->log("sagepay->cv2result: " . $sage->getData('cv2result'));
|
| 415 |
+
Mage::helper('full/log')->log("sagepay->getAvscv2: " . $sage->getAvscv2());
|
| 416 |
+
Mage::helper('full/log')->log("sagepay->getAddressResult: " . $sage->getAddressResult());
|
| 417 |
+
Mage::helper('full/log')->log("sagepay->getPostcodeResult: " . $sage->getPostcodeResult());
|
| 418 |
+
Mage::helper('full/log')->log("sagepay->getDeclineCode: " . $sage->getDeclineCode());
|
| 419 |
+
Mage::helper('full/log')->log("sagepay->getBankAuthCode: " . $sage->getBankAuthCode());
|
| 420 |
+
Mage::helper('full/log')->log("sagepay->getPayerStatus: " . $sage->getPayerStatus());
|
| 421 |
}
|
| 422 |
+
if ($gatewayName == "optimal_hosted") {
|
| 423 |
$optimalTransaction = unserialize($payment->getAdditionalInformation('transaction'));
|
| 424 |
+
if ($optimalTransaction) {
|
| 425 |
Mage::helper('full/log')->log("Optimal transaction: ");
|
| 426 |
+
Mage::helper('full/log')->log("transaction->cvdVerification: " . $optimalTransaction->cvdVerification);
|
| 427 |
+
Mage::helper('full/log')->log("transaction->houseNumberVerification: " . $optimalTransaction->houseNumberVerification);
|
| 428 |
+
Mage::helper('full/log')->log("transaction->zipVerification: " . $optimalTransaction->zipVerification);
|
| 429 |
+
} else {
|
|
|
|
| 430 |
Mage::helper('full/log')->log("Optimal gateway but no transaction found");
|
| 431 |
}
|
| 432 |
}
|
| 433 |
|
| 434 |
+
} catch (Exception $e) {
|
| 435 |
Mage::helper('full/log')->logException($e);
|
| 436 |
}
|
| 437 |
}
|
| 438 |
|
| 439 |
+
private function getPaymentDetails($model)
|
| 440 |
+
{
|
| 441 |
$payment = $model->getPayment();
|
| 442 |
+
if (!$payment) {
|
| 443 |
return null;
|
| 444 |
}
|
| 445 |
|
| 446 |
+
if (Mage::helper('full')->isDebugLogsEnabled()) {
|
| 447 |
$this->logPaymentData($model);
|
| 448 |
}
|
| 449 |
|
| 455 |
switch ($gatewayName) {
|
| 456 |
case 'authorizenet':
|
| 457 |
$authorize_data = $payment->getAdditionalInformation('authorize_cards');
|
| 458 |
+
if ($authorize_data && is_array($authorize_data)) {
|
| 459 |
$cards_data = array_values($authorize_data);
|
| 460 |
if ($cards_data && $cards_data[0]) {
|
| 461 |
$card_data = $cards_data[0];
|
| 462 |
+
if (isset($card_data['cc_last4'])) {
|
| 463 |
+
$creditCardNumber = $card_data['cc_last4'];
|
| 464 |
+
}
|
| 465 |
+
if (isset($card_data['cc_type'])) {
|
| 466 |
+
$creditCardCompany = $card_data['cc_type'];
|
| 467 |
+
}
|
| 468 |
+
if (isset($card_data['cc_avs_result_code'])) {
|
| 469 |
+
$avsResultCode = $card_data['cc_avs_result_code'];
|
| 470 |
+
}// getAvsResultCode
|
| 471 |
+
if (isset($card_data['cc_response_code'])) {
|
| 472 |
+
$cvvResultCode = $card_data['cc_response_code'];
|
| 473 |
+
} // getCardCodeResponseCode
|
| 474 |
}
|
| 475 |
}
|
| 476 |
break;
|
| 487 |
$houseVerification = $optimalTransaction->houseNumberVerification;
|
| 488 |
$zipVerification = $optimalTransaction->zipVerification;
|
| 489 |
$avsResultCode = $houseVerification . ',' . $zipVerification;
|
| 490 |
+
} catch (Exception $e) {
|
| 491 |
+
Mage::helper('full/log')->log("optimal payment (" . $gatewayName . ") additional payment info failed to parse:" . $e->getMessage());
|
| 492 |
}
|
| 493 |
break;
|
| 494 |
case 'paypal_express':
|
| 526 |
$creditCardNumber = $sage->getData('last_four_digits');
|
| 527 |
$creditCardCompany = $sage->getData('card_type');
|
| 528 |
//Mage::helper('full/log')->log("sagepay payment (".$gatewayName.") additional info: ".PHP_EOL.var_export($sage->getAdditionalInformation(), 1));
|
| 529 |
+
Mage::helper('full/log')->log("sagepay payment (" . $gatewayName . ") additional info: " . PHP_EOL . var_export($payment->getAdditionalInformation(), 1));
|
| 530 |
+
} else {
|
| 531 |
+
Mage::helper('full/log')->log("sagepay payment (" . $gatewayName . ") - getSagepayInfo returned null object");
|
|
|
|
| 532 |
}
|
| 533 |
break;
|
| 534 |
|
| 535 |
case 'transarmor':
|
| 536 |
$avsResultCode = $payment->getAdditionalInformation('avs_response');
|
| 537 |
$cvvResultCode = $payment->getAdditionalInformation('cvv2_response');
|
| 538 |
+
Mage::helper('full/log')->log("transarmor payment additional info: " . PHP_EOL . var_export($payment->getAdditionalInformation(), 1));
|
| 539 |
break;
|
| 540 |
|
| 541 |
case 'braintreevzero':
|
| 546 |
$avsResultCode = $houseVerification . ',' . $zipVerification;
|
| 547 |
break;
|
| 548 |
|
| 549 |
+
case 'adyen_cc':
|
| 550 |
+
$avsResultCode = $payment->getAdyenAvsResult();
|
| 551 |
+
$cvvResultCode = $payment->getAdyenCvcResult();
|
| 552 |
+
$transactionId = $payment->getAdyenPspReference();
|
| 553 |
+
$creditCardBin = $payment->getAdyenCardBin();
|
| 554 |
+
break;
|
| 555 |
+
|
| 556 |
default:
|
| 557 |
Mage::helper('full/log')->log("unknown gateway:" . $gatewayName);
|
| 558 |
+
Mage::helper('full/log')->log("Gateway payment (" . $gatewayName . ") additional info: " . PHP_EOL . var_export($payment->getAdditionalInformation(), 1));
|
| 559 |
break;
|
| 560 |
}
|
| 561 |
} catch (Exception $e) {
|
| 590 |
'credit_card_number' => $creditCardNumber,
|
| 591 |
'credit_card_company' => $creditCardCompany,
|
| 592 |
'credit_card_bin' => $creditCardBin
|
| 593 |
+
), 'strlen'));
|
| 594 |
}
|
| 595 |
|
| 596 |
+
private function getLineItems($model)
|
| 597 |
+
{
|
| 598 |
$lineItems = array();
|
| 599 |
foreach ($model->getAllVisibleItems() as $key => $val) {
|
| 600 |
$prodType = null;
|
| 601 |
$category = null;
|
| 602 |
$subCategories = null;
|
| 603 |
+
$brand = null;
|
| 604 |
$product = $val->getProduct();
|
| 605 |
+
if ($product) {
|
| 606 |
$prodType = $val->getProduct()->getTypeId();
|
| 607 |
$categoryIds = $product->getCategoryIds();
|
| 608 |
foreach ($categoryIds as $categoryId) {
|
| 609 |
$cat = Mage::getModel('catalog/category')->load($categoryId);
|
| 610 |
$catName = $cat->getName();
|
| 611 |
if (!empty($catName)) {
|
| 612 |
+
if (empty($category)) {
|
| 613 |
$category = $catName;
|
| 614 |
+
} else if (empty($subCategories)) {
|
|
|
|
| 615 |
$subCategories = $catName;
|
| 616 |
+
} else {
|
|
|
|
| 617 |
$subCategories = $subCategories . '|' . $catName;
|
| 618 |
}
|
| 619 |
|
| 620 |
}
|
| 621 |
}
|
| 622 |
+
|
| 623 |
+
|
| 624 |
+
if ($product->getManufacturer()) {
|
| 625 |
+
$brand = $product->getAttributeText('manufacturer');
|
| 626 |
+
}
|
| 627 |
}
|
| 628 |
$lineItems[] = new Model\LineItem(array_filter(array(
|
| 629 |
'price' => $val->getPrice(),
|
| 634 |
'grams' => $val->getWeight(),
|
| 635 |
'product_type' => $prodType,
|
| 636 |
'category' => $category,
|
| 637 |
+
'brand' => $brand,
|
| 638 |
//'sub_category' => $subCategories
|
| 639 |
+
), 'strlen'));
|
| 640 |
}
|
| 641 |
|
| 642 |
return $lineItems;
|
| 643 |
}
|
| 644 |
|
| 645 |
+
private function getShippingLines($model)
|
| 646 |
+
{
|
| 647 |
return new Model\ShippingLine(array_filter(array(
|
| 648 |
'price' => $model->getShippingAmount(),
|
| 649 |
'title' => $model->getShippingDescription(),
|
| 650 |
'code' => $model->getShippingMethod()
|
| 651 |
+
), 'strlen'));
|
| 652 |
}
|
| 653 |
|
| 654 |
+
private function getClientDetails($model)
|
| 655 |
+
{
|
| 656 |
return new Model\ClientDetails(array_filter(array(
|
| 657 |
'accept_language' => Mage::app()->getLocale()->getLocaleCode(),
|
| 658 |
//'browser_ip' => $this->getRemoteIp($model),
|
| 659 |
'user_agent' => Mage::helper('core/http')->getHttpUserAgent()
|
| 660 |
+
), 'strlen'));
|
| 661 |
}
|
| 662 |
|
| 663 |
+
private function getAddress($address)
|
| 664 |
+
{
|
| 665 |
+
if (!$address) {
|
| 666 |
return null;
|
| 667 |
}
|
| 668 |
|
| 670 |
$address_1 = (!is_null($street) && array_key_exists('0', $street)) ? $street['0'] : null;
|
| 671 |
$address_2 = (!is_null($street) && array_key_exists('1', $street)) ? $street['1'] : null;
|
| 672 |
|
| 673 |
+
$addrArray = array_filter(array(
|
| 674 |
'first_name' => $address->getFirstname(),
|
| 675 |
'last_name' => $address->getLastname(),
|
| 676 |
'name' => $address->getFirstname() . " " . $address->getLastname(),
|
| 685 |
'phone' => $address->getTelephone(),
|
| 686 |
), 'strlen');
|
| 687 |
|
| 688 |
+
if (!$addrArray) {
|
| 689 |
return null;
|
| 690 |
}
|
| 691 |
return new Model\Address($addrArray);
|
| 692 |
}
|
| 693 |
|
| 694 |
+
private function getDiscountCodes($model)
|
| 695 |
+
{
|
| 696 |
$code = $model->getDiscountDescription();
|
| 697 |
$amount = $model->getDiscountAmount();
|
| 698 |
if ($amount && $code)
|
| 703 |
return null;
|
| 704 |
}
|
| 705 |
|
| 706 |
+
private function getCancelledAt($model)
|
| 707 |
+
{
|
| 708 |
$commentCollection = $model->getStatusHistoryCollection();
|
| 709 |
foreach ($commentCollection as $comment) {
|
| 710 |
if ($comment->getStatus() == Mage_Sales_Model_Order::STATE_CANCELED) {
|
| 714 |
return null;
|
| 715 |
}
|
| 716 |
|
| 717 |
+
private function formatDateAsIso8601($dateStr)
|
| 718 |
+
{
|
| 719 |
+
return ($dateStr == NULL) ? NULL : date('c', strtotime($dateStr));
|
| 720 |
}
|
| 721 |
|
| 722 |
+
private function getRemoteIp($model)
|
| 723 |
+
{
|
| 724 |
Mage::helper('full/log')->log("remote ip: " . $model->getRemoteIp() . ", x-forwarded-ip: " . $model->getXForwardedFor());
|
| 725 |
|
| 726 |
$forwardedIp = $model->getXForwardedFor();
|
| 727 |
+
$forwardeds = preg_split("/,/", $forwardedIp, -1, PREG_SPLIT_NO_EMPTY);
|
| 728 |
if (!empty($forwardeds)) {
|
| 729 |
return trim($forwardeds[0]);
|
| 730 |
}
|
| 731 |
$remoteIp = $model->getRemoteIp();
|
| 732 |
+
$remotes = preg_split("/,/", $remoteIp, -1, PREG_SPLIT_NO_EMPTY);
|
| 733 |
if (!empty($remotes)) {
|
| 734 |
return trim($remotes[0]);
|
| 735 |
}
|
| 756 |
// Only schedule a retry if one doesn't exist for this order/action combination.
|
| 757 |
// If one already exists it will be updated in Riskified_Full_Model_Cron::retrySubmissions() so
|
| 758 |
// there is no need to do anything here (eg update the existing retry).
|
| 759 |
+
if ($existingRetries->getSize() == 0) {
|
| 760 |
Mage::getModel('full/retry')
|
| 761 |
->addData(array(
|
| 762 |
'order_id' => $order->getId(),
|
app/code/community/Riskified/Full/Helper/Order/Invoice.php
CHANGED
|
@@ -3,29 +3,29 @@
|
|
| 3 |
class Riskified_Full_Helper_Order_Invoice extends Mage_Core_Helper_Abstract
|
| 4 |
{
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
}
|
| 3 |
class Riskified_Full_Helper_Order_Invoice extends Mage_Core_Helper_Abstract
|
| 4 |
{
|
| 5 |
|
| 6 |
+
/**
|
| 7 |
+
* Has this user enabled auto-invoicing when orders are approved?
|
| 8 |
+
*
|
| 9 |
+
* @return bool
|
| 10 |
+
*/
|
| 11 |
+
public function isAutoInvoiceEnabled()
|
| 12 |
+
{
|
| 13 |
+
return (bool)Mage::getStoreConfig('fullsection/full/auto_invoice_enabled');
|
| 14 |
+
}
|
| 15 |
|
| 16 |
+
/**
|
| 17 |
+
* Get the capture case to be used during auto-invoicing
|
| 18 |
+
*
|
| 19 |
+
* @return string
|
| 20 |
+
*/
|
| 21 |
+
public function getCaptureCase()
|
| 22 |
+
{
|
| 23 |
+
$case = Mage::getStoreConfig('fullsection/full/auto_invoice_capture_case');
|
| 24 |
|
| 25 |
+
if (!in_array($case, array(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE, Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE))) {
|
| 26 |
+
$case = Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE;
|
| 27 |
+
}
|
| 28 |
|
| 29 |
+
return $case;
|
| 30 |
+
}
|
| 31 |
}
|
app/code/community/Riskified/Full/Helper/Order/Status.php
CHANGED
|
@@ -2,25 +2,25 @@
|
|
| 2 |
|
| 3 |
class Riskified_Full_Helper_Order_Status extends Mage_Core_Helper_Abstract
|
| 4 |
{
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
/**
|
| 26 |
* Get Riskified's custom "on hold due to transport error" status code
|
|
@@ -91,7 +91,7 @@ class Riskified_Full_Helper_Order_Status extends Mage_Core_Helper_Abstract
|
|
| 91 |
{
|
| 92 |
$state = Mage::helper('full')->getApprovedState();
|
| 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 |
|
|
@@ -110,7 +110,7 @@ class Riskified_Full_Helper_Order_Status extends Mage_Core_Helper_Abstract
|
|
| 110 |
$allowedStatuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->getSelectedApprovedState());
|
| 111 |
if (!in_array($status, array_keys($allowedStatuses))) {
|
| 112 |
$status = $this->getRiskifiedApprovedStatusCode();
|
| 113 |
-
Mage::helper('full/log')->log("approved status: "
|
| 114 |
}
|
| 115 |
|
| 116 |
return $status;
|
|
@@ -125,7 +125,7 @@ class Riskified_Full_Helper_Order_Status extends Mage_Core_Helper_Abstract
|
|
| 125 |
{
|
| 126 |
$state = Mage::helper('full')->getDeclinedState();
|
| 127 |
|
| 128 |
-
if (!in_array($state, array(Mage_Sales_Model_Order::STATE_CANCELED,Mage_Sales_Model_Order::STATE_HOLDED))) {
|
| 129 |
$state = Mage_Sales_Model_Order::STATE_CANCELED;
|
| 130 |
}
|
| 131 |
|
|
@@ -144,7 +144,7 @@ class Riskified_Full_Helper_Order_Status extends Mage_Core_Helper_Abstract
|
|
| 144 |
$allowedStatuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->getSelectedDeclinedState());
|
| 145 |
if (!in_array($status, array_keys($allowedStatuses))) {
|
| 146 |
$status = $this->getRiskifiedDeclinedStatusCode();
|
| 147 |
-
Mage::helper('full/log')->log("declined status: "
|
| 148 |
}
|
| 149 |
|
| 150 |
return $status;
|
| 2 |
|
| 3 |
class Riskified_Full_Helper_Order_Status extends Mage_Core_Helper_Abstract
|
| 4 |
{
|
| 5 |
+
/**
|
| 6 |
+
* Get Riskified's custom "on hold for review" status code
|
| 7 |
+
*
|
| 8 |
+
* @return string
|
| 9 |
+
*/
|
| 10 |
+
public function getOnHoldStatusCode()
|
| 11 |
+
{
|
| 12 |
+
return 'riskified_holded';
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Get Riskified's custom "on hold for review" status label
|
| 17 |
+
*
|
| 18 |
+
* @return string
|
| 19 |
+
*/
|
| 20 |
+
public function getOnHoldStatusLabel()
|
| 21 |
+
{
|
| 22 |
+
return 'Under Review (Riskified)';
|
| 23 |
+
}
|
| 24 |
|
| 25 |
/**
|
| 26 |
* Get Riskified's custom "on hold due to transport error" status code
|
| 91 |
{
|
| 92 |
$state = Mage::helper('full')->getApprovedState();
|
| 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 |
|
| 110 |
$allowedStatuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->getSelectedApprovedState());
|
| 111 |
if (!in_array($status, array_keys($allowedStatuses))) {
|
| 112 |
$status = $this->getRiskifiedApprovedStatusCode();
|
| 113 |
+
Mage::helper('full/log')->log("approved status: " . $status . " not found in: " . var_export($allowedStatuses, 1));
|
| 114 |
}
|
| 115 |
|
| 116 |
return $status;
|
| 125 |
{
|
| 126 |
$state = Mage::helper('full')->getDeclinedState();
|
| 127 |
|
| 128 |
+
if (!in_array($state, array(Mage_Sales_Model_Order::STATE_CANCELED, Mage_Sales_Model_Order::STATE_HOLDED))) {
|
| 129 |
$state = Mage_Sales_Model_Order::STATE_CANCELED;
|
| 130 |
}
|
| 131 |
|
| 144 |
$allowedStatuses = Mage::getSingleton('sales/order_config')->getStateStatuses($this->getSelectedDeclinedState());
|
| 145 |
if (!in_array($status, array_keys($allowedStatuses))) {
|
| 146 |
$status = $this->getRiskifiedDeclinedStatusCode();
|
| 147 |
+
Mage::helper('full/log')->log("declined status: " . $status . " not found in: " . var_export($allowedStatuses, 1));
|
| 148 |
}
|
| 149 |
|
| 150 |
return $status;
|
app/code/community/Riskified/Full/Model/Authorizenet.php
CHANGED
|
@@ -1,31 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category Mage
|
| 22 |
-
* @package Mage_Paygate
|
| 23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*/
|
| 26 |
|
| 27 |
-
|
| 28 |
-
class Riskified_Full_Model_Authorizenet extends Mage_Paygate_Model_Authorizenet
|
| 29 |
{
|
| 30 |
/**
|
| 31 |
* it sets card`s data into additional information of payment model
|
|
@@ -34,10 +9,10 @@ class Riskified_Full_Model_Authorizenet extends Mage_Paygate_Model_Authorizenet
|
|
| 34 |
* @param mage_sales_model_order_payment $payment
|
| 35 |
* @return varien_object
|
| 36 |
*/
|
| 37 |
-
protected function
|
| 38 |
{
|
| 39 |
-
|
| 40 |
-
$card=parent::_registercard($response
|
| 41 |
$card->setCcAvsResultCode($response->getAvsResultCode());
|
| 42 |
$card->setCcResponseCode($response->getCardCodeResponseCode());
|
| 43 |
$payment->setCcAvsStatus($response->getAvsResultCode());
|
| 1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
class Riskified_Full_Model_Authorizenet extends Mage_Paygate_Model_Authorizenet
|
|
|
|
| 4 |
{
|
| 5 |
/**
|
| 6 |
* it sets card`s data into additional information of payment model
|
| 9 |
* @param mage_sales_model_order_payment $payment
|
| 10 |
* @return varien_object
|
| 11 |
*/
|
| 12 |
+
protected function _registerCard(varien_object $response, mage_sales_model_order_payment $payment)
|
| 13 |
{
|
| 14 |
+
Mage::helper('full/log')->log("in inherited _registercard.");
|
| 15 |
+
$card = parent::_registercard($response, $payment);
|
| 16 |
$card->setCcAvsResultCode($response->getAvsResultCode());
|
| 17 |
$card->setCcResponseCode($response->getCardCodeResponseCode());
|
| 18 |
$payment->setCcAvsStatus($response->getAvsResultCode());
|
app/code/community/Riskified/Full/Model/Container/Beacon.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Riskified_Full_Model_Container_Beacon extends Enterprise_PageCache_Model_Container_Abstract
|
| 4 |
+
{
|
| 5 |
+
protected function _getCacheId()
|
| 6 |
+
{
|
| 7 |
+
$cache = md5($this->_placeholder->getAttribute('cache_id'));
|
| 8 |
+
return 'RISKIFIED_FULL_BEACON_CACHE_' . $cache . '_' . $this->_getSessionId() . '_' . $this->_getRiskifiedCookie();
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
protected function _renderBlock()
|
| 12 |
+
{
|
| 13 |
+
$blockClass = $this->_placeholder->getAttribute('block');;
|
| 14 |
+
$template = $this->_placeholder->getAttribute('template');
|
| 15 |
+
$block = new $blockClass;
|
| 16 |
+
$block->setTemplate($template);
|
| 17 |
+
return $block->toHtml();
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
protected function _getSessionId()
|
| 21 |
+
{
|
| 22 |
+
return $this->_getCookieValue('frontend', '');
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
protected function _getRiskifiedCookie()
|
| 26 |
+
{
|
| 27 |
+
return $this->_getCookieValue('rCookie', '');
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
app/code/community/Riskified/Full/Model/Cron.php
CHANGED
|
@@ -48,34 +48,33 @@ class Riskified_Full_Model_Cron
|
|
| 48 |
, $adapter->quote(self::INTERVAL_BASE)
|
| 49 |
))
|
| 50 |
->order('updated_at ASC')
|
| 51 |
-
->limit(self::BATCH_SIZE)
|
| 52 |
-
;
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
| 65 |
|
| 66 |
try {
|
| 67 |
-
Mage::helper('full/order')->postOrder($order, $
|
| 68 |
|
| 69 |
// There is no need to delete the retry here. postOrder() dispatches a success event which
|
| 70 |
// results in all retries for this order getting deleted.
|
| 71 |
-
}
|
| 72 |
-
// Log the exception, store the backtrace and increment the counter
|
| 73 |
catch (Exception $e) {
|
| 74 |
Mage::helper('full/log')->logException($e);
|
| 75 |
|
| 76 |
-
$
|
| 77 |
->setLastError("Exception Message: " . $e->getMessage() . "\n\n" . Varien_Debug::backtrace(true, false))
|
| 78 |
-
->setAttempts($
|
| 79 |
->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate())
|
| 80 |
->save();
|
| 81 |
}
|
| 48 |
, $adapter->quote(self::INTERVAL_BASE)
|
| 49 |
))
|
| 50 |
->order('updated_at ASC')
|
| 51 |
+
->limit(self::BATCH_SIZE);
|
|
|
|
| 52 |
|
| 53 |
+
$mapperOrder = array();
|
| 54 |
+
$orderIds = array();
|
| 55 |
|
| 56 |
+
foreach ($retries as $retry) {
|
| 57 |
+
$orderIds[] = $retry->getOrderId();
|
| 58 |
+
$mapperOrder[$retry->getOrderId()] = $retry;
|
| 59 |
+
}
|
| 60 |
|
| 61 |
+
$collection = Mage::getModel('sales/order')->getCollection();
|
| 62 |
+
$collection->addFieldToFilter('entity_id', array('in' => array($orderIds)));
|
| 63 |
+
foreach ($collection as $order) {
|
| 64 |
+
Mage::helper('full/log')->log("Retrying order " . $order->getId());
|
| 65 |
|
| 66 |
try {
|
| 67 |
+
Mage::helper('full/order')->postOrder($order, $mapperOrder[$order->getId()]->getAction());
|
| 68 |
|
| 69 |
// There is no need to delete the retry here. postOrder() dispatches a success event which
|
| 70 |
// results in all retries for this order getting deleted.
|
| 71 |
+
} // Log the exception, store the backtrace and increment the counter
|
|
|
|
| 72 |
catch (Exception $e) {
|
| 73 |
Mage::helper('full/log')->logException($e);
|
| 74 |
|
| 75 |
+
$mapperOrder[$order->getId()]
|
| 76 |
->setLastError("Exception Message: " . $e->getMessage() . "\n\n" . Varien_Debug::backtrace(true, false))
|
| 77 |
+
->setAttempts($mapperOrder[$order->getId()]->getAttempts() + 1)
|
| 78 |
->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate())
|
| 79 |
->save();
|
| 80 |
}
|
app/code/community/Riskified/Full/Model/Observer.php
CHANGED
|
@@ -6,33 +6,36 @@ use Riskified\Common\Signature;
|
|
| 6 |
use Riskified\OrderWebhook\Model;
|
| 7 |
use Riskified\OrderWebhook\Transport;
|
| 8 |
|
| 9 |
-
class Riskified_Full_Model_Observer
|
|
|
|
| 10 |
|
| 11 |
-
public function saveOrderBefore($evt)
|
|
|
|
| 12 |
Mage::helper('full/log')->log("saveOrderBefore");
|
| 13 |
|
| 14 |
$payment = $evt->getPayment();
|
| 15 |
-
$cc_bin = substr($payment->getCcNumber(),0,6);
|
| 16 |
|
| 17 |
if ($cc_bin) {
|
| 18 |
$payment->setAdditionalInformation('riskified_cc_bin', $cc_bin);
|
| 19 |
}
|
| 20 |
}
|
| 21 |
|
| 22 |
-
public function saveRiskifiedConfig($evt)
|
|
|
|
| 23 |
Mage::helper('full/log')->log("saveRiskifiedConfig");
|
| 24 |
$helper = Mage::helper('full');
|
| 25 |
$settings = Mage::getStoreConfig('fullsection/full');
|
| 26 |
-
$riskifiedShopDomain =
|
| 27 |
$authToken = $helper->getAuthToken();
|
| 28 |
$all_active_methods = Mage::getModel('payment/config')->getActiveMethods();
|
| 29 |
-
$gateWays ='';
|
| 30 |
foreach ($all_active_methods as $key => $value)
|
| 31 |
{
|
| 32 |
-
$gateWays .= $key.",";
|
| 33 |
}
|
| 34 |
$extensionVersion = Mage::helper('full')->getExtensionVersion();
|
| 35 |
-
$shopHostUrl =
|
| 36 |
#Riskified::init($riskifiedShopDomain, $authToken, $env, Validations::IGNORE_MISSING);
|
| 37 |
$settings['gws'] = $gateWays;
|
| 38 |
$settings['host_url'] = $shopHostUrl;
|
|
@@ -42,69 +45,84 @@ class Riskified_Full_Model_Observer {
|
|
| 42 |
$settingsModel = new Model\MerchantSettings(array(
|
| 43 |
'settings' => $settings
|
| 44 |
));
|
| 45 |
-
if($authToken && $riskifiedShopDomain) {
|
| 46 |
Mage::helper('full/order')->updateMerchantSettings($settingsModel);
|
| 47 |
}
|
| 48 |
}
|
| 49 |
|
| 50 |
-
public function salesOrderPaymentPlaceEnd($evt)
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
//$order = $evt->getPayment()->getOrder();
|
| 54 |
|
| 55 |
//try {
|
| 56 |
-
|
| 57 |
//} catch (Exception $e) {
|
| 58 |
-
|
| 59 |
-
|
| 60 |
//}
|
| 61 |
}
|
| 62 |
|
| 63 |
-
public function salesOrderPaymentVoid($evt)
|
|
|
|
| 64 |
Mage::helper('full/log')->log("salesOrderPaymentVoid");
|
| 65 |
-
|
| 66 |
-
|
| 67 |
}
|
| 68 |
|
| 69 |
-
public function salesOrderPaymentRefund($evt)
|
|
|
|
| 70 |
Mage::helper('full/log')->log("salesOrderPaymentRefund");
|
| 71 |
//$order = $evt->getPayment()->getOrder();
|
| 72 |
//Mage::helper('full/order')->postOrder($order,'cancel');
|
| 73 |
}
|
| 74 |
|
| 75 |
-
public function salesOrderPaymentCancel($evt)
|
|
|
|
| 76 |
Mage::helper('full/log')->log("salesOrderPaymentCancel");
|
| 77 |
-
|
| 78 |
-
|
| 79 |
}
|
| 80 |
|
| 81 |
-
public function salesOrderPlaceBefore($evt)
|
|
|
|
| 82 |
Mage::helper('full/log')->log("salesOrderPlaceBefore");
|
| 83 |
}
|
| 84 |
|
| 85 |
-
public function salesOrderPlaceAfter($evt)
|
|
|
|
| 86 |
Mage::helper('full/log')->log("salesOrderPlaceAfter");
|
| 87 |
}
|
| 88 |
|
| 89 |
-
public function salesOrderSaveBefore($evt)
|
|
|
|
| 90 |
Mage::helper('full/log')->log("salesOrderSaveBefore");
|
| 91 |
}
|
| 92 |
|
| 93 |
-
public function salesOrderSaveAfter($evt)
|
|
|
|
| 94 |
Mage::helper('full/log')->log("salesOrderSaveAfter");
|
| 95 |
|
| 96 |
$order = $evt->getOrder();
|
| 97 |
-
if(!$order) {
|
| 98 |
return;
|
| 99 |
}
|
| 100 |
|
| 101 |
$newState = $order->getState();
|
| 102 |
|
| 103 |
if ($order->dataHasChangedFor('state')) {
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
// if we posted we should not re post
|
| 107 |
-
if($order->riskifiedInSave) {
|
| 108 |
Mage::helper('full/log')->log("Order : " . $order->getId() . " is already riskifiedInSave");
|
| 109 |
return;
|
| 110 |
}
|
|
@@ -122,7 +140,8 @@ class Riskified_Full_Model_Observer {
|
|
| 122 |
}
|
| 123 |
}
|
| 124 |
|
| 125 |
-
public function salesOrderCancel($evt)
|
|
|
|
| 126 |
Mage::helper('full/log')->log("salesOrderCancel");
|
| 127 |
|
| 128 |
$order = $evt->getOrder();
|
|
@@ -137,10 +156,12 @@ class Riskified_Full_Model_Observer {
|
|
| 137 |
}
|
| 138 |
}
|
| 139 |
|
| 140 |
-
public function postOrderIds($order_ids)
|
| 141 |
-
|
| 142 |
-
|
|
|
|
| 143 |
|
|
|
|
| 144 |
try {
|
| 145 |
Mage::helper('full/order')->postOrder($order, Riskified_Full_Helper_Order::ACTION_SUBMIT);
|
| 146 |
} catch (Exception $e) {
|
|
@@ -150,12 +171,13 @@ class Riskified_Full_Model_Observer {
|
|
| 150 |
}
|
| 151 |
}
|
| 152 |
|
| 153 |
-
public function addMassAction($observer)
|
|
|
|
| 154 |
$block = $observer->getEvent()->getBlock();
|
| 155 |
-
if((get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
|
| 156 |
-
|| get_class($block)=='Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction')
|
| 157 |
-
&& $block->getRequest()->getControllerName() == 'sales_order'
|
| 158 |
-
{
|
| 159 |
$block->addItem('full', array(
|
| 160 |
'label' => 'Submit to Riskified',
|
| 161 |
'url' => Mage::helper('adminhtml')->getUrl('adminhtml/riskifiedfull/massSend'),
|
|
@@ -163,55 +185,58 @@ class Riskified_Full_Model_Observer {
|
|
| 163 |
}
|
| 164 |
}
|
| 165 |
|
| 166 |
-
public function blockHtmlBefore($observer)
|
|
|
|
| 167 |
$block = $observer->getEvent()->getBlock();
|
| 168 |
if ($block->getType() == 'adminhtml/sales_order_view') {
|
| 169 |
$message = Mage::helper('sales')->__('Are you sure you want to submit this order to Riskified?');
|
| 170 |
$url = $block->getUrl('adminhtml/riskifiedfull/send');
|
| 171 |
$block->addButton('riski_submit', array(
|
| 172 |
-
'label'
|
| 173 |
-
'onclick'
|
| 174 |
));
|
| 175 |
}
|
| 176 |
}
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
public function updateOrderState(Varien_Event_Observer $observer)
|
| 184 |
-
|
| 185 |
-
|
| 186 |
$riskifiedInvoiceHelper = Mage::helper('full/order_invoice');
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
$riskifiedOldStatus = (string)
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
Mage::helper('full/log')->log("Data received from riskified: status: " . $riskifiedStatus . ", old_status: "
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|| $currentStatus == $riskifiedOrderStatusHelper->getTransportErrorStatusCode())
|
|
|
|
| 203 |
$newState = $riskifiedOrderStatusHelper->getSelectedApprovedState();
|
| 204 |
$newStatus = $riskifiedOrderStatusHelper->getSelectedApprovedStatus();
|
| 205 |
-
|
| 206 |
|
| 207 |
-
|
| 208 |
-
|
| 209 |
if ($currentState == Mage_Sales_Model_Order::STATE_HOLDED
|
| 210 |
&& ($currentStatus == $riskifiedOrderStatusHelper->getOnHoldStatusCode()
|
| 211 |
-
|| $currentStatus == $riskifiedOrderStatusHelper->getTransportErrorStatusCode())
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
|
|
|
| 215 |
|
| 216 |
break;
|
| 217 |
case 'submitted':
|
|
@@ -222,127 +247,139 @@ class Riskified_Full_Model_Observer {
|
|
| 222 |
$newStatus = $riskifiedOrderStatusHelper->getOnHoldStatusCode();
|
| 223 |
}
|
| 224 |
|
| 225 |
-
|
| 226 |
case 'error':
|
| 227 |
if ($currentState == Mage_Sales_Model_Order::STATE_PROCESSING
|
| 228 |
-
&& $riskifiedInvoiceHelper->isAutoInvoiceEnabled()
|
|
|
|
| 229 |
$newState = Mage_Sales_Model_Order::STATE_HOLDED;
|
| 230 |
$newStatus = $riskifiedOrderStatusHelper->getTransportErrorStatusCode();
|
| 231 |
}
|
| 232 |
-
|
|
|
|
|
|
|
| 233 |
|
| 234 |
$changed = false;
|
| 235 |
|
| 236 |
// if newState exists and new state/status are different from current and config is set to status-sync
|
| 237 |
-
|
| 238 |
&& ($newState != $currentState || $newStatus != $currentStatus)
|
| 239 |
-
&& Mage::helper('full')->getConfigStatusControlActive()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
if ($newState == Mage_Sales_Model_Order::STATE_CANCELED) {
|
| 241 |
Mage::helper('full/log')->log("Order '" . $order->getId() . "' should be canceled - calling cancel method");
|
| 242 |
$order->cancel();
|
|
|
|
|
|
|
|
|
|
| 243 |
}
|
| 244 |
-
$order->setState($newState, $newStatus, $description);
|
| 245 |
Mage::helper('full/log')->log("Updated order '" . $order->getId() . "' to: state: '$newState', status: '$newStatus', description: '$description'");
|
| 246 |
$changed=true;
|
| 247 |
} elseif ($description && $riskifiedStatus != $riskifiedOldStatus) {
|
| 248 |
Mage::helper('full/log')->log("Updated order " . $order->getId() . " history comment to: " . $description);
|
| 249 |
$order->addStatusHistoryComment($description);
|
| 250 |
-
$changed=true;
|
| 251 |
} else {
|
| 252 |
Mage::helper('full/log')->log("No update to state,status,comments is required for " . $order->getId());
|
| 253 |
}
|
| 254 |
|
| 255 |
|
| 256 |
if ($changed) {
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
private function logInvoiceParameters($order)
|
|
|
|
| 267 |
try {
|
| 268 |
-
Mage::helper('full/log')->log("Order "
|
| 269 |
-
Mage::helper('full/log')->log("Order state: "
|
| 270 |
-
Mage::helper('full/log')->log("Order status: "
|
| 271 |
-
Mage::helper('full/log')->log("UNHOLD action flag: "
|
| 272 |
-
Mage::helper('full/log')->log("INVOICE action flag: "
|
| 273 |
foreach ($order->getAllItems() as $item) {
|
| 274 |
-
Mage::helper('full/log')->log("item "
|
| 275 |
}
|
| 276 |
-
} catch(Exception $e) {
|
| 277 |
Mage::helper('full/log')->logException($e);
|
| 278 |
}
|
| 279 |
}
|
| 280 |
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
|
| 294 |
-
|
| 295 |
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
|
| 301 |
-
|
| 302 |
|
| 303 |
-
|
| 304 |
-
|
| 305 |
|
| 306 |
-
if(Mage::helper('full')->isDebugLogsEnabled()) {
|
| 307 |
$this->logInvoiceParameters($order);
|
| 308 |
}
|
| 309 |
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
|
| 347 |
/**
|
| 348 |
* Clear all submission retries for an order that have the same action.
|
|
@@ -363,7 +400,7 @@ class Riskified_Full_Model_Observer {
|
|
| 363 |
->addfieldtofilter('order_id', $order->getId())
|
| 364 |
->addFieldToFilter('action', $observer->getAction());
|
| 365 |
|
| 366 |
-
foreach($retries as $retry) {
|
| 367 |
$retry->delete();
|
| 368 |
}
|
| 369 |
}
|
| 6 |
use Riskified\OrderWebhook\Model;
|
| 7 |
use Riskified\OrderWebhook\Transport;
|
| 8 |
|
| 9 |
+
class Riskified_Full_Model_Observer
|
| 10 |
+
{
|
| 11 |
|
| 12 |
+
public function saveOrderBefore($evt)
|
| 13 |
+
{
|
| 14 |
Mage::helper('full/log')->log("saveOrderBefore");
|
| 15 |
|
| 16 |
$payment = $evt->getPayment();
|
| 17 |
+
$cc_bin = substr($payment->getCcNumber(), 0, 6);
|
| 18 |
|
| 19 |
if ($cc_bin) {
|
| 20 |
$payment->setAdditionalInformation('riskified_cc_bin', $cc_bin);
|
| 21 |
}
|
| 22 |
}
|
| 23 |
|
| 24 |
+
public function saveRiskifiedConfig($evt)
|
| 25 |
+
{
|
| 26 |
Mage::helper('full/log')->log("saveRiskifiedConfig");
|
| 27 |
$helper = Mage::helper('full');
|
| 28 |
$settings = Mage::getStoreConfig('fullsection/full');
|
| 29 |
+
$riskifiedShopDomain = $helper->getShopDomain();
|
| 30 |
$authToken = $helper->getAuthToken();
|
| 31 |
$all_active_methods = Mage::getModel('payment/config')->getActiveMethods();
|
| 32 |
+
$gateWays = '';
|
| 33 |
foreach ($all_active_methods as $key => $value)
|
| 34 |
{
|
| 35 |
+
$gateWays .= $key . ",";
|
| 36 |
}
|
| 37 |
$extensionVersion = Mage::helper('full')->getExtensionVersion();
|
| 38 |
+
$shopHostUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
| 39 |
#Riskified::init($riskifiedShopDomain, $authToken, $env, Validations::IGNORE_MISSING);
|
| 40 |
$settings['gws'] = $gateWays;
|
| 41 |
$settings['host_url'] = $shopHostUrl;
|
| 45 |
$settingsModel = new Model\MerchantSettings(array(
|
| 46 |
'settings' => $settings
|
| 47 |
));
|
| 48 |
+
if ($authToken && $riskifiedShopDomain) {
|
| 49 |
Mage::helper('full/order')->updateMerchantSettings($settingsModel);
|
| 50 |
}
|
| 51 |
}
|
| 52 |
|
| 53 |
+
public function salesOrderPaymentPlaceEnd($evt)
|
| 54 |
+
{
|
| 55 |
+
Mage::helper('full/log')->log("salesOrderPaymentPlaceEnd");
|
| 56 |
|
| 57 |
//$order = $evt->getPayment()->getOrder();
|
| 58 |
|
| 59 |
//try {
|
| 60 |
+
// Mage::helper('full/order')->postOrder($order, Riskified_Full_Helper_Order::ACTION_CREATE);
|
| 61 |
//} catch (Exception $e) {
|
| 62 |
+
// There is no need to do anything here. The exception has already been handled and a retry scheduled.
|
| 63 |
+
// We catch this exception so that the order is still saved in Magento.
|
| 64 |
//}
|
| 65 |
}
|
| 66 |
|
| 67 |
+
public function salesOrderPaymentVoid($evt)
|
| 68 |
+
{
|
| 69 |
Mage::helper('full/log')->log("salesOrderPaymentVoid");
|
| 70 |
+
$order = $evt->getPayment()->getOrder();
|
| 71 |
+
Mage::helper('full/order')->postOrder($order, 'cancel');
|
| 72 |
}
|
| 73 |
|
| 74 |
+
public function salesOrderPaymentRefund($evt)
|
| 75 |
+
{
|
| 76 |
Mage::helper('full/log')->log("salesOrderPaymentRefund");
|
| 77 |
//$order = $evt->getPayment()->getOrder();
|
| 78 |
//Mage::helper('full/order')->postOrder($order,'cancel');
|
| 79 |
}
|
| 80 |
|
| 81 |
+
public function salesOrderPaymentCancel($evt)
|
| 82 |
+
{
|
| 83 |
Mage::helper('full/log')->log("salesOrderPaymentCancel");
|
| 84 |
+
$order = $evt->getPayment()->getOrder();
|
| 85 |
+
Mage::helper('full/order')->postOrder($order, 'cancel');
|
| 86 |
}
|
| 87 |
|
| 88 |
+
public function salesOrderPlaceBefore($evt)
|
| 89 |
+
{
|
| 90 |
Mage::helper('full/log')->log("salesOrderPlaceBefore");
|
| 91 |
}
|
| 92 |
|
| 93 |
+
public function salesOrderPlaceAfter($evt)
|
| 94 |
+
{
|
| 95 |
Mage::helper('full/log')->log("salesOrderPlaceAfter");
|
| 96 |
}
|
| 97 |
|
| 98 |
+
public function salesOrderSaveBefore($evt)
|
| 99 |
+
{
|
| 100 |
Mage::helper('full/log')->log("salesOrderSaveBefore");
|
| 101 |
}
|
| 102 |
|
| 103 |
+
public function salesOrderSaveAfter($evt)
|
| 104 |
+
{
|
| 105 |
Mage::helper('full/log')->log("salesOrderSaveAfter");
|
| 106 |
|
| 107 |
$order = $evt->getOrder();
|
| 108 |
+
if (!$order) {
|
| 109 |
return;
|
| 110 |
}
|
| 111 |
|
| 112 |
$newState = $order->getState();
|
| 113 |
|
| 114 |
if ($order->dataHasChangedFor('state')) {
|
| 115 |
+
$oldState = $order->getOrigData('state');
|
| 116 |
+
|
| 117 |
+
if ($oldState == Mage_Sales_Model_Order::STATE_HOLDED and $newState == Mage_Sales_Model_Order::STATE_PROCESSING) {
|
| 118 |
+
Mage::helper('full/log')->log("Order : " . $order->getId() . " not notifying on unhold action");
|
| 119 |
+
return;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
Mage::helper('full/log')->log("Order: " . $order->getId() . " state changed from: " . $oldState . " to: " . $newState);
|
| 123 |
|
| 124 |
// if we posted we should not re post
|
| 125 |
+
if ($order->riskifiedInSave) {
|
| 126 |
Mage::helper('full/log')->log("Order : " . $order->getId() . " is already riskifiedInSave");
|
| 127 |
return;
|
| 128 |
}
|
| 140 |
}
|
| 141 |
}
|
| 142 |
|
| 143 |
+
public function salesOrderCancel($evt)
|
| 144 |
+
{
|
| 145 |
Mage::helper('full/log')->log("salesOrderCancel");
|
| 146 |
|
| 147 |
$order = $evt->getOrder();
|
| 156 |
}
|
| 157 |
}
|
| 158 |
|
| 159 |
+
public function postOrderIds($order_ids)
|
| 160 |
+
{
|
| 161 |
+
$collection = Mage::getModel('sales/order')->getCollection();
|
| 162 |
+
$collection->addFieldToFilter('entity_id', array('in' => array($order_ids)));
|
| 163 |
|
| 164 |
+
foreach ($collection as $order) {
|
| 165 |
try {
|
| 166 |
Mage::helper('full/order')->postOrder($order, Riskified_Full_Helper_Order::ACTION_SUBMIT);
|
| 167 |
} catch (Exception $e) {
|
| 171 |
}
|
| 172 |
}
|
| 173 |
|
| 174 |
+
public function addMassAction($observer)
|
| 175 |
+
{
|
| 176 |
$block = $observer->getEvent()->getBlock();
|
| 177 |
+
if ((get_class($block) == 'Mage_Adminhtml_Block_Widget_Grid_Massaction'
|
| 178 |
+
|| get_class($block) == 'Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction')
|
| 179 |
+
&& $block->getRequest()->getControllerName() == 'sales_order'
|
| 180 |
+
) {
|
| 181 |
$block->addItem('full', array(
|
| 182 |
'label' => 'Submit to Riskified',
|
| 183 |
'url' => Mage::helper('adminhtml')->getUrl('adminhtml/riskifiedfull/massSend'),
|
| 185 |
}
|
| 186 |
}
|
| 187 |
|
| 188 |
+
public function blockHtmlBefore($observer)
|
| 189 |
+
{
|
| 190 |
$block = $observer->getEvent()->getBlock();
|
| 191 |
if ($block->getType() == 'adminhtml/sales_order_view') {
|
| 192 |
$message = Mage::helper('sales')->__('Are you sure you want to submit this order to Riskified?');
|
| 193 |
$url = $block->getUrl('adminhtml/riskifiedfull/send');
|
| 194 |
$block->addButton('riski_submit', array(
|
| 195 |
+
'label' => Mage::helper('sales')->__('Submit to Riskified'),
|
| 196 |
+
'onclick' => "deleteConfirm('$message', '$url')",
|
| 197 |
));
|
| 198 |
}
|
| 199 |
}
|
| 200 |
|
| 201 |
+
/**
|
| 202 |
+
* Update the order state and status when it's been updated
|
| 203 |
+
*
|
| 204 |
+
* @param Varien_Event_Observer $observer
|
| 205 |
+
*/
|
| 206 |
public function updateOrderState(Varien_Event_Observer $observer)
|
| 207 |
+
{
|
| 208 |
+
$riskifiedOrderStatusHelper = Mage::helper('full/order_status');
|
| 209 |
$riskifiedInvoiceHelper = Mage::helper('full/order_invoice');
|
| 210 |
+
$order = $observer->getOrder();
|
| 211 |
+
$riskifiedStatus = (string)$observer->getStatus();
|
| 212 |
+
$riskifiedOldStatus = (string)$observer->getOldStatus();
|
| 213 |
+
$description = (string)$observer->getDescription();
|
| 214 |
+
$newState = $newStatus = null;
|
| 215 |
+
$currentState = $order->getState();
|
| 216 |
+
$currentStatus = $order->getStatus();
|
| 217 |
+
|
| 218 |
+
Mage::helper('full/log')->log("Checking if should update order '" . $order->getId() . "' from state: '$currentState' and status: '$currentStatus'");
|
| 219 |
+
Mage::helper('full/log')->log("Data received from riskified: status: " . $riskifiedStatus . ", old_status: " . $riskifiedOldStatus . ", description: " . $description);
|
| 220 |
+
|
| 221 |
+
switch ($riskifiedStatus) {
|
| 222 |
+
case 'approved':
|
| 223 |
+
if ($currentState == Mage_Sales_Model_Order::STATE_HOLDED
|
| 224 |
+
&& ($currentStatus == $riskifiedOrderStatusHelper->getOnHoldStatusCode()
|
| 225 |
+
|| $currentStatus == $riskifiedOrderStatusHelper->getTransportErrorStatusCode())
|
| 226 |
+
) {
|
| 227 |
$newState = $riskifiedOrderStatusHelper->getSelectedApprovedState();
|
| 228 |
$newStatus = $riskifiedOrderStatusHelper->getSelectedApprovedStatus();
|
| 229 |
+
}
|
| 230 |
|
| 231 |
+
break;
|
| 232 |
+
case 'declined':
|
| 233 |
if ($currentState == Mage_Sales_Model_Order::STATE_HOLDED
|
| 234 |
&& ($currentStatus == $riskifiedOrderStatusHelper->getOnHoldStatusCode()
|
| 235 |
+
|| $currentStatus == $riskifiedOrderStatusHelper->getTransportErrorStatusCode())
|
| 236 |
+
) {
|
| 237 |
+
$newState = $riskifiedOrderStatusHelper->getSelectedDeclinedState();
|
| 238 |
+
$newStatus = $riskifiedOrderStatusHelper->getSelectedDeclinedStatus();
|
| 239 |
+
}
|
| 240 |
|
| 241 |
break;
|
| 242 |
case 'submitted':
|
| 247 |
$newStatus = $riskifiedOrderStatusHelper->getOnHoldStatusCode();
|
| 248 |
}
|
| 249 |
|
| 250 |
+
break;
|
| 251 |
case 'error':
|
| 252 |
if ($currentState == Mage_Sales_Model_Order::STATE_PROCESSING
|
| 253 |
+
&& $riskifiedInvoiceHelper->isAutoInvoiceEnabled()
|
| 254 |
+
) {
|
| 255 |
$newState = Mage_Sales_Model_Order::STATE_HOLDED;
|
| 256 |
$newStatus = $riskifiedOrderStatusHelper->getTransportErrorStatusCode();
|
| 257 |
}
|
| 258 |
+
|
| 259 |
+
break;
|
| 260 |
+
}
|
| 261 |
|
| 262 |
$changed = false;
|
| 263 |
|
| 264 |
// if newState exists and new state/status are different from current and config is set to status-sync
|
| 265 |
+
if ($newState
|
| 266 |
&& ($newState != $currentState || $newStatus != $currentStatus)
|
| 267 |
+
&& Mage::helper('full')->getConfigStatusControlActive()
|
| 268 |
+
) {
|
| 269 |
+
if ($currentState == Mage_Sales_Model_Order::STATE_HOLDED && $newState != Mage_Sales_Model_Order::STATE_HOLDED) {
|
| 270 |
+
$order->unhold();
|
| 271 |
+
} elseif ($currentState != Mage_Sales_Model_Order::STATE_HOLDED && $newState == Mage_Sales_Model_Order::STATE_HOLDED) {
|
| 272 |
+
$order->hold();
|
| 273 |
+
}
|
| 274 |
if ($newState == Mage_Sales_Model_Order::STATE_CANCELED) {
|
| 275 |
Mage::helper('full/log')->log("Order '" . $order->getId() . "' should be canceled - calling cancel method");
|
| 276 |
$order->cancel();
|
| 277 |
+
$order->addStatusHistoryComment($description, $newStatus);
|
| 278 |
+
} else {
|
| 279 |
+
$order->setState($newState, $newStatus, $description);
|
| 280 |
}
|
|
|
|
| 281 |
Mage::helper('full/log')->log("Updated order '" . $order->getId() . "' to: state: '$newState', status: '$newStatus', description: '$description'");
|
| 282 |
$changed=true;
|
| 283 |
} elseif ($description && $riskifiedStatus != $riskifiedOldStatus) {
|
| 284 |
Mage::helper('full/log')->log("Updated order " . $order->getId() . " history comment to: " . $description);
|
| 285 |
$order->addStatusHistoryComment($description);
|
| 286 |
+
$changed = true;
|
| 287 |
} else {
|
| 288 |
Mage::helper('full/log')->log("No update to state,status,comments is required for " . $order->getId());
|
| 289 |
}
|
| 290 |
|
| 291 |
|
| 292 |
if ($changed) {
|
| 293 |
+
try {
|
| 294 |
+
$order->save();
|
| 295 |
+
} catch (Exception $e) {
|
| 296 |
+
Mage::helper('full/log')->log("Error saving order: " . $e->getMessage());
|
| 297 |
+
return;
|
| 298 |
+
}
|
| 299 |
+
}
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
private function logInvoiceParameters($order)
|
| 303 |
+
{
|
| 304 |
try {
|
| 305 |
+
Mage::helper('full/log')->log("Order " . $order->getId() . " parameters relevant to invoicing failure:");
|
| 306 |
+
Mage::helper('full/log')->log("Order state: " . $order->getState());
|
| 307 |
+
Mage::helper('full/log')->log("Order status: " . $order->getStatus());
|
| 308 |
+
Mage::helper('full/log')->log("UNHOLD action flag: " . $order->getActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_UNHOLD));
|
| 309 |
+
Mage::helper('full/log')->log("INVOICE action flag: " . $order->getActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_INVOICE));
|
| 310 |
foreach ($order->getAllItems() as $item) {
|
| 311 |
+
Mage::helper('full/log')->log("item " . $item->getProductId() . " - qty: " . $item->getQtyToInvoice() . " locked: " . $item->getLockedDoInvoice());
|
| 312 |
}
|
| 313 |
+
} catch (Exception $e) {
|
| 314 |
Mage::helper('full/log')->logException($e);
|
| 315 |
}
|
| 316 |
}
|
| 317 |
|
| 318 |
+
/**
|
| 319 |
+
* Create an invoice when the order is approved
|
| 320 |
+
*
|
| 321 |
+
* @param Varien_Event_Observer $observer
|
| 322 |
+
*/
|
| 323 |
+
public function autoInvoice(Varien_Event_Observer $observer)
|
| 324 |
+
{
|
| 325 |
+
$riskifiedInvoiceHelper = Mage::helper('full/order_invoice');
|
| 326 |
|
| 327 |
+
if (!$riskifiedInvoiceHelper->isAutoInvoiceEnabled()) {
|
| 328 |
+
return;
|
| 329 |
+
}
|
| 330 |
|
| 331 |
+
$order = $observer->getOrder();
|
| 332 |
|
| 333 |
+
// Sanity check
|
| 334 |
+
if (!$order || !$order->getId()) {
|
| 335 |
+
return;
|
| 336 |
+
}
|
| 337 |
|
| 338 |
+
Mage::helper('full/log')->log("Auto-invoicing order " . $order->getId());
|
| 339 |
|
| 340 |
+
if (!$order->canInvoice() || $order->getState() != Mage_Sales_Model_Order::STATE_PROCESSING) {
|
| 341 |
+
Mage::helper('full/log')->log("Order cannot be invoiced");
|
| 342 |
|
| 343 |
+
if (Mage::helper('full')->isDebugLogsEnabled()) {
|
| 344 |
$this->logInvoiceParameters($order);
|
| 345 |
}
|
| 346 |
|
| 347 |
+
return;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
| 351 |
+
|
| 352 |
+
if (!$invoice->getTotalQty()) {
|
| 353 |
+
Mage::helper('full/log')->log("Cannot create an invoice without products");
|
| 354 |
+
return;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
try {
|
| 358 |
+
$invoice
|
| 359 |
+
->setRequestedCaptureCase($riskifiedInvoiceHelper->getCaptureCase())
|
| 360 |
+
->addComment(
|
| 361 |
+
'Invoice automatically created by Riskified when order was approved',
|
| 362 |
+
false,
|
| 363 |
+
false
|
| 364 |
+
)
|
| 365 |
+
->register();
|
| 366 |
+
} catch (Exception $e) {
|
| 367 |
+
Mage::helper('full/log')->log("Error creating invoice: " . $e->getMessage());
|
| 368 |
+
return;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
try {
|
| 372 |
+
Mage::getModel('core/resource_transaction')
|
| 373 |
+
->addObject($invoice)
|
| 374 |
+
->addObject($order)
|
| 375 |
+
->save();
|
| 376 |
+
} catch (Exception $e) {
|
| 377 |
+
Mage::helper('full/log')->log("Error creating transaction: " . $e->getMessage());
|
| 378 |
+
return;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
Mage::helper('full/log')->log("Transaction saved");
|
| 382 |
+
}
|
| 383 |
|
| 384 |
/**
|
| 385 |
* Clear all submission retries for an order that have the same action.
|
| 400 |
->addfieldtofilter('order_id', $order->getId())
|
| 401 |
->addFieldToFilter('action', $observer->getAction());
|
| 402 |
|
| 403 |
+
foreach ($retries as $retry) {
|
| 404 |
$retry->delete();
|
| 405 |
}
|
| 406 |
}
|
app/code/community/Riskified/Full/Model/System/Config/Source/ApprovedState.php
CHANGED
|
@@ -2,14 +2,14 @@
|
|
| 2 |
|
| 3 |
class Riskified_Full_Model_System_Config_Source_ApprovedState
|
| 4 |
{
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
}
|
| 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/CanceledStateStatuses.php
CHANGED
|
@@ -8,8 +8,8 @@ class Riskified_Full_Model_System_Config_Source_CanceledStateStatuses
|
|
| 8 |
public function toOptionArray()
|
| 9 |
{
|
| 10 |
$arr = Mage::getSingleton('sales/order_config')->getStateStatuses(Mage_Sales_Model_Order::STATE_CANCELED);
|
| 11 |
-
return array_map(function($status_code
|
| 12 |
return array('value' => $status_code, 'label' => Mage::helper('full')->__($status_label));
|
| 13 |
-
}, array_keys($arr)
|
| 14 |
}
|
| 15 |
}
|
| 8 |
public function toOptionArray()
|
| 9 |
{
|
| 10 |
$arr = Mage::getSingleton('sales/order_config')->getStateStatuses(Mage_Sales_Model_Order::STATE_CANCELED);
|
| 11 |
+
return array_map(function ($status_code, $status_label) {
|
| 12 |
return array('value' => $status_code, 'label' => Mage::helper('full')->__($status_label));
|
| 13 |
+
}, array_keys($arr), $arr);
|
| 14 |
}
|
| 15 |
}
|
app/code/community/Riskified/Full/Model/System/Config/Source/CaptureCase.php
CHANGED
|
@@ -2,14 +2,14 @@
|
|
| 2 |
|
| 3 |
class Riskified_Full_Model_System_Config_Source_CaptureCase
|
| 4 |
{
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
}
|
| 2 |
|
| 3 |
class Riskified_Full_Model_System_Config_Source_CaptureCase
|
| 4 |
{
|
| 5 |
+
/**
|
| 6 |
+
* @return array
|
| 7 |
+
*/
|
| 8 |
+
public function toOptionArray()
|
| 9 |
+
{
|
| 10 |
+
return array(
|
| 11 |
+
array('value' => Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE, 'label' => Mage::helper('full')->__('Capture Online')),
|
| 12 |
+
array('value' => Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE, 'label' => Mage::helper('full')->__('Capture Offline'))
|
| 13 |
+
);
|
| 14 |
+
}
|
| 15 |
}
|
app/code/community/Riskified/Full/Model/System/Config/Source/DeclinedState.php
CHANGED
|
@@ -2,14 +2,14 @@
|
|
| 2 |
|
| 3 |
class Riskified_Full_Model_System_Config_Source_DeclinedState
|
| 4 |
{
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
}
|
| 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/Model/System/Config/Source/Env.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
class Riskified_Full_Model_System_Config_Source_Env
|
| 4 |
-
{
|
| 5 |
public function toOptionArray()
|
| 6 |
{
|
| 7 |
return array(
|
| 1 |
<?php
|
| 2 |
|
| 3 |
class Riskified_Full_Model_System_Config_Source_Env
|
| 4 |
+
{
|
| 5 |
public function toOptionArray()
|
| 6 |
{
|
| 7 |
return array(
|
app/code/community/Riskified/Full/Model/System/Config/Source/HoldedStateStatuses.php
CHANGED
|
@@ -8,8 +8,8 @@ class Riskified_Full_Model_System_Config_Source_HoldedStateStatuses
|
|
| 8 |
public function toOptionArray()
|
| 9 |
{
|
| 10 |
$arr = Mage::getSingleton('sales/order_config')->getStateStatuses(Mage_Sales_Model_Order::STATE_HOLDED);
|
| 11 |
-
return array_map(function($status_code
|
| 12 |
return array('value' => $status_code, 'label' => Mage::helper('full')->__($status_label));
|
| 13 |
-
}, array_keys($arr)
|
| 14 |
}
|
| 15 |
}
|
| 8 |
public function toOptionArray()
|
| 9 |
{
|
| 10 |
$arr = Mage::getSingleton('sales/order_config')->getStateStatuses(Mage_Sales_Model_Order::STATE_HOLDED);
|
| 11 |
+
return array_map(function ($status_code, $status_label) {
|
| 12 |
return array('value' => $status_code, 'label' => Mage::helper('full')->__($status_label));
|
| 13 |
+
}, array_keys($arr), $arr);
|
| 14 |
}
|
| 15 |
}
|
app/code/community/Riskified/Full/Model/System/Config/Source/ProcessingStateStatuses.php
CHANGED
|
@@ -8,8 +8,8 @@ class Riskified_Full_Model_System_Config_Source_ProcessingStateStatuses
|
|
| 8 |
public function toOptionArray()
|
| 9 |
{
|
| 10 |
$arr = Mage::getSingleton('sales/order_config')->getStateStatuses(Mage_Sales_Model_Order::STATE_PROCESSING);
|
| 11 |
-
return array_map(function($status_code
|
| 12 |
return array('value' => $status_code, 'label' => Mage::helper('full')->__($status_label));
|
| 13 |
-
}, array_keys($arr)
|
| 14 |
}
|
| 15 |
}
|
| 8 |
public function toOptionArray()
|
| 9 |
{
|
| 10 |
$arr = Mage::getSingleton('sales/order_config')->getStateStatuses(Mage_Sales_Model_Order::STATE_PROCESSING);
|
| 11 |
+
return array_map(function ($status_code, $status_label) {
|
| 12 |
return array('value' => $status_code, 'label' => Mage::helper('full')->__($status_label));
|
| 13 |
+
}, array_keys($arr), $arr);
|
| 14 |
}
|
| 15 |
}
|
app/code/community/Riskified/Full/controllers/Adminhtml/RiskifiedfullController.php
CHANGED
|
@@ -10,7 +10,7 @@ class Riskified_Full_Adminhtml_RiskifiedfullController extends Mage_Adminhtml_Co
|
|
| 10 |
*/
|
| 11 |
protected function _isAllowed()
|
| 12 |
{
|
| 13 |
-
return Mage::getSingleton('admin/session')->isAllowed('sales/order');
|
| 14 |
}
|
| 15 |
|
| 16 |
public function sendAction()
|
|
@@ -19,7 +19,7 @@ class Riskified_Full_Adminhtml_RiskifiedfullController extends Mage_Adminhtml_Co
|
|
| 19 |
$call = Mage::getModel('full/observer');
|
| 20 |
$call->postOrderIds(array($id));
|
| 21 |
|
| 22 |
-
Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array('order_id'
|
| 23 |
}
|
| 24 |
|
| 25 |
public function massSendAction()
|
| 10 |
*/
|
| 11 |
protected function _isAllowed()
|
| 12 |
{
|
| 13 |
+
return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/send_to_riskified');
|
| 14 |
}
|
| 15 |
|
| 16 |
public function sendAction()
|
| 19 |
$call = Mage::getModel('full/observer');
|
| 20 |
$call->postOrderIds(array($id));
|
| 21 |
|
| 22 |
+
Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array('order_id' => $id)));
|
| 23 |
}
|
| 24 |
|
| 25 |
public function massSendAction()
|
app/code/community/Riskified/Full/controllers/ResponseController.php
CHANGED
|
@@ -19,8 +19,7 @@ class Riskified_Full_ResponseController extends Mage_Core_Controller_Front_Actio
|
|
| 19 |
$statusCode = 200;
|
| 20 |
$msg = 'Test notification received successfully';
|
| 21 |
Mage::helper('full/log')->log("Test Notification received: ", serialize($notification));
|
| 22 |
-
}
|
| 23 |
-
else {
|
| 24 |
|
| 25 |
// Changing scope to ADMIN store so that all orders will be visible and all admin functionalities will work
|
| 26 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
|
@@ -55,22 +54,23 @@ class Riskified_Full_ResponseController extends Mage_Core_Controller_Front_Actio
|
|
| 55 |
|
| 56 |
$response->setHttpResponseCode($statusCode);
|
| 57 |
$response->setHeader('Content-Type', 'application/json');
|
| 58 |
-
$response->setBody('{ "order" : { "id" : "' . $id . '", "description" : "' . $msg .'" } }');
|
| 59 |
}
|
| 60 |
|
| 61 |
-
private function loadOrderByOrigId($full_orig_id)
|
| 62 |
-
|
|
|
|
| 63 |
return null;
|
| 64 |
}
|
| 65 |
|
| 66 |
-
$magento_ids = explode("_"
|
| 67 |
$order_id = $magento_ids[0];
|
| 68 |
$increment_id = $magento_ids[1];
|
| 69 |
|
| 70 |
if ($order_id && $increment_id) {
|
| 71 |
return Mage::getModel('sales/order')->getCollection()
|
| 72 |
->addFieldToFilter('entity_id', $order_id)
|
| 73 |
-
->addFieldToFilter('increment_id'
|
| 74 |
->getFirstItem();
|
| 75 |
}
|
| 76 |
return Mage::getModel('sales/order')->load($order_id);
|
| 19 |
$statusCode = 200;
|
| 20 |
$msg = 'Test notification received successfully';
|
| 21 |
Mage::helper('full/log')->log("Test Notification received: ", serialize($notification));
|
| 22 |
+
} else {
|
|
|
|
| 23 |
|
| 24 |
// Changing scope to ADMIN store so that all orders will be visible and all admin functionalities will work
|
| 25 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
| 54 |
|
| 55 |
$response->setHttpResponseCode($statusCode);
|
| 56 |
$response->setHeader('Content-Type', 'application/json');
|
| 57 |
+
$response->setBody('{ "order" : { "id" : "' . $id . '", "description" : "' . $msg . '" } }');
|
| 58 |
}
|
| 59 |
|
| 60 |
+
private function loadOrderByOrigId($full_orig_id)
|
| 61 |
+
{
|
| 62 |
+
if (!$full_orig_id) {
|
| 63 |
return null;
|
| 64 |
}
|
| 65 |
|
| 66 |
+
$magento_ids = explode("_", $full_orig_id);
|
| 67 |
$order_id = $magento_ids[0];
|
| 68 |
$increment_id = $magento_ids[1];
|
| 69 |
|
| 70 |
if ($order_id && $increment_id) {
|
| 71 |
return Mage::getModel('sales/order')->getCollection()
|
| 72 |
->addFieldToFilter('entity_id', $order_id)
|
| 73 |
+
->addFieldToFilter('increment_id', $increment_id)
|
| 74 |
->getFirstItem();
|
| 75 |
}
|
| 76 |
return Mage::getModel('sales/order')->load($order_id);
|
app/code/community/Riskified/Full/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<config>
|
| 4 |
+
<acl>
|
| 5 |
+
<resources>
|
| 6 |
+
<all>
|
| 7 |
+
<title>Allow Everything</title>
|
| 8 |
+
</all>
|
| 9 |
+
<admin>
|
| 10 |
+
<children>
|
| 11 |
+
<Riskified_Full translate="title" module="full">
|
| 12 |
+
<title>Full Module</title>
|
| 13 |
+
<sort_order>10</sort_order>
|
| 14 |
+
</Riskified_Full>
|
| 15 |
+
<system>
|
| 16 |
+
<children>
|
| 17 |
+
<config>
|
| 18 |
+
<children>
|
| 19 |
+
<fullsection translate="title" module="full">
|
| 20 |
+
<title>Riskified</title>
|
| 21 |
+
<sort_order>99</sort_order>
|
| 22 |
+
</fullsection>
|
| 23 |
+
</children>
|
| 24 |
+
</config>
|
| 25 |
+
</children>
|
| 26 |
+
</system>
|
| 27 |
+
<sales>
|
| 28 |
+
<children>
|
| 29 |
+
<order>
|
| 30 |
+
<children>
|
| 31 |
+
<actions>
|
| 32 |
+
<children>
|
| 33 |
+
<send_to_riskified translate="title" module="full">
|
| 34 |
+
<title>Send Manually to Riskfied</title>
|
| 35 |
+
<sort_order>99</sort_order>
|
| 36 |
+
</send_to_riskified>
|
| 37 |
+
</children>
|
| 38 |
+
</actions>
|
| 39 |
+
</children>
|
| 40 |
+
</order>
|
| 41 |
+
</children>
|
| 42 |
+
</sales>
|
| 43 |
+
</children>
|
| 44 |
+
</admin>
|
| 45 |
+
</resources>
|
| 46 |
+
</acl>
|
| 47 |
+
</config>
|
app/code/community/Riskified/Full/etc/cache.xml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<placeholders>
|
| 3 |
+
<riskified_full>
|
| 4 |
+
<block>full/beacon</block>
|
| 5 |
+
<name>riskified.full.beacon</name>
|
| 6 |
+
<placeholder>RISKIFIED_FULL_BEACON_CACHE</placeholder>
|
| 7 |
+
<container>Riskified_Full_Model_Container_Beacon</container>
|
| 8 |
+
</riskified_full>
|
| 9 |
+
</placeholders>
|
| 10 |
+
</config>
|
app/code/community/Riskified/Full/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Riskified_Full>
|
| 5 |
-
<version>1.0.8.
|
| 6 |
</Riskified_Full>
|
| 7 |
</modules>
|
| 8 |
|
|
@@ -26,6 +26,11 @@
|
|
| 26 |
</entities>
|
| 27 |
</riskified_full_resource>
|
| 28 |
</models>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
<resources>
|
| 30 |
<riskified_full_setup>
|
| 31 |
<setup>
|
|
@@ -138,15 +143,6 @@
|
|
| 138 |
</riskified_full>
|
| 139 |
</observers>
|
| 140 |
</order_cancel_after>
|
| 141 |
-
<adminhtml_widget_container_html_before>
|
| 142 |
-
<observers>
|
| 143 |
-
<module>
|
| 144 |
-
<type>singleton</type>
|
| 145 |
-
<class>full/observer</class>
|
| 146 |
-
<method>blockHtmlBefore</method>
|
| 147 |
-
</module>
|
| 148 |
-
</observers>
|
| 149 |
-
</adminhtml_widget_container_html_before>
|
| 150 |
<riskified_full_order_update>
|
| 151 |
<observers>
|
| 152 |
<riskified_full_handle_order_update>
|
|
@@ -219,35 +215,17 @@
|
|
| 219 |
</admin>
|
| 220 |
|
| 221 |
<adminhtml>
|
| 222 |
-
<
|
| 223 |
-
<
|
| 224 |
-
<
|
| 225 |
-
<
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
<system>
|
| 234 |
-
<children>
|
| 235 |
-
<config>
|
| 236 |
-
<children>
|
| 237 |
-
<fullsection translate="title"
|
| 238 |
-
module="full"> <!-- This is name of the section created by us -->
|
| 239 |
-
<title>Riskified</title>
|
| 240 |
-
<!-- Title as shown in User->Roles->Permissions Window -->
|
| 241 |
-
<sort_order>99</sort_order>
|
| 242 |
-
</fullsection>
|
| 243 |
-
</children>
|
| 244 |
-
</config>
|
| 245 |
-
</children>
|
| 246 |
-
</system>
|
| 247 |
-
</children>
|
| 248 |
-
</admin>
|
| 249 |
-
</resources>
|
| 250 |
-
</acl>
|
| 251 |
<layout>
|
| 252 |
<updates>
|
| 253 |
<full>
|
|
@@ -267,7 +245,6 @@
|
|
| 267 |
</core_block_abstract_prepare_layout_before>
|
| 268 |
</events>
|
| 269 |
</adminhtml>
|
| 270 |
-
|
| 271 |
<crontab>
|
| 272 |
<jobs>
|
| 273 |
<riskified_full_retry_submission>
|
|
@@ -284,7 +261,7 @@
|
|
| 284 |
<phpunit>
|
| 285 |
<suite>
|
| 286 |
<modules>
|
| 287 |
-
<Riskified_Full
|
| 288 |
</modules>
|
| 289 |
</suite>
|
| 290 |
</phpunit>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Riskified_Full>
|
| 5 |
+
<version>1.0.8.3</version>
|
| 6 |
</Riskified_Full>
|
| 7 |
</modules>
|
| 8 |
|
| 26 |
</entities>
|
| 27 |
</riskified_full_resource>
|
| 28 |
</models>
|
| 29 |
+
<blocks>
|
| 30 |
+
<full>
|
| 31 |
+
<class>Riskified_Full_Block</class>
|
| 32 |
+
</full>
|
| 33 |
+
</blocks>
|
| 34 |
<resources>
|
| 35 |
<riskified_full_setup>
|
| 36 |
<setup>
|
| 143 |
</riskified_full>
|
| 144 |
</observers>
|
| 145 |
</order_cancel_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
<riskified_full_order_update>
|
| 147 |
<observers>
|
| 148 |
<riskified_full_handle_order_update>
|
| 215 |
</admin>
|
| 216 |
|
| 217 |
<adminhtml>
|
| 218 |
+
<events>
|
| 219 |
+
<adminhtml_widget_container_html_before>
|
| 220 |
+
<observers>
|
| 221 |
+
<module>
|
| 222 |
+
<type>singleton</type>
|
| 223 |
+
<class>full/observer</class>
|
| 224 |
+
<method>blockHtmlBefore</method>
|
| 225 |
+
</module>
|
| 226 |
+
</observers>
|
| 227 |
+
</adminhtml_widget_container_html_before>
|
| 228 |
+
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
<layout>
|
| 230 |
<updates>
|
| 231 |
<full>
|
| 245 |
</core_block_abstract_prepare_layout_before>
|
| 246 |
</events>
|
| 247 |
</adminhtml>
|
|
|
|
| 248 |
<crontab>
|
| 249 |
<jobs>
|
| 250 |
<riskified_full_retry_submission>
|
| 261 |
<phpunit>
|
| 262 |
<suite>
|
| 263 |
<modules>
|
| 264 |
+
<Riskified_Full/>
|
| 265 |
</modules>
|
| 266 |
</suite>
|
| 267 |
</phpunit>
|
app/code/community/Riskified/Full/etc/system.xml
CHANGED
|
@@ -42,7 +42,8 @@
|
|
| 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
|
|
|
|
| 46 |
</domain>
|
| 47 |
<key translate="label comment">
|
| 48 |
<label>Auth token</label>
|
|
@@ -51,7 +52,8 @@
|
|
| 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
|
|
|
|
| 55 |
</key>
|
| 56 |
<order_status_sync translate="label comment">
|
| 57 |
<label>Order Status Sync</label>
|
|
@@ -161,7 +163,8 @@
|
|
| 161 |
<show_in_default>1</show_in_default>
|
| 162 |
<show_in_website>0</show_in_website>
|
| 163 |
<show_in_store>0</show_in_store>
|
| 164 |
-
<comment
|
|
|
|
| 165 |
<depends>
|
| 166 |
<order_status_sync>1</order_status_sync>
|
| 167 |
</depends>
|
| 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>
|
| 46 |
+
<![CDATA[This is the shop domain used during signup. See <a href="http://www.riskified.com/documentation/magento.html" target="_blank">documentation</a> for more details.]]></comment>
|
| 47 |
</domain>
|
| 48 |
<key translate="label comment">
|
| 49 |
<label>Auth token</label>
|
| 52 |
<show_in_default>1</show_in_default>
|
| 53 |
<show_in_website>0</show_in_website>
|
| 54 |
<show_in_store>0</show_in_store>
|
| 55 |
+
<comment>
|
| 56 |
+
<![CDATA[ Your <i>secret</i> auth token can be found in your <a href="https://app.riskified.com/main/settings/advanced" target="_blank">Riskified Settings page</a>. ]]></comment>
|
| 57 |
</key>
|
| 58 |
<order_status_sync translate="label comment">
|
| 59 |
<label>Order Status Sync</label>
|
| 163 |
<show_in_default>1</show_in_default>
|
| 164 |
<show_in_website>0</show_in_website>
|
| 165 |
<show_in_store>0</show_in_store>
|
| 166 |
+
<comment>
|
| 167 |
+
<![CDATA[Should an invoice automatically be created when Riskified approves this order?]]></comment>
|
| 168 |
<depends>
|
| 169 |
<order_status_sync>1</order_status_sync>
|
| 170 |
</depends>
|
app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-install-1.0.1.php
CHANGED
|
@@ -7,8 +7,8 @@ $installer->startSetup();
|
|
| 7 |
$helper = Mage::helper('full/order_status');
|
| 8 |
|
| 9 |
Mage::getModel('sales/order_status')
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
$installer->endSetup();
|
| 7 |
$helper = Mage::helper('full/order_status');
|
| 8 |
|
| 9 |
Mage::getModel('sales/order_status')
|
| 10 |
+
->setStatus($helper->getOnHoldStatusCode())->setLabel($helper->getOnHoldStatusLabel())
|
| 11 |
+
->assignState(Mage_Sales_Model_Order::STATE_HOLDED)
|
| 12 |
+
->save();
|
| 13 |
|
| 14 |
$installer->endSetup();
|
app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.2.0-1.0.2.1.php
CHANGED
|
@@ -7,8 +7,8 @@ $installer->startSetup();
|
|
| 7 |
$helper = Mage::helper('full/order_status');
|
| 8 |
|
| 9 |
Mage::getModel('sales/order_status')
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
$installer->endSetup();
|
| 7 |
$helper = Mage::helper('full/order_status');
|
| 8 |
|
| 9 |
Mage::getModel('sales/order_status')
|
| 10 |
+
->setStatus($helper->getTransportErrorStatusCode())->setLabel($helper->getTransportErrorStatusLabel())
|
| 11 |
+
->assignState(Mage_Sales_Model_Order::STATE_HOLDED)
|
| 12 |
+
->save();
|
| 13 |
|
| 14 |
$installer->endSetup();
|
app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.4-1.0.5.0.php
CHANGED
|
@@ -8,31 +8,30 @@ $installer->startSetup();
|
|
| 8 |
$table = $installer->getConnection()
|
| 9 |
->newTable($installer->getTable('full/retry'))
|
| 10 |
->addColumn('retry_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
| 11 |
-
'identity'
|
| 12 |
-
'unsigned'
|
| 13 |
-
'nullable'
|
| 14 |
-
'primary'
|
| 15 |
), 'Id')
|
| 16 |
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
| 17 |
-
'unsigned'
|
| 18 |
-
'nullable'
|
| 19 |
'default' => 0
|
| 20 |
), 'Order Id')
|
| 21 |
->addColumn('action', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
|
| 22 |
-
'nullable'
|
| 23 |
), 'Action')
|
| 24 |
->addColumn('last_error', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
| 25 |
-
'nullable'
|
| 26 |
), 'Last Error')
|
| 27 |
->addColumn('attempts', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
| 28 |
-
'unsigned'
|
| 29 |
-
'nullable'
|
| 30 |
'default' => 0
|
| 31 |
), 'Number of retry attempts')
|
| 32 |
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
|
| 33 |
-
'nullable'
|
| 34 |
-
), 'Date last updated')
|
| 35 |
-
;
|
| 36 |
|
| 37 |
$installer->getConnection()->createTable($table);
|
| 38 |
|
| 8 |
$table = $installer->getConnection()
|
| 9 |
->newTable($installer->getTable('full/retry'))
|
| 10 |
->addColumn('retry_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
| 11 |
+
'identity' => true,
|
| 12 |
+
'unsigned' => true,
|
| 13 |
+
'nullable' => false,
|
| 14 |
+
'primary' => true,
|
| 15 |
), 'Id')
|
| 16 |
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
| 17 |
+
'unsigned' => true,
|
| 18 |
+
'nullable' => false,
|
| 19 |
'default' => 0
|
| 20 |
), 'Order Id')
|
| 21 |
->addColumn('action', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
|
| 22 |
+
'nullable' => false,
|
| 23 |
), 'Action')
|
| 24 |
->addColumn('last_error', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
|
| 25 |
+
'nullable' => true,
|
| 26 |
), 'Last Error')
|
| 27 |
->addColumn('attempts', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
| 28 |
+
'unsigned' => true,
|
| 29 |
+
'nullable' => false,
|
| 30 |
'default' => 0
|
| 31 |
), 'Number of retry attempts')
|
| 32 |
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
|
| 33 |
+
'nullable' => false
|
| 34 |
+
), 'Date last updated');
|
|
|
|
| 35 |
|
| 36 |
$installer->getConnection()->createTable($table);
|
| 37 |
|
app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.5.5-1.0.6.0.php
CHANGED
|
@@ -9,10 +9,10 @@ $helper = Mage::helper('full/order_status');
|
|
| 9 |
// create new approved and declined statuses
|
| 10 |
|
| 11 |
Mage::getModel('sales/order_status')
|
| 12 |
-
|
| 13 |
->setLabel($helper->getRiskifiedDeclinedStatusLabel())
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
Mage::getModel('sales/order_status')
|
| 18 |
->setStatus($helper->getRiskifiedDeclinedStatusCode())
|
| 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())
|
app/code/community/Riskified/Full/sql/riskified_full_setup/mysql4-upgrade-1.0.8.0-1.0.8.1.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 4 |
+
$installer = $this;
|
| 5 |
+
|
| 6 |
+
$installer->startSetup();
|
| 7 |
+
|
| 8 |
+
$table = $installer->getConnection()
|
| 9 |
+
->addForeignKey(
|
| 10 |
+
$installer->getFkName($installer->getTable('full/retry'), 'order_id', $installer->getTable('sales/order'), 'entity_id'),
|
| 11 |
+
$installer->getTable('full/retry'),
|
| 12 |
+
'order_id',
|
| 13 |
+
$installer->getTable('sales/order'),
|
| 14 |
+
'entity_id'
|
| 15 |
+
);
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/full.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<layout version="0.1.0">
|
| 3 |
<default>
|
| 4 |
<reference name="before_body_end">
|
| 5 |
-
<block type="
|
| 6 |
</reference>
|
| 7 |
</default>
|
| 8 |
</layout>
|
| 2 |
<layout version="0.1.0">
|
| 3 |
<default>
|
| 4 |
<reference name="before_body_end">
|
| 5 |
+
<block type="full/beacon" name="riskified.full.beacon" />
|
| 6 |
</reference>
|
| 7 |
</default>
|
| 8 |
</layout>
|
app/design/frontend/base/default/template/full/{riskified.phtml → beacon.phtml}
RENAMED
|
@@ -1,12 +1,10 @@
|
|
| 1 |
-
|
| 2 |
<script type="text/javascript">
|
| 3 |
(function() {
|
| 4 |
function riskifiedBeaconLoad() {
|
| 5 |
-
var session_id = "<?php echo
|
| 6 |
-
var store_domain="<?php echo
|
| 7 |
-
var
|
| 8 |
-
var
|
| 9 |
-
var url = ('https:' == document.location.protocol ? 'https://' : 'http://') + "<?php echo Mage::helper('full')->getConfigBeaconUrl()?>?shop="+store_domain+"&sid="+session_id+"&v="+version;
|
| 10 |
var s = document.createElement('script');
|
| 11 |
s.type = 'text/javascript';
|
| 12 |
s.async = true;
|
|
|
|
| 1 |
<script type="text/javascript">
|
| 2 |
(function() {
|
| 3 |
function riskifiedBeaconLoad() {
|
| 4 |
+
var session_id = "<?php echo $this->sessionId; ?>";
|
| 5 |
+
var store_domain = "<?php echo $this->shopDomain; ?>";
|
| 6 |
+
var version = "<?php echo $this->extensionVersion; ?>";
|
| 7 |
+
var url = ('https:' == document.location.protocol ? 'https://' : 'http://') + "<?php echo $this->beaconUrl?>?shop="+store_domain+"&sid="+session_id+"&v="+version;
|
|
|
|
| 8 |
var s = document.createElement('script');
|
| 9 |
s.type = 'text/javascript';
|
| 10 |
s.async = true;
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>riskified_magento</name>
|
| 4 |
-
<version>1.0.8.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -9,11 +9,13 @@
|
|
| 9 |
<summary>Riskified Magento extension</summary>
|
| 10 |
<description>Riskified reviews, approves & guarantees
|
| 11 |
transactions you would otherwise decline.</description>
|
| 12 |
-
<notes>*
|
|
|
|
|
|
|
| 13 |
<authors><author><name>Riskified_Mage</name><user>Riskified_Mage</user><email>support@riskified.com</email></author></authors>
|
| 14 |
-
<date>
|
| 15 |
-
<time>
|
| 16 |
-
<contents><target name="magecommunity"><dir name="Riskified"><dir name="Full"><dir><dir name="Helper"><file name="Data.php" hash="
|
| 17 |
<compatible/>
|
| 18 |
<dependencies><required><php><min>4.4.0</min><max>6.0.0</max></php></required></dependencies>
|
| 19 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>riskified_magento</name>
|
| 4 |
+
<version>1.0.8.3</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>* Beacon with FPC hole punching capabilities
|
| 13 |
+
* Better support for status transitions with order status sync
|
| 14 |
+
* Voiding payments at the gateway on decline when state set to canceled.</notes>
|
| 15 |
<authors><author><name>Riskified_Mage</name><user>Riskified_Mage</user><email>support@riskified.com</email></author></authors>
|
| 16 |
+
<date>2016-03-21</date>
|
| 17 |
+
<time>16:07:57</time>
|
| 18 |
+
<contents><target name="magecommunity"><dir name="Riskified"><dir name="Full"><dir><dir name="Block"><file name="Beacon.php" hash="00c6f36ab82a4805b5408cda907bdcfa"/></dir><dir name="Helper"><dir name="Customer"><file name="Order.php" hash="38278dee0939fba4a017e347ac1784ad"/></dir><file name="Data.php" hash="de74f8666de65022c11ccc7290c494be"/><file name="Debug.php" hash="b4cd9735bdd601cb624f7495242606e2"/><file name="Log.php" hash="ae614c5071160221b71fb0ed600da67e"/><dir name="Order"><file name="Invoice.php" hash="0117cd5689818c3dc9ab9b59fced6c18"/><file name="Status.php" hash="210a0c440b4070fdcb2ead2c2db4e567"/></dir><file name="Order.php" hash="5c66f5cc1ae5c4aa2b820aef8def8d4e"/></dir><dir name="Model"><file name="Authorizenet.php" hash="4b910a92820a8d5571a5129e51b54fd3"/><dir name="Container"><file name="Beacon.php" hash="b1c3910031983b9291c98dbe46d61f09"/></dir><file name="Cron.php" hash="3cdbb07e1eac686b37e179a341640178"/><file name="Observer.php" hash="ce32dda2157928a76fd94311a113bb27"/><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="6f4d7f7eb52922e57ff9069ec6031b63"/><file name="CanceledStateStatuses.php" hash="c274fb739314b34104e0b0085f1039c8"/><file name="CaptureCase.php" hash="6f2505f2c51df6a7caa26d5f89995b47"/><file name="DeclinedState.php" hash="d2c80dd15b3843bce5eb4d2a660b080a"/><file name="Env.php" hash="e213a59d9c438e4dc39b226134a85fab"/><file name="HoldedStateStatuses.php" hash="212f2476e5f6bed6d3456133d6e27c40"/><file name="ProcessingStateStatuses.php" hash="19af6046f86df7a5ba28693545493304"/></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="RiskifiedfullController.php" hash="2bcd1d1e3b05bc35e08bd0a9609bb2df"/></dir><file name="ResponseController.php" hash="2e1cc71cb0d8ed2668b21e2e143067b2"/></dir><dir name="etc"><file name="adminhtml.xml" hash="333f4002a4c677b670cd449147b9d3c8"/><file name="cache.xml" hash="3a7cd749515499cce292330c46ce5028"/><file name="config.xml" hash="fd0e3923108ee325f46ae3dd9e9cfa9b"/><file name="system.xml" hash="58e468c2ef66e1b0b8ffc0dcd7e6c55e"/></dir><dir name="sql"><dir name="riskified_full_setup"><file name="mysql4-install-1.0.1.php" hash="66592f315ddacbb116e70b34094fbbef"/><file name="mysql4-upgrade-1.0.2.0-1.0.2.1.php" hash="5d12b7203027e843f6322b5a48fb3d23"/><file name="mysql4-upgrade-1.0.4-1.0.5.0.php" hash="df9bb6016ebab61444d65a5d92b0a70e"/><file name="mysql4-upgrade-1.0.5.5-1.0.6.0.php" hash="c749f3c2564fdf9310dcd22d493630d8"/><file name="mysql4-upgrade-1.0.8.0-1.0.8.1.php" hash="45ac33ab1e02f06f6850dd9876017f09"/></dir></dir></dir><file name=".DS_Store" hash="af9575107ec7e509e8f187f6c21faa5f"/></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="a88b28f46d8dcdf51633802c367bcc41"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="full.xml" hash="96d4fb310618a1e6fb149dc367952812"/></dir><dir name="template"><dir name="full"><file name="beacon.phtml" hash="396625d0c46c9f4dd287cef289a9bef8"/></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="c6fb5a90b2c527b794fcec803acb36d9"/><file name="order_full_flow.php" hash="2f9ee71abb1188685d8adb18dca97321"/><file name="order_marketplace_create.php" hash="ae3d2fb28154a710934d6243302a590d"/><file name="order_simple_submit.php" hash="d8458f7992b486b6dac28558526f068b"/><file name="run_callback_server.sh" hash="8202fd93c15e088d072805d3a2f4c02b"/><file name="update_merchant_settings.php" hash="24499737ab057aba76cd054fd5051aad"/><file name="upload_historical.php" hash="78bdb85c036183de16968a79c8836efd"/></dir><dir name="src"><dir name="Riskified"><dir name="Common"><file name="Env.php" hash="3fc8342a423141fb0c110901deebfe25"/><dir name="Exception"><file name="BaseException.php" hash="ce902d0a3bd9af53b3c1923541602ead"/></dir><file name="Riskified.php" hash="c3adcd9835e919c85507636b22665fcc"/><dir name="Signature"><file name="HttpDataSignature.php" hash="b9f5d57db1903126a72eb38ca55ba878"/></dir><file name="Validations.php" hash="4af37b31901f215b660c868c31594b75"/></dir><dir name="DecisionNotification"><dir name="Exception"><file name="AuthorizationException.php" hash="4cab71ac324efd3b29bdfa6236a8f531"/><file name="BadHeaderException.php" hash="407a0d9e94d52e8b43bed02e34bd4a70"/><file name="BadPostJsonException.php" hash="2e2a7f84fae19fd525f01f6899ea218b"/><file name="NotificationException.php" hash="8f7d1ed8b9523ec66423c6ff2703085f"/></dir><dir name="Model"><file name="Notification.php" hash="9e2f5fd421abe37ab7b742767966f312"/></dir></dir><dir name="OrderWebhook"><dir name="Exception"><file name="ClassMismatchPropertyException.php" hash="8854b7aea6736b290826eb44ac0ba578"/><file name="CurlException.php" hash="27488d2dd0fa2c25b647a5967e3821b1"/><file name="FormatMismatchPropertyException.php" hash="2729989c3ac2a245341fd01a4d004b49"/><file name="InvalidPropertyException.php" hash="97084ff2ff33f5c657c5876a44aa97d2"/><file name="MalformedJsonException.php" hash="8c795b605988f20f1899dcf160f29cf1"/><file name="MissingPropertyException.php" hash="5ad8df6ba645a113fac7b65e08167d2c"/><file name="MultiplePropertiesException.php" hash="aaa042c5a0fcfd15dc2744059b15798b"/><file name="PropertyException.php" hash="7a234406434c5616aab72da27a1ed6ed"/><file name="TypeMismatchPropertyException.php" hash="5eed61220c954a462411f433a2c85bf2"/><file name="UnsuccessfulActionException.php" hash="b02fafbda955fa889ca36c5092ccc68d"/></dir><dir name="Model"><file name="AbstractModel.php" hash="73adfaac9fe9e189827baac5a71e41a4"/><file name="Address.php" hash="afcbe96d54dd0c03b01eb057662cdcf9"/><file name="Attribute.php" hash="e7fa146d7c9c807494c225e6a41afcfb"/><file name="AuthorizationError.php" hash="b82229eff42d94ceba58d4d6a3a4118b"/><file name="ChargeFreePaymentDetails.php" hash="07ab9a9022cc3152404617b72230e843"/><file name="Checkout.php" hash="ede0e6d2fd8319ada669de35b4c3190f"/><file name="ClientDetails.php" hash="50b329fa6b77bcbeff4b725705b957af"/><file name="Customer.php" hash="43baa39c861eb653834066b595b55407"/><file name="Decision.php" hash="55bf62bfcfc49ab9e5b823e7ec90d6bd"/><file name="DecisionDetails.php" hash="317121548885d2b8eb75a4d5e383f9f8"/><file name="DiscountCode.php" hash="0861920950828a3ff19904b92b4cb50d"/><file name="Fulfillment.php" hash="9111db9b13ae7b2fbe6bf806a66d78f2"/><file name="FulfillmentDetails.php" hash="d3c11d4e8943862fc4a774f3f8e9d7d7"/><file name="LineItem.php" hash="f01c65e7ad1195bb994d77d869e301d7"/><file name="MerchantSettings.php" hash="62f42b50b7a25b014cbed4ea528998aa"/><file name="Order.php" hash="e5264565f54800012294d8aecf0619cf"/><file name="OrderCancellation.php" hash="f6f2d5234bb98b56902e632fbccc07b3"/><file name="PaymentDetails.php" hash="413b5a6ab26ec6b9b0664a9d9e301c02"/><file name="Refund.php" hash="1c3ad264984585cfcefc909ffa708dc4"/><file name="RefundDetails.php" hash="f9a0e27e26bbfb6699bb0dd44fe6a184"/><file name="Seller.php" hash="2dd5dc2dc22582231263cad803149a16"/><file name="ShippingLine.php" hash="5ac14361474789db570fa6d14b17a973"/><file name="SocialDetails.php" hash="1fbc1939121c9618e612316c1a4500ca"/><file name="TaxLine.php" hash="59f82a19bc9ada690aa79bc96307db5e"/></dir><dir name="Transport"><file name="AbstractTransport.php" hash="6be123376c81f478968ee420ca5b31cb"/><file name="CurlTransport.php" hash="ecfb195ac0f8f9599dd859dffc40c968"/></dir></dir><file name="autoloader.php" hash="f3471e90daf6184a096d337bbcd40bd1"/></dir></dir></dir><file name=".gitignore" hash="73f01e1298c44b6cc3e24a70cad8c56c"/></dir><dir name="riskified_scripts"><file name="riskified_historical_upload.php" hash="db28908aa4d29a78b712057fa60924fb"/></dir></target></contents>
|
| 19 |
<compatible/>
|
| 20 |
<dependencies><required><php><min>4.4.0</min><max>6.0.0</max></php></required></dependencies>
|
| 21 |
</package>
|
