Hi, you've said that you've earned Sofia's trust. This mean you have already find Sofia's secret with Rafael and when you confront her, she gave you $1000. Do you remember you did this?
If you already did, then when you go to Rafael to blackmail him with the digital trace, Rafael can't do anything because Sofia will prevent Rafael from bribing the police. This is how you force Rafael to quit from the agency, with the support from Sofia.