Fix settlement of gift card #5935
Refactor code #5935