Skip to content

Commit

Permalink
Using ip from order object (#3)
Browse files Browse the repository at this point in the history
* Using ip from order object
  • Loading branch information
Wouter Jonker authored and IvoWams committed Jul 9, 2019
1 parent 9ceb34f commit b3649d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/addons/paynl_addon/func.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
13 changes: 9 additions & 4 deletions app/addons/paynl_addon/paynl/classes/Pay/Api/Start.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 == '') {
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit b3649d3

Please sign in to comment.