Registration prerequisite to suit.
No person engaged in the business or acting in the capacity of a contractor may bring or maintain any action in any court of this state for the collection of compensation for the performance of any work or for breach of any contract for which registration is required under this chapter without alleging and proving that he or she was a duly registered contractor and held a current and valid certificate of registration at the time he or she contracted for the performance of such work or entered into such contract. For the purposes of this section, the court shall not find a contractor in substantial compliance with the registration requirements of this chapter unless: (1) The department has on file the information required by RCW 18.27.030; (2) the contractor has at all times had in force a current bond or other security as required by RCW 18.27.040; and (3) the contractor has at all times had in force current insurance as required by RCW 18.27.050. In determining under this section whether a contractor is in substantial compliance with the registration requirements of this chapter, the court shall take into consideration the length of time during which the contractor did not hold a valid certificate of registration.