Setting the Shipment Method via API does not correctly set the order state #1594

Closed
rottmanj opened this Issue May 24, 2012 · 2 comments

Comments

Projects
None yet
3 participants
@rottmanj

While using the order api, when you set the shipment method the state of the order does not correctly update. The state of the order remains in the delivery state. This also causes another issue where the shipment_state is not correctly set to pending

Spree Version: 1-1-stable
Ruby Version: 1.9.2p290
Rails Version: 3.2.3

Here is some sample code

#create order
line_items = [{:variant_id=>1, :quantity=>1}]
orderOptions = {:body=>{:order=>{:line_items=>line_items}}}
order = ActiveSupport::JSON.decode(HTTParty.post("#{$SPREE_SRV}/orders?token=#{$SPREE_API}",orderOptions))

#create order address
addressData = {:firstname=>'Test', :lastname=>'User', :address1=>'123 ABC st', :city=>'Los Angeles',:state_id=>'276110813',:country_id=>'214',:zipcode=>'12345'}
addressOptions = {:body=>{:shipping_address=>addressData, :billing_address=>addressData}}
address = ActiveSupport::JSON.decode(HTTParty.put("#{$SPREE_SRV}/orders/#{order[:number]}/address?token=#{$SPREE_API}",addressOptions))

#set shipping method
shippingOptions = {:body=>{:order=>{:shipping_method_id=>1}}}
shipping = HTTParty.put("#{$SPREE_SRV}orders/#{order[:number]}?token=#{$SPREE_API}",shippingOptions)
@radar

This comment has been minimized.

Show comment Hide comment
@radar

radar May 25, 2012

Member

Can you please show us what the API is returning for you as the response for this request?

Member

radar commented May 25, 2012

Can you please show us what the API is returning for you as the response for this request?

@himanshumohan

This comment has been minimized.

Show comment Hide comment
@himanshumohan

himanshumohan Jul 13, 2012

I am also facing the same problem as after creating order and filling all shipping_details and billing_details when i am sending request for shipment_method_id ,the state is not changing from "delivery" state to "payment" state(even on server). I m sending PUT request as
"curl -X PUT -d '{"shipping_method_id":"123456"}' http://localhost:3000/api/orders/R12345?token= -H "Content-Type:application/json""
And the response i got is same as we got when we send GET request "http://localhost:3000//api/orders/R1234567?token=" i.e.response which contain all detail after the filling address request with status same as "status=>delivery" , while it should be in "status=>payment" .

I am also facing the same problem as after creating order and filling all shipping_details and billing_details when i am sending request for shipment_method_id ,the state is not changing from "delivery" state to "payment" state(even on server). I m sending PUT request as
"curl -X PUT -d '{"shipping_method_id":"123456"}' http://localhost:3000/api/orders/R12345?token= -H "Content-Type:application/json""
And the response i got is same as we got when we send GET request "http://localhost:3000//api/orders/R1234567?token=" i.e.response which contain all detail after the filling address request with status same as "status=>delivery" , while it should be in "status=>payment" .

@rottmanj rottmanj closed this Aug 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment