The security contract has been invoiced and paid in full, but the quality deposit has not been recovered afterwards and the tax has been paid in full. What about the overpaid tax?

There should be no problem of overpaying taxes.

If the other party refuses to pay for the breach of contract, then you should sue and ask the other party to pay for the goods and bear the responsibility of overdue payment.

If the actual transaction amount changes (for example, part of it has been returned), the invoice that has been issued should be offset in red.