pay gate refund function

Added refund function
Added test case for refund function