- run composer install
- cp env.example .env
- Edit .env file to set your mysql user, password and database name
- run php artisan migrate
- run php artisan db:seed
You can import the PHP CHALLENGE.postman_collection.json to the Postman App to see the API documentation.
- Recipient
- Name
- Email (unique)
- Special Offer
- Name
- fixed percentage discount
- Voucher Code
- unique randomly generated Code (at least 8 chars)
- assigned to a Recipient and a special offer
- Expiration Date
- Can just be used once
- Should track date of usage
- For a given Special Offer and an expiration date generate for each Recipient a Voucher Code
- Provide an endpoint, reachable via HTTP, which receives a Voucher Code and Email and validates the Voucher Code. In Case it is valid, return the Percentage Discount and set the date of usage
- Extra: For a given Email, return all his valid Voucher Codes with the Name of the Special Offer Tasks ❏ Design a database schema ❏ Write an application ❏ Add an API endpoint for verifying and redeeming vouchers ❏ The code should be covered by tests ❏ Write a documentation with code examples for the implemented calls (Postman collection is a nice-to-have) Hints
- A micro-framework may help you get started quickly
- Security is not a concern - look at this as an internal app, no need for access control
- A system that works is appreciated, but the larger focus is on code quality etc.
- Tests may reveal inconsistencies or unexpected scenarios in the original specification
- Any further questions? Feel free to ask us!
Documentation for the framework can be found on the Lumen website.
If you discover a security vulnerability within Lumen, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
The Lumen framework is open-sourced software licensed under the MIT license