Skip to content

Commit e69e10e

Browse files
committed
Add request id to vat status
1 parent e5af2c3 commit e69e10e

26 files changed

+349
-171
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### IntelliJ IDEA ###
2+
.idea
3+
*.iws
4+
*.iml
5+
*.ipr
6+
7+
### Local
8+
/**/node_modules/

example/example.js

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

2121
'use strict';
2222

23-
var NIP24 = require('nip24client');
23+
const NIP24 = require('nip24client');
2424

2525
// Utworzenie obiektu klienta usługi serwisu produkcyjnego
2626
// id – ciąg znaków reprezentujący identyfikator klucza API
2727
// key – ciąg znaków reprezentujący klucz API
2828
// var nip24 = new NIP24.NIP24Client('id', 'key');
2929

3030
// Utworzenie obiektu klienta usługi serwisu testowego
31-
var nip24 = new NIP24.NIP24Client();
31+
const nip24 = new NIP24.NIP24Client();
3232

33-
var nip = '7171642051';
34-
var nip_eu = 'PL' + nip;
35-
var account_number = '49154000046458439719826658';
33+
const nip = '7171642051';
34+
const nip_eu = 'PL' + nip;
35+
const account_number = '49154000046458439719826658';
3636

3737
// Sprawdzenie stanu konta
3838
nip24.getAccountStatus().then((account) => {

example/package-lock.json

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nip24example",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"description": "NIP24 Client for Javascript - Example",
55
"author": "",
66
"license": "Apache-2.0",

index.js

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

lib/accountstatus.js

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

lib/alldata.js

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

lib/error.js

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

2121
'use strict';
2222

2323

24-
var CLI_CONNECT = 201;
25-
var CLI_RESPONSE = 202;
26-
var CLI_NUMBER = 203;
27-
var CLI_NIP = 204;
28-
var CLI_REGON = 205;
29-
var CLI_KRS = 206;
30-
var CLI_EUVAT = 207;
31-
var CLI_IBAN = 208;
32-
var CLI_EXCEPTION = 209;
33-
var CLI_DATEFORMAT = 210;
34-
var CLI_INPUT = 211;
24+
const CLI_CONNECT = 201;
25+
const CLI_RESPONSE = 202;
26+
const CLI_NUMBER = 203;
27+
const CLI_NIP = 204;
28+
const CLI_REGON = 205;
29+
const CLI_KRS = 206;
30+
const CLI_EUVAT = 207;
31+
const CLI_IBAN = 208;
32+
const CLI_EXCEPTION = 209;
33+
const CLI_DATEFORMAT = 210;
34+
const CLI_INPUT = 211;
3535

36-
var codes = [
36+
const codes = [
3737
/* CLI_CONNECT */ 'Nie udało się nawiązać połączenia z serwisem NIP24',
3838
/* CLI_RESPONSE */ 'Odpowiedź serwisu NIP24 ma nieprawidłowy format',
3939
/* CLI_NUMBER */ 'Nieprawidłowy typ numeru',
@@ -50,7 +50,7 @@ var codes = [
5050
/**
5151
* Get error message
5252
* @param {int} code error code
53-
* @return {string} error message
53+
* @return {string|null} error message
5454
*/
5555
function message(code)
5656
{

lib/euvat.js

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

2121
'use strict';
2222

23-
var NIP = require('./nip');
23+
const NIP = require('./nip');
2424

2525

2626
/**
@@ -54,7 +54,7 @@ function isValid(nip)
5454
return false;
5555
}
5656

57-
var map = {
57+
const map = {
5858
'AT': /^ATU\\d{8}$/,
5959
'BE': /^BE0\\d{9}$/,
6060
'BG': /^BG\\d{9,10}$/,
@@ -85,8 +85,8 @@ function isValid(nip)
8585
'SK': /^SK\\d{10}$/
8686
};
8787

88-
var cc = nip.substr(0, 2);
89-
var num = nip.substr(2);
88+
const cc = nip.substr(0, 2);
89+
const num = nip.substr(2);
9090

9191
if (!(cc in map)) {
9292
return false;

lib/iban.js

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

@@ -52,7 +52,7 @@ function isValid(iban)
5252
return false;
5353
}
5454

55-
var map = {
55+
const map = {
5656
'AD': /^AD\\d{10}[A-Z0-9]{12}$/,
5757
'AE': /^AE\\d{21}$/,
5858
'AL': /^AL\\d{10}[A-Z0-9]{16}$/,
@@ -130,7 +130,7 @@ function isValid(iban)
130130
'XK': /^XK\\d{18}$/
131131
};
132132

133-
var cc = iban.substr(0, 2);
133+
const cc = iban.substr(0, 2);
134134

135135
if (!(cc in map)) {
136136
return false;
@@ -142,10 +142,10 @@ function isValid(iban)
142142

143143
iban = iban.substr(4) + iban.substr(0, 4);
144144

145-
var sb = '';
145+
let sb = '';
146146

147-
for (var i = 0; i < iban.length; i++) {
148-
var ord = iban.charCodeAt(i);
147+
for (let i = 0; i < iban.length; i++) {
148+
const ord = iban.charCodeAt(i);
149149

150150
if (ord >= 65 && ord <= 90) {
151151
sb += (ord - 55);

0 commit comments

Comments
 (0)