We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit c1f27550 authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Shopper ip address fall back for getRemoteIp() (#550)

* Order->getRemoteIp() can return null, in this case fall back for
Order->getXForwardedFor()
parent ec71d70e
......@@ -39,7 +39,8 @@ class CustomerIpDataBuilder implements BuilderInterface
*
* @param \Adyen\Payment\Helper\Requests $adyenRequestsHelper
*/
public function __construct(\Adyen\Payment\Helper\Requests $adyenRequestsHelper)
public function __construct(
\Adyen\Payment\Helper\Requests $adyenRequestsHelper)
{
$this->adyenRequestsHelper = $adyenRequestsHelper;
}
......@@ -52,7 +53,12 @@ class CustomerIpDataBuilder implements BuilderInterface
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$shopperIp = $paymentDataObject->getPayment()->getOrder()->getXForwardedFor();
$order = $paymentDataObject->getPayment()->getOrder();
$shopperIp = $order-> getRemoteIp();
if (empty($shopperIp)) {
$shopperIp = $order-> getXForwardedFor();
}
return $this->adyenRequestsHelper->buildCustomerIpData([], $shopperIp);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment