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

Fix error when passing coupon_code to api/checkouts#update #2136

Merged

Conversation

jhawthorn
Copy link
Contributor

Previously, when given a coupon_code, this action would always error. handler wasn't the PromotionHandler, but the return value of apply (a hash). This has been the case since Spree 2.2.

The error wasn't noticed in specs because of the rescue_from in BaseController, which I am working on removing.

This also makes the return status of a real coupon application error (which previously was inaccessible) 422.

@jhawthorn jhawthorn added the changelog:solidus_api Changes to the solidus_api gem label Aug 8, 2017
order.update_column(:state, "payment")
put spree.api_checkout_path(order.to_param), params: { order_token: order.guest_token, order: { coupon_code: "foobar" } }
expect(response.status).to eq(422)
expect(json_response).to eq({"error"=>"The coupon code you entered doesn't exist. Please try again."})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside { missing.
Surrounding space missing for operator =>.
Space inside } missing.

@jhawthorn jhawthorn merged commit 7146f76 into solidusio:master Aug 14, 2017
@jhawthorn
Copy link
Contributor Author

Merged as part of #2139

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants