For using this api, please follow this step:
- You have to clone this repo first.
- Start server with docker command "docker-compose up".
- Wait 15 seconds.
- Then you can use postman for request to this API.
- Example of request and response can you see in section below.
If you want to run test case, please follow this step:
- Start server with docker command "docker-compose up -d".
- Wait 15 seconds.
- Type "docker-compose exec django bash".
- And then "python manage.py test --keepdb".
Sign Up User
-
Method:
POST
-
Data Params
- Header:
{ Content-Type : "application/json" }
Body: all param is required{ "name": "Fadhlan Ridhwanallah", "handphone": "089658825175", "password": "password" }
- Header:
-
Success Response:
- Code: 200
Content:{}
- Code: 200
-
Error Response:
- Code: 404
Content:{ message : "Password must not blank" }
- Code: 404
Sign In User
-
Method:
POST
-
Data Params
- Header:
{ Content-Type : "application/json" }
Body: all param is required{ "handphone": "089658825175", "password": "password" }
- Header:
-
Success Response:
- Code: 200
Content:{ "user_id": "d7ef0752-367c-11e9-a0bc-0242ac150003", "name": "Fadhlan Ridhwanallah", "handphone": "089658825175" }
- Code: 200
-
Error Response:
- Code: 404
Content:{ message : "Password is not valid" }
- Code: 404
Create Tax Object
-
URL http://localhost:8000/user/{user_id}/tax/insert
example: http://localhost:8000/user/d7ef0752-367c-11e9-a0bc-0242ac150003/tax/insert
-
Method:
POST
-
Data Params
- Header:
{ Content-Type : "application/json" }
Body: all param is required{ "tax_code": 3, "name": "Movie", "price": "100" }
- Header:
-
Success Response:
- Code: 200
Content:{ "tax_id": "5c6ef690-367d-11e9-a0bc-0242ac150003", "name": "Movie", "tax_code": 3, "type": "entertainment", "refundable": "No", "price": 100, "tax": 0, "amount": 100 }
- Code: 200
-
Error Response:
- Code: 404
Content:{ message : "ORMUser matching query does not exist." }
- Code: 404
Get Tax Calculation
-
URL http://localhost:8000/user/{user_id}/tax/insert
example: http://localhost:8000/user/d7ef0752-367c-11e9-a0bc-0242ac150003/tax/get
-
Method:
GET
-
Data Params
- Header:
{ Content-Type : "application/json" }
- Header:
-
Success Response:
- Code: 200
Content:{ "tax_object": [ { "tax_id": "5c6ef690-367d-11e9-a0bc-0242ac150003", "name": "Movie", "tax_code": 3, "type": "entertainment", "refundable": "No", "price": 100, "tax": 0, "amount": 100 }, { "tax_id": "c21e0dbe-367d-11e9-a0bc-0242ac150003", "name": "Big Mac", "tax_code": 1, "type": "entertainment", "refundable": "No", "price": 1000, "tax": 9, "amount": 1009 } ], "price_sub_total": 1100, "tax_sub_total": 9, "grand_total": 1109 }
- Code: 200
-
Error Response:
- Code: 404
Content:{ message : "ORMUser matching query does not exist." }
- Code: 404