is this "receipt" variable being used?

I would early return here, and drop the following "else" (and thus remove an indent: Flat is better than nested).