Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin api users cannot create an order with line items #3420

Open
rileyanderson opened this issue Nov 7, 2019 · 2 comments
Open

Admin api users cannot create an order with line items #3420

rileyanderson opened this issue Nov 7, 2019 · 2 comments
Labels
changelog:solidus_api Changes to the solidus_api gem type:bug Error, flaw or fault

Comments

@rileyanderson
Copy link

Api users that have admin role cannot create an order with line items though the api. When a user has an admin role it assumes that the intent is to import an order.
https://github.com/solidusio/solidus/blob/master/api/app/controllers/spree/api/orders_controller.rb#L36-L38

Solidus Version:
Master

To Reproduce

  • Assign user admin role.
  • Create order with line items though api.

Current behavior
Throws an error - NoMethodError: undefined method 'each_key' for [{"variant_id"=>xx, "quantity"=>xx}] as importer expects a hash of hashes instead of an array of hashes.

https://github.com/solidusio/solidus/blob/master/core/lib/spree/core/importer/order.rb#L99-L112

Expected behavior
Should not call importer in this instance. Ideally importer would be a separate endpoint.

@kennyadsl
Copy link
Member

@rileyanderson I agree with you, we should have a single behavior for this endpoint, or at least make it work with the same data both ways.

@kennyadsl
Copy link
Member

@rileyanderson Hey there, I'm taking a look at this but it looks like the accepted parameters are the same for both those endpoints. We have also a spec covering your scenario.

Can you please describe the context of the error better?

@kennyadsl kennyadsl added Unconfirmed changelog:solidus_api Changes to the solidus_api gem labels Dec 2, 2019
@waiting-for-dev waiting-for-dev added type:bug Error, flaw or fault and removed Unconfirmed labels Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_api Changes to the solidus_api gem type:bug Error, flaw or fault
Projects
None yet
Development

No branches or pull requests

3 participants