transaction service refactor and unit test