Open AlfredMadere opened 12 months ago
This endpoint allows splitting an expense among group members, either evenly or based on specified criteria.
Endpoint: POST /groups/{group_id}/split-expense
POST /groups/{group_id}/split-expense
Path Parameter:
group_id
Body:
{ "trip_id": int, "description": string, "total_amount": float, "split_details": [ { "user_id": int, "share_percentage": float } ] }
Success (200 OK):
{ "message": "Expense split successfully", "split_summary": [ { "user_id": int, "owed_amount": float } ] }
Failure (e.g., 400 Bad Request):
{ "error": "Invalid request data" }
This endpoint provides a summary of the group's financial status, showing each member's net balance, considering all transactions and expenses.
Endpoint: GET /groups/{group_id}/balance-overview
GET /groups/{group_id}/balance-overview
{ "group_balance": [ { "user_id": int, "net_balance": float } ], "transaction_details": [ { "transaction_id": int, "from_user_id": int, "to_user_id": int, "amount": float, "description": string, "date": string } ] }
Failure (e.g., 404 Not Found):
{ "error": "Group not found" }
API Specification
1. Split Expense Among Group Members
This endpoint allows splitting an expense among group members, either evenly or based on specified criteria.
Endpoint:
POST /groups/{group_id}/split-expense
Request
Path Parameter:
group_id
(int): The ID of the group.Body:
Response
Success (200 OK):
Failure (e.g., 400 Bad Request):
2. Group Balance Overview
This endpoint provides a summary of the group's financial status, showing each member's net balance, considering all transactions and expenses.
Endpoint:
GET /groups/{group_id}/balance-overview
Request
group_id
(int): The ID of the group.Response
Success (200 OK):
Failure (e.g., 404 Not Found):