This PR introduces key features and enhancements related to coupon application functionality in the backend. The aim is to allow buyers to apply coupon codes to their cart, including validating the coupon, checking its expiration, and updating the cart's total price accordingly.
Description of Task Completed:
Coupon Application Endpoint:
Implemented an endpoint for applying a coupon code to the user's cart.
Validates the coupon code and checks for its expiration date and usage limits.
Applies the discount to the appropriate product in the cart and updates the cart's total price.
Handles errors such as missing coupon code, invalid coupon code, expired coupon, and no matching product in the cart.
Tests:
Added tests for the coupon application endpoint to ensure it functions correctly.
Added tests for error handling to ensure robustness and reliability of the coupon application functionality.
Swagger Documentation:
Documented the new coupon application endpoint in Swagger for easy API reference and testing.
What does this PR do?
Description of Task Completed: