- API receives, validates and saves purchase data, as well as calculates the cash back value.
POST /api/cashback
{
"sold_at": "2026-01-02 00:00:00",
"customer": {
"document": "00000000000",
"name": "JOSE DA SILVA",
},
"total": "100.00",
"products": [
{
"type": "A",
"value": "10.00",
"qty": 1,
},
{
"type": "B",
"value": "10.00",
"qty": 9
}
]
}
where:
- customer -> document: client unique id
- products -> type: product type
- products -> value: product unit value
- products -> qty: product quantity
- Pass the cashback amount to an API of MaisTODOS company.
URL: https://5efb30ac80d8170016f7613d.mockapi.io/api/mock/Cashback
Método: POST
Data: document -> client unique id
cashback -> calculated value
API return:
{
"createdAt": "2021-07-26T22:50:55.740Z",
"message": "Cashback criado com sucesso!",
"id": "NaN",
"document": "33535353535",
"cashback": "10"
}
- Visual Studio SCode
- Python 3.9.10
- Flask
- SQLAlchemy
- SQLite
- Postman
pip install -r requirements.txt