Pass referral total to affiliate_wp()->referrals->update

https://github.com/affiliatewp/AffiliateWP/issues/406

This seems better. I moved the code for calculating the referral above so it can be used for both a new tracked discount, or to update an existing referral with the referral total.