adyen-magento2
adyen-magento2 copied to clipboard
[ECP-9246] Unable to create Credit Memos for orders containing deleted products.
Describe the bug
Unable to create a credit memo for orders containing deleted products.
Getting the following Error message An error has happened during application run. See exception log for details.
With the following log message
[2024-05-29T12:01:30.491360+00:00] main.CRITICAL: Error: Call to a member function getId() on null in /vendor/adyen/module-payment/Helper/OpenInvoice.php:190
To Reproduce Steps to reproduce the behavior:
- Create a product
- Place an order using said product
- Invoice & Ship the order
- Delete the product
- Attempt to create a credit memo for the order
Expected behavior Credit memo to create successfully.
Magento version 2.4.5-p7
Plugin version 9.5.2
Additional Information
It should be expected that calling getProduct
on a order item could return null, in the case the original product no longer exists in the catalog. Either should be looking to use the data baked into the line item, or have logic to handle cases where the original item no longer exists.