Refund issue when using customer discount

Have you looked at this tutorial?