Skip to content

hellinoliveira/voucher_pool

Repository files navigation

PHP VOUCHERPOOL CHALLENGE

To run the project you need to:

  1. run composer install
  2. cp env.example .env
  3. Edit .env file to set your mysql user, password and database name
  4. run php artisan migrate
  5. run php artisan db:seed

Postman Documentation

You can import the PHP CHALLENGE.postman_collection.json to the Postman App to see the API documentation. 

The Challenge

Entities
  • 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
Functionalities
  • 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!

Lumen PHP Framework

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

Official Documentation

Documentation for the framework can be found on the Lumen website.

Security Vulnerabilities

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.

License

The Lumen framework is open-sourced software licensed under the MIT license

About

Small project for challenge and learning purpose

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages