@orchesty/connector-flexi-bee 1.0.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/CHANGELOG.md +7 -0
- package/LICENSE +190 -0
- package/coverage/clover.xml +389 -0
- package/coverage/coverage-final.json +19 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/Batch/FlexiBeeFormaDopravyBatch.ts.html +145 -0
- package/coverage/lcov-report/src/Batch/FlexiBeeFormaUhradyBatch.ts.html +148 -0
- package/coverage/lcov-report/src/Batch/FlexiBeeGetSkladovyPohybBatch.ts.html +139 -0
- package/coverage/lcov-report/src/Batch/FlexiBeeObjednavkaPrijataBatch.ts.html +145 -0
- package/coverage/lcov-report/src/Batch/FlexiBeeObjednavkaVydanaBatch.ts.html +145 -0
- package/coverage/lcov-report/src/Batch/FlexiBeeSimpleIterator.ts.html +295 -0
- package/coverage/lcov-report/src/Batch/FlexiBeeSkladoveKartyBatch.ts.html +298 -0
- package/coverage/lcov-report/src/Batch/FlexiBeeStitkyBatch.ts.html +145 -0
- package/coverage/lcov-report/src/Batch/index.html +221 -0
- package/coverage/lcov-report/src/Connector/FlexiBeeCreateObjednavkaVydanaConnector.ts.html +322 -0
- package/coverage/lcov-report/src/Connector/FlexiBeeCreateSkladovyPohybConnector.ts.html +346 -0
- package/coverage/lcov-report/src/Connector/FlexiBeeGetCenikKartyConnector.ts.html +829 -0
- package/coverage/lcov-report/src/Connector/FlexiBeeGetObjednavkaVydanaConnector.ts.html +316 -0
- package/coverage/lcov-report/src/Connector/FlexiBeeGetSarzeExpiraceKartyConnector.ts.html +304 -0
- package/coverage/lcov-report/src/Connector/FlexiBeeUpdateObjednavkaPrijataConnector.ts.html +322 -0
- package/coverage/lcov-report/src/Connector/FlexiBeeUpdateSkladovyPohybConnector.ts.html +361 -0
- package/coverage/lcov-report/src/Connector/index.html +206 -0
- package/coverage/lcov-report/src/FexiBeeApplication.ts.html +694 -0
- package/coverage/lcov-report/src/FlexiBee.utils.ts.html +142 -0
- package/coverage/lcov-report/src/index.html +131 -0
- package/coverage/lcov-report/test/dataProvider.ts.html +496 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov.info +633 -0
- package/dist/Batch/FlexiBeeFormaDopravyBatch.d.ts +12 -0
- package/dist/Batch/FlexiBeeFormaDopravyBatch.js +12 -0
- package/dist/Batch/FlexiBeeFormaUhradyBatch.d.ts +13 -0
- package/dist/Batch/FlexiBeeFormaUhradyBatch.js +12 -0
- package/dist/Batch/FlexiBeeGetSkladovyPohybBatch.d.ts +9 -0
- package/dist/Batch/FlexiBeeGetSkladovyPohybBatch.js +12 -0
- package/dist/Batch/FlexiBeeObjednavkaPrijataBatch.d.ts +10 -0
- package/dist/Batch/FlexiBeeObjednavkaPrijataBatch.js +13 -0
- package/dist/Batch/FlexiBeeObjednavkaVydanaBatch.d.ts +10 -0
- package/dist/Batch/FlexiBeeObjednavkaVydanaBatch.js +13 -0
- package/dist/Batch/FlexiBeeSimpleIterator.d.ts +10 -0
- package/dist/Batch/FlexiBeeSimpleIterator.js +44 -0
- package/dist/Batch/FlexiBeeSkladoveKartyBatch.d.ts +60 -0
- package/dist/Batch/FlexiBeeSkladoveKartyBatch.js +12 -0
- package/dist/Batch/FlexiBeeStitkyBatch.d.ts +12 -0
- package/dist/Batch/FlexiBeeStitkyBatch.js +12 -0
- package/dist/Connector/FlexiBeeCreateNewContactConnector.d.ts +7 -0
- package/dist/Connector/FlexiBeeCreateNewContactConnector.js +84 -0
- package/dist/Connector/FlexiBeeCreateObjednavkaVydanaConnector.d.ts +20 -0
- package/dist/Connector/FlexiBeeCreateObjednavkaVydanaConnector.js +45 -0
- package/dist/Connector/FlexiBeeCreateSkladovyPohybConnector.d.ts +28 -0
- package/dist/Connector/FlexiBeeCreateSkladovyPohybConnector.js +45 -0
- package/dist/Connector/FlexiBeeGetCenikKartyConnector.d.ts +209 -0
- package/dist/Connector/FlexiBeeGetCenikKartyConnector.js +25 -0
- package/dist/Connector/FlexiBeeGetContactsArrayConnector.d.ts +6 -0
- package/dist/Connector/FlexiBeeGetContactsArrayConnector.js +21 -0
- package/dist/Connector/FlexiBeeGetObjednavkaVydanaConnector.d.ts +23 -0
- package/dist/Connector/FlexiBeeGetObjednavkaVydanaConnector.js +47 -0
- package/dist/Connector/FlexiBeeGetSarzeExpiraceKartyConnector.d.ts +32 -0
- package/dist/Connector/FlexiBeeGetSarzeExpiraceKartyConnector.js +27 -0
- package/dist/Connector/FlexiBeeUpdateObjednavkaPrijataConnector.d.ts +20 -0
- package/dist/Connector/FlexiBeeUpdateObjednavkaPrijataConnector.js +45 -0
- package/dist/Connector/FlexiBeeUpdateSkladovyPohybConnector.d.ts +30 -0
- package/dist/Connector/FlexiBeeUpdateSkladovyPohybConnector.js +45 -0
- package/dist/FexiBeeApplication.d.ts +28 -0
- package/dist/FexiBeeApplication.js +179 -0
- package/dist/FlexiBee.utils.d.ts +2 -0
- package/dist/FlexiBee.utils.js +12 -0
- package/dist/package.json +22 -0
- package/dist/types/FlexiBeeObjednavkaPrijata.d.ts +152 -0
- package/dist/types/FlexiBeeObjednavkaPrijata.js +2 -0
- package/dist/types/FlexiBeeObjednavkaVydana.d.ts +186 -0
- package/dist/types/FlexiBeeObjednavkaVydana.js +2 -0
- package/dist/types/FlexiBeeSkladovyPohyb.d.ts +96 -0
- package/dist/types/FlexiBeeSkladovyPohyb.js +2 -0
- package/jest.config.js +13 -0
- package/package.json +22 -0
- package/src/Batch/FlexiBeeFormaDopravyBatch.ts +20 -0
- package/src/Batch/FlexiBeeFormaUhradyBatch.ts +21 -0
- package/src/Batch/FlexiBeeGetSkladovyPohybBatch.ts +18 -0
- package/src/Batch/FlexiBeeObjednavkaPrijataBatch.ts +20 -0
- package/src/Batch/FlexiBeeObjednavkaVydanaBatch.ts +20 -0
- package/src/Batch/FlexiBeeSimpleIterator.ts +70 -0
- package/src/Batch/FlexiBeeSkladoveKartyBatch.ts +71 -0
- package/src/Batch/FlexiBeeStitkyBatch.ts +20 -0
- package/src/Batch/__tests__/Data/FlexiBeeFormaDopravyBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/FlexiBeeFormaDopravyBatch/mock.json +18 -0
- package/src/Batch/__tests__/Data/FlexiBeeFormaDopravyBatch/output.json +11 -0
- package/src/Batch/__tests__/Data/FlexiBeeFormaUhradyBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/FlexiBeeFormaUhradyBatch/mock.json +19 -0
- package/src/Batch/__tests__/Data/FlexiBeeFormaUhradyBatch/output.json +11 -0
- package/src/Batch/__tests__/Data/FlexiBeeGetSkladovyPohybBatch/input.json +8 -0
- package/src/Batch/__tests__/Data/FlexiBeeGetSkladovyPohybBatch/mock.json +107 -0
- package/src/Batch/__tests__/Data/FlexiBeeGetSkladovyPohybBatch/output.json +11 -0
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaPrijataBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaPrijataBatch/mock.json +162 -0
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaPrijataBatch/output.json +11 -0
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaVydanaBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaVydanaBatch/mock.json +200 -0
- package/src/Batch/__tests__/Data/FlexiBeeObjednavkaVydanaBatch/output.json +11 -0
- package/src/Batch/__tests__/Data/FlexiBeeSkladoveKartyBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/FlexiBeeSkladoveKartyBatch/mock.json +66 -0
- package/src/Batch/__tests__/Data/FlexiBeeSkladoveKartyBatch/output.json +11 -0
- package/src/Batch/__tests__/Data/FlexiBeeStitkyBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/FlexiBeeStitkyBatch/mock.json +18 -0
- package/src/Batch/__tests__/Data/FlexiBeeStitkyBatch/output.json +11 -0
- package/src/Batch/__tests__/FlexiBeeFormaDopravyBatch.ts +17 -0
- package/src/Batch/__tests__/FlexiBeeFormaUhradyBatch.ts +17 -0
- package/src/Batch/__tests__/FlexiBeeGetSkladovyPohybBatch.ts +17 -0
- package/src/Batch/__tests__/FlexiBeeObjednavkaPrijataBatch.ts +17 -0
- package/src/Batch/__tests__/FlexiBeeObjednavkaVydanaBatch.ts +17 -0
- package/src/Batch/__tests__/FlexiBeeSkladoveKartyBatch.ts +17 -0
- package/src/Batch/__tests__/FlexiBeeStitkyBatch.ts +17 -0
- package/src/Connector/FlexiBeeCreateNewContactConnector.ts +98 -0
- package/src/Connector/FlexiBeeCreateObjednavkaVydanaConnector.ts +79 -0
- package/src/Connector/FlexiBeeCreateSkladovyPohybConnector.ts +87 -0
- package/src/Connector/FlexiBeeGetCenikKartyConnector.ts +248 -0
- package/src/Connector/FlexiBeeGetContactsArrayConnector.ts +28 -0
- package/src/Connector/FlexiBeeGetObjednavkaVydanaConnector.ts +77 -0
- package/src/Connector/FlexiBeeGetSarzeExpiraceKartyConnector.ts +73 -0
- package/src/Connector/FlexiBeeUpdateObjednavkaPrijataConnector.ts +79 -0
- package/src/Connector/FlexiBeeUpdateSkladovyPohybConnector.ts +92 -0
- package/src/Connector/__tests__/Data/FlexiBeeCreateObjednavkaVydanaConnector/input.json +8 -0
- package/src/Connector/__tests__/Data/FlexiBeeCreateObjednavkaVydanaConnector/mock.json +24 -0
- package/src/Connector/__tests__/Data/FlexiBeeCreateObjednavkaVydanaConnector/output.json +12 -0
- package/src/Connector/__tests__/Data/FlexiBeeCreateSkladovyPohybConnector/input.json +8 -0
- package/src/Connector/__tests__/Data/FlexiBeeCreateSkladovyPohybConnector/mock.json +24 -0
- package/src/Connector/__tests__/Data/FlexiBeeCreateSkladovyPohybConnector/output.json +12 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetCenikKartyConnector/input.json +59 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetCenikKartyConnector/mock.json +211 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetCenikKartyConnector/output.json +261 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetObjednavkaVydanaConnector/input.json +8 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetObjednavkaVydanaConnector/mock.json +193 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetObjednavkaVydanaConnector/output.json +187 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetSarzeExpiraceKartyConnector/input.json +261 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetSarzeExpiraceKartyConnector/mock.json +49 -0
- package/src/Connector/__tests__/Data/FlexiBeeGetSarzeExpiraceKartyConnector/output.json +301 -0
- package/src/Connector/__tests__/Data/FlexiBeeUpdateObjednavkaPrijataConnector/input.json +8 -0
- package/src/Connector/__tests__/Data/FlexiBeeUpdateObjednavkaPrijataConnector/mock.json +24 -0
- package/src/Connector/__tests__/Data/FlexiBeeUpdateObjednavkaPrijataConnector/output.json +12 -0
- package/src/Connector/__tests__/Data/FlexiBeeUpdateSkladovyPohybConnector/input.json +9 -0
- package/src/Connector/__tests__/Data/FlexiBeeUpdateSkladovyPohybConnector/mock.json +24 -0
- package/src/Connector/__tests__/Data/FlexiBeeUpdateSkladovyPohybConnector/output.json +12 -0
- package/src/Connector/__tests__/FlexiBeeCreateObjednavkaVydanaConnector.ts +17 -0
- package/src/Connector/__tests__/FlexiBeeCreateSkladovyPohybConnector.ts +17 -0
- package/src/Connector/__tests__/FlexiBeeGetCenikKartyConnector.ts +17 -0
- package/src/Connector/__tests__/FlexiBeeGetObjednavkaVydanaConnector.ts +17 -0
- package/src/Connector/__tests__/FlexiBeeGetSarzeExpiraceKartyConnector.ts +17 -0
- package/src/Connector/__tests__/FlexiBeeUpdateObjednavkaPrijataConnector.ts +17 -0
- package/src/Connector/__tests__/FlexiBeeUpdateSkladovyPohybConnector.ts +17 -0
- package/src/FexiBeeApplication.ts +203 -0
- package/src/FlexiBee.utils.ts +19 -0
- package/src/types/FlexiBeeObjednavkaPrijata.ts +153 -0
- package/src/types/FlexiBeeObjednavkaVydana.ts +188 -0
- package/src/types/FlexiBeeSkladovyPohyb.ts +97 -0
- package/test/dataProvider.ts +137 -0
- package/tsconfig.json +8 -0
- package/tsconfig.prod.json +13 -0
- package/tsconfig.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,79 @@
|
|
|
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 FlexiBeeApplication from '../FexiBeeApplication';
|
|
5
|
+
|
|
6
|
+
export const FLEXI_BEE_CREATE_OBJEDNAVKA_VYDANA = 'flexi-bee-create-objednavka-vydana';
|
|
7
|
+
|
|
8
|
+
export default class FlexiBeeCreateObjednavkaVydanaConnector extends AConnector {
|
|
9
|
+
|
|
10
|
+
public constructor(
|
|
11
|
+
protected dataKey: string | null = null,
|
|
12
|
+
) {
|
|
13
|
+
super();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public getName(): string {
|
|
17
|
+
return FLEXI_BEE_CREATE_OBJEDNAVKA_VYDANA;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async processAction(
|
|
21
|
+
dto: ProcessDto<FlexiBeeCreateObjednavkaVydanaInput>,
|
|
22
|
+
): Promise<ProcessDto<FlexiBeeCreateObjednavkaVydanaOutput>> {
|
|
23
|
+
const applicationInstall = await this.getApplicationInstallFromProcess(dto);
|
|
24
|
+
|
|
25
|
+
let data = dto.getJsonData();
|
|
26
|
+
if (this.dataKey) {
|
|
27
|
+
// eslint-disable-next-line
|
|
28
|
+
data = (data as any)[this.dataKey];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const application = this.getApplication<FlexiBeeApplication>();
|
|
32
|
+
const request = await application.getRequestDto(
|
|
33
|
+
dto,
|
|
34
|
+
applicationInstall,
|
|
35
|
+
HttpMethods.POST,
|
|
36
|
+
application.getUrl(applicationInstall, 'objednavka-vydana'),
|
|
37
|
+
JSON.stringify({
|
|
38
|
+
winstrom: {
|
|
39
|
+
// eslint-disable-next-line
|
|
40
|
+
'objednavka-vydana': [
|
|
41
|
+
data,
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
const resp = (await this.getSender().send<Response>(request)).getJsonBody().winstrom.results;
|
|
47
|
+
|
|
48
|
+
if (this.dataKey) {
|
|
49
|
+
// eslint-disable-next-line
|
|
50
|
+
const data = dto.getJsonData() as any;
|
|
51
|
+
data[this.dataKey] = resp;
|
|
52
|
+
dto.setNewJsonData(data);
|
|
53
|
+
} else {
|
|
54
|
+
dto.setNewJsonData(resp);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return dto as unknown as ProcessDto<FlexiBeeCreateObjednavkaVydanaOutput>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface ResponseResult {
|
|
63
|
+
results: {
|
|
64
|
+
id: string;
|
|
65
|
+
ref: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface Response {
|
|
70
|
+
winstrom: {
|
|
71
|
+
results: ResponseResult[];
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface FlexiBeeCreateObjednavkaVydanaInput {
|
|
76
|
+
kod: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type FlexiBeeCreateObjednavkaVydanaOutput = ResponseResult[];
|
|
@@ -0,0 +1,87 @@
|
|
|
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 FlexiBeeApplication from '../FexiBeeApplication';
|
|
5
|
+
|
|
6
|
+
export const FLEXI_BEE_CREATE_SKLADOVY_POHYB = 'flexi-bee-create-skladovy-pohyb';
|
|
7
|
+
|
|
8
|
+
export default class FlexiBeeCreateSkladovyPohybConnector extends AConnector {
|
|
9
|
+
|
|
10
|
+
public constructor(
|
|
11
|
+
protected dataKey: string | null = null,
|
|
12
|
+
) {
|
|
13
|
+
super();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public getName(): string {
|
|
17
|
+
return FLEXI_BEE_CREATE_SKLADOVY_POHYB;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async processAction(
|
|
21
|
+
dto: ProcessDto<FlexiBeeCreateSkladovyPohybInput>,
|
|
22
|
+
): Promise<ProcessDto<FlexiBeeCreateSkladovyPohybOutput>> {
|
|
23
|
+
const applicationInstall = await this.getApplicationInstallFromProcess(dto);
|
|
24
|
+
|
|
25
|
+
let pohyb = dto.getJsonData();
|
|
26
|
+
if (this.dataKey) {
|
|
27
|
+
// eslint-disable-next-line
|
|
28
|
+
pohyb = (pohyb as any)[this.dataKey];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const application = this.getApplication<FlexiBeeApplication>();
|
|
32
|
+
const request = await application.getRequestDto(
|
|
33
|
+
dto,
|
|
34
|
+
applicationInstall,
|
|
35
|
+
HttpMethods.POST,
|
|
36
|
+
application.getUrl(applicationInstall, 'skladovy-pohyb'),
|
|
37
|
+
JSON.stringify({
|
|
38
|
+
winstrom: {
|
|
39
|
+
// eslint-disable-next-line
|
|
40
|
+
'skladovy-pohyb': [
|
|
41
|
+
pohyb,
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
const resp = (await this.getSender().send<Response>(request)).getJsonBody().winstrom.results;
|
|
47
|
+
|
|
48
|
+
if (this.dataKey) {
|
|
49
|
+
// eslint-disable-next-line
|
|
50
|
+
const data = dto.getJsonData() as any;
|
|
51
|
+
data[this.dataKey] = resp;
|
|
52
|
+
dto.setNewJsonData(data);
|
|
53
|
+
} else {
|
|
54
|
+
dto.setNewJsonData(resp);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return dto as unknown as ProcessDto<FlexiBeeCreateSkladovyPohybOutput>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface ResponseResult {
|
|
63
|
+
results: {
|
|
64
|
+
id: string;
|
|
65
|
+
ref: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface Response {
|
|
70
|
+
winstrom: {
|
|
71
|
+
results: ResponseResult[];
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface FlexiBeeCreateSkladovyPohybInput {
|
|
76
|
+
kod: string;
|
|
77
|
+
typPohybuK: string;
|
|
78
|
+
typDokl: string;
|
|
79
|
+
sklad: string;
|
|
80
|
+
skladovePolozky: {
|
|
81
|
+
cenik: string;
|
|
82
|
+
sklad: string;
|
|
83
|
+
mnozMj: string;
|
|
84
|
+
}[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type FlexiBeeCreateSkladovyPohybOutput = ResponseResult[];
|
|
@@ -0,0 +1,248 @@
|
|
|
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 { FlexiBeeSkladoveKartyItemOutput } from '../Batch/FlexiBeeSkladoveKartyBatch';
|
|
5
|
+
import FlexiBeeApplication from '../FexiBeeApplication';
|
|
6
|
+
import { parseFlexiBeeUri } from '../FlexiBee.utils';
|
|
7
|
+
|
|
8
|
+
export const FLEXI_BEE_GET_CENIK_KARTY_CONNECTOR = 'flexi-bee-get-cenik-karty-connector';
|
|
9
|
+
|
|
10
|
+
export default class FlexiBeeGetCenikKartyConnector extends AConnector {
|
|
11
|
+
|
|
12
|
+
public getName(): string {
|
|
13
|
+
return FLEXI_BEE_GET_CENIK_KARTY_CONNECTOR;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public async processAction(
|
|
17
|
+
dto: ProcessDto<FlexiBeeGetCenikKartyInput>,
|
|
18
|
+
): Promise<ProcessDto<FlexiBeeGetCenikKartyOutput>> {
|
|
19
|
+
const applicationInstall = await this.getApplicationInstallFromProcess(dto);
|
|
20
|
+
const data = dto.getJsonData() as FlexiBeeGetCenikKartyOutput;
|
|
21
|
+
|
|
22
|
+
const application = this.getApplication<FlexiBeeApplication>();
|
|
23
|
+
const request = await application.getRequestDto(
|
|
24
|
+
dto,
|
|
25
|
+
applicationInstall,
|
|
26
|
+
HttpMethods.GET,
|
|
27
|
+
application.getUrl(applicationInstall, parseFlexiBeeUri(data['cenik@ref'])),
|
|
28
|
+
);
|
|
29
|
+
const response = await this.getSender().send<Response>(request);
|
|
30
|
+
data.cenikData = response.getJsonBody().winstrom.cenik;
|
|
31
|
+
|
|
32
|
+
return dto.setNewJsonData(data);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
38
|
+
type Cenik = {
|
|
39
|
+
'id': string;
|
|
40
|
+
'lastUpdate': string;
|
|
41
|
+
'kod': string;
|
|
42
|
+
'nazev': string;
|
|
43
|
+
'nazevA': string;
|
|
44
|
+
'nazevB': string;
|
|
45
|
+
'nazevC': string;
|
|
46
|
+
'poznam': string;
|
|
47
|
+
'popis': string;
|
|
48
|
+
'platiOd': string;
|
|
49
|
+
'platiDo': string;
|
|
50
|
+
'eanKod': string;
|
|
51
|
+
'kodPlu': string;
|
|
52
|
+
'typCenyDphK': string;
|
|
53
|
+
'typCenyDphK@showAs': string;
|
|
54
|
+
'procZakl': string;
|
|
55
|
+
'individCena': string;
|
|
56
|
+
'limMnoz2': string;
|
|
57
|
+
'limMnoz3': string;
|
|
58
|
+
'limMnoz4': string;
|
|
59
|
+
'limMnoz5': string;
|
|
60
|
+
'procento2': string;
|
|
61
|
+
'procento3': string;
|
|
62
|
+
'procento4': string;
|
|
63
|
+
'procento5': string;
|
|
64
|
+
'cena2': string;
|
|
65
|
+
'cena3': string;
|
|
66
|
+
'cena4': string;
|
|
67
|
+
'cena5': string;
|
|
68
|
+
'zaokrJakK': string;
|
|
69
|
+
'zaokrJakK@showAs': string;
|
|
70
|
+
'zaokrNaK': string;
|
|
71
|
+
'zaokrNaK@showAs': string;
|
|
72
|
+
'typSzbDphK': string;
|
|
73
|
+
'typSzbDphK@showAs': string;
|
|
74
|
+
'desetinMj': string;
|
|
75
|
+
'nakupCena': string;
|
|
76
|
+
'cenJednotka': string;
|
|
77
|
+
'typCenyVychoziK': string;
|
|
78
|
+
'typCenyVychoziK@showAs': string;
|
|
79
|
+
'typVypCenyK': string;
|
|
80
|
+
'typVypCenyK@showAs': string;
|
|
81
|
+
'typCenyVychozi25K': string;
|
|
82
|
+
'typCenyVychozi25K@showAs': string;
|
|
83
|
+
'typVypCeny25K': string;
|
|
84
|
+
'typVypCeny25K@showAs': string;
|
|
85
|
+
'evidVyrCis': string;
|
|
86
|
+
'unikVyrCis': string;
|
|
87
|
+
'zaruka': string;
|
|
88
|
+
'mjZarukyK': string;
|
|
89
|
+
'mjKoef2': string;
|
|
90
|
+
'mjKoef3': string;
|
|
91
|
+
'prodejMj': string;
|
|
92
|
+
'hmotMj': string;
|
|
93
|
+
'hmotObal': string;
|
|
94
|
+
'objem': string;
|
|
95
|
+
'zatrid': string;
|
|
96
|
+
'skladove': string;
|
|
97
|
+
'typZasobyK': string;
|
|
98
|
+
'typZasobyK@showAs': string;
|
|
99
|
+
'baleniNazev1': string;
|
|
100
|
+
'baleniNazev2': string;
|
|
101
|
+
'baleniNazev3': string;
|
|
102
|
+
'baleniNazev4': string;
|
|
103
|
+
'baleniNazev5': string;
|
|
104
|
+
'baleniMj1': string;
|
|
105
|
+
'baleniMj2': string;
|
|
106
|
+
'baleniMj3': string;
|
|
107
|
+
'baleniMj4': string;
|
|
108
|
+
'baleniMj5': string;
|
|
109
|
+
'baleniEan1': string;
|
|
110
|
+
'baleniEan2': string;
|
|
111
|
+
'baleniEan3': string;
|
|
112
|
+
'baleniEan4': string;
|
|
113
|
+
'baleniEan5': string;
|
|
114
|
+
'inEvid': string;
|
|
115
|
+
'inKoefMj': string;
|
|
116
|
+
'inKoefStat': string;
|
|
117
|
+
'inKodSled': string;
|
|
118
|
+
'popisA': string;
|
|
119
|
+
'popisB': string;
|
|
120
|
+
'popisC': string;
|
|
121
|
+
'cenaBezna': string;
|
|
122
|
+
'stitky': string;
|
|
123
|
+
'stavy': string;
|
|
124
|
+
'pocetPriloh': string;
|
|
125
|
+
'exportNaEshop': string;
|
|
126
|
+
'minMarzeCenik': string;
|
|
127
|
+
'minMarze': string;
|
|
128
|
+
'evidSarze': string;
|
|
129
|
+
'evidExpir': string;
|
|
130
|
+
'sada': string;
|
|
131
|
+
'dnyTrvanPoExpir': string;
|
|
132
|
+
'neseskupovatObj': string;
|
|
133
|
+
'kratkyPopis': string;
|
|
134
|
+
'klicSlova': string;
|
|
135
|
+
'techParam': string;
|
|
136
|
+
'dodaciLhuta': string;
|
|
137
|
+
'prodejKasa': string;
|
|
138
|
+
'skupZboz': string;
|
|
139
|
+
'skupZboz@ref': string;
|
|
140
|
+
'skupZboz@showAs': string;
|
|
141
|
+
'mj1': string;
|
|
142
|
+
'mj1@ref': string;
|
|
143
|
+
'mj1@showAs': string;
|
|
144
|
+
'mj2': string;
|
|
145
|
+
'mj2@ref': string;
|
|
146
|
+
'mj2@showAs': string;
|
|
147
|
+
'mj3': string;
|
|
148
|
+
'mj3@ref': string;
|
|
149
|
+
'mj3@showAs': string;
|
|
150
|
+
'mjHmot': string;
|
|
151
|
+
'mjHmot@ref': string;
|
|
152
|
+
'mjHmot@showAs': string;
|
|
153
|
+
'mjObj': string;
|
|
154
|
+
'mjObj@ref': string;
|
|
155
|
+
'mjObj@showAs': string;
|
|
156
|
+
'stat': string;
|
|
157
|
+
'nomen': string;
|
|
158
|
+
'dodavatel': string;
|
|
159
|
+
'dodavatel@ref': string;
|
|
160
|
+
'dodavatel@showAs': string;
|
|
161
|
+
'vyrobce': string;
|
|
162
|
+
'vyrobce@ref': string;
|
|
163
|
+
'vyrobce@showAs': string;
|
|
164
|
+
'dphPren': string;
|
|
165
|
+
'mjDodaciLhuta': string;
|
|
166
|
+
'mjDodaciLhuta@ref': string;
|
|
167
|
+
'mjDodaciLhuta@showAs': string;
|
|
168
|
+
'sumStavMj': string;
|
|
169
|
+
'sumRezerMj': string;
|
|
170
|
+
'sumPozadavkyMj': string;
|
|
171
|
+
'sumDostupMj': string;
|
|
172
|
+
'cenaZaklBezDph': string;
|
|
173
|
+
'cenaZaklVcDph': string;
|
|
174
|
+
'cenaZakl': string;
|
|
175
|
+
'sady-a-komplety': unknown[];
|
|
176
|
+
'poplatky': unknown[];
|
|
177
|
+
'dodavatele': {
|
|
178
|
+
'id': string;
|
|
179
|
+
'lastUpdate': string;
|
|
180
|
+
'kodIndi': string;
|
|
181
|
+
'nakupCena': string;
|
|
182
|
+
'poznam': string;
|
|
183
|
+
'primarni': string;
|
|
184
|
+
'stavMJ': string;
|
|
185
|
+
'dodaciLhuta': string;
|
|
186
|
+
'stitky': string;
|
|
187
|
+
'limMnoz2': string;
|
|
188
|
+
'limMnoz3': string;
|
|
189
|
+
'limMnoz4': string;
|
|
190
|
+
'limMnoz5': string;
|
|
191
|
+
'nakupCena2': string;
|
|
192
|
+
'nakupCena3': string;
|
|
193
|
+
'nakupCena4': string;
|
|
194
|
+
'nakupCena5': string;
|
|
195
|
+
'cenik': string;
|
|
196
|
+
'cenik@ref': string;
|
|
197
|
+
'cenik@showAs': string;
|
|
198
|
+
'firma': string;
|
|
199
|
+
'firma@ref': string;
|
|
200
|
+
'firma@showAs': string;
|
|
201
|
+
'mjDodaciLhuta': string;
|
|
202
|
+
'mena': string;
|
|
203
|
+
}[],
|
|
204
|
+
'odberatele': {
|
|
205
|
+
'id': string;
|
|
206
|
+
'lastUpdate': string;
|
|
207
|
+
'kodIndi': string;
|
|
208
|
+
'prodejCena': string;
|
|
209
|
+
'poznam': string;
|
|
210
|
+
'platiOdData': string;
|
|
211
|
+
'platiDoData': string;
|
|
212
|
+
'rucneVybrat': string;
|
|
213
|
+
'limMnoz2': string;
|
|
214
|
+
'limMnoz3': string;
|
|
215
|
+
'limMnoz4': string;
|
|
216
|
+
'limMnoz5': string;
|
|
217
|
+
'prodejCena2': string;
|
|
218
|
+
'prodejCena3': string;
|
|
219
|
+
'prodejCena4': string;
|
|
220
|
+
'prodejCena5': string;
|
|
221
|
+
'cenik': string;
|
|
222
|
+
'cenik@ref': string;
|
|
223
|
+
'cenik@showAs': string;
|
|
224
|
+
'firma': string;
|
|
225
|
+
'firma@ref': string;
|
|
226
|
+
'firma@showAs': string;
|
|
227
|
+
'skupCen': string;
|
|
228
|
+
'stredisko': string;
|
|
229
|
+
'mena': string;
|
|
230
|
+
}[]
|
|
231
|
+
'typy-sazeb-dph': unknown[];
|
|
232
|
+
'szbDph': string;
|
|
233
|
+
}[];
|
|
234
|
+
|
|
235
|
+
interface Response {
|
|
236
|
+
'winstrom': {
|
|
237
|
+
'@version': string;
|
|
238
|
+
'cenik': Cenik;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export type FlexiBeeGetCenikKartyInput = FlexiBeeSkladoveKartyItemOutput;
|
|
243
|
+
|
|
244
|
+
export interface FlexiBeeGetCenikKartyOutput extends FlexiBeeSkladoveKartyItemOutput {
|
|
245
|
+
cenikData: Cenik;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,28 @@
|
|
|
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 FlexiBeeApplication from '../FexiBeeApplication';
|
|
5
|
+
|
|
6
|
+
export default class FlexiBeeGetContactsArrayConnector extends AConnector {
|
|
7
|
+
|
|
8
|
+
public getName(): string {
|
|
9
|
+
return 'flexibee-get-contacts-array';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async processAction(dto: ProcessDto): Promise<ProcessDto> {
|
|
13
|
+
const applicationInstall = await this.getApplicationInstallFromProcess(dto);
|
|
14
|
+
|
|
15
|
+
const application = this.getApplication<FlexiBeeApplication>();
|
|
16
|
+
const request = await application.getRequestDto(
|
|
17
|
+
dto,
|
|
18
|
+
applicationInstall,
|
|
19
|
+
HttpMethods.GET,
|
|
20
|
+
application.getUrl(applicationInstall, 'kontakt.json'),
|
|
21
|
+
);
|
|
22
|
+
const response = await this.getSender().send(request, { success: '200-201' });
|
|
23
|
+
dto.setData(response.getBody());
|
|
24
|
+
|
|
25
|
+
return dto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
|
|
2
|
+
import ResponseDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResponseDto';
|
|
3
|
+
import { IResultRanges } from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResultCodeRange';
|
|
4
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
5
|
+
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
|
|
6
|
+
import FlexiBeeApplication from '../FexiBeeApplication';
|
|
7
|
+
import { FlexiBeeObjednavkaVydana } from '../types/FlexiBeeObjednavkaVydana';
|
|
8
|
+
|
|
9
|
+
export const FLEXI_BEE_GET_OBJEDNAVKA_VYDANA_CONNECTOR = 'flexi-bee-get-objednavka-vydana-connector';
|
|
10
|
+
|
|
11
|
+
export default class FlexiBeeGetObjednavkaVydanaConnector extends AConnector {
|
|
12
|
+
|
|
13
|
+
public constructor(
|
|
14
|
+
protected dataKey: string | null = null,
|
|
15
|
+
) {
|
|
16
|
+
super();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public getName(): string {
|
|
20
|
+
return FLEXI_BEE_GET_OBJEDNAVKA_VYDANA_CONNECTOR;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<FlexiBeeObjednavkaVydana>> {
|
|
24
|
+
const applicationInstall = await this.getApplicationInstallFromProcess(dto);
|
|
25
|
+
const data = dto.getJsonData();
|
|
26
|
+
// eslint-disable-next-line
|
|
27
|
+
let id = data.id;
|
|
28
|
+
if (this.dataKey) {
|
|
29
|
+
// eslint-disable-next-line
|
|
30
|
+
id = (data as any)[this.dataKey].id;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const application = this.getApplication<FlexiBeeApplication>();
|
|
34
|
+
const request = await application.getRequestDto(
|
|
35
|
+
dto,
|
|
36
|
+
applicationInstall,
|
|
37
|
+
HttpMethods.GET,
|
|
38
|
+
application.getUrl(applicationInstall, `objednavka-vydana/${id}.json?detail=full`),
|
|
39
|
+
);
|
|
40
|
+
const response = await this.getSender().send<IResponse>(request, this.getCodeRanges());
|
|
41
|
+
|
|
42
|
+
return this.handleResponse(response, dto) as ProcessDto<FlexiBeeObjednavkaVydana>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
protected getCodeRanges(): IResultRanges|null {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected handleResponse(response: ResponseDto<IResponse>, dto: ProcessDto): ProcessDto {
|
|
50
|
+
const order = response.getJsonBody().winstrom['objednavka-vydana'][0] ?? [];
|
|
51
|
+
|
|
52
|
+
if (this.dataKey) {
|
|
53
|
+
// eslint-disable-next-line
|
|
54
|
+
const data = dto.getJsonData() as any;
|
|
55
|
+
data[this.dataKey] = order;
|
|
56
|
+
dto.setNewJsonData(data);
|
|
57
|
+
} else {
|
|
58
|
+
dto.setNewJsonData(order);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return dto as unknown as ProcessDto<FlexiBeeObjednavkaVydana>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface IInput {
|
|
67
|
+
id: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
71
|
+
export interface IResponse {
|
|
72
|
+
winstrom: {
|
|
73
|
+
'@version': string;
|
|
74
|
+
'objednavka-vydana': FlexiBeeObjednavkaVydana[];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,73 @@
|
|
|
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 FlexiBeeApplication from '../FexiBeeApplication';
|
|
5
|
+
import { parseFlexiBeeId } from '../FlexiBee.utils';
|
|
6
|
+
import { FlexiBeeGetCenikKartyOutput } from './FlexiBeeGetCenikKartyConnector';
|
|
7
|
+
|
|
8
|
+
export const FLEXI_BEE_GET_SARZE_EXPIRACE_KARTY_CONNECTOR = 'flexi-bee-get-sarze-expirace-karty-connector';
|
|
9
|
+
|
|
10
|
+
export default class FlexiBeeGetSarzeExpiraceKartyConnector extends AConnector {
|
|
11
|
+
|
|
12
|
+
public getName(): string {
|
|
13
|
+
return FLEXI_BEE_GET_SARZE_EXPIRACE_KARTY_CONNECTOR;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public async processAction(
|
|
17
|
+
dto: ProcessDto<FlexiBeeGetSarzeExpiraceKartyInput>,
|
|
18
|
+
): Promise<ProcessDto<FlexiBeeGetSarzeExpiraceKartyOutput>> {
|
|
19
|
+
const applicationInstall = await this.getApplicationInstallFromProcess(dto);
|
|
20
|
+
const data = dto.getJsonData() as FlexiBeeGetSarzeExpiraceKartyOutput;
|
|
21
|
+
const cenikId = parseFlexiBeeId(data['cenik@ref']);
|
|
22
|
+
const skladId = parseFlexiBeeId(data['sklad@ref']);
|
|
23
|
+
|
|
24
|
+
const application = this.getApplication<FlexiBeeApplication>();
|
|
25
|
+
const request = await application.getRequestDto(
|
|
26
|
+
dto,
|
|
27
|
+
applicationInstall,
|
|
28
|
+
HttpMethods.GET,
|
|
29
|
+
application.getUrl(applicationInstall, `sarze-expirace/(cenik=${cenikId}%20and%20sklad=${skladId}).json?detail=full`),
|
|
30
|
+
);
|
|
31
|
+
const response = await this.getSender().send<Response>(request);
|
|
32
|
+
data.sarzeExpiraceData = response.getJsonBody().winstrom['sarze-expirace'];
|
|
33
|
+
|
|
34
|
+
return dto.setNewJsonData(data);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
40
|
+
type SarzeExpirace = {
|
|
41
|
+
'id': string;
|
|
42
|
+
'pocet': string;
|
|
43
|
+
'cenaMj': string;
|
|
44
|
+
'datVyst': string;
|
|
45
|
+
'datSklad': string;
|
|
46
|
+
'datTrvan': string;
|
|
47
|
+
'datVyroby': string;
|
|
48
|
+
'expirace': string;
|
|
49
|
+
'sarze': string;
|
|
50
|
+
'typPohybuK': string;
|
|
51
|
+
'typPohybuK@showAs': string;
|
|
52
|
+
'sklad': string;
|
|
53
|
+
'sklad@ref': string;
|
|
54
|
+
'sklad@showAs': string;
|
|
55
|
+
'cenik': string;
|
|
56
|
+
'cenik@ref': string;
|
|
57
|
+
'cenik@showAs': string;
|
|
58
|
+
}[];
|
|
59
|
+
|
|
60
|
+
interface Response {
|
|
61
|
+
'winstrom': {
|
|
62
|
+
'@version': string;
|
|
63
|
+
'sarze-expirace': SarzeExpirace;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type FlexiBeeGetSarzeExpiraceKartyInput = FlexiBeeGetCenikKartyOutput;
|
|
68
|
+
|
|
69
|
+
export interface FlexiBeeGetSarzeExpiraceKartyOutput extends FlexiBeeGetCenikKartyOutput {
|
|
70
|
+
sarzeExpiraceData: SarzeExpirace;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,79 @@
|
|
|
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 FlexiBeeApplication from '../FexiBeeApplication';
|
|
5
|
+
|
|
6
|
+
export const FLEXI_BEE_UPDATE_OBJEDNAVKA_PRIJATA = 'flexi-bee-update-objednavka-prijata';
|
|
7
|
+
|
|
8
|
+
export default class FlexiBeeUpdateObjednavkaPrijataConnector extends AConnector {
|
|
9
|
+
|
|
10
|
+
public constructor(
|
|
11
|
+
protected dataKey: string | null = null,
|
|
12
|
+
) {
|
|
13
|
+
super();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public getName(): string {
|
|
17
|
+
return FLEXI_BEE_UPDATE_OBJEDNAVKA_PRIJATA;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async processAction(
|
|
21
|
+
dto: ProcessDto<FlexiBeeUpdateObjednavkaPrijataInput>,
|
|
22
|
+
): Promise<ProcessDto<FlexiBeeUpdateObjednavkaPrijataOutput>> {
|
|
23
|
+
const applicationInstall = await this.getApplicationInstallFromProcess(dto);
|
|
24
|
+
|
|
25
|
+
let data = dto.getJsonData();
|
|
26
|
+
if (this.dataKey) {
|
|
27
|
+
// eslint-disable-next-line
|
|
28
|
+
data = (data as any)[this.dataKey];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const application = this.getApplication<FlexiBeeApplication>();
|
|
32
|
+
const request = await application.getRequestDto(
|
|
33
|
+
dto,
|
|
34
|
+
applicationInstall,
|
|
35
|
+
HttpMethods.PUT,
|
|
36
|
+
application.getUrl(applicationInstall, 'objednavka-prijata'),
|
|
37
|
+
JSON.stringify({
|
|
38
|
+
winstrom: {
|
|
39
|
+
// eslint-disable-next-line
|
|
40
|
+
'objednavka-prijata': [
|
|
41
|
+
data,
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
const resp = (await this.getSender().send<Response>(request)).getJsonBody().winstrom.results;
|
|
47
|
+
|
|
48
|
+
if (this.dataKey) {
|
|
49
|
+
// eslint-disable-next-line
|
|
50
|
+
const data = dto.getJsonData() as any;
|
|
51
|
+
data[this.dataKey] = resp;
|
|
52
|
+
dto.setNewJsonData(data);
|
|
53
|
+
} else {
|
|
54
|
+
dto.setNewJsonData(resp);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return dto as unknown as ProcessDto<FlexiBeeUpdateObjednavkaPrijataOutput>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface ResponseResult {
|
|
63
|
+
results: {
|
|
64
|
+
id: string;
|
|
65
|
+
ref: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface Response {
|
|
70
|
+
winstrom: {
|
|
71
|
+
results: ResponseResult[];
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface FlexiBeeUpdateObjednavkaPrijataInput {
|
|
76
|
+
id: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type FlexiBeeUpdateObjednavkaPrijataOutput = ResponseResult[];
|