The failure of a foreign corporation to obtain a certificate of authority to transact business in the state does not impair the validity of a contract or act of it, and does not prevent the corporation from defending an action, suit, or proceeding in a court of the state.