Extract generate_cost and generate_amazon from generate_controler.