There is an official bug in Magento 2.2.3 of Paypal Payflow Pro, It is sending comment_1 parameter to Paypal instead of comment1, And Paypal is ignoring this parameter
Magento Team acknowledge this issue: (https://github.com/magento/magento2/issues/15163 )
Now to fix it, I am trying to override \Magento\Paypal\Model\Payflowpro model file
But it's not working, I compiled, upgraded, flush, removed all cached from var/generated folder
But It's not working. Do you have any clue why it's not working?
This is my code
module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MyNameSpace_Paypal" setup_version="1.0.1">
<sequence>
<module name="Magento_Paypal" />
</sequence>
</module>
</config>
Payflowpro.php
<?php
namespace MyNameSpace\Paypal\Model;
use Magento\Framework\DataObject;
use Magento\Sales\Model\Order;
class Payflowpro extends \Magento\Paypal\Model\Payflowpro
{
public function addRequestOrderInfo(DataObject $request, Order $order)
{
$id = $order->getId();
//for auth request order id is not exists yet
if (!empty($id)) {
$request->setPonum($id);
}
$orderIncrementId = $order->getIncrementId();
//Added ->setData('comment1', $orderIncrementId);
//instead of ->setComment1($orderIncrementId)
$request->setCustref($orderIncrementId)
->setInvnum($orderIncrementId)
->setData('comment1', $orderIncrementId);
}
}
di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Paypal\Model\Payflowpro" type="MyNameSpace\Paypal\Model\Payflowpro" />
</config>