Skip to content

Commit

Permalink
Fixed undefined array key warning
Browse files Browse the repository at this point in the history
  • Loading branch information
fraudlabspro committed Nov 19, 2024
1 parent 54ac6d8 commit 8bb81d1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
28 changes: 14 additions & 14 deletions Block/Adminhtml/Order/View/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ public function toHtml(){
$score = '<div style="color:#33CC00;font-size:3em;margin-top:20px;"><strong>'.$data['fraudlabspro_score'].'</strong></div>';
}

$countryCode = ($data['ip_geolocation']['country_code']) ?? $data['ip_country'];
$region = ($data['ip_geolocation']['region']) ?? $data['ip_region'];
$city = ($data['ip_geolocation']['city']) ?? $data['ip_city'];
$countryCode = (($data['ip_geolocation']['country_code']) ?? ($data['ip_country'] ?? ''));
$region = (($data['ip_geolocation']['region']) ?? ($data['ip_region'] ?? ''));
$city = (($data['ip_geolocation']['city']) ?? ($data['ip_city'] ?? ''));
$countryName = $this->_objectManager->create('Magento\Directory\Model\Country')->load($countryCode)->getName();
$location = array($countryName, $region, $city);
$location = array_unique($location);
Expand All @@ -215,18 +215,18 @@ public function toHtml(){
$status = '-';
}

$usageType = ($data['ip_geolocation']['usage_type']) ?? $data['ip_usage_type'];
$usageType = (($data['ip_geolocation']['usage_type']) ?? ($data['ip_usage_type'] ?? ''));
$usageType = is_array($usageType) ? implode(', ', $usageType) : $usageType;
$timezone = ($data['ip_geolocation']['timezone']) ?? $data['ip_timezone'];
$distanceKm = ($data['billing_address']['ip_distance_in_km']) ?? $data['distance_in_km'];
$distanceMile = ($data['billing_address']['ip_distance_in_mile']) ?? $data['distance_in_mile'];
$lat = ($data['ip_geolocation']['latitude']) ?? $data['ip_latitude'];
$lon = ($data['ip_geolocation']['longitude']) ?? $data['ip_longitude'];
$shipForward = ($data['shipping_address']['is_address_ship_forward']) ?? $data['is_address_ship_forward'];
$freeEmail = ($data['email_address']['is_free']) ?? $data['is_free_email'];
$proxyIP = ($data['ip_geolocation']['is_proxy']) ?? $data['is_proxy_ip_address'];
$blacklistIP = ($data['ip_geolocation']['is_in_blacklist']) ?? $data['is_ip_blacklist'];
$blacklistEmail = ($data['email_address']['is_in_blacklist']) ?? $data['is_email_blacklist'];
$timezone = (($data['ip_geolocation']['timezone']) ?? ($data['ip_timezone'] ?? ''));
$distanceKm = (($data['billing_address']['ip_distance_in_km']) ?? ($data['distance_in_km'] ?? ''));
$distanceMile = (($data['billing_address']['ip_distance_in_mile']) ?? ($data['distance_in_mile'] ?? ''));
$lat = (($data['ip_geolocation']['latitude']) ?? ($data['ip_latitude'] ?? ''));
$lon = (($data['ip_geolocation']['longitude']) ?? ($data['ip_longitude'] ?? ''));
$shipForward = (($data['shipping_address']['is_address_ship_forward']) ?? ($data['is_address_ship_forward'] ?? ''));
$freeEmail = (($data['email_address']['is_free']) ?? ($data['is_free_email'] ?? ''));
$proxyIP = (($data['ip_geolocation']['is_proxy']) ?? ($data['is_proxy_ip_address'] ?? ''));
$blacklistIP = (($data['ip_geolocation']['is_in_blacklist']) ?? ($data['is_ip_blacklist'] ?? ''));
$blacklistEmail = (($data['email_address']['is_in_blacklist']) ?? ($data['is_email_blacklist'] ?? ''));
$flpRule = '-';
if (isset($data['fraudlabspro_rules'])) {
if (is_array($data['fraudlabspro_rules'])) {
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision History for FraudLabs Pro Magento2

2.6.1 2024-11-19
Fixed undefined array key warning.

2.6.0 2024-10-03
Supported Adobe Commerce (cloud).

Expand Down
2 changes: 1 addition & 1 deletion Controller/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function processSendRequestToFraudLabsPro($order) {
'device_fingerprint' => (isset($_COOKIE['flp_device'])) ? $_COOKIE['flp_device'] : '',
'flp_checksum' => (isset($_COOKIE['flp_checksum'])) ? $_COOKIE['flp_checksum'] : '',
'source' => 'magento',
'source_version' => '2.6.0',
'source_version' => '2.6.1',
'items' => $item_sku,
'coupon_code' => $order->getCouponCode() ? $order->getCouponCode() : '',
'coupon_amount' => $order->getCouponCode() ? -($order->getDiscountAmount()) : '',
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hexasoft/module-fraudlabspro",
"description": "FraudLabs Pro Fraud Prevention plugin that screen the order transaction for online frauds. Fraud Prevention extension for Magento 2.",
"version": "2.6.0",
"version": "2.6.1",
"type": "magento2-module",
"require": {
"php": ">=5.5"
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Hexasoft_FraudLabsPro" setup_version="2.6.0">
<module name="Hexasoft_FraudLabsPro" setup_version="2.6.1">
<sequence>
<module name="Magento_Sales"/>
</sequence>
Expand Down

0 comments on commit 8bb81d1

Please sign in to comment.