small payments refactor for better codeclimate

Made some changes based on https://codeclimate.com/github/HabitRPG/habitrpg/src/controllers/payments.js

In particular, added a missing import, refactored out the shared send-email stuff, added a bunch of semicolons, and used parens to initialize dates.

I stayed away from the single-line-if bracket stuff, because I don't know if that's a project style issue or something like that.

I'm not really sure how to properly test this change - let me know if there's something I should be doing.