Refactor ReturnAuthorization#generate_number

Fixes #3864