czech-data-box 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +16 -0
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.prettierrc.yaml +6 -0
- package/.vscode/launch.json +15 -0
- package/.vscode/settings.json +5 -0
- package/CHANGELOG.md +17 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +84 -0
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/eslint.config.js +26 -0
- package/examples/db_login_with_certificate.js +27 -0
- package/examples/db_search.js +27 -0
- package/examples/dm_operations.js +58 -0
- package/package.json +57 -0
- package/resources/certs/cacert_postsignum_vca4.pem +44 -0
- package/resources/wsdl/ChangePassword.wsdl +84 -0
- package/resources/wsdl/ChangePasswordTypes.xsd +69 -0
- package/resources/wsdl/ExtWs.wsdl +65 -0
- package/resources/wsdl/dbTypes.xsd +1688 -0
- package/resources/wsdl/db_access.wsdl +197 -0
- package/resources/wsdl/db_manipulations.wsdl +598 -0
- package/resources/wsdl/db_search.wsdl +362 -0
- package/resources/wsdl/dmBaseTypes.xsd +1497 -0
- package/resources/wsdl/dm_VoDZ.wsdl +212 -0
- package/resources/wsdl/dm_info.wsdl +412 -0
- package/resources/wsdl/dm_operations.wsdl +242 -0
- package/src/index.js +4 -0
- package/src/lib/ISDSBox.js +309 -0
- package/src/lib/ISDSSentOutFiles.js +84 -0
- package/src/lib/ISDSSoapClient.js +201 -0
- package/src/lib/config.js +64 -0
- package/src/models/DataBox.js +142 -0
- package/src/models/DataMessage.js +153 -0
- package/src/models/DataMessageFile.js +69 -0
- package/src/models/DataMessageFiles.js +23 -0
- package/test/ISDSBox.test.js +129 -0
- package/test/ISDSSentOutFiles.test.js +124 -0
- package/test/ISDSSoapClient.test.js +81 -0
- package/test/communication_test.pdf +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { constants } from 'crypto'; // Use the crypto module for constants
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import soap from 'soap';
|
|
4
|
+
import http from 'http';
|
|
5
|
+
import https from 'https';
|
|
6
|
+
import os from 'os';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
|
|
10
|
+
import { DEBUG } from './config.js';
|
|
11
|
+
|
|
12
|
+
// Ensure Buffer is available globally (mostly needed in non-Node.js environments)
|
|
13
|
+
if (typeof Buffer === 'undefined') {
|
|
14
|
+
global.Buffer = require('buffer').Buffer;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Define the dirname constant
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const dirname = path.dirname(__filename);
|
|
20
|
+
|
|
21
|
+
class ISDSSoapClient {
|
|
22
|
+
constructor(wsdl, options, debug = DEBUG) {
|
|
23
|
+
this.client = null;
|
|
24
|
+
this.wsdl = wsdl;
|
|
25
|
+
this.options = options;
|
|
26
|
+
this.debug = debug;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async init() {
|
|
30
|
+
try {
|
|
31
|
+
// Default wsdl_options
|
|
32
|
+
let wsdl_options = {
|
|
33
|
+
rejectUnauthorized: false,
|
|
34
|
+
secureOptions:
|
|
35
|
+
constants.SSL_OP_NO_SSLv3 |
|
|
36
|
+
constants.SSL_OP_NO_TLSv1 |
|
|
37
|
+
constants.SSL_OP_NO_TLSv1_1 |
|
|
38
|
+
constants.SSL_OP_NO_COMPRESSION,
|
|
39
|
+
ciphers: 'HIGH:!aNULL:!MD5:!3DES', // Only use strong ciphers
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Conditionally set SSL version for non-Windows systems
|
|
43
|
+
if (os.platform() !== 'win32') {
|
|
44
|
+
wsdl_options.secureProtocol = 'TLSv1_3_method'; // Example: force TLSv1.2
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Conditionally add client certificate, private key, and CA if loginType is 1
|
|
48
|
+
if (this.options.loginType === 1) {
|
|
49
|
+
(wsdl_options.cert = this.options.publicKey),
|
|
50
|
+
(wsdl_options.key = this.options.privateKey),
|
|
51
|
+
(wsdl_options.ca = fs.readFileSync(
|
|
52
|
+
path.join(
|
|
53
|
+
dirname,
|
|
54
|
+
'..',
|
|
55
|
+
'..',
|
|
56
|
+
'resources',
|
|
57
|
+
'certs',
|
|
58
|
+
'cacert_postsignum_vca4.pem',
|
|
59
|
+
),
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const clientOptions = {
|
|
64
|
+
...this.options,
|
|
65
|
+
wsdl_options,
|
|
66
|
+
httpClient: {
|
|
67
|
+
request: (rurl, data, callback, exheaders) => {
|
|
68
|
+
const headers = exheaders || {};
|
|
69
|
+
headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
|
70
|
+
|
|
71
|
+
const options = {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: headers,
|
|
74
|
+
rejectUnauthorized: wsdl_options.rejectUnauthorized,
|
|
75
|
+
followAllRedirects: true, // Equivalent to CURLOPT_FOLLOWLOCATION
|
|
76
|
+
timeout: 30000, // Set a timeout as needed
|
|
77
|
+
agentOptions: {
|
|
78
|
+
secureOptions: wsdl_options.secureOptions,
|
|
79
|
+
secureProtocol: wsdl_options.secureProtocol,
|
|
80
|
+
ciphers: wsdl_options.ciphers,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Conditionally add client certificate, private key, and CA if loginType is 1
|
|
85
|
+
if (this.options.loginType === 1) {
|
|
86
|
+
options.cert = wsdl_options.cert;
|
|
87
|
+
options.key = wsdl_options.key;
|
|
88
|
+
options.ca = wsdl_options.ca;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const protocol = /^https/.test(rurl) ? https : http;
|
|
92
|
+
|
|
93
|
+
const req = protocol.request(rurl, options, (res) => {
|
|
94
|
+
let body = '';
|
|
95
|
+
res.setEncoding('utf8');
|
|
96
|
+
res.on('data', (chunk) => {
|
|
97
|
+
body += chunk;
|
|
98
|
+
});
|
|
99
|
+
res.on('end', () => {
|
|
100
|
+
callback(null, res, body);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
req.on('error', (err) => {
|
|
105
|
+
console.error('Request error:', err); // Improved logging
|
|
106
|
+
callback(err);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
req.write(data);
|
|
110
|
+
req.end();
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
if (this.debug) {
|
|
116
|
+
console.log(`Initializing SOAP client with WSDL: ${this.wsdl}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
this.client = await soap.createClientAsync(this.wsdl, clientOptions);
|
|
120
|
+
|
|
121
|
+
// Override the endpoint URL with the one specified in the options
|
|
122
|
+
this.client.setEndpoint(this.options.location);
|
|
123
|
+
|
|
124
|
+
// Add common HTTP headers to each request
|
|
125
|
+
this.client.addHttpHeader('Method', 'POST');
|
|
126
|
+
this.client.addHttpHeader('Connection', 'Keep-Alive');
|
|
127
|
+
this.client.addHttpHeader('User-Agent', 'Node-SOAP-Client');
|
|
128
|
+
this.client.addHttpHeader('Content-Type', 'text/xml; charset=utf-8');
|
|
129
|
+
|
|
130
|
+
// Add Authorization header to each request
|
|
131
|
+
if (this.options.loginType === 0) {
|
|
132
|
+
this.client.setSecurity(
|
|
133
|
+
new soap.BasicAuthSecurity(this.options.login, this.options.password),
|
|
134
|
+
);
|
|
135
|
+
} else if (this.options.loginType === 1) {
|
|
136
|
+
const wsSecurity = new soap.WSSecurityCert(
|
|
137
|
+
this.options.privateKey,
|
|
138
|
+
this.options.publicKey,
|
|
139
|
+
this.options.passPhrase,
|
|
140
|
+
);
|
|
141
|
+
this.client.setSecurity(wsSecurity);
|
|
142
|
+
} else {
|
|
143
|
+
this.client.addHttpHeader(
|
|
144
|
+
'Authorization',
|
|
145
|
+
`Basic ${Buffer.from(`${this.options.login}:${this.options.password}`).toString('base64')}`,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Enable debug logging if necessary
|
|
150
|
+
if (this.debug === true) {
|
|
151
|
+
this.client.on('request', (xml) => {
|
|
152
|
+
console.log('Request:', xml);
|
|
153
|
+
fs.writeFile('soap-request-debug.xml', xml, (err) => {
|
|
154
|
+
if (err) {
|
|
155
|
+
console.error('Error writing XML to file:', err);
|
|
156
|
+
} else {
|
|
157
|
+
console.log(
|
|
158
|
+
'XML request successfully written to file request.xml',
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
this.client.on('response', (xml, response) => {
|
|
164
|
+
console.log('Response:', response);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error('Error initializing SOAP client:', error);
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async request(method, args) {
|
|
174
|
+
if (!this.client) {
|
|
175
|
+
await this.init();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (this.debug) {
|
|
179
|
+
console.log(
|
|
180
|
+
`Making SOAP request to method: ${method} with args: ${JSON.stringify(args)}`,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
const result = await this.client[`${method}Async`](args);
|
|
185
|
+
if (this.debug === true) {
|
|
186
|
+
console.log(`SOAP Response for method ${method}:`, result);
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
} catch (error) {
|
|
190
|
+
console.error(`Error in SOAP request for method ${method}:`, error);
|
|
191
|
+
if (error.response) {
|
|
192
|
+
console.error('Error Response Data:', error.response.data);
|
|
193
|
+
console.error('Error Response Status:', error.response.status);
|
|
194
|
+
console.error('Error Response Headers:', error.response.headers);
|
|
195
|
+
}
|
|
196
|
+
throw error;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export default ISDSSoapClient;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// config.js
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
export const DEBUG = false; // Set to true to enable debug mode globally
|
|
5
|
+
|
|
6
|
+
function getServiceURL(serviceType, loginType, productionMode) {
|
|
7
|
+
let baseURL = 'https://ws1';
|
|
8
|
+
if (loginType !== 0) {
|
|
9
|
+
baseURL += 'c';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (productionMode === false) {
|
|
13
|
+
baseURL += '.czebox.cz/';
|
|
14
|
+
} else if (productionMode === true) {
|
|
15
|
+
baseURL += '.mojedatovaschranka.cz/';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (loginType === 1) {
|
|
19
|
+
baseURL += 'cert/';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
baseURL += 'DS/';
|
|
23
|
+
|
|
24
|
+
switch (serviceType) {
|
|
25
|
+
case 0:
|
|
26
|
+
return `${baseURL}dz`;
|
|
27
|
+
case 1:
|
|
28
|
+
return `${baseURL}dx`;
|
|
29
|
+
case 2:
|
|
30
|
+
return `${baseURL}DsManage`;
|
|
31
|
+
case 3:
|
|
32
|
+
return `${baseURL}DsManage`;
|
|
33
|
+
case 4:
|
|
34
|
+
return `${baseURL}df`;
|
|
35
|
+
default:
|
|
36
|
+
throw new Error('Invalid service type');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getServiceWSDL(serviceType) {
|
|
41
|
+
const directory = path.join(
|
|
42
|
+
path.dirname(new URL(import.meta.url).pathname),
|
|
43
|
+
'..',
|
|
44
|
+
'..',
|
|
45
|
+
'resources',
|
|
46
|
+
'wsdl',
|
|
47
|
+
);
|
|
48
|
+
switch (serviceType) {
|
|
49
|
+
case 0:
|
|
50
|
+
return path.join(directory, 'dm_operations.wsdl');
|
|
51
|
+
case 1:
|
|
52
|
+
return path.join(directory, 'dm_info.wsdl');
|
|
53
|
+
case 2:
|
|
54
|
+
return path.join(directory, 'db_manipulations.wsdl');
|
|
55
|
+
case 3:
|
|
56
|
+
return path.join(directory, 'db_access.wsdl');
|
|
57
|
+
case 4:
|
|
58
|
+
return path.join(directory, 'db_search.wsdl');
|
|
59
|
+
default:
|
|
60
|
+
throw new Error('Invalid service type');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { getServiceURL, getServiceWSDL };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// src/models/DataBox.js
|
|
2
|
+
class DataBox {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.dbOwnerInfo = {};
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
setDbId(value) {
|
|
8
|
+
this.dbOwnerInfo.dbID = value;
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setDbType(value) {
|
|
13
|
+
this.dbOwnerInfo.dbType = value;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
setIc(value) {
|
|
18
|
+
this.dbOwnerInfo.ic = value;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
setPnFirstName(value) {
|
|
23
|
+
this.dbOwnerInfo.pnFirstName = value;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setPnMiddleName(value) {
|
|
28
|
+
this.dbOwnerInfo.pnMiddleName = value;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
setPnLastName(value) {
|
|
33
|
+
this.dbOwnerInfo.pnLastName = value;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setPnLastNameAtBirth(value) {
|
|
38
|
+
this.dbOwnerInfo.pnLastNameAtBirth = value;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
setFirmName(value) {
|
|
43
|
+
this.dbOwnerInfo.firmName = value;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setBiDate(value) {
|
|
48
|
+
this.dbOwnerInfo.biDate = value;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
setBiCity(value) {
|
|
53
|
+
this.dbOwnerInfo.biCity = value;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setBiCounty(value) {
|
|
58
|
+
this.dbOwnerInfo.biCounty = value;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setBiState(value) {
|
|
63
|
+
this.dbOwnerInfo.biState = value;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setAdCity(value) {
|
|
68
|
+
this.dbOwnerInfo.adCity = value;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setAdStreet(value) {
|
|
73
|
+
this.dbOwnerInfo.adStreet = value;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
setAdNumberInStreet(value) {
|
|
78
|
+
this.dbOwnerInfo.adNumberInStreet = value;
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
setAdNumberInMunicipality(value) {
|
|
83
|
+
this.dbOwnerInfo.adNumberInMunicipality = value;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setAdZipCode(value) {
|
|
88
|
+
this.dbOwnerInfo.adZipCode = value;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
setAdState(value) {
|
|
93
|
+
this.dbOwnerInfo.adState = value;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
setNationality(value) {
|
|
98
|
+
this.dbOwnerInfo.nationality = value;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
setEmail(value) {
|
|
103
|
+
this.dbOwnerInfo.email = value;
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
setTelNumber(value) {
|
|
108
|
+
this.dbOwnerInfo.telNumber = value;
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
setIdentifier(value) {
|
|
113
|
+
this.dbOwnerInfo.identifier = value;
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
setRegistryCode(value) {
|
|
118
|
+
this.dbOwnerInfo.registryCode = value;
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
setDbState(value) {
|
|
123
|
+
this.dbOwnerInfo.dbState = value;
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setDbEffectiveOVM(value) {
|
|
128
|
+
this.dbOwnerInfo.dbEffectiveOVM = value;
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
setDbOpenAddressing(value) {
|
|
133
|
+
this.dbOwnerInfo.dbOpenAddressing = value;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
build() {
|
|
138
|
+
return { dbOwnerInfo: this.dbOwnerInfo };
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export default DataBox;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// models/DataMessage.js
|
|
2
|
+
class DataMessage {
|
|
3
|
+
constructor({
|
|
4
|
+
dmSenderOrgUnit = null,
|
|
5
|
+
dmSenderOrgUnitNum = null,
|
|
6
|
+
dbIDRecipient = null,
|
|
7
|
+
dmRecipientOrgUnit = null,
|
|
8
|
+
dmRecipientOrgUnitNum = null,
|
|
9
|
+
dmToHands = null,
|
|
10
|
+
dmAnnotation = null,
|
|
11
|
+
dmRecipientRefNumber = null,
|
|
12
|
+
dmSenderRefNumber = null,
|
|
13
|
+
dmRecipientIdent = null,
|
|
14
|
+
dmSenderIdent = null,
|
|
15
|
+
dmLegalTitleLaw = null,
|
|
16
|
+
dmLegalTitleYear = null,
|
|
17
|
+
dmLegalTitleSect = null,
|
|
18
|
+
dmLegalTitlePar = null,
|
|
19
|
+
dmLegalTitlePoint = null,
|
|
20
|
+
dmPersonalDelivery = false,
|
|
21
|
+
dmAllowSubstDelivery = false,
|
|
22
|
+
dmOVM = false,
|
|
23
|
+
dmPublishOwnID = false,
|
|
24
|
+
} = {}) {
|
|
25
|
+
this.dmSenderOrgUnit = dmSenderOrgUnit;
|
|
26
|
+
this.dmSenderOrgUnitNum = dmSenderOrgUnitNum;
|
|
27
|
+
this.dbIDRecipient = dbIDRecipient;
|
|
28
|
+
this.dmRecipientOrgUnit = dmRecipientOrgUnit;
|
|
29
|
+
this.dmRecipientOrgUnitNum = dmRecipientOrgUnitNum;
|
|
30
|
+
this.dmToHands = dmToHands;
|
|
31
|
+
this.dmAnnotation = dmAnnotation;
|
|
32
|
+
this.dmRecipientRefNumber = dmRecipientRefNumber;
|
|
33
|
+
this.dmSenderRefNumber = dmSenderRefNumber;
|
|
34
|
+
this.dmRecipientIdent = dmRecipientIdent;
|
|
35
|
+
this.dmSenderIdent = dmSenderIdent;
|
|
36
|
+
this.dmLegalTitleLaw = dmLegalTitleLaw;
|
|
37
|
+
this.dmLegalTitleYear = dmLegalTitleYear;
|
|
38
|
+
this.dmLegalTitleSect = dmLegalTitleSect;
|
|
39
|
+
this.dmLegalTitlePar = dmLegalTitlePar;
|
|
40
|
+
this.dmLegalTitlePoint = dmLegalTitlePoint;
|
|
41
|
+
this.dmPersonalDelivery = dmPersonalDelivery;
|
|
42
|
+
this.dmAllowSubstDelivery = dmAllowSubstDelivery;
|
|
43
|
+
this.dmOVM = dmOVM;
|
|
44
|
+
this.dmPublishOwnID = dmPublishOwnID;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setDmSenderOrgUnit(value) {
|
|
48
|
+
this.dmSenderOrgUnit = value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setDmSenderOrgUnitNum(value) {
|
|
52
|
+
this.dmSenderOrgUnitNum = value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setDbIDRecipient(value) {
|
|
56
|
+
this.dbIDRecipient = value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setDmRecipientOrgUnit(value) {
|
|
60
|
+
this.dmRecipientOrgUnit = value;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
setDmRecipientOrgUnitNum(value) {
|
|
64
|
+
this.dmRecipientOrgUnitNum = value;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setDmToHands(value) {
|
|
68
|
+
this.dmToHands = value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
setDmAnnotation(value) {
|
|
72
|
+
this.dmAnnotation = value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setDmRecipientRefNumber(value) {
|
|
76
|
+
this.dmRecipientRefNumber = value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
setDmSenderRefNumber(value) {
|
|
80
|
+
this.dmSenderRefNumber = value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
setDmRecipientIdent(value) {
|
|
84
|
+
this.dmRecipientIdent = value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setDmSenderIdent(value) {
|
|
88
|
+
this.dmSenderIdent = value;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setDmLegalTitleLaw(value) {
|
|
92
|
+
this.dmLegalTitleLaw = value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
setDmLegalTitleYear(value) {
|
|
96
|
+
this.dmLegalTitleYear = value;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
setDmLegalTitleSect(value) {
|
|
100
|
+
this.dmLegalTitleSect = value;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setDmLegalTitlePar(value) {
|
|
104
|
+
this.dmLegalTitlePar = value;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
setDmLegalTitlePoint(value) {
|
|
108
|
+
this.dmLegalTitlePoint = value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
setDmPersonalDelivery(value) {
|
|
112
|
+
this.dmPersonalDelivery = value;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
setDmAllowSubstDelivery(value) {
|
|
116
|
+
this.dmAllowSubstDelivery = value;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
setDmOVM(value) {
|
|
120
|
+
this.dmOVM = value;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
setDmPublishOwnID(value) {
|
|
124
|
+
this.dmPublishOwnID = value;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
build() {
|
|
128
|
+
return {
|
|
129
|
+
dmSenderOrgUnit: this.dmSenderOrgUnit,
|
|
130
|
+
dmSenderOrgUnitNum: this.dmSenderOrgUnitNum,
|
|
131
|
+
dbIDRecipient: this.dbIDRecipient,
|
|
132
|
+
dmRecipientOrgUnit: this.dmRecipientOrgUnit,
|
|
133
|
+
dmRecipientOrgUnitNum: this.dmRecipientOrgUnitNum,
|
|
134
|
+
dmToHands: this.dmToHands,
|
|
135
|
+
dmAnnotation: this.dmAnnotation,
|
|
136
|
+
dmRecipientRefNumber: this.dmRecipientRefNumber,
|
|
137
|
+
dmSenderRefNumber: this.dmSenderRefNumber,
|
|
138
|
+
dmRecipientIdent: this.dmRecipientIdent,
|
|
139
|
+
dmSenderIdent: this.dmSenderIdent,
|
|
140
|
+
dmLegalTitleLaw: this.dmLegalTitleLaw,
|
|
141
|
+
dmLegalTitleYear: this.dmLegalTitleYear,
|
|
142
|
+
dmLegalTitleSect: this.dmLegalTitleSect,
|
|
143
|
+
dmLegalTitlePar: this.dmLegalTitlePar,
|
|
144
|
+
dmLegalTitlePoint: this.dmLegalTitlePoint,
|
|
145
|
+
dmPersonalDelivery: this.dmPersonalDelivery,
|
|
146
|
+
dmAllowSubstDelivery: this.dmAllowSubstDelivery,
|
|
147
|
+
dmOVM: this.dmOVM,
|
|
148
|
+
dmPublishOwnID: this.dmPublishOwnID,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export default DataMessage;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
class DataMessageFile {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.dmEncodedContent = null;
|
|
4
|
+
this.dmXMLContent = null;
|
|
5
|
+
this.dmMimeType = null;
|
|
6
|
+
this.dmFileMetaType = null;
|
|
7
|
+
this.dmFileDescr = null;
|
|
8
|
+
this.dmFileGuid = null;
|
|
9
|
+
this.dmUpFileGuid = null;
|
|
10
|
+
this.dmFormat = null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
setDmEncodedContent(value) {
|
|
14
|
+
this.dmEncodedContent = value;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
setDmXMLContent(value) {
|
|
18
|
+
this.dmXMLContent = value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setDmMimeType(value) {
|
|
22
|
+
this.dmMimeType = value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
setDmFileMetaType(value) {
|
|
26
|
+
this.dmFileMetaType = value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setDmFileDescr(value) {
|
|
30
|
+
this.dmFileDescr = value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setDmFileGuid(value) {
|
|
34
|
+
this.dmFileGuid = value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setDmUpFileGuid(value) {
|
|
38
|
+
this.dmUpFileGuid = value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setDmFormat(value) {
|
|
42
|
+
this.dmFormat = value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
build() {
|
|
46
|
+
const attributes = {
|
|
47
|
+
dmMimeType: this.dmMimeType || '',
|
|
48
|
+
dmFileMetaType: this.dmFileMetaType || '',
|
|
49
|
+
dmFileDescr: this.dmFileDescr || '',
|
|
50
|
+
dmFileGuid: this.dmFileGuid || '',
|
|
51
|
+
dmUpFileGuid: this.dmUpFileGuid || '',
|
|
52
|
+
dmFormat: this.dmFormat || '',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const fileObject = {
|
|
56
|
+
attributes: attributes,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (this.dmEncodedContent) {
|
|
60
|
+
fileObject.dmEncodedContent = this.dmEncodedContent;
|
|
61
|
+
} else if (this.dmXMLContent) {
|
|
62
|
+
fileObject.dmXMLContent = this.dmXMLContent;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return fileObject;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default DataMessageFile;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import DataMessageFile from './DataMessageFile.js';
|
|
2
|
+
|
|
3
|
+
class DataMessageFiles {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.files = [];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
addFile(file) {
|
|
9
|
+
if (file instanceof DataMessageFile) {
|
|
10
|
+
this.files.push(file.build());
|
|
11
|
+
} else {
|
|
12
|
+
throw new Error('Invalid file type');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
build() {
|
|
17
|
+
return {
|
|
18
|
+
dmFile: this.files,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default DataMessageFiles;
|