@orchesty/connector-wflow 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/dist/Batch/WflowSubscribeWebhookBatch.d.ts +7 -0
- package/dist/Batch/WflowSubscribeWebhookBatch.js +52 -0
- package/dist/Batch/WflowUnsubscribeWebhookBatch.d.ts +7 -0
- package/dist/Batch/WflowUnsubscribeWebhookBatch.js +42 -0
- package/dist/Connector/WflowGetDocumentConnector.d.ts +310 -0
- package/dist/Connector/WflowGetDocumentConnector.js +25 -0
- package/dist/Connector/WflowGetOrganizationsConnector.d.ts +15 -0
- package/dist/Connector/WflowGetOrganizationsConnector.js +27 -0
- package/dist/Connector/WflowPutDocumentConnector.d.ts +117 -0
- package/dist/Connector/WflowPutDocumentConnector.js +32 -0
- package/dist/Connector/WflowUpdateDocumentStateConnector.d.ts +11 -0
- package/dist/Connector/WflowUpdateDocumentStateConnector.js +25 -0
- package/dist/WflowApplication.d.ts +40 -0
- package/dist/WflowApplication.js +126 -0
- package/dist/package.json +22 -0
- package/jest.config.js +13 -0
- package/package.json +22 -0
- package/src/Batch/WflowSubscribeWebhookBatch.ts +80 -0
- package/src/Batch/WflowUnsubscribeWebhookBatch.ts +55 -0
- package/src/Batch/__tests__/Data/WflowSubscribeWebhookBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/WflowSubscribeWebhookBatch/mock.json +5 -0
- package/src/Batch/__tests__/Data/WflowSubscribeWebhookBatch/output.json +6 -0
- package/src/Batch/__tests__/Data/WflowUnsubscribeWebhookBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/WflowUnsubscribeWebhookBatch/mock.json +5 -0
- package/src/Batch/__tests__/Data/WflowUnsubscribeWebhookBatch/output.json +6 -0
- package/src/Batch/__tests__/WflowSubscribeWebhookBatch.ts +17 -0
- package/src/Batch/__tests__/WflowUnsubscribeWebhookBatch.ts +17 -0
- package/src/Connector/WflowGetDocumentConnector.ts +341 -0
- package/src/Connector/WflowGetOrganizationsConnector.ts +40 -0
- package/src/Connector/WflowPutDocumentConnector.ts +152 -0
- package/src/Connector/WflowUpdateDocumentStateConnector.ts +39 -0
- package/src/Connector/__tests__/Data/WflowGetDocumentConnector/input.json +9 -0
- package/src/Connector/__tests__/Data/WflowGetDocumentConnector/mock.json +449 -0
- package/src/Connector/__tests__/Data/WflowGetDocumentConnector/output.json +450 -0
- package/src/Connector/__tests__/Data/WflowGetOrganizationsConnector/input.json +6 -0
- package/src/Connector/__tests__/Data/WflowGetOrganizationsConnector/mock.json +12 -0
- package/src/Connector/__tests__/Data/WflowGetOrganizationsConnector/output.json +13 -0
- package/src/Connector/__tests__/Data/WflowPutDocumentConnector/input.json +9 -0
- package/src/Connector/__tests__/Data/WflowPutDocumentConnector/mock.json +5 -0
- package/src/Connector/__tests__/Data/WflowPutDocumentConnector/output.json +9 -0
- package/src/Connector/__tests__/Data/WflowUpdateDocumentState/input.json +8 -0
- package/src/Connector/__tests__/Data/WflowUpdateDocumentState/mock.json +5 -0
- package/src/Connector/__tests__/Data/WflowUpdateDocumentState/output.json +8 -0
- package/src/Connector/__tests__/WflowGetDocumentConnector.ts +17 -0
- package/src/Connector/__tests__/WflowGetOrganizationsConnector.ts +17 -0
- package/src/Connector/__tests__/WflowPutDocumentConnector.ts +17 -0
- package/src/Connector/__tests__/WflowUpdateDocumentState.ts +17 -0
- package/src/WflowApplication.ts +140 -0
- package/test/dataProvider.ts +55 -0
- package/tsconfig.json +9 -0
- package/tsconfig.prod.json +10 -0
- package/tsconfig.prod.tsbuildinfo +1 -0
|
@@ -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_UNSUBSCRIBE_WEBHOOK_BATCH } from '../WflowUnsubscribeWebhookBatch';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for WflowUnsubscribeWebhookBatch', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testBatch(WFLOW_UNSUBSCRIBE_WEBHOOK_BATCH);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,341 @@
|
|
|
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 { NAME as WFLOW_APP_NAME, ORGANIZATION, ORGANIZATION_FORM } from '../WflowApplication';
|
|
5
|
+
|
|
6
|
+
export const NAME = `${WFLOW_APP_NAME}-get-document-connector`;
|
|
7
|
+
|
|
8
|
+
export default class WflowGetDocumentConnector extends AConnector {
|
|
9
|
+
|
|
10
|
+
public getName(): string {
|
|
11
|
+
return NAME;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
15
|
+
const app = this.getApplication();
|
|
16
|
+
const applicationInstall = await this.getApplicationInstallFromProcess(dto);
|
|
17
|
+
const { documentId } = dto.getJsonData();
|
|
18
|
+
const organization = applicationInstall.getSettings()[ORGANIZATION_FORM]?.[ORGANIZATION];
|
|
19
|
+
|
|
20
|
+
const request = await app.getRequestDto(
|
|
21
|
+
dto,
|
|
22
|
+
applicationInstall,
|
|
23
|
+
HttpMethods.GET,
|
|
24
|
+
`/${organization}/documents/${documentId}`,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const response = (await this.getSender().send<IOutput>(request)).getJsonBody();
|
|
28
|
+
|
|
29
|
+
return dto.setNewJsonData(response);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IInput {
|
|
35
|
+
documentId: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface IOutput {
|
|
39
|
+
id: string;
|
|
40
|
+
serie: Serie;
|
|
41
|
+
number: string;
|
|
42
|
+
internalCode: string;
|
|
43
|
+
vatDocumentCode: string;
|
|
44
|
+
variableSymbol: string;
|
|
45
|
+
constantSymbol: string;
|
|
46
|
+
specificSymbol: string;
|
|
47
|
+
issueDate: string;
|
|
48
|
+
dueDate: string;
|
|
49
|
+
vatDate: string;
|
|
50
|
+
acceptDate: string;
|
|
51
|
+
caseDate: string;
|
|
52
|
+
validFrom: string;
|
|
53
|
+
validTo: string;
|
|
54
|
+
effectiveFrom: string;
|
|
55
|
+
effectiveTo: string;
|
|
56
|
+
signatureDate: string;
|
|
57
|
+
reviewDate: string;
|
|
58
|
+
accountTerm: string;
|
|
59
|
+
vatTerm: string;
|
|
60
|
+
taxExclusiveAmount: number;
|
|
61
|
+
totalAmount: number;
|
|
62
|
+
roundingAmount: number;
|
|
63
|
+
totalAmountFC: number;
|
|
64
|
+
advanceAmount: number;
|
|
65
|
+
currency: string;
|
|
66
|
+
partnerIC: string;
|
|
67
|
+
partnerVAT: string;
|
|
68
|
+
partnerLocalVAT: string;
|
|
69
|
+
partnerName: string;
|
|
70
|
+
partnerAddress: string;
|
|
71
|
+
partnerEmail: string;
|
|
72
|
+
accountNo: string;
|
|
73
|
+
bankCode: string;
|
|
74
|
+
iban: string;
|
|
75
|
+
bic: string;
|
|
76
|
+
meIC: string;
|
|
77
|
+
exchangeRate: number;
|
|
78
|
+
exchangeRateUnits: number;
|
|
79
|
+
tag: string;
|
|
80
|
+
orderNo: string;
|
|
81
|
+
description: string;
|
|
82
|
+
contactPersonName: string;
|
|
83
|
+
contactPersonEmail: string;
|
|
84
|
+
remainsToDeliverAmount: number;
|
|
85
|
+
invoiceType: string;
|
|
86
|
+
expectedDeliveryDate: string;
|
|
87
|
+
accountCode: string;
|
|
88
|
+
doNotPay: boolean;
|
|
89
|
+
created: string;
|
|
90
|
+
updated: string;
|
|
91
|
+
lastAction: string;
|
|
92
|
+
removed: string;
|
|
93
|
+
locked: boolean;
|
|
94
|
+
approvalStatus: string;
|
|
95
|
+
flowStatus: string;
|
|
96
|
+
payment: {
|
|
97
|
+
paidAmount: number;
|
|
98
|
+
paidDate: string;
|
|
99
|
+
paymentStatus: string;
|
|
100
|
+
paymentOrderAmount: number;
|
|
101
|
+
paymentOrderStatus: string;
|
|
102
|
+
activePaymentRequestDate: string;
|
|
103
|
+
};
|
|
104
|
+
dataSource: string;
|
|
105
|
+
source: string;
|
|
106
|
+
createdBy: string;
|
|
107
|
+
series: string;
|
|
108
|
+
type: {
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
kind: string;
|
|
112
|
+
default: boolean;
|
|
113
|
+
erpExclude: boolean;
|
|
114
|
+
filesExtendName: boolean;
|
|
115
|
+
docCreatingMethod: string;
|
|
116
|
+
autoStamp: string;
|
|
117
|
+
serie: Serie;
|
|
118
|
+
sequence: {
|
|
119
|
+
id: string;
|
|
120
|
+
entity: string;
|
|
121
|
+
description: string;
|
|
122
|
+
fixedPart: string;
|
|
123
|
+
counter: string;
|
|
124
|
+
};
|
|
125
|
+
invoiceType: string;
|
|
126
|
+
};
|
|
127
|
+
partner: {
|
|
128
|
+
id: string;
|
|
129
|
+
externalId: string;
|
|
130
|
+
ic: string;
|
|
131
|
+
vat: string;
|
|
132
|
+
name: string;
|
|
133
|
+
address: string;
|
|
134
|
+
localVAT: string;
|
|
135
|
+
note: string;
|
|
136
|
+
phoneNo: string;
|
|
137
|
+
mailAddress: string;
|
|
138
|
+
deliveryPeriod: number;
|
|
139
|
+
minOrderTotal: number;
|
|
140
|
+
toleranceRate: number;
|
|
141
|
+
language: string;
|
|
142
|
+
isValid: boolean;
|
|
143
|
+
businessRegisterRegistration: string;
|
|
144
|
+
customer: boolean;
|
|
145
|
+
supplier: boolean;
|
|
146
|
+
};
|
|
147
|
+
deliveryLocation: {
|
|
148
|
+
id: string;
|
|
149
|
+
externalId: string;
|
|
150
|
+
code: string;
|
|
151
|
+
description: string;
|
|
152
|
+
isValid: boolean;
|
|
153
|
+
address: string;
|
|
154
|
+
contact: string;
|
|
155
|
+
};
|
|
156
|
+
accounting: Accounting;
|
|
157
|
+
vaTs: {
|
|
158
|
+
rate: number;
|
|
159
|
+
type: string;
|
|
160
|
+
base: number;
|
|
161
|
+
tax: number;
|
|
162
|
+
}[];
|
|
163
|
+
lines: {
|
|
164
|
+
id: string;
|
|
165
|
+
totalAmount: number;
|
|
166
|
+
totalAmountFC: number;
|
|
167
|
+
accountCode: string;
|
|
168
|
+
currency: string;
|
|
169
|
+
description: string;
|
|
170
|
+
quantity: number;
|
|
171
|
+
unitPrice: number;
|
|
172
|
+
measureUnit: string;
|
|
173
|
+
vatType: string;
|
|
174
|
+
vatRate: number;
|
|
175
|
+
order: number;
|
|
176
|
+
approval: {
|
|
177
|
+
level: number;
|
|
178
|
+
team: {
|
|
179
|
+
id: string;
|
|
180
|
+
name: string;
|
|
181
|
+
description: string;
|
|
182
|
+
system: boolean;
|
|
183
|
+
};
|
|
184
|
+
identity: {
|
|
185
|
+
login: string;
|
|
186
|
+
firstName: string;
|
|
187
|
+
lastName: string;
|
|
188
|
+
fullName: string;
|
|
189
|
+
};
|
|
190
|
+
date: string;
|
|
191
|
+
status: string;
|
|
192
|
+
};
|
|
193
|
+
changedAfterApprove: boolean;
|
|
194
|
+
accounting: Accounting;
|
|
195
|
+
code: string;
|
|
196
|
+
costCenter: CostCenter;
|
|
197
|
+
contract: Contract;
|
|
198
|
+
activity: Activity;
|
|
199
|
+
}[];
|
|
200
|
+
transactionId: string;
|
|
201
|
+
expenseCardId: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
interface Serie {
|
|
205
|
+
id: string;
|
|
206
|
+
externalId: string;
|
|
207
|
+
code: string;
|
|
208
|
+
description: string;
|
|
209
|
+
isValid: boolean;
|
|
210
|
+
kind: string;
|
|
211
|
+
invoiceType: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface Accounting {
|
|
215
|
+
businessItemCode: string;
|
|
216
|
+
accountingRule: {
|
|
217
|
+
id: string;
|
|
218
|
+
externalId: string;
|
|
219
|
+
code: string;
|
|
220
|
+
description: string;
|
|
221
|
+
isValid: boolean;
|
|
222
|
+
kind: string;
|
|
223
|
+
};
|
|
224
|
+
activity: Activity;
|
|
225
|
+
businessCase: {
|
|
226
|
+
id: string;
|
|
227
|
+
externalId: string;
|
|
228
|
+
code: string;
|
|
229
|
+
description: string;
|
|
230
|
+
isValid: boolean;
|
|
231
|
+
};
|
|
232
|
+
cardDocumentType: {
|
|
233
|
+
id: string;
|
|
234
|
+
externalId: string;
|
|
235
|
+
code: string;
|
|
236
|
+
description: string;
|
|
237
|
+
isValid: boolean;
|
|
238
|
+
};
|
|
239
|
+
cashDocumentType: {
|
|
240
|
+
id: string;
|
|
241
|
+
externalId: string;
|
|
242
|
+
code: string;
|
|
243
|
+
description: string;
|
|
244
|
+
isValid: boolean;
|
|
245
|
+
};
|
|
246
|
+
cashRegister: {
|
|
247
|
+
id: string;
|
|
248
|
+
externalId: string;
|
|
249
|
+
code: string;
|
|
250
|
+
description: string;
|
|
251
|
+
isValid: boolean;
|
|
252
|
+
};
|
|
253
|
+
contraAccount: {
|
|
254
|
+
id: string;
|
|
255
|
+
externalId: string;
|
|
256
|
+
code: string;
|
|
257
|
+
description: string;
|
|
258
|
+
isValid: boolean;
|
|
259
|
+
};
|
|
260
|
+
contract: Contract;
|
|
261
|
+
costCenter: CostCenter;
|
|
262
|
+
employee: {
|
|
263
|
+
id: string;
|
|
264
|
+
externalId: string;
|
|
265
|
+
code: string;
|
|
266
|
+
description: string;
|
|
267
|
+
isValid: boolean;
|
|
268
|
+
};
|
|
269
|
+
paymentMethod: {
|
|
270
|
+
id: string;
|
|
271
|
+
externalId: string;
|
|
272
|
+
code: string;
|
|
273
|
+
description: string;
|
|
274
|
+
isValid: boolean;
|
|
275
|
+
kind: string;
|
|
276
|
+
};
|
|
277
|
+
project: {
|
|
278
|
+
id: string;
|
|
279
|
+
externalId: string;
|
|
280
|
+
code: string;
|
|
281
|
+
description: string;
|
|
282
|
+
isValid: boolean;
|
|
283
|
+
};
|
|
284
|
+
vatControlStatementLine: {
|
|
285
|
+
id: string;
|
|
286
|
+
externalId: string;
|
|
287
|
+
code: string;
|
|
288
|
+
description: string;
|
|
289
|
+
isValid: boolean;
|
|
290
|
+
};
|
|
291
|
+
vatReturnLine: {
|
|
292
|
+
id: string;
|
|
293
|
+
externalId: string;
|
|
294
|
+
code: string;
|
|
295
|
+
description: string;
|
|
296
|
+
isValid: boolean;
|
|
297
|
+
reverseCharge: boolean;
|
|
298
|
+
};
|
|
299
|
+
vatReverseChargeCode: {
|
|
300
|
+
id: string;
|
|
301
|
+
externalId: string;
|
|
302
|
+
code: string;
|
|
303
|
+
description: string;
|
|
304
|
+
isValid: boolean;
|
|
305
|
+
};
|
|
306
|
+
vehicle: {
|
|
307
|
+
id: string;
|
|
308
|
+
externalId: string;
|
|
309
|
+
code: string;
|
|
310
|
+
description: string;
|
|
311
|
+
isValid: boolean;
|
|
312
|
+
};
|
|
313
|
+
vatSupplyModeCode: string;
|
|
314
|
+
vatApplyReductionCoefficient: boolean;
|
|
315
|
+
vatFixedAssets: boolean;
|
|
316
|
+
vatMode: string;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
interface CostCenter {
|
|
320
|
+
id: string;
|
|
321
|
+
externalId: string;
|
|
322
|
+
code: string;
|
|
323
|
+
description: string;
|
|
324
|
+
isValid: boolean;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface Contract {
|
|
328
|
+
id: string;
|
|
329
|
+
externalId: string;
|
|
330
|
+
code: string;
|
|
331
|
+
description: string;
|
|
332
|
+
isValid: boolean;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface Activity {
|
|
336
|
+
id: string;
|
|
337
|
+
externalId: string;
|
|
338
|
+
code: string;
|
|
339
|
+
description: string;
|
|
340
|
+
isValid: boolean;
|
|
341
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { NAME as WFLOW_APPLICATION } from '../WflowApplication';
|
|
5
|
+
|
|
6
|
+
export const NAME = `${WFLOW_APPLICATION}-get-organizations-connector`;
|
|
7
|
+
|
|
8
|
+
export default class WflowGetOrganizationsConnector 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 app = this.getApplication();
|
|
20
|
+
|
|
21
|
+
const request = await app.getRequestDto(
|
|
22
|
+
dto,
|
|
23
|
+
await this.getApplicationInstallFromProcess(dto, this.useInForm ? null : true),
|
|
24
|
+
HttpMethods.GET,
|
|
25
|
+
'/user/myorganizations',
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const response = (await this.getSender().send<IOutput[]>(request)).getJsonBody();
|
|
29
|
+
|
|
30
|
+
return dto.setNewJsonData(response);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface IOutput {
|
|
36
|
+
name: string;
|
|
37
|
+
baseURL: string;
|
|
38
|
+
subdomain: string;
|
|
39
|
+
trialExpiration?: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
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 { NAME as WFLOW_APP_NAME, ORGANIZATION, ORGANIZATION_FORM } from '../WflowApplication';
|
|
5
|
+
|
|
6
|
+
export const NAME = `${WFLOW_APP_NAME}-put-document-connector`;
|
|
7
|
+
|
|
8
|
+
export default class WflowPutDocumentConnector extends AConnector {
|
|
9
|
+
|
|
10
|
+
public getName(): string {
|
|
11
|
+
return NAME;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
15
|
+
const app = this.getApplication();
|
|
16
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
17
|
+
const { externalId, ignoreLock, setAsFilled } = dto.getJsonData();
|
|
18
|
+
|
|
19
|
+
const query = new URLSearchParams();
|
|
20
|
+
if (externalId) query.set('externalId', externalId);
|
|
21
|
+
if (ignoreLock) query.set('ignoreLock', ignoreLock.toString());
|
|
22
|
+
if (setAsFilled) query.set('setAsFilled', setAsFilled.toString());
|
|
23
|
+
|
|
24
|
+
const organization: string | undefined
|
|
25
|
+
= appInstall.getSettings()[ORGANIZATION_FORM]?.[ORGANIZATION];
|
|
26
|
+
|
|
27
|
+
const request = await app.getRequestDto(
|
|
28
|
+
dto,
|
|
29
|
+
appInstall,
|
|
30
|
+
HttpMethods.PUT,
|
|
31
|
+
`/${organization}/documents${query.size ? `?${query}` : ''}`,
|
|
32
|
+
dto.getJsonData(),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
await this.getSender().send(request);
|
|
36
|
+
|
|
37
|
+
return dto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface UpdateRegister {
|
|
43
|
+
id: string;
|
|
44
|
+
externalId: string;
|
|
45
|
+
code: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface IInput {
|
|
49
|
+
id: string;
|
|
50
|
+
externalId?: string;
|
|
51
|
+
ignoreLock?: boolean;
|
|
52
|
+
setAsFilled?: boolean;
|
|
53
|
+
type?: {
|
|
54
|
+
id?: string;
|
|
55
|
+
kind?: 'IncomingInvoice' | 'OutgoingInvoice' | 'ExpenditureCashSlip' | 'SupplierOrder' | 'CustomerOrder' | 'Other' | 'Contract' | 'IncomeCashReceipt';
|
|
56
|
+
};
|
|
57
|
+
number?: string;
|
|
58
|
+
internalCode?: string;
|
|
59
|
+
vatDocumentCode?: string;
|
|
60
|
+
variableSymbol?: string;
|
|
61
|
+
constantSymbol?: string;
|
|
62
|
+
specificSymbol?: string;
|
|
63
|
+
issueDate?: string;
|
|
64
|
+
dueDate?: string;
|
|
65
|
+
vatDate?: string;
|
|
66
|
+
acceptDate?: string;
|
|
67
|
+
caseDate?: string;
|
|
68
|
+
validFrom?: string;
|
|
69
|
+
validTo?: string;
|
|
70
|
+
effectiveFrom?: string;
|
|
71
|
+
effectiveTo?: string;
|
|
72
|
+
signatureDate?: string;
|
|
73
|
+
reviewDate?: string;
|
|
74
|
+
accountTerm?: string;
|
|
75
|
+
vatTerm?: string;
|
|
76
|
+
totalAmount?: number;
|
|
77
|
+
roundingAmount?: number;
|
|
78
|
+
totalAmountFC?: number;
|
|
79
|
+
advanceAmount?: number;
|
|
80
|
+
currency?: string;
|
|
81
|
+
partnerIC?: string;
|
|
82
|
+
partnerVAT?: string;
|
|
83
|
+
partnerLocalVAT?: string;
|
|
84
|
+
partnerName?: string;
|
|
85
|
+
partnerAddress?: string;
|
|
86
|
+
partnerEmail?: string;
|
|
87
|
+
accountNo?: string;
|
|
88
|
+
bankCode?: string;
|
|
89
|
+
iban?: string;
|
|
90
|
+
bic?: string;
|
|
91
|
+
meIC?: string;
|
|
92
|
+
exchangeRate?: number;
|
|
93
|
+
exchangeRateUnits?: number;
|
|
94
|
+
tag?: string;
|
|
95
|
+
orderNo?: string;
|
|
96
|
+
description?: string;
|
|
97
|
+
contactPersonName?: string;
|
|
98
|
+
contactPersonEmail?: string;
|
|
99
|
+
invoiceType?: 'TaxInvoice' | 'CreditNote' | 'DebitNote' | 'Proforma' | 'TaxInvoicePayment';
|
|
100
|
+
expectedDeliveryDate?: string;
|
|
101
|
+
deliveryLocation?: UpdateRegister;
|
|
102
|
+
series?: string;
|
|
103
|
+
serie?: UpdateRegister;
|
|
104
|
+
accountCode?: string;
|
|
105
|
+
doNotPay?: boolean;
|
|
106
|
+
partner?: {
|
|
107
|
+
id: string;
|
|
108
|
+
};
|
|
109
|
+
vaTs?: {
|
|
110
|
+
type: 'Exempt' | 'FirstReduced' | 'SecondReduced' | 'Basic';
|
|
111
|
+
rate?: number;
|
|
112
|
+
base?: number;
|
|
113
|
+
tax?: number;
|
|
114
|
+
}[];
|
|
115
|
+
lines?: {
|
|
116
|
+
id?: string;
|
|
117
|
+
totalAmount?: number;
|
|
118
|
+
totalAmountFC?: number;
|
|
119
|
+
accountCode?: string;
|
|
120
|
+
currency?: string;
|
|
121
|
+
description?: string;
|
|
122
|
+
quantity?: number;
|
|
123
|
+
unitPrice?: number;
|
|
124
|
+
measureUnit?: string;
|
|
125
|
+
order?: number;
|
|
126
|
+
}[];
|
|
127
|
+
accounting?: {
|
|
128
|
+
businessItemCode?: string;
|
|
129
|
+
accountingRule?: UpdateRegister;
|
|
130
|
+
activity?: UpdateRegister;
|
|
131
|
+
businessCase?: UpdateRegister;
|
|
132
|
+
cardDocumentType?: UpdateRegister;
|
|
133
|
+
cashDocumentType?: UpdateRegister;
|
|
134
|
+
cashRegister?: UpdateRegister;
|
|
135
|
+
contraAccount?: UpdateRegister;
|
|
136
|
+
contract?: UpdateRegister;
|
|
137
|
+
costCenter?: UpdateRegister;
|
|
138
|
+
employee?: UpdateRegister;
|
|
139
|
+
paymentMethod?: UpdateRegister;
|
|
140
|
+
project?: UpdateRegister;
|
|
141
|
+
vatControlStatementLine?: UpdateRegister;
|
|
142
|
+
vatReturnLine?: UpdateRegister;
|
|
143
|
+
vatReverseChargeCode?: UpdateRegister;
|
|
144
|
+
vehicle?: UpdateRegister;
|
|
145
|
+
vatSupplyModeCode?: 'Normal' | 'TravelService' | 'UsedGoods';
|
|
146
|
+
vatApplyReductionCoefficient?: boolean;
|
|
147
|
+
vatFixedAssets?: boolean;
|
|
148
|
+
vatMode?: 'Standard' | 'ReverseChargeDomestic' | 'ReverseCharge' | 'Excluded' | 'InForeignCurrency';
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type IOutput = IInput;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { NAME as WFLOW_APP_NAME, ORGANIZATION, ORGANIZATION_FORM } from '../WflowApplication';
|
|
5
|
+
|
|
6
|
+
export const NAME = `${WFLOW_APP_NAME}-update-document-state-connector`;
|
|
7
|
+
|
|
8
|
+
export default class WflowUpdateDocumentStateConnector extends AConnector {
|
|
9
|
+
|
|
10
|
+
public getName(): string {
|
|
11
|
+
return NAME;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
|
|
15
|
+
const app = this.getApplication();
|
|
16
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
17
|
+
const { documentId } = dto.getJsonData();
|
|
18
|
+
|
|
19
|
+
const organization: string | undefined
|
|
20
|
+
= appInstall.getSettings()[ORGANIZATION_FORM]?.[ORGANIZATION];
|
|
21
|
+
|
|
22
|
+
const request = await app.getRequestDto(
|
|
23
|
+
dto,
|
|
24
|
+
appInstall,
|
|
25
|
+
HttpMethods.PUT,
|
|
26
|
+
`/${organization}/documents/${documentId}/task/Export/processed`,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
await this.getSender().send(request, [200]);
|
|
30
|
+
return dto;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface IInput {
|
|
36
|
+
documentId: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type IOutput = IInput;
|