Skip to content

Commit 473b767

Browse files
committed
Added a new function for searching data in the VAT registry.
1 parent c45abc2 commit 473b767

23 files changed

+1287
-175
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
<groupId>pl.nip24</groupId>
77
<artifactId>nip24-client</artifactId>
8-
<version>1.3.4</version>
8+
<version>1.3.5</version>
99

10-
<name>nip24-client-java</name>
10+
<name>nip24-java-client</name>
1111
<description>NIP24 Service Client for Java</description>
1212
<url>http://www.nip24.pl</url>
1313

src/main/java/pl/nip24/client/AccountStatus.java

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2019 NETCAT (www.netcat.pl)
2+
* Copyright 2015-2020 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.
@@ -14,12 +14,14 @@
1414
* limitations under the License.
1515
*
1616
* @author NETCAT <firma@netcat.pl>
17-
* @copyright 2015-2019 NETCAT (www.netcat.pl)
17+
* @copyright 2015-2020 NETCAT (www.netcat.pl)
1818
* @license http://www.apache.org/licenses/LICENSE-2.0
1919
*/
2020

2121
package pl.nip24.client;
2222

23+
import java.util.Date;
24+
2325
/**
2426
* Dane konta użytkownika
2527
* @author robert
@@ -28,6 +30,8 @@ public class AccountStatus {
2830

2931
protected String uid;
3032

33+
protected String type;
34+
protected Date validTo;
3135
protected String billingPlanName;
3236

3337
protected float subscriptionPrice;
@@ -37,6 +41,7 @@ public class AccountStatus {
3741
protected float itemPriceAll;
3842
protected float itemPriceIBAN;
3943
protected float itemPriceWhitelist;
44+
protected float itemPriceSearchVAT;
4045

4146
protected int limit;
4247
protected int requestDelay;
@@ -60,6 +65,7 @@ public class AccountStatus {
6065
protected boolean funcGetVATStatus;
6166
protected boolean funcGetIBANStatus;
6267
protected boolean funcGetWhitelistStatus;
68+
protected boolean funcSearchVAT;
6369

6470
protected int invoiceDataCount;
6571
protected int allDataCount;
@@ -68,6 +74,7 @@ public class AccountStatus {
6874
protected int viesStatusCount;
6975
protected int ibanStatusCount;
7076
protected int whitelistStatusCount;
77+
protected int searchVATCount;
7178
protected int totalCount;
7279

7380
/**
@@ -95,6 +102,42 @@ public void setUID(String uid)
95102
this.uid = uid;
96103
}
97104

105+
/**
106+
* Typ konta
107+
* @return typ konta
108+
*/
109+
public String getType()
110+
{
111+
return type;
112+
}
113+
114+
/**
115+
* Typ konta
116+
* @param type typ konta
117+
*/
118+
public void setType(String type)
119+
{
120+
this.type = type;
121+
}
122+
123+
/**
124+
* Data ważności konta pre-paid
125+
* @return data ważności
126+
*/
127+
public Date getValidTo()
128+
{
129+
return validTo;
130+
}
131+
132+
/**
133+
* Data ważności konta pre-paid
134+
* @param validTo data ważności
135+
*/
136+
public void setValidTo(Date validTo)
137+
{
138+
this.validTo = validTo;
139+
}
140+
98141
/**
99142
* Nazwa bieżącego planu taryfowego
100143
* @return nazwa planu
@@ -239,6 +282,24 @@ public void setItemPriceWhitelist(float itemPriceWhitelist)
239282
this.itemPriceWhitelist = itemPriceWhitelist;
240283
}
241284

285+
/**
286+
* Koszt netto pojedynczego zapytania - wyszukiwanie danych w rejestrze VAT
287+
* @return cena netto
288+
*/
289+
public float getItemPriceSearchVAT()
290+
{
291+
return itemPriceSearchVAT;
292+
}
293+
294+
/**
295+
* Koszt netto pojedynczego zapytania - wyszukiwanie danych w rejestrze VAT
296+
* @param itemPriceSearchVAT cena netto
297+
*/
298+
public void setItemPriceSearchVAT(float itemPriceSearchVAT)
299+
{
300+
this.itemPriceSearchVAT = itemPriceSearchVAT;
301+
}
302+
242303
/**
243304
* Maksymalna liczba zapytań w planie
244305
* @return liczba zapytań
@@ -581,6 +642,24 @@ public void setFuncGetWhitelistStatus(boolean funcGetWhitelistStatus)
581642
this.funcGetWhitelistStatus = funcGetWhitelistStatus;
582643
}
583644

645+
/**
646+
* Dostęp do funkcji wyszukującej dane w rejestrze VAT
647+
* @return true jeżeli funkcja jest dostępna
648+
*/
649+
public boolean isFuncSearchVAT()
650+
{
651+
return funcSearchVAT;
652+
}
653+
654+
/**
655+
* Dostęp do funkcji wyszukującej dane w rejestrze VAT
656+
* @param funcSearchVAT true jeżeli funkcja jest dostępna
657+
*/
658+
public void setFuncSearchVAT(boolean funcSearchVAT)
659+
{
660+
this.funcSearchVAT = funcSearchVAT;
661+
}
662+
584663
/**
585664
* Ilość wykonanych zapytań o dane podmiotu do faktury
586665
* @return ilość zapytań
@@ -707,6 +786,24 @@ public void setWhitelistStatusCount(int whitelistStatusCount)
707786
this.whitelistStatusCount = whitelistStatusCount;
708787
}
709788

789+
/**
790+
* Ilość wykonanych zapytań wyszukiwania danych w rejestrze VAT
791+
* @return ilość zapytań
792+
*/
793+
public int getSearchVATCount()
794+
{
795+
return searchVATCount;
796+
}
797+
798+
/**
799+
* Ilość wykonanych zapytań wyszukiwania danych w rejestrze VAT
800+
* @param searchVATCount ilość zapytań
801+
*/
802+
public void setSearchVATCount(int searchVATCount)
803+
{
804+
this.searchVATCount = searchVATCount;
805+
}
806+
710807
/**
711808
* Całkowita ilość wykonanych zapytań w bieżącym miesiącu
712809
* @return ilość zapytań
@@ -729,6 +826,8 @@ public void setTotalCount(int totalCount)
729826
public String toString()
730827
{
731828
return "AccountStatus: [uid = " + uid
829+
+ ", type = " + type
830+
+ ", validTo = " + (validTo != null ? validTo.toString() : "")
732831
+ ", billingPlanName = " + billingPlanName
733832

734833
+ ", subscriptionPrice = " + subscriptionPrice
@@ -738,6 +837,7 @@ public String toString()
738837
+ ", itemPriceAll = " + itemPriceAll
739838
+ ", itemPriceIBAN = " + itemPriceIBAN
740839
+ ", itemPriceWhitelist = " + itemPriceWhitelist
840+
+ ", itemPriceSearchVAT = " + itemPriceSearchVAT
741841

742842
+ ", limit = " + limit
743843
+ ", requestDelay = " + requestDelay
@@ -761,6 +861,7 @@ public String toString()
761861
+ ", funcGetVATStatus = " + funcGetVATStatus
762862
+ ", funcGetIBANStatus = " + funcGetIBANStatus
763863
+ ", funcGetWhitelistStatus = " + funcGetWhitelistStatus
864+
+ ", funcSearchVAT = " + funcSearchVAT
764865

765866
+ ", invoiceDataCount = " + invoiceDataCount
766867
+ ", allDataCount = " + allDataCount
@@ -769,6 +870,7 @@ public String toString()
769870
+ ", VIESStatusCount = " + viesStatusCount
770871
+ ", IBANStatusCount = " + ibanStatusCount
771872
+ ", whitelistStatusCount = " + whitelistStatusCount
873+
+ ", searchVATCount = " + searchVATCount
772874
+ ", totalCount = " + totalCount
773875
+ "]";
774876
}

src/main/java/pl/nip24/client/AllData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2019 NETCAT (www.netcat.pl)
2+
* Copyright 2015-2020 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.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*
1616
* @author NETCAT <firma@netcat.pl>
17-
* @copyright 2015-2019 NETCAT (www.netcat.pl)
17+
* @copyright 2015-2020 NETCAT (www.netcat.pl)
1818
* @license http://www.apache.org/licenses/LICENSE-2.0
1919
*/
2020

src/main/java/pl/nip24/client/EUVAT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2019 NETCAT (www.netcat.pl)
2+
* Copyright 2015-2020 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.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*
1616
* @author NETCAT <firma@netcat.pl>
17-
* @copyright 2015-2019 NETCAT (www.netcat.pl)
17+
* @copyright 2015-2020 NETCAT (www.netcat.pl)
1818
* @license http://www.apache.org/licenses/LICENSE-2.0
1919
*/
2020

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/**
2+
* Copyright 2015-2020 NETCAT (www.netcat.pl)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* @author NETCAT <firma@netcat.pl>
17+
* @copyright 2015-2020 NETCAT (www.netcat.pl)
18+
* @license http://www.apache.org/licenses/LICENSE-2.0
19+
*/
20+
21+
package pl.nip24.client;
22+
23+
import java.util.HashMap;
24+
import java.util.Map;
25+
26+
/**
27+
* Kody błędów
28+
* @author robert
29+
*/
30+
public class Error {
31+
32+
public final static int NIP_EMPTY = 1;
33+
public final static int NIP_UNKNOWN = 2;
34+
public final static int GUS_LOGIN = 3;
35+
public final static int GUS_CAPTCHA = 4;
36+
public final static int GUS_SYNC = 5;
37+
public final static int NIP_UPDATE = 6;
38+
public final static int NIP_BAD = 7;
39+
public final static int CONTENT_SYNTAX = 8;
40+
public final static int NIP_NOT_ACTIVE = 9;
41+
public final static int INVALID_PATH = 10;
42+
public final static int EXCEPTION = 11;
43+
public final static int NO_PERMISSION = 12;
44+
public final static int GEN_INVOICES = 13;
45+
public final static int GEN_SPEC_INV = 14;
46+
public final static int SEND_INVOICE = 15;
47+
public final static int PREMIUM_FEATURE = 16;
48+
public final static int SEND_ANNOUNCEMENT = 17;
49+
public final static int INVOICE_PAYMENT = 18;
50+
public final static int REGON_BAD = 19;
51+
public final static int SEARCH_KEY_EMPTY = 20;
52+
public final static int KRS_BAD = 21;
53+
public final static int EUVAT_BAD = 22;
54+
public final static int VIES_SYNC = 23;
55+
public final static int CEIDG_SYNC = 24;
56+
public final static int RANDOM_NUMBER = 25;
57+
public final static int PLAN_FEATURE = 26;
58+
public final static int SEARCH_TYPE = 27;
59+
public final static int PPUMF_SYNC = 28;
60+
public final static int PPUMF_DIRECT = 29;
61+
public final static int NIP_FEATURE = 30;
62+
public final static int REGON_FEATURE = 31;
63+
public final static int KRS_FEATURE = 32;
64+
public final static int TEST_MODE = 33;
65+
public final static int ACTIVITY_CHECK = 34;
66+
public final static int ACCESS_DENIED = 35;
67+
public final static int MAINTENANCE = 36;
68+
public final static int BILLING_PLANS = 37;
69+
public final static int DOCUMENT_PDF = 38;
70+
public final static int EXPORT_PDF = 39;
71+
public final static int RANDOM_TYPE = 40;
72+
public final static int LEGAL_FORM = 41;
73+
public final static int GROUP_CHECKS = 42;
74+
public final static int CLIENT_COUNTERS = 43;
75+
public final static int URE_SYNC = 44;
76+
public final static int URE_DATA = 45;
77+
public final static int DKN_BAD = 46;
78+
public final static int SEND_REMAINDER = 47;
79+
public final static int EXPORT_JPK = 48;
80+
public final static int GEN_ORDER_INV = 49;
81+
public final static int SEND_EXPIRATION = 50;
82+
public final static int IBAN_SYNC = 51;
83+
public final static int ORDER_CANCEL = 52;
84+
public final static int WHITELIST_CHECK = 53;
85+
public final static int AUTH_TIMESTAMP = 54;
86+
public final static int AUTH_MAC = 55;
87+
public final static int IBAN_BAD = 56;
88+
89+
public final static int DB_AUTH_IP = 101;
90+
public final static int DB_AUTH_KEY_STATUS = 102;
91+
public final static int DB_AUTH_KEY_VALUE = 103;
92+
public final static int DB_AUTH_OVER_PLAN = 104;
93+
public final static int DB_CLIENT_LOCKED = 105;
94+
public final static int DB_CLIENT_TYPE = 106;
95+
public final static int DB_CLIENT_NOT_PAID = 107;
96+
public final static int DB_AUTH_KEYID_VALUE = 108;
97+
98+
public final static int CLI_CONNECT = 201;
99+
public final static int CLI_RESPONSE = 202;
100+
public final static int CLI_NUMBER = 203;
101+
public final static int CLI_NIP = 204;
102+
public final static int CLI_REGON = 205;
103+
public final static int CLI_KRS = 206;
104+
public final static int CLI_EUVAT = 207;
105+
public final static int CLI_IBAN = 208;
106+
public final static int CLI_EXCEPTION = 209;
107+
public final static int CLI_DATEFORMAT = 210;
108+
public final static int CLI_INPUT = 211;
109+
110+
private final static Map<Integer, String> codes = new HashMap<>();
111+
112+
static {
113+
codes.put(CLI_CONNECT, "Nie udało się nawiązać połączenia z serwisem NIP24");
114+
codes.put(CLI_RESPONSE, "Odpowiedź serwisu NIP24 ma nieprawidłowy format");
115+
codes.put(CLI_NUMBER, "Nieprawidłowy typ numeru");
116+
codes.put(CLI_NIP, "Numer NIP jest nieprawidłowy");
117+
codes.put(CLI_REGON, "Numer REGON jest nieprawidłowy");
118+
codes.put(CLI_KRS, "Numer KRS jest nieprawidłowy");
119+
codes.put(CLI_EUVAT, "Numer EU VAT ID jest nieprawidłowy");
120+
codes.put(CLI_IBAN, "Numer IBAN jest nieprawidłowy");
121+
codes.put(CLI_EXCEPTION, "Funkcja wygenerowała wyjątek");
122+
codes.put(CLI_DATEFORMAT, "Podana data ma nieprawidłowy format");
123+
codes.put(CLI_INPUT, "Nieprawidłowy parametr wejściowy funkcji");
124+
}
125+
126+
/**
127+
* Pobranie komunikatu błędu
128+
* @param code kod błędu
129+
* @return komunikat
130+
*/
131+
public static String message(int code)
132+
{
133+
if (code < CLI_CONNECT || code > CLI_INPUT) {
134+
return null;
135+
}
136+
137+
return codes.get(code);
138+
}
139+
}

0 commit comments

Comments
 (0)