From b3649d35455c7fc224112a8398c81017cf67c70b Mon Sep 17 00:00:00 2001 From: Wouter Jonker Date: Tue, 9 Jul 2019 14:07:05 +0200 Subject: [PATCH] Using ip from order object (#3) * Using ip from order object --- app/addons/paynl_addon/func.php | 2 ++ .../paynl_addon/paynl/classes/Pay/Api/Start.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/addons/paynl_addon/func.php b/app/addons/paynl_addon/func.php index e9dedff..f926ffb 100644 --- a/app/addons/paynl_addon/func.php +++ b/app/addons/paynl_addon/func.php @@ -102,6 +102,8 @@ function fn_paynl_startTransaction($order_id, $order_info, $processor_data, $exc ); $payNL->setExtra1($order_id); + $payNL->setIpAddress($order_info['ip_address']); + foreach ($order_info['products'] as $key => $product) { $prices = paynl_getTaxForItem($order_info, $key); diff --git a/app/addons/paynl_addon/paynl/classes/Pay/Api/Start.php b/app/addons/paynl_addon/paynl/classes/Pay/Api/Start.php index 4f5578b..1c2c40c 100644 --- a/app/addons/paynl_addon/paynl/classes/Pay/Api/Start.php +++ b/app/addons/paynl_addon/paynl/classes/Pay/Api/Start.php @@ -12,7 +12,8 @@ class Pay_Api_Start extends Pay_Api { private $_paymentOptionId; private $_paymentOptionSubId; private $_finishUrl; - + private $_ipAddress; + private $_exchangeUrl; private $_description; private $_enduser; @@ -170,7 +171,10 @@ public function setExchangeUrl($exchangeUrl) { $this->_exchangeUrl = $exchangeUrl; } - + public function setIpAddress($ip) + { + $this->_ipAddress = $ip; + } public function setExtra1($extra1) { $this->_extra1 = $extra1; @@ -200,7 +204,8 @@ public function setDescription($description) { * @return array * @throws Pay_Exception */ - protected function _getPostData() { + protected function _getPostData() + { $data = parent::_getPostData(); if ($this->_apiToken == '') { @@ -242,7 +247,7 @@ protected function _getPostData() { } - $data['ipAddress'] = $_SERVER['REMOTE_ADDR']; + $data['ipAddress'] = empty($this->_ipAddress) ? $_SERVER['REMOTE_ADDR'] : $this->_ipAddress; // I set the browser data with dummydata, because most servers dont have the get_browser function available $data['browserData'] = array(