Skip to content

Commit

Permalink
Added new parameters in API endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
fraudlabspro committed Oct 7, 2022
1 parent 6553a47 commit 0dc06a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>fraudlabspro</name>
<displayName><![CDATA[FraudLabs Pro Fraud Prevention]]></displayName>
<version><![CDATA[1.15.2]]></version>
<version><![CDATA[1.16.0]]></version>
<description><![CDATA[FraudLabs Pro screens transaction for online frauds to protect your store from fraud attempts.]]></description>
<author><![CDATA[FraudLabs Pro]]></author>
<tab><![CDATA[payment_security]]></tab>
Expand Down
11 changes: 10 additions & 1 deletion fraudlabspro.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct()
{
$this->name = 'fraudlabspro';
$this->tab = 'payment_security';
$this->version = '1.15.1';
$this->version = '1.16.0';
$this->author = 'FraudLabs Pro';
$this->controllers = ['payment', 'validation'];
$this->module_key = 'cdb22a61c7ec8d1f900f6c162ad96caa';
Expand Down Expand Up @@ -165,10 +165,17 @@ public function hookNewOrder($params)

$product_list = $params['order']->getProductsDetail();

file_put_contents('product.txt', print_r($product_list, true));
file_put_contents('order.txt', print_r($params, true));

$quantity = 0;

$items = [];

foreach ($product_list as $p) {
$quantity += $p['product_quantity'];

$items[] = $p['reference'] . ':' . $p['product_quantity'] . ':' . (($p['is_virtual'] == '1') ? 'virtual' : (($p['download_hash']) ? 'downloadable' : 'physical'));
}

$ip = Db::getInstance()->getValue('SELECT `ip` FROM `' . _DB_PREFIX_ . 'flp_order_ip` WHERE `id_cart` = "' . ((int) $params['cart']->id) . '"');
Expand Down Expand Up @@ -203,6 +210,8 @@ public function hookNewOrder($params)
'quantity' => $quantity,
'currency' => $default_currency->iso_code,
'user_order_id' => $params['order']->id,
'payment_gateway' => $params['order']->payment,
'items' => implode(',', $items),
'flp_checksum' => Context::getContext()->cookie->flp_checksum,
'format' => 'json',
'source' => 'prestashop',
Expand Down

0 comments on commit 0dc06a7

Please sign in to comment.