refactored purchases controllers and services