dwindown
|
249505ddf3
|
feat: Coupons CRUD - Backend API (Phase 1)
Implemented CouponsController with full CRUD operations
Created: CouponsController.php
- GET /coupons - List coupons with pagination and filtering
- GET /coupons/{id} - Get single coupon
- POST /coupons - Create new coupon
- PUT /coupons/{id} - Update coupon
- DELETE /coupons/{id} - Delete coupon
Features:
- Pagination support (page, per_page)
- Search by coupon code
- Filter by discount_type
- Full coupon data (all WooCommerce fields)
- Validation (code required, duplicate check)
- Error handling (user-friendly messages)
Coupon Fields Supported:
- Basic: code, amount, discount_type, description
- Usage: usage_count, usage_limit, usage_limit_per_user
- Restrictions: product_ids, categories, email_restrictions
- Limits: minimum_amount, maximum_amount, date_expires
- Options: individual_use, free_shipping, exclude_sale_items
Registered in Routes.php:
- Added CouponsController to route registration
- Follows API_ROUTES.md standards
Following PROJECT_SOP.md:
- Consistent error responses
- Permission checks (manage_woocommerce)
- User-friendly error messages
- Standard REST patterns
Next Steps:
- Frontend list page with submenu tabs
- Frontend create/edit form
- Update API_ROUTES.md
- Update NavigationRegistry.php
|
2025-11-20 13:52:12 +07:00 |
|