You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code expects all items to ship, which is not the case for virtual products. This causes those items not to be invoiced leading to a partial (or failed) capture.
To Reproduce
Steps to reproduce the behavior:
Place an order with both virtual and regular (simple) products
Pay using an Open Invoice method (Klarna for example)
Create a shipment
Inspect the invoice and capture flow
Expected behavior
Items which do not require a shipment (e.g. virtual products) should be invoiced and captured.
Magento version
2.4.7-p3
Plugin version
9.6.0, but can be reproduced on the latest version (9.11.0) as well.
Screenshots
N/A
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Thank you for creating this issue. This is indeed an interesting case and we've assumed it should be outside of the Capture on Shipment flow, so far. We are ready to discuss and improve the flow.
As you've mentioned, the code block above only captures the items require shipment as the name suggests. From my understanding, we shouldn't merge two distinct flows. We don't have enough evidence to capture the virtual products alongside of the shipment. It might not cover the use case of everyone. Capture on Shipment is only meant to be used with physical items.
However, in reality it might be cumbersome to go back and capture these virtual item/s again. Do you have any idea about a non-destructive flow? In the meanwhile, I will discuss this case with our product manager and get back to you.
I agree mangling virtual items in the shipment flow might not be the best solution. If the order exists of only virtual products, there won't even be a shipment to call the observer.
If the invoice is created externally or manually for those items the flow should succeed, since the Adyen\Payment\Observer\InvoiceObserver already links those invoices with the Adyen payment. The transaction ID (PSP reference) doesn't seem to be populated in this case, that might need a little change in order to support online refunds. When the Invoice is created by the shipment observer the transaction ID is populated (with the PSP reference).
Regarding invoicing the virtual items, it might be an option to add a configuration flag to automatically create an invoice for those items. It should be disabled by default, since it heavily depends on the Store if this is a desired option (and it matches the current behavior).
Most virtual items are things like licenses, online gift cards, etc. which in general don't run out of stock and are processed instantly. Some modules containing logic for those virtual products might create an Invoice simultaneously, others do not. Providing an option in the Adyen module to create those invoices automatically would be nice, since you are already providing this option for regular (shipment) items.
Describe the bug
adyen-magento2/Observer/BeforeShipmentObserver.php
Lines 167 to 177 in 0431f3b
This code expects all items to ship, which is not the case for virtual products. This causes those items not to be invoiced leading to a partial (or failed) capture.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Items which do not require a shipment (e.g. virtual products) should be invoiced and captured.
Magento version
2.4.7-p3
Plugin version
9.6.0, but can be reproduced on the latest version (9.11.0) as well.
Screenshots
N/A
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: