After a voyage is COMPLETED, calculate each agent's commission from the orders they placed.
New endpoint:
GET /api/v1/voyages/{voyageId}/commissions β agent commission breakdown
Commission report response:
{
"voyageNumber": "VOY-2025-001",
"agents": [
{
"agentName": "Ali Hassan",
"type": "INTERNAL",
"commissionPercent": 5.0,
"orderCount": 12,
"totalOrderValueUsd": 48000.00,
"commissionEarnedUsd": 2400.00
},
{
"agentName": "FastFreight FZE",
"type": "EXTERNAL",
"commissionPercent": 8.0,
"orderCount": 6,
"totalOrderValueUsd": 30000.00,
"commissionEarnedUsd": 2400.00
}
],
"totalCommissionsUsd": 4800.00
}
Business rules:
- Commission =
agent.commissionPercent Γ sum of finalPriceUsd for that agent's DELIVERED
orders on the voyage
- Only
DELIVERED orders count
- Only
COMPLETED voyages (return 409 otherwise)
Acceptance criteria:
After a voyage is
COMPLETED, calculate each agent's commission from the orders they placed.New endpoint:
GET /api/v1/voyages/{voyageId}/commissionsβ agent commission breakdownCommission report response:
{ "voyageNumber": "VOY-2025-001", "agents": [ { "agentName": "Ali Hassan", "type": "INTERNAL", "commissionPercent": 5.0, "orderCount": 12, "totalOrderValueUsd": 48000.00, "commissionEarnedUsd": 2400.00 }, { "agentName": "FastFreight FZE", "type": "EXTERNAL", "commissionPercent": 8.0, "orderCount": 6, "totalOrderValueUsd": 30000.00, "commissionEarnedUsd": 2400.00 } ], "totalCommissionsUsd": 4800.00 }Business rules:
agent.commissionPercentΓ sum offinalPriceUsdfor that agent'sDELIVEREDorders on the voyage
DELIVEREDorders countCOMPLETEDvoyages (return 409 otherwise)Acceptance criteria: