11/**
2- * Copyright 2015-2022 NETCAT (www.netcat.pl)
2+ * Copyright 2015-2023 NETCAT (www.netcat.pl)
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
76 *
87 * http://www.apache.org/licenses/LICENSE-2.0
98 *
109 * Unless required by applicable law or agreed to in writing, software
1110 * distributed under the License is distributed on an "AS IS" BASIS,
1211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
1412 * limitations under the License.
1513 *
1614 * @author NETCAT <[email protected] > 17- * @copyright 2015-2022 NETCAT (www.netcat.pl)
15+ * @copyright 2015-2023 NETCAT (www.netcat.pl)
1816 * @license http://www.apache.org/licenses/LICENSE-2.0
1917 */
2018
19+ using NIP24 . Model ;
2120using System ;
2221
2322namespace NIP24
@@ -31,19 +30,17 @@ static void Main(string[] args)
3130 {
3231 try
3332 {
34- // Utworzenie obiektu klienta usługi serwisu produkcyjnego
3533 // id – ciąg znaków reprezentujący identyfikator klucza API
3634 // key – ciąg znaków reprezentujący klucz API
3735 // NIP24Client nip24 = new NIP24Client("id", "key");
3836
39- // Utworzenie obiektu klienta usługi serwisu testowego
4037 NIP24Client nip24 = new NIP24Client ( ) ;
4138
4239 string nip = "7171642051" ;
4340 string nip_eu = "PL" + nip ;
4441 string account_number = "49154000046458439719826658" ;
42+ string krs_number = "0000030897" ;
4543
46- // Sprawdzenie stanu konta
4744 AccountStatus account = nip24 . GetAccountStatus ( ) ;
4845
4946 if ( account != null )
@@ -74,7 +71,6 @@ static void Main(string[] args)
7471 }
7572 }
7673
77- // Sprawdzenie statusu firmy w rejestrze VAT
7874 VATStatus vat = nip24 . GetVATStatus ( Number . NIP , nip ) ;
7975
8076 if ( vat != null )
@@ -146,7 +142,6 @@ static void Main(string[] args)
146142 Console . WriteLine ( "Błąd: " + nip24 . LastError + " (kod: " + nip24 . LastErrorCode + ")" ) ;
147143 }
148144
149- // Wywołanie metody wyszukującej dane w rejestrze VAT
150145 SearchResult result = nip24 . SearchVATRegistry ( Number . NIP , nip ) ;
151146
152147 if ( result != null )
@@ -157,8 +152,32 @@ static void Main(string[] args)
157152 {
158153 Console . WriteLine ( "Błąd: " + nip24 . LastError + " (kod: " + nip24 . LastErrorCode + ")" ) ;
159154 }
160- }
161- catch ( Exception e )
155+
156+ // Wywołanie metody pobierającej pełne dane z KRS
157+ KRSData krs = nip24 . GetKRSData ( Number . KRS , krs_number ) ;
158+
159+ if ( krs != null )
160+ {
161+ Console . WriteLine ( krs ) ;
162+ }
163+ else
164+ {
165+ Console . WriteLine ( "Błąd: " + nip24 . LastError + " (kod: " + nip24 . LastErrorCode + ")" ) ;
166+ }
167+
168+ // Wywołanie metody pobierającej dane z KRS (np. tylko dział 1)
169+ krs = nip24 . GetKRSSection ( Number . KRS , krs_number , 1 ) ;
170+
171+ if ( krs != null )
172+ {
173+ Console . WriteLine ( krs ) ;
174+ }
175+ else
176+ {
177+ Console . WriteLine ( "Błąd: " + nip24 . LastError + " (kod: " + nip24 . LastErrorCode + ")" ) ;
178+ }
179+ }
180+ catch ( Exception e )
162181 {
163182 System . Diagnostics . Debug . WriteLine ( e . StackTrace ) ;
164183 }
0 commit comments