I received the Code Craft task as a Dasher payout calculation API problem.
Dasher Payout Calculation API
Overview
The prompt said that, as part of a migration from a monolith to a microservice architecture, the team was building a new Payments Service. My task was to implement the Dasher payout logic, which required calling an upstream dependency to retrieve the relevant data.
Goal
Create this endpoint:
POST payout
Input: dasherId
Output: dollar amount the Dasher gets paid
The endpoint needed to request delivery information from a separate endpoint.
Requirements
The first version of the payment model was based on the time a Dasher spent fulfilling each order. Given the sequence of order activities for one Dasher on one day, I needed to calculate the Dasher's pay using these rules:
- Base pay rate: $0.30 per minute.
- Multiple-order pay rate: number of ongoing deliveries multiplied by the base pay rate.
The implementation also needed test coverage.
Discussion
Loading comments…