Since you have brought this dispute out into the open, it shows the importance of getting any sub contracted work pre-qualified.
If it was agreed beforehand that the work would only be paid upon satisfactory completion
and when paid in full by the customer then I can not see the problem, other than
why would someone agree to these terms.

If on the other hand if it was
not made clear and payment was expected in full upon completion or 30days as is normal procedure, then that is a different matter altogether and payment should be made in full whether payment from the customer has been received or not.