If there is a failure on express donations (a member has saved payment methods and clicked on a one-click link from a fundraiser), we don't currently show any error message on the UI.
This PR passes the error code back to the front end, where we can show a generic error message.
The follow-up for this will be handling each error code independently to show better error messages for the members, however, there is a separate task to do it, but we are waiting for translations. This ticket will only show an error message on the UI.
Return the error code on the express_donation and one_click endpoints, too, as pronto is using them, and we need to handle the errors there as well.
Improved the logging as we logged the error without details such as the error code and specific error message returned by Braintree.
Before: RuntimeError (Error while making a sale transaction on BrainTree: #<Braintree::ErrorResult:0x0000564358120060>):
After: Error while making a sale transaction on BrainTree: Declined - Call Issuer code: 2044
Overview
RuntimeError (Error while making a sale transaction on BrainTree: #<Braintree::ErrorResult:0x0000564358120060>):
Error while making a sale transaction on BrainTree: Declined - Call Issuer code: 2044
Ticket
https://app.asana.com/0/1119304937718815/1203423804221592/f
Video
https://user-images.githubusercontent.com/15176901/204346799-fd6206c0-1108-4148-ac84-328a48aed26b.mp4