innoshop
innoshop copied to clipboard
Prevent excessive product return requests
Customers were previously able to request returns for a quantity greater than what they originally ordered. This commit adds a validation check to ensure that the total return quantity, including previous returns, does not exceed the ordered amount for the given product. If the condition is violated, the user is shown an appropriate error message.
@dinmezpinar Thanks for your PR. I think the detection code would be better placed in OrderReturnRepo. This way, the controller remains lightweight, and the logic is centralized in the repository, making it reusable for REST APIs as well. What do you think?