Hello I am a lawyer with over 15 years experience. I will help you with this.
I am sorry. I have just noticed this is a question about Scottish law which I will not be able to help with.
Is there anyone who can give me an answer? Failing that, what would be your answer under English law?
Under English law it would depend. If there was a contract that B would carry out legal acts in return for payment from A then if B accepted the money and failed to carry out the acts then he may well be in breach of contract. This would give A the right to bring a claim against B seeking compensation for losses suffered as a result of B's default. Compensation would principally be return of the money plus compensation for any consequential losses.
These are the general principles under English and Welsh law. The comments are vague because your question is light on detail. If you wanted to give me more detail I might be able to provide more practical help. A contract doesn't need to be in writing but is simply an offer and acceptance between parties with one or more party carrying out an act for consideration (ie payment).
I withheld payment of rent to my landlord because he refused to replace a damaged carpet. Through his letting agent he agreed to replace the carpet provided I paid the arrears to the letting agent who would hold the money until the carpet was replaced. I paid the arrears to the letting agent. The landlord now refuses to replace the carpet and intends to have me evicted.
Whether the landlord is obliged to repair the carpet will depend on the terms of the tenancy agreement if there is one. As to whether you had a legally enforceable contract regarding the repairs this is not completely clear. He may say that he only agreed to repair the carpet because you unreasonably withheld rent. This might well be a successful defence. Look at your tenancy agreement to see if there is a clause that could cover replacing defective carpets. The repairing obligations implied in all tenancy agreements would not normally cover this. In terms of possible eviction he will need to follow the correct legal procedures regarding notice giving etc. which is really a separate legal issue to the question you posted.
I hope I have answered your question but if you need further help please let me know. Also I would be grateful if you would change the rating of my service.