@orchesty/connector-wflow 1.0.0 → 1.0.1

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/coverage/clover.xml +247 -0
  3. package/coverage/coverage-final.json +10 -0
  4. package/coverage/lcov-report/base.css +224 -0
  5. package/coverage/lcov-report/block-navigation.js +87 -0
  6. package/coverage/lcov-report/favicon.png +0 -0
  7. package/coverage/lcov-report/index.html +161 -0
  8. package/coverage/lcov-report/prettify.css +1 -0
  9. package/coverage/lcov-report/prettify.js +2 -0
  10. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  11. package/coverage/lcov-report/sorter.js +210 -0
  12. package/coverage/lcov-report/src/Batch/WflowSubscribeWebhookBatch.ts.html +325 -0
  13. package/coverage/lcov-report/src/Batch/WflowUnsubscribeWebhookBatch.ts.html +250 -0
  14. package/coverage/lcov-report/src/Batch/index.html +131 -0
  15. package/coverage/lcov-report/src/Connector/WflowGetDocumentConnector.ts.html +1108 -0
  16. package/coverage/lcov-report/src/Connector/WflowGetDocumentTypesConnector.ts.html +292 -0
  17. package/coverage/lcov-report/src/Connector/WflowGetOrganizationsConnector.ts.html +205 -0
  18. package/coverage/lcov-report/src/Connector/WflowPutDocumentConnector.ts.html +541 -0
  19. package/coverage/lcov-report/src/Connector/WflowUpdateDocumentStateConnector.ts.html +202 -0
  20. package/coverage/lcov-report/src/Connector/index.html +176 -0
  21. package/coverage/lcov-report/src/WflowApplication.ts.html +535 -0
  22. package/coverage/lcov-report/src/index.html +116 -0
  23. package/coverage/lcov-report/test/dataProvider.ts.html +256 -0
  24. package/coverage/lcov-report/test/index.html +116 -0
  25. package/coverage/lcov.info +389 -0
  26. package/dist/Connector/WflowGetDocumentTypesConnector.d.ts +36 -0
  27. package/dist/Connector/WflowGetDocumentTypesConnector.js +28 -0
  28. package/dist/WflowApplication.d.ts +1 -0
  29. package/dist/WflowApplication.js +7 -0
  30. package/dist/package.json +1 -1
  31. package/package.json +1 -1
  32. package/src/Connector/WflowGetDocumentTypesConnector.ts +69 -0
  33. package/src/Connector/__tests__/Data/WflowGetDocumentTypesConnector/input.json +7 -0
  34. package/src/Connector/__tests__/Data/WflowGetDocumentTypesConnector/mock.json +32 -0
  35. package/src/Connector/__tests__/Data/WflowGetDocumentTypesConnector/output.json +28 -0
  36. package/src/Connector/__tests__/WflowGetDocumentTypesConnector.ts +17 -0
  37. package/src/WflowApplication.ts +10 -0
  38. package/test/dataProvider.ts +2 -0
  39. package/tsconfig.json +2 -2
  40. package/tsconfig.prod.tsbuildinfo +1 -1
@@ -0,0 +1,389 @@
1
+ TN:
2
+ SF:src/WflowApplication.ts
3
+ FN:23,(anonymous_10)
4
+ FN:38,(anonymous_11)
5
+ FN:45,(anonymous_12)
6
+ FN:49,(anonymous_13)
7
+ FN:53,(anonymous_14)
8
+ FN:57,(anonymous_15)
9
+ FN:61,(anonymous_16)
10
+ FN:73,(anonymous_17)
11
+ FN:89,(anonymous_18)
12
+ FN:99,(anonymous_19)
13
+ FN:103,(anonymous_20)
14
+ FN:107,(anonymous_21)
15
+ FN:111,(anonymous_22)
16
+ FN:115,(anonymous_23)
17
+ FN:119,(anonymous_24)
18
+ FN:129,(anonymous_25)
19
+ FN:137,(anonymous_26)
20
+ FNF:17
21
+ FNH:6
22
+ FNDA:7,(anonymous_10)
23
+ FNDA:7,(anonymous_11)
24
+ FNDA:14,(anonymous_12)
25
+ FNDA:0,(anonymous_13)
26
+ FNDA:0,(anonymous_14)
27
+ FNDA:0,(anonymous_15)
28
+ FNDA:0,(anonymous_16)
29
+ FNDA:5,(anonymous_17)
30
+ FNDA:1,(anonymous_18)
31
+ FNDA:0,(anonymous_19)
32
+ FNDA:0,(anonymous_20)
33
+ FNDA:0,(anonymous_21)
34
+ FNDA:0,(anonymous_22)
35
+ FNDA:1,(anonymous_23)
36
+ FNDA:0,(anonymous_24)
37
+ FNDA:0,(anonymous_25)
38
+ FNDA:0,(anonymous_26)
39
+ DA:1,7
40
+ DA:3,7
41
+ DA:4,7
42
+ DA:5,7
43
+ DA:6,7
44
+ DA:9,7
45
+ DA:10,7
46
+ DA:11,7
47
+ DA:12,7
48
+ DA:15,7
49
+ DA:16,7
50
+ DA:19,7
51
+ DA:20,7
52
+ DA:21,7
53
+ DA:23,7
54
+ DA:24,7
55
+ DA:25,7
56
+ DA:26,7
57
+ DA:27,7
58
+ DA:28,7
59
+ DA:29,7
60
+ DA:30,7
61
+ DA:31,7
62
+ DA:32,7
63
+ DA:33,7
64
+ DA:36,7
65
+ DA:40,7
66
+ DA:42,7
67
+ DA:46,14
68
+ DA:50,0
69
+ DA:54,0
70
+ DA:58,0
71
+ DA:62,0
72
+ DA:80,5
73
+ DA:84,5
74
+ DA:86,5
75
+ DA:90,1
76
+ DA:92,1
77
+ DA:93,0
78
+ DA:96,1
79
+ DA:100,0
80
+ DA:104,0
81
+ DA:108,0
82
+ DA:112,0
83
+ DA:116,1
84
+ DA:120,0
85
+ DA:129,0
86
+ DA:130,0
87
+ DA:132,0
88
+ DA:133,0
89
+ DA:137,0
90
+ DA:139,0
91
+ LF:52
92
+ LH:36
93
+ BRDA:23,0,0,7
94
+ BRDA:23,0,1,7
95
+ BRDA:84,1,0,5
96
+ BRDA:84,1,1,0
97
+ BRDA:92,2,0,0
98
+ BRDA:92,2,1,1
99
+ BRDA:132,3,0,0
100
+ BRDA:132,3,1,0
101
+ BRF:8
102
+ BRH:4
103
+ end_of_record
104
+ TN:
105
+ SF:src/Batch/WflowSubscribeWebhookBatch.ts
106
+ FN:14,(anonymous_1)
107
+ FN:18,(anonymous_2)
108
+ FN:28,(anonymous_3)
109
+ FN:31,(anonymous_4)
110
+ FN:32,(anonymous_5)
111
+ FNF:5
112
+ FNH:2
113
+ FNDA:7,(anonymous_1)
114
+ FNDA:1,(anonymous_2)
115
+ FNDA:0,(anonymous_3)
116
+ FNDA:0,(anonymous_4)
117
+ FNDA:0,(anonymous_5)
118
+ DA:1,7
119
+ DA:3,7
120
+ DA:4,7
121
+ DA:5,7
122
+ DA:7,7
123
+ DA:8,7
124
+ DA:10,7
125
+ DA:12,7
126
+ DA:15,7
127
+ DA:19,1
128
+ DA:20,1
129
+ DA:22,1
130
+ DA:23,1
131
+ DA:25,1
132
+ DA:28,0
133
+ DA:30,1
134
+ DA:31,0
135
+ DA:32,0
136
+ DA:36,1
137
+ DA:37,1
138
+ DA:41,0
139
+ DA:42,0
140
+ DA:43,0
141
+ DA:46,0
142
+ DA:47,0
143
+ DA:62,0
144
+ DA:66,0
145
+ DA:77,0
146
+ LF:28
147
+ LH:17
148
+ BRDA:36,0,0,1
149
+ BRDA:36,0,1,0
150
+ BRDA:42,1,0,0
151
+ BRDA:42,1,1,0
152
+ BRF:4
153
+ BRH:1
154
+ end_of_record
155
+ TN:
156
+ SF:src/Batch/WflowUnsubscribeWebhookBatch.ts
157
+ FN:13,(anonymous_1)
158
+ FN:17,(anonymous_2)
159
+ FNF:2
160
+ FNH:2
161
+ FNDA:7,(anonymous_1)
162
+ FNDA:1,(anonymous_2)
163
+ DA:1,7
164
+ DA:3,7
165
+ DA:4,7
166
+ DA:5,7
167
+ DA:7,7
168
+ DA:9,7
169
+ DA:11,7
170
+ DA:14,7
171
+ DA:18,1
172
+ DA:19,1
173
+ DA:20,1
174
+ DA:22,1
175
+ DA:27,1
176
+ DA:28,1
177
+ DA:32,0
178
+ DA:33,0
179
+ DA:34,0
180
+ DA:37,0
181
+ DA:44,0
182
+ DA:46,0
183
+ DA:47,0
184
+ DA:48,0
185
+ DA:51,0
186
+ DA:52,0
187
+ LF:24
188
+ LH:14
189
+ BRDA:27,0,0,1
190
+ BRDA:27,0,1,0
191
+ BRDA:33,1,0,0
192
+ BRDA:33,1,1,0
193
+ BRDA:46,2,0,0
194
+ BRDA:46,2,1,0
195
+ BRF:6
196
+ BRH:1
197
+ end_of_record
198
+ TN:
199
+ SF:src/Connector/WflowGetDocumentConnector.ts
200
+ FN:10,(anonymous_1)
201
+ FN:14,(anonymous_2)
202
+ FNF:2
203
+ FNH:2
204
+ FNDA:7,(anonymous_1)
205
+ FNDA:1,(anonymous_2)
206
+ DA:1,7
207
+ DA:2,7
208
+ DA:4,7
209
+ DA:6,7
210
+ DA:8,7
211
+ DA:11,7
212
+ DA:15,1
213
+ DA:16,1
214
+ DA:17,1
215
+ DA:18,1
216
+ DA:20,1
217
+ DA:27,1
218
+ DA:29,1
219
+ LF:13
220
+ LH:13
221
+ BRF:0
222
+ BRH:0
223
+ end_of_record
224
+ TN:
225
+ SF:src/Connector/WflowGetDocumentTypesConnector.ts
226
+ FN:10,(anonymous_1)
227
+ FN:14,(anonymous_2)
228
+ FN:18,(anonymous_3)
229
+ FNF:3
230
+ FNH:3
231
+ FNDA:7,(anonymous_1)
232
+ FNDA:7,(anonymous_2)
233
+ FNDA:1,(anonymous_3)
234
+ DA:1,7
235
+ DA:2,7
236
+ DA:4,7
237
+ DA:6,7
238
+ DA:8,7
239
+ DA:10,7
240
+ DA:11,7
241
+ DA:15,7
242
+ DA:19,1
243
+ DA:20,1
244
+ DA:22,1
245
+ DA:29,1
246
+ DA:31,1
247
+ LF:13
248
+ LH:13
249
+ BRDA:10,0,0,7
250
+ BRDA:20,1,0,0
251
+ BRDA:20,1,1,1
252
+ BRF:3
253
+ BRH:2
254
+ end_of_record
255
+ TN:
256
+ SF:src/Connector/WflowGetOrganizationsConnector.ts
257
+ FN:10,(anonymous_1)
258
+ FN:14,(anonymous_2)
259
+ FN:18,(anonymous_3)
260
+ FNF:3
261
+ FNH:3
262
+ FNDA:7,(anonymous_1)
263
+ FNDA:7,(anonymous_2)
264
+ FNDA:1,(anonymous_3)
265
+ DA:1,7
266
+ DA:2,7
267
+ DA:4,7
268
+ DA:6,7
269
+ DA:8,7
270
+ DA:10,7
271
+ DA:11,7
272
+ DA:15,7
273
+ DA:19,1
274
+ DA:21,1
275
+ DA:28,1
276
+ DA:30,1
277
+ LF:12
278
+ LH:12
279
+ BRDA:10,0,0,7
280
+ BRDA:23,1,0,0
281
+ BRDA:23,1,1,1
282
+ BRF:3
283
+ BRH:2
284
+ end_of_record
285
+ TN:
286
+ SF:src/Connector/WflowPutDocumentConnector.ts
287
+ FN:10,(anonymous_1)
288
+ FN:14,(anonymous_2)
289
+ FNF:2
290
+ FNH:2
291
+ FNDA:7,(anonymous_1)
292
+ FNDA:1,(anonymous_2)
293
+ DA:1,7
294
+ DA:2,7
295
+ DA:4,7
296
+ DA:6,7
297
+ DA:8,7
298
+ DA:11,7
299
+ DA:15,1
300
+ DA:16,1
301
+ DA:17,1
302
+ DA:19,1
303
+ DA:20,1
304
+ DA:21,1
305
+ DA:22,1
306
+ DA:25,1
307
+ DA:27,1
308
+ DA:35,1
309
+ DA:37,1
310
+ LF:17
311
+ LH:17
312
+ BRDA:20,0,0,0
313
+ BRDA:20,0,1,1
314
+ BRDA:21,1,0,0
315
+ BRDA:21,1,1,1
316
+ BRDA:22,2,0,0
317
+ BRDA:22,2,1,1
318
+ BRDA:31,3,0,0
319
+ BRDA:31,3,1,1
320
+ BRF:8
321
+ BRH:4
322
+ end_of_record
323
+ TN:
324
+ SF:src/Connector/WflowUpdateDocumentStateConnector.ts
325
+ FN:10,(anonymous_1)
326
+ FN:14,(anonymous_2)
327
+ FNF:2
328
+ FNH:2
329
+ FNDA:7,(anonymous_1)
330
+ FNDA:1,(anonymous_2)
331
+ DA:1,7
332
+ DA:2,7
333
+ DA:4,7
334
+ DA:6,7
335
+ DA:8,7
336
+ DA:11,7
337
+ DA:15,1
338
+ DA:16,1
339
+ DA:17,1
340
+ DA:20,1
341
+ DA:22,1
342
+ DA:29,1
343
+ DA:30,1
344
+ LF:13
345
+ LH:13
346
+ BRF:0
347
+ BRH:0
348
+ end_of_record
349
+ TN:
350
+ SF:test/dataProvider.ts
351
+ FN:19,init
352
+ FNF:1
353
+ FNH:1
354
+ FNDA:7,init
355
+ DA:1,7
356
+ DA:2,7
357
+ DA:3,7
358
+ DA:4,7
359
+ DA:5,7
360
+ DA:6,7
361
+ DA:7,7
362
+ DA:8,7
363
+ DA:9,7
364
+ DA:10,7
365
+ DA:11,7
366
+ DA:12,7
367
+ DA:13,7
368
+ DA:14,7
369
+ DA:15,7
370
+ DA:16,7
371
+ DA:17,7
372
+ DA:19,7
373
+ DA:20,7
374
+ DA:33,7
375
+ DA:46,7
376
+ DA:47,7
377
+ DA:48,7
378
+ DA:50,7
379
+ DA:51,7
380
+ DA:52,7
381
+ DA:53,7
382
+ DA:54,7
383
+ DA:55,7
384
+ DA:56,7
385
+ LF:30
386
+ LH:30
387
+ BRF:0
388
+ BRH:0
389
+ end_of_record
@@ -0,0 +1,36 @@
1
+ import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
2
+ import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
3
+ export declare const NAME = "wflow-get-document-types-connector";
4
+ export default class WflowGetDocumentTypesConnector extends AConnector {
5
+ private readonly useInForm;
6
+ constructor(useInForm?: boolean);
7
+ getName(): string;
8
+ processAction(dto: ProcessDto): Promise<ProcessDto<IOutput[]>>;
9
+ }
10
+ export interface IOutput {
11
+ id: string;
12
+ name: string;
13
+ kind: string;
14
+ default: boolean;
15
+ erpExclude: boolean;
16
+ filesExtendName: boolean;
17
+ docCreatingMethod: string;
18
+ autoStamp: string;
19
+ serie?: {
20
+ id: string;
21
+ externalId?: string;
22
+ code?: string;
23
+ description?: string;
24
+ isValid?: boolean;
25
+ kind?: string;
26
+ invoiceType?: string;
27
+ };
28
+ sequence?: {
29
+ id: string;
30
+ entity?: string;
31
+ description?: string;
32
+ fixedPart?: string;
33
+ counter?: string;
34
+ };
35
+ invoiceType?: string;
36
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NAME = void 0;
7
+ const AConnector_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Connector/AConnector"));
8
+ const HttpMethods_1 = require("@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods");
9
+ const WflowApplication_1 = require("../WflowApplication");
10
+ exports.NAME = `${WflowApplication_1.NAME}-get-document-types-connector`;
11
+ class WflowGetDocumentTypesConnector extends AConnector_1.default {
12
+ useInForm;
13
+ constructor(useInForm = false) {
14
+ super();
15
+ this.useInForm = useInForm;
16
+ }
17
+ getName() {
18
+ return exports.NAME;
19
+ }
20
+ async processAction(dto) {
21
+ const application = this.getApplication();
22
+ const applicationInstall = await this.getApplicationInstallFromProcess(dto, this.useInForm ? null : true);
23
+ const requestDto = application.getRequestDto(dto, applicationInstall, HttpMethods_1.HttpMethods.GET, `/${application.getOrganization(applicationInstall)}/documents/types?pageSize=100`);
24
+ const responseDto = await this.getSender().send(requestDto);
25
+ return dto.setNewJsonData(responseDto.getJsonBody().items);
26
+ }
27
+ }
28
+ exports.default = WflowGetDocumentTypesConnector;
@@ -31,6 +31,7 @@ export default class WflowApplication extends AOAuth2Application {
31
31
  getLogo(): string;
32
32
  getFormStack(): FormStack;
33
33
  getRequestDto(dto: AProcessDto, applicationInstall: ApplicationInstall, method: HttpMethods, path?: string, data?: unknown): RequestDto;
34
+ getOrganization(applicationInstall: ApplicationInstall): string;
34
35
  getAuthUrl(): string;
35
36
  getTokenUrl(): string;
36
37
  getScopes(): string[];
@@ -97,6 +97,13 @@ class WflowApplication extends AOAuth2Application_1.default {
97
97
  const url = new URL(`/api${path ?? ''}`, 'https://api.wflow.com').href;
98
98
  return new RequestDto_1.default(url, method, dto, data, headers);
99
99
  }
100
+ getOrganization(applicationInstall) {
101
+ const organization = applicationInstall.getSettings()[exports.ORGANIZATION_FORM]?.[exports.ORGANIZATION];
102
+ if (!organization) {
103
+ throw Error('Organization is not set.');
104
+ }
105
+ return organization;
106
+ }
100
107
  getAuthUrl() {
101
108
  return 'https://account.wflow.com/connect/authorize';
102
109
  }
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orchesty/connector-wflow",
3
3
  "description": "",
4
- "version": "0.0.0",
4
+ "version": "1.0.0",
5
5
  "license": "Apache-2.0",
6
6
  "url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
7
  "repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orchesty/connector-wflow",
3
3
  "description": "",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "license": "Apache-2.0",
6
6
  "url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
7
  "repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
@@ -0,0 +1,69 @@
1
+ import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
2
+ import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
3
+ import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
4
+ import WflowApplication, { NAME as WFLOW_APPLICATION } from '../WflowApplication';
5
+
6
+ export const NAME = `${WFLOW_APPLICATION}-get-document-types-connector`;
7
+
8
+ export default class WflowGetDocumentTypesConnector extends AConnector {
9
+
10
+ public constructor(private readonly useInForm = false) {
11
+ super();
12
+ }
13
+
14
+ public getName(): string {
15
+ return NAME;
16
+ }
17
+
18
+ public async processAction(dto: ProcessDto): Promise<ProcessDto<IOutput[]>> {
19
+ const application = this.getApplication<WflowApplication>();
20
+ const applicationInstall = await this.getApplicationInstallFromProcess(dto, this.useInForm ? null : true);
21
+
22
+ const requestDto = application.getRequestDto(
23
+ dto,
24
+ applicationInstall,
25
+ HttpMethods.GET,
26
+ `/${application.getOrganization(applicationInstall)}/documents/types?pageSize=100`,
27
+ );
28
+
29
+ const responseDto = await this.getSender().send<IResponse>(requestDto);
30
+
31
+ return dto.setNewJsonData(responseDto.getJsonBody().items);
32
+ }
33
+
34
+ }
35
+
36
+ export interface IOutput {
37
+ id: string;
38
+ name: string;
39
+ kind: string;
40
+ default: boolean;
41
+ erpExclude: boolean;
42
+ filesExtendName: boolean;
43
+ docCreatingMethod: string;
44
+ autoStamp: string;
45
+ serie?: {
46
+ id: string;
47
+ externalId?: string;
48
+ code?: string;
49
+ description?: string;
50
+ isValid?: boolean;
51
+ kind?: string;
52
+ invoiceType?: string;
53
+ };
54
+ sequence?: {
55
+ id: string;
56
+ entity?: string;
57
+ description?: string;
58
+ fixedPart?: string;
59
+ counter?: string;
60
+ };
61
+ invoiceType?: string;
62
+ }
63
+
64
+ interface IResponse {
65
+ items: IOutput[];
66
+ totalItems: number;
67
+ pageSize: number;
68
+ page: number;
69
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {
6
+ }
7
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "http": "GET https://api.wflow.com/api/test/documents/types?pageSize=100",
3
+ "code": 200,
4
+ "body": {
5
+ "items": [
6
+ {
7
+ "erpExclude": false,
8
+ "filesExtendName": false,
9
+ "docCreatingMethod": "Upload",
10
+ "autoStamp": "None",
11
+ "id": "One",
12
+ "name": "One",
13
+ "kind": "IncomingInvoice",
14
+ "default": false
15
+ },
16
+ {
17
+ "erpExclude": false,
18
+ "filesExtendName": false,
19
+ "docCreatingMethod": "Upload",
20
+ "autoStamp": "None",
21
+ "invoiceType": "TaxInvoice",
22
+ "id": "Two",
23
+ "name": "Two",
24
+ "kind": "IncomingInvoice",
25
+ "default": false
26
+ }
27
+ ],
28
+ "totalItems": 2,
29
+ "pageSize": 100,
30
+ "page": 0
31
+ }
32
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": [
6
+ {
7
+ "autoStamp": "None",
8
+ "default": false,
9
+ "docCreatingMethod": "Upload",
10
+ "erpExclude": false,
11
+ "filesExtendName": false,
12
+ "id": "One",
13
+ "kind": "IncomingInvoice",
14
+ "name": "One"
15
+ },
16
+ {
17
+ "autoStamp": "None",
18
+ "default": false,
19
+ "docCreatingMethod": "Upload",
20
+ "erpExclude": false,
21
+ "filesExtendName": false,
22
+ "id": "Two",
23
+ "invoiceType": "TaxInvoice",
24
+ "kind": "IncomingInvoice",
25
+ "name": "Two"
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,17 @@
1
+ import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
2
+ import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
3
+ import init from '../../../test/dataProvider';
4
+ import { NAME as WFLOW_GET_DOCUMENT_TYPES_CONNECTOR } from '../WflowGetDocumentTypesConnector';
5
+
6
+ let tester: NodeTester;
7
+
8
+ describe('Tests for WflowGetDocumentTypesConnector', () => {
9
+ beforeEach(() => {
10
+ tester = new NodeTester(container, __filename);
11
+ init();
12
+ });
13
+
14
+ it('process - ok', async () => {
15
+ await tester.testConnector(WFLOW_GET_DOCUMENT_TYPES_CONNECTOR);
16
+ });
17
+ });
@@ -86,6 +86,16 @@ export default class WflowApplication extends AOAuth2Application {
86
86
  return new RequestDto(url, method, dto, data, headers);
87
87
  }
88
88
 
89
+ public getOrganization(applicationInstall: ApplicationInstall): string {
90
+ const organization = applicationInstall.getSettings()[ORGANIZATION_FORM]?.[ORGANIZATION];
91
+
92
+ if (!organization) {
93
+ throw Error('Organization is not set.');
94
+ }
95
+
96
+ return organization;
97
+ }
98
+
89
99
  public getAuthUrl(): string {
90
100
  return 'https://account.wflow.com/connect/authorize';
91
101
  }
@@ -10,6 +10,7 @@ import { mockOnce } from '@orchesty/nodejs-sdk/dist/test/MockServer';
10
10
  import WflowSubscribeWebhookBatch from '../src/Batch/WflowSubscribeWebhookBatch';
11
11
  import WflowUnsubscribeWebhookBatch from '../src/Batch/WflowUnsubscribeWebhookBatch';
12
12
  import WflowGetDocumentConnector from '../src/Connector/WflowGetDocumentConnector';
13
+ import WflowGetDocumentTypesConnector from '../src/Connector/WflowGetDocumentTypesConnector';
13
14
  import WflowGetOrganizationsConnector from '../src/Connector/WflowGetOrganizationsConnector';
14
15
  import WflowPutDocumentConnector from '../src/Connector/WflowPutDocumentConnector';
15
16
  import WflowUpdateDocumentStateConnector from '../src/Connector/WflowUpdateDocumentStateConnector';
@@ -47,6 +48,7 @@ export default function init(): void {
47
48
  container.setApplication(app);
48
49
 
49
50
  container.setNode(new WflowGetDocumentConnector(), app);
51
+ container.setNode(new WflowGetDocumentTypesConnector(), app);
50
52
  container.setNode(new WflowUpdateDocumentStateConnector(), app);
51
53
  container.setNode(new WflowSubscribeWebhookBatch(), app);
52
54
  container.setNode(new WflowUnsubscribeWebhookBatch(), app);
package/tsconfig.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "outDir": "./dist",
6
6
  "composite": true
7
7
  },
8
- "include": ["src", "test", "../../tests"]
9
- }
8
+ "include": ["src", "test", "../../test"]
9
+ }