refactored update_payment_total method