refactor and fix orders api spec