We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) 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