Version Notes
* Updated activation process.
Download this release
Release Info
Developer | Riskified_Mage |
Extension | riskified_magento |
Version | 1.0.6.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.6.6 to 1.0.6.7
- app/code/community/Riskified/Full/.DS_Store +0 -0
- app/code/community/Riskified/Full/Helper/Data.php +8 -0
- app/code/community/Riskified/Full/Helper/Order.php +36 -0
- app/code/community/Riskified/Full/Model/Observer.php +34 -0
- app/code/community/Riskified/Full/etc/config.xml +10 -1
- app/code/community/Riskified/Full/etc/system.xml +2 -2
- app/design/adminhtml/default/default/template/full/jsinit.phtml +134 -155
- lib/riskified_php_sdk/sample/update_merchant_settings.php +49 -0
- lib/riskified_php_sdk/src/Riskified/Common/Riskified.php +1 -1
- lib/riskified_php_sdk/src/Riskified/OrderWebhook/Model/Decision.php +28 -0
- lib/riskified_php_sdk/src/Riskified/OrderWebhook/Model/DecisionDetails.php +33 -0
- lib/riskified_php_sdk/src/Riskified/OrderWebhook/Model/MerchantSettings.php +13 -0
- lib/riskified_php_sdk/src/Riskified/OrderWebhook/Model/Order.php +3 -1
- lib/riskified_php_sdk/src/Riskified/OrderWebhook/Transport/AbstractTransport.php +27 -1
- lib/riskified_scripts/riskified_historical_upload.php +69 -0
- package.xml +5 -5
app/code/community/Riskified/Full/.DS_Store
DELETED
Binary file
|
app/code/community/Riskified/Full/Helper/Data.php
CHANGED
@@ -26,6 +26,14 @@ class Riskified_Full_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
26 |
return 'Riskified\Common\Env::' . Mage::getStoreConfig('fullsection/full/env');
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
public function getConfigBeaconUrl(){
|
30 |
return Mage::getStoreConfig('fullsection/full/beaconurl');
|
31 |
}
|
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 |
}
|
app/code/community/Riskified/Full/Helper/Order.php
CHANGED
@@ -19,6 +19,42 @@ class Riskified_Full_Helper_Order extends Mage_Core_Helper_Abstract {
|
|
19 |
$this->initSdk();
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
/**
|
23 |
* Submit an order to Riskified.
|
24 |
*
|
19 |
$this->initSdk();
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* Update the merchan't settings
|
24 |
+
*
|
25 |
+
* @param settings hash
|
26 |
+
* @return stdClass
|
27 |
+
* @throws Exception
|
28 |
+
*/
|
29 |
+
public function updateMerchantSettings($settings) {
|
30 |
+
$transport = $this->getTransport();
|
31 |
+
Mage::helper('full/log')->log('updateMerchantSettings');
|
32 |
+
|
33 |
+
try {
|
34 |
+
$response = $transport->updateMerchantSettings($settings);
|
35 |
+
|
36 |
+
Mage::helper('full/log')->log('Merchant Settings posted successfully');
|
37 |
+
} catch(\Riskified\OrderWebhook\Exception\UnsuccessfulActionException $uae) {
|
38 |
+
if ($uae->statusCode == '401') {
|
39 |
+
Mage::helper('full/log')->logException($uae);
|
40 |
+
Mage::getSingleton('adminhtml/session')->addError('Make sure you have the correct Auth token as it appears in Riskified advanced settings.');
|
41 |
+
}
|
42 |
+
throw $uae;
|
43 |
+
} catch(\Riskified\OrderWebhook\Exception\CurlException $curlException) {
|
44 |
+
Mage::helper('full/log')->logException($curlException);
|
45 |
+
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $curlException->getMessage());
|
46 |
+
|
47 |
+
throw $curlException;
|
48 |
+
}
|
49 |
+
catch (Exception $e) {
|
50 |
+
Mage::helper('full/log')->logException($e);
|
51 |
+
Mage::getSingleton('adminhtml/session')->addError('Riskified extension: ' . $e->getMessage());
|
52 |
+
|
53 |
+
throw $e;
|
54 |
+
}
|
55 |
+
return $response;
|
56 |
+
|
57 |
+
}
|
58 |
/**
|
59 |
* Submit an order to Riskified.
|
60 |
*
|
app/code/community/Riskified/Full/Model/Observer.php
CHANGED
@@ -1,4 +1,10 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class Riskified_Full_Model_Observer {
|
4 |
|
@@ -13,6 +19,34 @@ class Riskified_Full_Model_Observer {
|
|
13 |
}
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public function salesOrderPaymentPlaceEnd($evt) {
|
17 |
Mage::helper('full/log')->log("salesOrderPaymentPlaceEnd");
|
18 |
|
1 |
<?php
|
2 |
+
use Riskified\Common\Riskified;
|
3 |
+
use Riskified\Common\Env;
|
4 |
+
use Riskified\Common\Validations;
|
5 |
+
use Riskified\Common\Signature;
|
6 |
+
use Riskified\OrderWebhook\Model;
|
7 |
+
use Riskified\OrderWebhook\Transport;
|
8 |
|
9 |
class Riskified_Full_Model_Observer {
|
10 |
|
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 = $helper->getShopDomain();
|
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 = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
36 |
+
#Riskified::init($riskifiedShopDomain, $authToken, $env, Validations::IGNORE_MISSING);
|
37 |
+
$settings['gws'] = $gateWays;
|
38 |
+
$settings['host_url'] = $shopHostUrl;
|
39 |
+
$settings['extension_version'] = $extensionVersion;
|
40 |
+
unset($settings['key']);
|
41 |
+
unset($settings['domain']);
|
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 |
Mage::helper('full/log')->log("salesOrderPaymentPlaceEnd");
|
52 |
|
app/code/community/Riskified/Full/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Riskified_Full>
|
5 |
-
<version>1.0.6.
|
6 |
</Riskified_Full>
|
7 |
</modules>
|
8 |
|
@@ -39,6 +39,15 @@
|
|
39 |
</full>
|
40 |
</helpers>
|
41 |
<events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
<sales_order_payment_place_start>
|
43 |
<observers>
|
44 |
<riskified_full>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Riskified_Full>
|
5 |
+
<version>1.0.6.7</version>
|
6 |
</Riskified_Full>
|
7 |
</modules>
|
8 |
|
39 |
</full>
|
40 |
</helpers>
|
41 |
<events>
|
42 |
+
<admin_system_config_changed_section_fullsection>
|
43 |
+
<observers>
|
44 |
+
<riskified_full>
|
45 |
+
<type>singleton</type>
|
46 |
+
<class>full/observer</class>
|
47 |
+
<method>saveRiskifiedConfig</method>
|
48 |
+
</riskified_full>
|
49 |
+
</observers>
|
50 |
+
</admin_system_config_changed_section_fullsection>
|
51 |
<sales_order_payment_place_start>
|
52 |
<observers>
|
53 |
<riskified_full>
|
app/code/community/Riskified/Full/etc/system.xml
CHANGED
@@ -42,7 +42,7 @@
|
|
42 |
<show_in_default>1</show_in_default>
|
43 |
<show_in_website>0</show_in_website>
|
44 |
<show_in_store>0</show_in_store>
|
45 |
-
<comment><![CDATA[This is the shop domain used during signup]]></comment>
|
46 |
</domain>
|
47 |
<key translate="label comment">
|
48 |
<label>Auth token</label>
|
@@ -51,7 +51,7 @@
|
|
51 |
<show_in_default>1</show_in_default>
|
52 |
<show_in_website>0</show_in_website>
|
53 |
<show_in_store>0</show_in_store>
|
54 |
-
<comment><![CDATA[ Your <i>secret</i> auth token can be found in your Riskified Settings page
|
55 |
</key>
|
56 |
<order_status_sync translate="label comment">
|
57 |
<label>Order Status Sync</label>
|
42 |
<show_in_default>1</show_in_default>
|
43 |
<show_in_website>0</show_in_website>
|
44 |
<show_in_store>0</show_in_store>
|
45 |
+
<comment><![CDATA[This is the shop domain used during signup. See <a href="http://www.riskified.com/documentation/magento.html" target="_blank">documentation</a> for more details.]]></comment>
|
46 |
</domain>
|
47 |
<key translate="label comment">
|
48 |
<label>Auth token</label>
|
51 |
<show_in_default>1</show_in_default>
|
52 |
<show_in_website>0</show_in_website>
|
53 |
<show_in_store>0</show_in_store>
|
54 |
+
<comment><![CDATA[ Your <i>secret</i> auth token can be found in your <a href="https://app.riskified.com/main/settings/advanced" target="_blank">Riskified Settings page</a>. ]]></comment>
|
55 |
</key>
|
56 |
<order_status_sync translate="label comment">
|
57 |
<label>Order Status Sync</label>
|
app/design/adminhtml/default/default/template/full/jsinit.phtml
CHANGED
@@ -19,17 +19,17 @@
|
|
19 |
*/
|
20 |
?>
|
21 |
|
22 |
-
<?php
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
?>
|
32 |
-
|
33 |
<style type="text/css">
|
34 |
.riskified-botton {
|
35 |
font-family: Helvetica Neue;
|
@@ -83,18 +83,18 @@
|
|
83 |
margin-bottom: 10px;
|
84 |
padding-left: 10px ;
|
85 |
}
|
86 |
-
|
87 |
.text-notice {
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
}
|
97 |
-
|
98 |
#activation-done{
|
99 |
display: none;
|
100 |
}
|
@@ -102,151 +102,130 @@
|
|
102 |
</style>
|
103 |
|
104 |
<script type="text/javascript">
|
105 |
-
//<![CDATA[
|
106 |
-
|
107 |
-
function showRiskifiedNotice(noticeId){
|
108 |
-
$$(noticeId)[0].style.setProperty("display","block");
|
109 |
-
}
|
110 |
|
111 |
-
function
|
112 |
-
|
113 |
-
}
|
114 |
|
115 |
-
function
|
116 |
-
|
117 |
-
|
118 |
-
showRiskifiedNotice("#magento-notice");
|
119 |
-
return;
|
120 |
-
}
|
121 |
-
var riskifiedPassword = $$("#riskified-shop-password")[0].value;
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
127 |
|
128 |
-
|
|
|
|
|
|
|
129 |
|
130 |
-
|
131 |
-
$$("#fullsection_full_domain")[0].value = riskifiedShopDomain;
|
132 |
-
riskifiedActivation(riskifiedPassword,riskifiedShopDomain,generatedKey)
|
133 |
-
}
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
var fullsectionIndex = document.location.href.indexOf('fullsection');
|
139 |
-
if (fullsectionIndex == -1){
|
140 |
-
return;
|
141 |
}
|
142 |
-
var riskifiedShopDomain = '<?php echo Mage::helper("full")->getShopDomain()?>'
|
143 |
-
var generatedKey = '<?php echo Mage::helper('full')->getAuthToken()?>';
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
});
|
153 |
-
}catch(err){
|
154 |
-
console.log("error reporting new config params");
|
155 |
-
}
|
156 |
-
return true;
|
157 |
-
}
|
158 |
|
159 |
-
|
160 |
-
var keys = "<?php echo $allkeys ?>";
|
161 |
-
var extensionVersion = '<?php echo Mage::helper('full')->getExtensionVersion()?>'
|
162 |
-
var activateURL = 'https://' + '<?php echo Mage::helper("full/order")->getRiskifiedDomain()?>/magento/activate';
|
163 |
-
var shopHostUrl = "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)?>";
|
164 |
-
|
165 |
-
new Ajax.Request(activateURL, {
|
166 |
-
method: 'POST',
|
167 |
-
parameters: "shop_url="+riskifiedShopDomain+"&password="+riskifiedPassword+"&auth_token="+generatedKey+"&gws="+keys+"&host_url="+shopHostUrl+"&extension_version="+extensionVersion,
|
168 |
-
onSuccess:
|
169 |
-
function(response) {
|
170 |
-
hideRiskifiedNotice("#magento-notice");
|
171 |
-
configForm.submit();
|
172 |
-
$$("#activation-done")[0].style.setProperty("display","block");
|
173 |
-
$$("#activation-pre")[0].style.setProperty("display","none");
|
174 |
-
$$("#activate_button")[0].disabled = true;
|
175 |
-
},
|
176 |
-
onFailure:
|
177 |
-
function(response) {
|
178 |
-
showRiskifiedNotice("#magento-notice");
|
179 |
-
}
|
180 |
-
});
|
181 |
-
}
|
182 |
-
document.observe("dom:loaded", function() {
|
183 |
-
var rhtml = '';
|
184 |
-
rhtml += '<span id="riskified-logo" style="margin-top: 12px; margin-bottom: 19px; display:block">';
|
185 |
-
rhtml += ' <img width="204px" height="53px" src="<?php echo $this->getSkinUrl('images/riskified/logo.jpg'); ?>"/>';
|
186 |
-
rhtml += '</span>';
|
187 |
-
rhtml += '<div id="riskified-header" style="font-family:Helvetica Neue; font-size: 19px; line-height: 23px; color: #393536;">';
|
188 |
-
rhtml += 'The Riskified extension has been installed.<br>To activate the extension please connect it to your Riskified account';
|
189 |
-
rhtml += '</div>';
|
190 |
-
rhtml += '<span class="step-wrapper">';
|
191 |
-
rhtml += ' <div class="step-title" style="font-family:Helvetica Neue; font-size: 25px; line-height: 30px; color: #393536; display:inline-block">';
|
192 |
-
rhtml += ' 1. Create Your Account';
|
193 |
-
rhtml += ' <span style="margin-left: 20px;font-family:Helvetica Neue; font-size: 14px; line-height: 17px; color: #828282; padding: 5px; display:block">';
|
194 |
-
rhtml += ' Already have an account? go to step #2';
|
195 |
-
rhtml += ' </span>';
|
196 |
-
rhtml += ' </div>';
|
197 |
-
rhtml += ' <span class="step-inner">';
|
198 |
-
rhtml += ' <span class="step-action">';
|
199 |
-
rhtml += ' <a class="riskified-botton" style="margin-top:13px" href="http://www.riskified.com/?platform=magento#install-section" target="_blank">Create an account</a>';
|
200 |
-
rhtml += ' </span>';
|
201 |
-
rhtml += ' </span>';
|
202 |
-
rhtml += '</span>';
|
203 |
-
rhtml += '<span class="step-wrapper">';
|
204 |
-
rhtml += ' <div class="step-title" style="font-family:Helvetica Neue; font-size: 25px; line-height: 30px; color: #393536; display:inline-block">';
|
205 |
-
rhtml += ' 2. Activate you extension';
|
206 |
-
rhtml += ' </div>';
|
207 |
-
rhtml += ' <span class="step-inner" id="activation-pre">';
|
208 |
-
rhtml += ' <form id="activate-form">';
|
209 |
-
rhtml += ' <input tabindex="1" id="riskified-shop-domain" type="text" pattern="" placeholder="your-riskified.shop.domain">';
|
210 |
-
rhtml += ' <input tabindex="2" id="riskified-shop-password" type="password" pattern="" placeholder="your Riskified password">';
|
211 |
-
rhtml += ' </form>';
|
212 |
-
rhtml += ' <span class="text-notice" id="magento-notice">Shop url or password are incorrect</span>';
|
213 |
-
rhtml += ' <span class="step-action">';
|
214 |
-
rhtml += ' <a tabindex="3" class="riskified-botton" href="javascript:activate()">Activate your account</a>';
|
215 |
-
rhtml += ' </span>';
|
216 |
-
rhtml += ' </span>';
|
217 |
-
rhtml += ' <span class="step-inner" id="activation-done">';
|
218 |
-
rhtml += ' <span class="step-action">';
|
219 |
-
rhtml += ' <span class="done-message" style="display:block; margin-bottom:25; text-align:center; font-family:Helvetica Neue; font-size: 25px; line-height: 30px; color: #9bc47f;">Activation was successfull</span>';
|
220 |
-
rhtml += ' <span class="done-message" style="display:block; margin-bottom:25; text-align:center; font-family:Helvetica Neue; font-size: 25px; line-height: 30px; color: #828282;">Saving...</span>';
|
221 |
-
rhtml += ' </span>';
|
222 |
-
rhtml += ' </span>';
|
223 |
-
rhtml += '</span>';
|
224 |
-
|
225 |
-
rhtml += '</span>';
|
226 |
-
var keyRow = $$('#row_fullsection_full_key')
|
227 |
-
if (keyRow.size()== 0){
|
228 |
-
return;
|
229 |
-
}else{
|
230 |
-
keyRow = keyRow[0];
|
231 |
-
}
|
232 |
-
|
233 |
-
var authToken = '<?php echo Mage::helper('full')->getAuthToken()?>';
|
234 |
-
|
235 |
-
var section = $$("#fullsection_full")[0];
|
236 |
-
|
237 |
-
if (authToken.trim()) {
|
238 |
-
rhtml = '<span id="riskified-logo" style="margin-top: 12px; margin-bottom: 19px; display:block"> <img width="204px" height="53px" src="<?php echo $this->getSkinUrl('images/riskified/logo.jpg'); ?>"></span>';
|
239 |
-
rhtml += '<div id="riskified-header" style="font-family:Helvetica Neue; font-size: 19px; line-height: 23px; color: #393536;margin-bottom: 25px;">The extension is connected to your Riskified account</div>';
|
240 |
-
rhtml += '<a class="riskified-botton" style="margin-bottom:30px" href="//<?php echo Mage::helper('full/order')->getRiskifiedApp()?>" target="_blank">Go to Riskified App</a>';
|
241 |
-
}else{
|
242 |
-
$$(".entry-edit-head.collapseable")[0].style.display = "none";
|
243 |
-
}
|
244 |
-
htmlBody = rhtml;
|
245 |
-
|
246 |
-
section.up().insert({top:htmlBody});
|
247 |
-
$$(".save").forEach(function(saveButton){saveButton.observe('click',riskifiedOnSave)})
|
248 |
-
});
|
249 |
-
|
250 |
-
//]]>
|
251 |
</script>
|
252 |
|
19 |
*/
|
20 |
?>
|
21 |
|
22 |
+
<?php
|
23 |
+
$all_active_methods = Mage::getModel('payment/config')->getActiveMethods();
|
24 |
+
$allkeys ='';
|
25 |
+
foreach ($all_active_methods as $key => $value)
|
26 |
+
{
|
27 |
+
$paymentTitle = Mage::getStoreConfig('payment/'.$key.'/title');
|
28 |
+
$methods[$key] = $paymentTitle;
|
29 |
+
$allkeys .= $key.",";
|
30 |
+
}
|
31 |
?>
|
32 |
+
|
33 |
<style type="text/css">
|
34 |
.riskified-botton {
|
35 |
font-family: Helvetica Neue;
|
83 |
margin-bottom: 10px;
|
84 |
padding-left: 10px ;
|
85 |
}
|
86 |
+
|
87 |
.text-notice {
|
88 |
+
font-weight: 300;
|
89 |
+
font-size: 15px;
|
90 |
+
color: #d15a2f;
|
91 |
+
display: none;
|
92 |
+
margin-top: 0px;
|
93 |
+
margin-bottom: 0px;
|
94 |
+
line-height: 0px;
|
95 |
+
text-align: center;
|
96 |
}
|
97 |
+
|
98 |
#activation-done{
|
99 |
display: none;
|
100 |
}
|
102 |
</style>
|
103 |
|
104 |
<script type="text/javascript">
|
105 |
+
//<![CDATA[
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
function showRiskifiedNotice(noticeId){
|
108 |
+
$$(noticeId)[0].style.setProperty("display","block");
|
109 |
+
}
|
110 |
|
111 |
+
function hideRiskifiedNotice(noticeId){
|
112 |
+
$$(noticeId)[0].style.setProperty("display","none");
|
113 |
+
}
|
|
|
|
|
|
|
|
|
114 |
|
115 |
+
function activate(){
|
116 |
+
var riskifiedShopDomain = $$("#riskified-shop-domain")[0].value;
|
117 |
+
if (riskifiedShopDomain == ""){
|
118 |
+
showRiskifiedNotice("#magento-notice");
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
var riskifiedPassword = $$("#riskified-shop-password")[0].value;
|
122 |
|
123 |
+
if (riskifiedPassword == ""){
|
124 |
+
showRiskifiedNotice("#magento-notice");
|
125 |
+
return;
|
126 |
+
}
|
127 |
|
128 |
+
var generatedKey = "<?php echo sha1(microtime(true).mt_rand(10000,90000)); ?>";
|
|
|
|
|
|
|
129 |
|
130 |
+
$$("#fullsection_full_key")[0].value = generatedKey;
|
131 |
+
$$("#fullsection_full_domain")[0].value = riskifiedShopDomain;
|
132 |
+
riskifiedActivation(riskifiedPassword,riskifiedShopDomain,generatedKey)
|
|
|
|
|
|
|
133 |
}
|
|
|
|
|
134 |
|
135 |
+
function riskifiedOnSave(event){
|
136 |
+
try
|
137 |
+
{
|
138 |
+
var fullsectionIndex = document.location.href.indexOf('fullsection');
|
139 |
+
if (fullsectionIndex == -1){
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
var riskifiedShopDomain = '<?php echo Mage::helper("full")->getShopDomain()?>'
|
143 |
+
var generatedKey = '<?php echo Mage::helper('full')->getAuthToken()?>';
|
144 |
+
|
145 |
+
var version = "<?php echo Mage::helper('full')->getExtensionVersion() ?>";
|
146 |
+
var extensionConfigSaveEndpoint = ('https:' == document.location.protocol ? 'https://' : 'http://') + '<?php echo Mage::helper("full/order")->getRiskifiedDomain()?>/magento/config';
|
147 |
+
var admin_url = '<?php echo Mage::helper("full")->getAdminUrl()?>';
|
148 |
+
|
149 |
+
new Ajax.Request(extensionConfigSaveEndpoint, {
|
150 |
+
method: 'POST',
|
151 |
+
parameters: "shop_url="+riskifiedShopDomain+"&auth_token="+generatedKey+"&admin_url="+admin_url+"&version"+version
|
152 |
+
});
|
153 |
+
}catch(err){
|
154 |
+
console.log("error reporting new config params");
|
155 |
+
}
|
156 |
+
return true;
|
157 |
+
}
|
158 |
|
159 |
+
function riskifiedActivation(riskifiedPassword,riskifiedShopDomain,generatedKey){
|
160 |
+
var keys = "<?php echo $allkeys ?>";
|
161 |
+
var extensionVersion = '<?php echo Mage::helper('full')->getExtensionVersion()?>'
|
162 |
+
var activateURL = 'http://' + '<?php echo Mage::helper("full/order")->getRiskifiedDomain()?>/magento/activate';
|
163 |
+
var shopHostUrl = "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)?>";
|
164 |
+
|
165 |
+
new Ajax.Request(activateURL, {
|
166 |
+
method: 'POST',
|
167 |
+
parameters: "shop_url="+riskifiedShopDomain+"&password="+riskifiedPassword+"&auth_token="+generatedKey+"&gws="+keys+"&host_url="+shopHostUrl+"&extension_version="+extensionVersion,
|
168 |
+
onSuccess:
|
169 |
+
function(response) {
|
170 |
+
hideRiskifiedNotice("#magento-notice");
|
171 |
+
configForm.submit();
|
172 |
+
$$("#activation-done")[0].style.setProperty("display","block");
|
173 |
+
$$("#activation-pre")[0].style.setProperty("display","none");
|
174 |
+
$$("#activate_button")[0].disabled = true;
|
175 |
+
},
|
176 |
+
onFailure:
|
177 |
+
function(response) {
|
178 |
+
showRiskifiedNotice("#magento-notice");
|
179 |
+
}
|
180 |
+
});
|
181 |
+
}
|
182 |
+
document.observe("dom:loaded", function() {
|
183 |
+
var rhtml = '';
|
184 |
+
rhtml += '<span id="riskified-logo" style="margin-top: 12px; margin-bottom: 19px; display:block">';
|
185 |
+
rhtml += ' <img width="204px" height="53px" src="<?php echo $this->getSkinUrl('images/riskified/logo.jpg'); ?>"/>';
|
186 |
+
rhtml += '</span>';
|
187 |
+
rhtml += '<div id="riskified-header" style="font-family:Helvetica Neue; font-size: 19px; line-height: 23px; color: #393536;">';
|
188 |
+
rhtml += 'The Riskified extension has been installed.<br>To activate the extension please connect it to your Riskified account';
|
189 |
+
rhtml += '</div>';
|
190 |
+
|
191 |
+
var keyRow = $$('#row_fullsection_full_key')
|
192 |
+
if (keyRow.size()== 0){
|
193 |
+
return;
|
194 |
+
}else{
|
195 |
+
keyRow = keyRow[0];
|
196 |
+
}
|
197 |
+
|
198 |
+
var authToken = '<?php echo Mage::helper('full')->getAuthToken()?>';
|
199 |
+
var shopDomain= '<?php echo Mage::helper('full')->getShopDomain()?>';
|
200 |
+
|
201 |
+
var section = $$("#fullsection_full")[0];
|
202 |
+
|
203 |
+
if (authToken.trim() || shopDomain.trim()) {
|
204 |
+
rhtml = '<span id="riskified-logo" style="margin-top: 12px; margin-bottom: 19px; display:block"> <img width="204px" height="53px" src="<?php echo $this->getSkinUrl('images/riskified/logo.jpg'); ?>"></span>';
|
205 |
+
rhtml += '<div id="riskified-header" style="font-family:Helvetica Neue; font-size: 19px; line-height: 23px; color: #393536;margin-bottom: 25px;">The extension is connected to your Riskified account</div>';
|
206 |
+
rhtml += '<a class="riskified-botton" style="margin-bottom:30px" href="//<?php echo Mage::helper('full/order')->getRiskifiedApp()?>" target="_blank">Go to Riskified App</a>';
|
207 |
+
}else{
|
208 |
+
rhtml += '<span class="step-wrapper">';
|
209 |
+
rhtml += ' <div class="step-title" style="font-family:Helvetica Neue; font-size: 25px; line-height: 30px; color: #393536; display:inline-block">';
|
210 |
+
rhtml += ' Create Your Account';
|
211 |
+
rhtml += ' <span style="margin-left: 20px;font-family:Helvetica Neue; font-size: 14px; line-height: 17px; color: #828282; padding: 5px; display:block">';
|
212 |
+
rhtml += ' Already have an account? Fill the Shop Domain and Auth Token fields. ';
|
213 |
+
rhtml += ' </span>';
|
214 |
+
rhtml += ' </div>';
|
215 |
+
rhtml += ' <span class="step-inner">';
|
216 |
+
rhtml += ' <span class="step-action">';
|
217 |
+
rhtml += ' <a class="riskified-botton" style="margin-top:13px" href="http://www.riskified.com/?platform=magento#install-section" target="_blank">Create an account</a>';
|
218 |
+
rhtml += ' </span>';
|
219 |
+
rhtml += ' </span>';
|
220 |
+
rhtml += '</span>';
|
221 |
+
$$(".entry-edit-head.collapseable")[0].style.display = "none";
|
222 |
+
}
|
223 |
+
htmlBody = rhtml;
|
224 |
+
|
225 |
+
section.up().insert({top:htmlBody});
|
226 |
+
$$(".save").forEach(function(saveButton){saveButton.observe('click',riskifiedOnSave)})
|
227 |
});
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
+
//]]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
</script>
|
231 |
|
lib/riskified_php_sdk/sample/update_merchant_settings.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: droritbaron
|
5 |
+
* Date: 3/29/15
|
6 |
+
* Time: 5:03 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
// A simple example of submitting an order.
|
10 |
+
// Usage: php order_simple_submit.php
|
11 |
+
|
12 |
+
include __DIR__.'/../src/Riskified/autoloader.php';
|
13 |
+
use Riskified\Common\Riskified;
|
14 |
+
use Riskified\Common\Env;
|
15 |
+
use Riskified\Common\Validations;
|
16 |
+
use Riskified\Common\Signature;
|
17 |
+
use Riskified\OrderWebhook\Model;
|
18 |
+
use Riskified\OrderWebhook\Transport;
|
19 |
+
|
20 |
+
# Replace with the 'shop domain' of your account in Riskified
|
21 |
+
$domain = "test.com";
|
22 |
+
|
23 |
+
# Replace with the 'auth token' listed in the Riskified web app under the 'Settings' Tab
|
24 |
+
$authToken = "1388add8a99252fc1a4974de471e73cd";
|
25 |
+
|
26 |
+
Riskified::init($domain, $authToken, Env::DEV, Validations::IGNORE_MISSING);
|
27 |
+
|
28 |
+
# Order
|
29 |
+
$settings = new Model\MerchantSettings(array(
|
30 |
+
'settings' => array('version'=>'1234','gws' => 'Adyen,CC')
|
31 |
+
));
|
32 |
+
|
33 |
+
echo "\n MERCHANT SETTINGS:".PHP_EOL.json_encode(json_decode($settings->toJson())).PHP_EOL;
|
34 |
+
|
35 |
+
|
36 |
+
# Create a curl transport to the Riskified Server
|
37 |
+
$transport = new Transport\CurlTransport(new Signature\HttpDataSignature());
|
38 |
+
$transport->timeout = 10;
|
39 |
+
|
40 |
+
|
41 |
+
try {
|
42 |
+
$response = $transport->updateMerchantSettings($settings);
|
43 |
+
echo PHP_EOL."Update Merchant Settings succeeded. Response: ".PHP_EOL.json_encode($response).PHP_EOL;
|
44 |
+
} catch(\Riskified\OrderWebhook\Exception\UnsuccessfulActionException $uae) {
|
45 |
+
echo PHP_EOL."Update Merchant Settings not succeeded. Status code was: ".$uae->statusCode." and json body was: "
|
46 |
+
.json_encode($uae->jsonResponse).PHP_EOL;
|
47 |
+
} catch(Exception $e) {
|
48 |
+
echo PHP_EOL."Update Merchant Settings not succeeded. Exception: ".$e->getMessage().PHP_EOL;
|
49 |
+
}
|
lib/riskified_php_sdk/src/Riskified/Common/Riskified.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
* @package Riskified\Common
|
21 |
*/
|
22 |
class Riskified {
|
23 |
-
const VERSION = '1.1
|
24 |
const API_VERSION = '2';
|
25 |
|
26 |
/**
|
20 |
* @package Riskified\Common
|
21 |
*/
|
22 |
class Riskified {
|
23 |
+
const VERSION = '1.5.1';
|
24 |
const API_VERSION = '2';
|
25 |
|
26 |
/**
|
lib/riskified_php_sdk/src/Riskified/OrderWebhook/Model/Decision.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php namespace Riskified\OrderWebhook\Model;
|
2 |
+
/**
|
3 |
+
* Copyright 2013-2015 Riskified.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
6 |
+
* You may not use this file except in compliance with the License.
|
7 |
+
* A copy of the License is located at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0.html
|
10 |
+
*
|
11 |
+
* or in the "license" file accompanying this file. This file is distributed
|
12 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13 |
+
* express or implied. See the License for the specific language governing
|
14 |
+
* permissions and limitations under the License.
|
15 |
+
*/
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Class Decision
|
19 |
+
* data model of an exisiting order's refund details
|
20 |
+
* @package Riskified\OrderWebhook\Model
|
21 |
+
*/
|
22 |
+
class Decision extends AbstractModel {
|
23 |
+
|
24 |
+
protected $_fields = array(
|
25 |
+
'id' => 'string',
|
26 |
+
'decision' => 'object \DecisionDetails'
|
27 |
+
);
|
28 |
+
}
|
lib/riskified_php_sdk/src/Riskified/OrderWebhook/Model/DecisionDetails.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php namespace Riskified\OrderWebhook\Model;
|
2 |
+
/**
|
3 |
+
* Copyright 2013-2015 Riskified.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
6 |
+
* You may not use this file except in compliance with the License.
|
7 |
+
* A copy of the License is located at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0.html
|
10 |
+
*
|
11 |
+
* or in the "license" file accompanying this file. This file is distributed
|
12 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13 |
+
* express or implied. See the License for the specific language governing
|
14 |
+
* permissions and limitations under the License.
|
15 |
+
*/
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Class DecisionDetails
|
19 |
+
* data model of shipping line costs
|
20 |
+
* @package Riskified\OrderWebhook\Model
|
21 |
+
*/
|
22 |
+
class DecisionDetails extends AbstractModel {
|
23 |
+
|
24 |
+
protected $_fields = array(
|
25 |
+
'external_status' => 'string',
|
26 |
+
'decided_at' => 'date optional',
|
27 |
+
'reason' => 'string optional',
|
28 |
+
'amount' => 'double optional',
|
29 |
+
'currency' => 'string /^[A-Z]{3}$/i optional',
|
30 |
+
'notes' => 'string optional'
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
lib/riskified_php_sdk/src/Riskified/OrderWebhook/Model/MerchantSettings.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php namespace Riskified\OrderWebhook\Model;
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: droritbaron
|
5 |
+
* Date: 3/29/15
|
6 |
+
* Time: 5:29 PM
|
7 |
+
*/
|
8 |
+
class MerchantSettings extends AbstractModel {
|
9 |
+
|
10 |
+
protected $_fields = array(
|
11 |
+
'settings' => 'array string'
|
12 |
+
);
|
13 |
+
}
|
lib/riskified_php_sdk/src/Riskified/OrderWebhook/Model/Order.php
CHANGED
@@ -81,6 +81,8 @@ class Order extends AbstractModel {
|
|
81 |
'tax_lines' => 'array object \TaxLine optional',
|
82 |
|
83 |
'authorization_error' => 'object \AuthorizationError optional',
|
84 |
-
'nocharge_amount' => 'object \RefundDetails optional'
|
|
|
|
|
85 |
);
|
86 |
}
|
81 |
'tax_lines' => 'array object \TaxLine optional',
|
82 |
|
83 |
'authorization_error' => 'object \AuthorizationError optional',
|
84 |
+
'nocharge_amount' => 'object \RefundDetails optional',
|
85 |
+
|
86 |
+
'decision' => 'object \DecisionDetails optional'
|
87 |
);
|
88 |
}
|
lib/riskified_php_sdk/src/Riskified/OrderWebhook/Transport/AbstractTransport.php
CHANGED
@@ -54,6 +54,16 @@ abstract class AbstractTransport {
|
|
54 |
$this->use_https = Riskified::$env != Env::DEV;
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
/**
|
58 |
* Submit an Order to Riskified for review
|
59 |
* @param $order object Order to submit
|
@@ -114,6 +124,17 @@ abstract class AbstractTransport {
|
|
114 |
return $this->send_order($fulfillment, 'fulfill', true);
|
115 |
}
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
/**
|
118 |
* Send a Checkout to Riskified
|
119 |
* @param $checkout object Checkout to send
|
@@ -140,7 +161,6 @@ abstract class AbstractTransport {
|
|
140 |
return $this->send_json_request($json, 'historical');
|
141 |
}
|
142 |
|
143 |
-
|
144 |
protected function send_order($order, $endpoint, $enforce_required_keys) {
|
145 |
if ($this->validate($order, $enforce_required_keys)) {
|
146 |
$json = '{"order":' . $order->toJson() . '}';
|
@@ -149,6 +169,12 @@ abstract class AbstractTransport {
|
|
149 |
return null;
|
150 |
}
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
protected function send_checkout($checkout, $endpoint) {
|
153 |
if ($this->validate($checkout, false)) {
|
154 |
$json = '{"checkout":' . $checkout->toJson() . '}';
|
54 |
$this->use_https = Riskified::$env != Env::DEV;
|
55 |
}
|
56 |
|
57 |
+
/**
|
58 |
+
* Update a merchant's settings
|
59 |
+
* @param hash object named 'settings' with a key-value structure
|
60 |
+
* @return object Response object
|
61 |
+
* @throws \Riskified\Common\Exception\BaseException on any issue
|
62 |
+
*/
|
63 |
+
public function updateMerchantSettings($settings) {
|
64 |
+
return $this->send_settings($settings);
|
65 |
+
}
|
66 |
+
|
67 |
/**
|
68 |
* Submit an Order to Riskified for review
|
69 |
* @param $order object Order to submit
|
124 |
return $this->send_order($fulfillment, 'fulfill', true);
|
125 |
}
|
126 |
|
127 |
+
/**
|
128 |
+
* Send order decision status
|
129 |
+
* @param $decision object Decision on the order. reports riskified about what was your decision on the order.
|
130 |
+
* @return object Response object
|
131 |
+
* @throws \Riskified\Common\Exception\BaseException on any issue
|
132 |
+
*/
|
133 |
+
public function decisionOrder($decision) {
|
134 |
+
return $this->send_order($decision, 'decision', true);
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
/**
|
139 |
* Send a Checkout to Riskified
|
140 |
* @param $checkout object Checkout to send
|
161 |
return $this->send_json_request($json, 'historical');
|
162 |
}
|
163 |
|
|
|
164 |
protected function send_order($order, $endpoint, $enforce_required_keys) {
|
165 |
if ($this->validate($order, $enforce_required_keys)) {
|
166 |
$json = '{"order":' . $order->toJson() . '}';
|
169 |
return null;
|
170 |
}
|
171 |
|
172 |
+
protected function send_settings($settings) {
|
173 |
+
$json = $settings->toJson();
|
174 |
+
return $this->send_json_request($json, 'settings');
|
175 |
+
return null;
|
176 |
+
}
|
177 |
+
|
178 |
protected function send_checkout($checkout, $endpoint) {
|
179 |
if ($this->validate($checkout, false)) {
|
180 |
$json = '{"checkout":' . $checkout->toJson() . '}';
|
lib/riskified_scripts/riskified_historical_upload.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// if this is not run from the Magento root, use chdir() to move execution back.
|
3 |
+
//chdir('../magento/');
|
4 |
+
|
5 |
+
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
|
6 |
+
require 'app/Mage.php';
|
7 |
+
|
8 |
+
umask (0);
|
9 |
+
Mage::app(); // can set the run code/type, just like in the Mage::run() call
|
10 |
+
|
11 |
+
$helper = Mage::helper('full');
|
12 |
+
$authToken = $helper->getAuthToken();
|
13 |
+
$env = constant($helper->getConfigEnv());
|
14 |
+
$domain = $helper->getShopDomain();
|
15 |
+
|
16 |
+
echo "Riskified auth token: $authToken \n";
|
17 |
+
echo "Riskified shop domain: $domain \n";
|
18 |
+
echo "Riskified target environment: $env \n";
|
19 |
+
echo "*********** \n";
|
20 |
+
include __DIR__ . 'lib/riskified_php_sdk/src/Riskified/autoloader.php';
|
21 |
+
use Riskified\Common\Riskified;
|
22 |
+
use Riskified\Common\Env;
|
23 |
+
use Riskified\Common\Validations;
|
24 |
+
use Riskified\Common\Signature;
|
25 |
+
use Riskified\OrderWebhook\Model;
|
26 |
+
use Riskified\OrderWebhook\Transport;
|
27 |
+
|
28 |
+
Riskified::init($domain, $authToken, $env, Validations::SKIP);
|
29 |
+
// add your own code below:
|
30 |
+
$batch_size = 10;
|
31 |
+
$options = getopt("p::");
|
32 |
+
$page = intval($options["p"]);
|
33 |
+
if (!$page) {
|
34 |
+
$page = 1;
|
35 |
+
}
|
36 |
+
$orders = Mage::getModel('sales/order')->getCollection();
|
37 |
+
|
38 |
+
$total_count = $orders->getSize();
|
39 |
+
|
40 |
+
echo "starting to upload orders, total_count: $total_count \n";
|
41 |
+
|
42 |
+
$orders_collection = Mage::getModel('sales/order')
|
43 |
+
->getCollection()
|
44 |
+
->setPageSize($batch_size)
|
45 |
+
->setCurPage($page);
|
46 |
+
|
47 |
+
$total_uploaded = 0;
|
48 |
+
|
49 |
+
while ($total_uploaded < $total_count) {
|
50 |
+
$last_id = $orders_collection->getLastItem()->getEntityId();
|
51 |
+
|
52 |
+
try {
|
53 |
+
Mage::helper('full/order')->postHistoricalOrders($orders_collection);
|
54 |
+
$total_uploaded += $orders_collection->count();
|
55 |
+
echo "last id: $last_id, page:$page, total_uploaded: $total_uploaded \n";
|
56 |
+
$page++;
|
57 |
+
$orders_collection = Mage::getModel('sales/order')
|
58 |
+
->getCollection()
|
59 |
+
->setPageSize($batch_size)
|
60 |
+
->setCurPage($page);
|
61 |
+
} catch (Exception $e) {
|
62 |
+
echo "Error: ".$e->getMessage();
|
63 |
+
exit(1);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
echo "*********** \n";
|
67 |
+
echo "wOOt, Finished successfully!!!! total_uploaded: $total_uploaded\n";
|
68 |
+
echo "Please let us know and we will process the order within 24 hours, Thanks!!\n";
|
69 |
+
?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>riskified_magento</name>
|
4 |
-
<version>1.0.6.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -9,11 +9,11 @@
|
|
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>2015-04-
|
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.6.7</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>* Updated activation process. </notes>
|
13 |
<authors><author><name>Riskified_Mage</name><user>Riskified_Mage</user><email>support@riskified.com</email></author></authors>
|
14 |
+
<date>2015-04-07</date>
|
15 |
+
<time>13:22:19</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Riskified"><dir name="Full"><dir><dir name="Helper"><file name="Data.php" hash="6b312d0bb7f613b22d41dda5f361e709"/><file name="Debug.php" hash="18335d988a142ee639ea59dbecafa15c"/><file name="Log.php" hash="14125243576ab5b08f40066d24b7241d"/><dir name="Order"><file name="Invoice.php" hash="fd6fcbdedd44551785eddd0e1a482e80"/><file name="Status.php" hash="478a2b111b02a5ba3a7df6cf1fa8c8cc"/></dir><file name="Order.php" hash="afd0a52eb3cb15f2c6776a059cf9c991"/></dir><dir name="Model"><file name="Authorizenet.php" hash="bd42f62d06a036b9da7709d2e40fc8f1"/><file name="Cron.php" hash="187b86ebe9238ff132ed0337f05a8ae9"/><file name="Observer.php" hash="96b1ca6ac81bba8f401b85e0ef4ee1f6"/><dir name="Resource"><dir name="Retry"><file name="Collection.php" hash="fd62ad4e4cdd8d372751bfa9988cc3a9"/></dir><file name="Retry.php" hash="3be3db7e54bd8bb45e0faffa1941f515"/></dir><file name="Retry.php" hash="89e7344139affa4fe0b9a252a5d1c592"/><dir name="System"><dir name="Config"><dir name="Source"><file name="ApprovedState.php" hash="5c620d1039347218354bd58c2238ecb4"/><file name="CanceledStateStatuses.php" hash="f7c38690820a5354ca8879931a3b08c2"/><file name="CaptureCase.php" hash="daafa6f53c65fa6e6e7ffbb067dbbbba"/><file name="DeclinedState.php" hash="a00907072c06ade079483e3db03bb94f"/><file name="Env.php" hash="4d923355b3e56fac95c2a9b3c353ab76"/><file name="HoldedStateStatuses.php" hash="c081ae14278e82ba8805c8231bbe1068"/><file name="ProcessingStateStatuses.php" hash="74760571fb4273d4b9fbb3d42205ca8d"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="General.php" hash="a5d4950c5655960879e7d75c06977941"/></dir><dir name="Helper"><dir name="General"><dir name="fixtures"><file name="extensionConfigEnabled.yaml" hash="eec8c8d8a1d5de49897b19740cf8e074"/></dir></dir><file name="General.php" hash="607c9711656be48084f6688e114b6bf6"/></dir><dir name="Model"><file name="Environments.php" hash="f3fc028d17c82b9b84b709b932e64eae"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FullController.php" hash="f80e78a808e99f11a7bc00bd02be3f2e"/></dir><file name="ResponseController.php" hash="550c29c6c6706067bac3531b8f3eb37f"/></dir><dir name="etc"><file name="config.xml" hash="2b89bf277cce18e2992d5df5a0dccd56"/><file name="system.xml" hash="81109c3eca86d9d05843e55105a2d257"/></dir><dir name="sql"><dir name="riskified_full_setup"><file name="mysql4-install-1.0.1.php" hash="6d29dde79353e8bfefa6ea7bc2ef562a"/><file name="mysql4-upgrade-1.0.2.0-1.0.2.1.php" hash="822e85326678a320f141a3ae948e4a24"/><file name="mysql4-upgrade-1.0.4-1.0.5.0.php" hash="557115e1a978d9b194b2cd1cfb8b5a95"/><file name="mysql4-upgrade-1.0.5.5-1.0.6.0.php" hash="0318846fbe8f3e56d8f7d3fdc750e102"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Riskified_Full.xml" hash="d684caecdf710e5d0173ca07e5c5d1c0"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="full.xml" hash="8dbb3dd16fcb5821eb07e9b5d978d55c"/></dir><dir name="template"><dir name="full"><file name="jsinit.phtml" hash="3a8ed0ede76116764a702f42ed09716b"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="full.xml" hash="9497753e5c3d2860062c5446c058b4bc"/></dir><dir name="template"><dir name="full"><file name="riskified.phtml" hash="fe4a577c6ef98316d906c36c17f11406"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="riskified"><file name="logo.jpg" hash="0ac96bf07aa8b8ecb3ff06c2ccbf0827"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="riskified_php_sdk"><file name="README.md" hash="f37118baa641e4ef6d670bb1c0298482"/><dir><dir name="sample"><file name="callback.php" hash="c6fb5a90b2c527b794fcec803acb36d9"/><file name="order_full_flow.php" hash="71d931fff3aa98402c9a7d3b271a6ae4"/><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="06a7ee9ef9a846fa5977ac57f34382f8"/><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="c2aa3d4e7ac69daf79422e16b868b3d8"/><file name="Attribute.php" hash="e7fa146d7c9c807494c225e6a41afcfb"/><file name="AuthorizationError.php" hash="b82229eff42d94ceba58d4d6a3a4118b"/><file name="Checkout.php" hash="ede0e6d2fd8319ada669de35b4c3190f"/><file name="ClientDetails.php" hash="50b329fa6b77bcbeff4b725705b957af"/><file name="Customer.php" hash="02801c70557fbfa6aea7ac6058f6f4b4"/><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="3a03c75348060aa9ca930174b9d5dc56"/><file name="MerchantSettings.php" hash="62f42b50b7a25b014cbed4ea528998aa"/><file name="Order.php" hash="40af1582ecc5864b73f5d50b5a2cb12b"/><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="8a9296a4277a645bb86f5956b7437081"/><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>
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>4.4.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|