doPaymentsFailed() refers to wrong variable
Created by: wmortada
This looks like a typo to me. The function doPaymentsFailed() refers to a variable $update but this isn't defined. I think it should refer to $contribution.
I haven't tested this myself, but spotted it while reading through the code.