Build a Payments Service POST payout endpoint (input dasherId, output dollar amount) that fetches the Dasher's order activities from an upstream endpoint and pays $0.3 per minute, multiplied by the number of ongoing deliveries, with test coverage. Asked in the code craft stage. Reported follow-ups: Any edge cases you can think of in your implementation? What would happen if the upstream service had high latency? What would you do?
Implement calculate_payout(dasher_id, order_activities). order_activities is a list of objects containing nonnegative duration_minutes and ongoing_deliveries. Return the payout as a numeric dollar amount rounded to two decimal places.
def calculate_payout(dasher_id, order_activities):