-
Notifications
You must be signed in to change notification settings - Fork 89
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
Validate complete order request #599
Conversation
Thanks for your contribution to ShopAPI. I have a question about your pull request: What does it validate at the moment, if you haven't have any validation specified. |
@mamazu Ideally it should re-validate inventory availability, which can be implemented later. Nevertheless, Sylius is meant to be extendable, even the ShopAPI doesn't have any validation specified, it should still perform validation to allower developer to add custom validator. |
Also due to inconsistent implementation in action class, error is being return in multiple different formats. For example, invalid cart token, it returns proper error 400 in
However, in
In
|
Currently as you found the order complete doesn't validate anything and therefore only asserts that the cart is there (which then will cause an error => 500) We should definitely add the same validators as the other endpoints have as well. Like CartExists and so on. |
Hey @kayue, are you willing to add test for this case? |
b52c391
to
ebb5182
Compare
ebb5182
to
0ad629c
Compare
OrderInterface $order, | ||
FactoryInterface $stateMachineFactory, | ||
StateMachineInterface $stateMachine, | ||
ExecutionContextInterface $context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExecutionContextInterface $context | |
ExecutionContextInterface $context |
Thanks, Ka and Max! 🥇 |
Thanks @lchrusciel for adding the tests. I didn't know what to test but now I learned. |
All credits to @mamazu. I just asked him for help ;) |
The first step to fix #598 is to perform validation in
CompleteOrderAction