Interaction in the initial and final states in direct nuclear reactions