A system to gain or utilize points via transactions
- Commit (multiple) transactions
- Give points to payers
- Use points (optional: from certain payers)
- Return a list of points from payers
FetchPoints uses a number of open source projects to work properly:
- Flask - Micro Web Framework which utilizes Python
- PyMongo - Establishes connection with MongoDB via Python
FetchPoints requires Flask and PyMongo to run.
Install the dependencies and start the server.
pip install pymongo Flask
Run app.py to start the server up.
Route | Required |
---|---|
/api/spend_points |
int Amount |
/api/give_points |
int Amount, string payer |
/api/balance |
None |
api/spend_points
- Spends points based on amount given.
api/give_points
- Get points from payer based on amount
api/balance
- Returns the amount of points from each payer
To run the test cases, you have to run the app.py first then run the test.py. You may be required to install importlib
and requests
. If you don't have it, use pip install importlib requests
.
WARNING
: Testing resets the database so only do this during development.