API for creating, reading, updating and deleting resellers and their purchases and check their cashback
- docker-compose
- docker
- python3.8+
$ git clone https://github.com/lsantosdemoura/cashback-api
$ cd cashback-api
# You can build and start docker at once
$ make runserver
- The project itself:
$ docker-compose exec web bash
- Postgres:
$ docker-compose exec db bash
$ cd cashback-api
$ make run-tests
- create resellers
- POST
- payload:
{
"email": "string",
"fullname": "string",
"cpf": "string",
"password": "string"
}
- response:
{
"email": "string",
"fullname": "string",
"cpf": "string"
}
- Returns a refresh and an access token that will be used as authentication in other endpoints
- POST
- payload:
{
"email": "string",
"password": "string"
}
- response:
{
"refresh": "string",
"access": "string"
}
- Returns a new access token
- POST
- payload:
{
"refresh": "string"
}
- response:
{
"access": "string"
}
- Creates a purchase for the authenticated reseller
- POST
- payload:
{
"code": "string",
"value": "float",
"date": "string",
"reseller": "string"
}
- response:
{
"code": "string",
"value": "string",
"date": "string",
"reseller": "string",
"status": "string"
}
- Retrieves the authenticated reseller's purchases, the response has the last month purchases but with
start_date
andend_date
query parameters the response will have that range - GET
- query parameters [optional]:
start_date: "%Y-%m-%d"
end_date: "%Y-%m-%d"
- headers:
{
"Authorization": "Bearer <access token>"
}
- response:
{
"count": "integer",
"next": "integer",
"previous": "integer",
"results": [
{
"code": "string",
"value": "string",
"date": "string",
"reseller": "string",
"status": "string",
"cashback_percentage": "string",
"cashback_value": "string"
}
]
}
- Returns the reseller's already gahered cashback
- GET
- headers:
{
"Authorization": "Bearer <access token>"
}
- response:
{
"credit": "integer"
}