In a shared repo, implement an auto-refund system according to the given requirements (practical coding, mini system design style) with AI assistance allowed
Asked in the Technical phone screen pair programming stage. The interviewer shares a repo containing the full problem statement; AI use is encouraged.
Implement process_refunds(requests). Each request is a dictionary with request_id, order_id, refundable_amount, and amount, where monetary values are integer cents. Process requests in order, approve each unique request only when amount is positive and does not exceed the order's remaining balance, and prevent duplicate request IDs from changing the result. Return one result per input request with request_id, status, and remaining_amount.
def process_refunds(requests):