adobe / commerce-integration-starter-kit

Adobe's integration starter kit uses Adobe Developer App Builder to improve real-time connection reliability and reduce the time-to-market for integrations between Adobe Commerce and other back-office systems, such as ERPs, CRMs, and PIMs.
Apache License 2.0
6 stars 2 forks source link

The shipment examples use POST /shipment instead of POST /order/{orderId}/ship #12

Closed brian-labelle closed 2 months ago

brian-labelle commented 3 months ago

The shipment examples use POST /shipment instead of POST /order/{orderId}/ship

The problem is that, in 2.4.7 instances of Adobe Commerce, POST /shipment only seems to create the Shipments in the database. However, POST /order/{orderId}/ship does more than this -- not only does it create the shipment, but it also calls other methods that update the shipped item quantities on the order items, and updates the total quantity on the shipment.

POST /order/{orderId}/ship calls Magento\Sales\Api\ShipOrderInterface::execute, which eventually calls \Magento\Sales\Model\Order\Shipment\OrderRegistrar::register, and that method sets the quantities of items that are shipped on an order item, which allows proceed with the order flow.

But POST /shipment only saves the shipment -- it doesn't update any of the order item quantities, and doesn't seem to affect the order flow of placed, invoiced, shipped, complete

It's unclear what the intended usage of POST /shipment is if it is not capable of updating the order item values and affecting the overall order flow.

Recommendation: switch starter kit examples to POST /order/{orderId}/ship or provide alternative way to ship orders from the starter kit

rojoangel commented 2 months ago

@brian-labelle let us know if you have any feedback on the PR linked above. Thanks!