Troubleshooting failed webhook executions of the PayPal PLUS Extension from iways that cause automatic invoicing to stop

magento.stackexchange https://magento.stackexchange.com/questions/331388

Question

I use the following components:

magento (community) ver. 2.3.5-p1
iways/module-pay-pal-plus ver. 1.3.1 (github.com, marketplace.magento.com)

Since the last update to 2.3.5-p1, the behaviour for payments via the PayPal PLUS Extension has changed. Until now, payments via the PayPal PLUS extension were booked with the PayPal transaction type "Capture". Since the update, the PayPal Transaction Type "Authorization" is used for booking.

To clarify my problem, here are two pictures from the Magento admin interface: Transaction Type
New behavior since the update to magento 2.3.5-p1

PayPal transaction type
Usual behaviour from magento 2.3.4

The change ensures that incoming orders are not automatically processed by our system. The creation of an invoice and the update of the stock is no longer done automatically but has to be triggered manually for each incoming order. We still use the "PayPal Express Checkout" in parallel to the PayPal PLUS extension, which continues to work perfectly.

I cannot find a setting to change the one I use. How do I change the PayPal transaction type of the extension, so that the order process in our magento backend is automated again?

Or is there a more common way to capture authorized PayPal payments and automatically generate invoices for those orders than changing the PayPal transaction type?

Desired behavior:
after a customer has successfully paid his order via PayPal PLUS, the order should be marked as paid in the Magento admin interface and an invoice should be created automatically.

Was it helpful?

Solution

After months without any support or answers from the extension authors i-ways.net, I found a very helpful PR in the GitHub repository of the extension. 🎉

Addition to the original posting

In summary, the error described in the opening post actually has nothing to do with faulty PayPals transaction types. Only the error during the webhook execution was responsible for the fact that the PayPal transaction was not fully captured and thus remained in the status authorization.
The error in the webhook execution meant that no automatic exchange of the status of the payment process between PayPal and Magento could take place. This means that every order paid via PayPal Plus had to be processed manually in the Magento admin interface and no automatic invoicing was possible.

The error pattern

Obviously the authors of the extension made a careless mistake which leads to an error during the webhook execution which finally prevents the correct execution. In the logfiles the error was reported like this:

[Wed Feb 17 14:13:32.835783 2021] [proxy_fcgi:error] [pid 23446:tid 139947608532736] [client 173.0.81.33:42850] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\\Framework\\Filesystem\\DriverInterface in /var/www/share/<domain>/magento_live/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:116\nStack trace:\n#0 /var/www/share/<domain>/magento_live/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->createObject('Magento\\\\Framewo...', Array)\n#1 /var/www/share/<domain>/magento_live/vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Framewo...')\n#2 /var/www/share/<domain>/magento_live/vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\\\Framewo...')\n#3 /var/www/share/<domain>/magento_live/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Iways\\\\P...'

Troubleshooting

Changing a single line of code in vendor/iways/module-pay-pal-plus/Controller/Webhooks/Index.php fixed the problem.

[...]
95           \Iways\PayPalPlus\Model\Webhook\EventFactory $webhookEventFactory,
96           \Iways\PayPalPlus\Model\ApiFactory $apiFactory,
97           \Psr\Log\LoggerInterface $logger,
98  -        \Magento\Framework\Filesystem\DriverInterface $driver
98  +        \Magento\Framework\Filesystem\Driver\File $driver
99       ) {
100          $this->_logger = $logger;
101          $this->_webhookEventFactory = $webhookEventFactory;
[...]

Due to the bad support we will not use the extension from i-ways.net in the future and are currently looking for alternatives.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top