Refactor and add test to Spree::Payment#set_unique_identifier.

Fixes #3493