A well-formed request can still violate a business rule. A positive refund amount may exceed what remains refundable. A settled-order action may arrive before settlement. Input types alone can't decide whether either action is allowed.
Read the authoritative state before approving the operation. These labs validate the amount and order state, and keep partial refunds working. The model evaluates one request at a time. Real money movements also need atomic enforcement: two concurrent requests must not both spend the same remaining balance, and a retry must not repeat an already completed action. Use database constraints, appropriate transactions and a deliberate idempotency policy when you build the production workflow.
Read the fixed handler, then apply the same idea to each exercise.