add #refund implementation and tests.