In my project I get packing slips from the shipments from ERP system.
The shipments are already sent at that point from warehouse perspective. So that means I want to create the shipment, move it all the way to Shipped right away.
So I first set my shipments to processing to trigger capture of payments (only direct pay). Litium will capture payment and move the shipment to “ReadyToShip”.
What is the best way for me to move them to the final stage Shipped? How can I know when Litium has finished moving a shipment to “ReadyToShip”, because as far as I understand, that is how far Litium will take it automatically using events in the background. Then you have to move them to Shipped yourself.
Hi Martin, not sure i understand what you are asking for.
Simplest way to get order to move to completed is to use the erp connect api.
First call /shipmnets to create the shipment this will cause capture payment for all items values included in the shipment to be captured. Delivery will now be in status ready to ship. If not all items included in delivery connect api will create partpayments.
If you then call /notify/delivery you will set delivery status to delivered and if all deliveries delivered order should go to completed now.
It is the step between “ReadyToShip” and “Shipped” that is the problem. I need to do that in the same piece of code, in the same request.
When you initiate (no matter how) the capture of the payments, this happens in the backgronud.
If you call the “create shipment” as you suggest, you don’t immediately get a reply that the shipment is now “ReadyToShip”, this happens with events in Litium. So in the background Litium starts communicating with Apps and finishes up by setting the shipment to “ReadyToShip”.
This can take maybe 1 second or something.
So… I have to wait an indeterminate amount of time, before I can set it to “Shipped”.
Right now I have like this:
Set shipment to processing
Thread.Sleep(5000) and hope by then, that Litium background events have moved shipment to “ReadyToShip”
Try setting shipment to shipped.
I would like to rewrite this, so that I can trigger moving the shipments to “Shipped” as soon as the status has been set to “ReadyToShip”, not have an ugly thread sleep and “hope” everything has gone well.
Does that explain it better?
We have no signal from warehouse that I can use to indicate the actuall “Shipped”-status, I need to set it immediately.
I looked for this event, but I was looking for like “ShipmentReadyToShip” or “ShipmentStatusUpdated” or “ShipmentUpdated” … but did not think it was called just “ReadyToShip”.
My first idea was to listen for an event… but couldnt find it… but there it is!
One could also register a webhook for the Litium.Connect.Erp.Events.ReadyToShip filter, if you want to accomplish this only using the connect API. When the webhook is triggered, the /notify/delivered endpoint should be called which moves the shipment to “Shipped”