Added logic for failed contributions

When a payment fails, mark the contribution as having failed, and
set the recurring contribution to try again next time.

(Also fixed the accumulation of messages in $apiResult. The union
operator was causing messages to be lost.)