Closed gaurav945 closed 7 years ago
@kennyadsl some help, please...
Hey there, I'm not sure this kind of state change is allowed via current API, anyway you could try to workaround this by using the /orders/ endpoint. You can even try to build your own endpoint in the api/checkout controller that does the same as update but without triggering the order.next
call.
Thanks for the quick reply, I have a follow up query, which is, then how to handle the following scenario :
Suppose, I have a web app, which uses Solidus APIs & the flow is similar to Solidus's flow. Now, let's say that I am on the confirm your order page, but I would like to go back & change my shipment provider, then how will I do that then, without transitioning the state ?
what about going one step back, for example moving to address if you have to go to address + 1 (delivery)? I think it's better moving this conversation on solidus slack #support channel, ok?
Okay & I am sorry for any inconvenience caused, I am actually new to all this, raising issues on github & such technical stuff, so I didn't know what would be the right place to discuss these kind of things.
What is happening
Lets say the order number "R398140812", is in "confirm" state. I want to transition back to "delivery" state. So, I make a PUT call to "api/checkouts/R398140812", with the body as {"state" : "delivery"}, but the state is getting set to "payment" & not "delivery".
What should happen instead
There's a before_action for next, advance, update & complete, by the name of "update_order_state", which checks, if there is a state parameter in the body of the arguments passed. If there is, it appropriately assigns the state to the order, that was passed as the body. But then, afterwards, the update action gets triggered & that does @order.next!, thereby changing the state to "delivery + 1", meaning "payment". So, instead of that happening, shouldn't it just do @order.save, in some action ?
The actual issue
System configuration
Solidus Version: 2.1.0
Extensions in use: No Extensions