Refactor Paymill gateway

* Removes duplication
* Extracts complex method to class

Closes #824.