@orchesty/connector-raynet-crm 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 +283 -0
- package/coverage/coverage-final.json +13 -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/RaynetCRMGetActivities.ts.html +385 -0
- package/coverage/lcov-report/src/Batch/RaynetCRMGetClients.ts.html +679 -0
- package/coverage/lcov-report/src/Batch/RaynetCRMGetContactPersons.ts.html +553 -0
- package/coverage/lcov-report/src/Batch/RaynetCRMSubscribeWebhook.ts.html +355 -0
- package/coverage/lcov-report/src/Batch/RaynetCRMUnregisterWebhook.ts.html +241 -0
- package/coverage/lcov-report/src/Batch/index.html +176 -0
- package/coverage/lcov-report/src/Connector/RaynetCRMGetVoipByTel.ts.html +856 -0
- package/coverage/lcov-report/src/Connector/RaynetCRMUniversalActivityDetail.ts.html +448 -0
- package/coverage/lcov-report/src/Connector/RaynetCRMUniversalCreateActivity.ts.html +223 -0
- package/coverage/lcov-report/src/Connector/RaynetCRMUniversalDeleteActivity.ts.html +184 -0
- package/coverage/lcov-report/src/Connector/RaynetCRMUniversalUpdateActivity.ts.html +205 -0
- package/coverage/lcov-report/src/Connector/index.html +176 -0
- package/coverage/lcov-report/src/RaynetCRMApplication.ts.html +331 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/test/dataProvider.ts.html +205 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov.info +465 -0
- package/dist/Batch/RaynetCRMGetActivities.d.ts +58 -0
- package/dist/Batch/RaynetCRMGetActivities.js +38 -0
- package/dist/Batch/RaynetCRMGetClients.d.ts +161 -0
- package/dist/Batch/RaynetCRMGetClients.js +33 -0
- package/dist/Batch/RaynetCRMGetContactPersons.d.ts +119 -0
- package/dist/Batch/RaynetCRMGetContactPersons.js +33 -0
- package/dist/Batch/RaynetCRMSubscribeWebhook.d.ts +15 -0
- package/dist/Batch/RaynetCRMSubscribeWebhook.js +64 -0
- package/dist/Batch/RaynetCRMUnregisterWebhook.d.ts +7 -0
- package/dist/Batch/RaynetCRMUnregisterWebhook.js +39 -0
- package/dist/Connector/RaynetCRMGetVoipByTel.d.ts +225 -0
- package/dist/Connector/RaynetCRMGetVoipByTel.js +27 -0
- package/dist/Connector/RaynetCRMUniversalActivityDetail.d.ts +86 -0
- package/dist/Connector/RaynetCRMUniversalActivityDetail.js +31 -0
- package/dist/Connector/RaynetCRMUniversalCreateActivity.d.ts +18 -0
- package/dist/Connector/RaynetCRMUniversalCreateActivity.js +25 -0
- package/dist/Connector/RaynetCRMUniversalDeleteActivity.d.ts +12 -0
- package/dist/Connector/RaynetCRMUniversalDeleteActivity.js +22 -0
- package/dist/Connector/RaynetCRMUniversalUpdateActivity.d.ts +11 -0
- package/dist/Connector/RaynetCRMUniversalUpdateActivity.js +27 -0
- package/dist/RaynetCRMApplication.d.ts +19 -0
- package/dist/RaynetCRMApplication.js +92 -0
- package/dist/package.json +23 -0
- package/jest.config.js +13 -0
- package/package.json +23 -0
- package/src/Batch/RaynetCRMGetActivities.ts +100 -0
- package/src/Batch/RaynetCRMGetClients.ts +198 -0
- package/src/Batch/RaynetCRMGetContactPersons.ts +156 -0
- package/src/Batch/RaynetCRMSubscribeWebhook.ts +90 -0
- package/src/Batch/RaynetCRMUnregisterWebhook.ts +52 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetActivities/from-input.json +8 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetActivities/from-mock.json +64 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetActivities/from-output.json +11 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetActivities/input.json +6 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetActivities/mock.json +64 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetActivities/output.json +11 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetClients/email-input.json +8 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetClients/email-mock.json +157 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetClients/email-output.json +11 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetClients/input.json +6 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetClients/mock.json +157 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetClients/output.json +11 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetContactPersons/email-input.json +8 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetContactPersons/email-mock.json +157 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetContactPersons/email-output.json +11 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetContactPersons/input.json +6 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetContactPersons/mock.json +112 -0
- package/src/Batch/__tests__/Data/RaynetCRMGetContactPersons/output.json +11 -0
- package/src/Batch/__tests__/Data/RaynetCRMSubscribeWebhook/input.json +6 -0
- package/src/Batch/__tests__/Data/RaynetCRMSubscribeWebhook/mock.json +10 -0
- package/src/Batch/__tests__/Data/RaynetCRMSubscribeWebhook/output.json +6 -0
- package/src/Batch/__tests__/Data/RaynetCRMUnregisterWebhook/input.json +6 -0
- package/src/Batch/__tests__/Data/RaynetCRMUnregisterWebhook/mock.json +7 -0
- package/src/Batch/__tests__/Data/RaynetCRMUnregisterWebhook/output.json +6 -0
- package/src/Batch/__tests__/RaynetCRMGetActivities.ts +23 -0
- package/src/Batch/__tests__/RaynetCRMGetClients.ts +23 -0
- package/src/Batch/__tests__/RaynetCRMGetContactPersons.ts +23 -0
- package/src/Batch/__tests__/RaynetCRMSubscribeWebhook.ts +18 -0
- package/src/Batch/__tests__/RaynetCRMUnregisterWebhook.ts +42 -0
- package/src/Connector/RaynetCRMGetVoipByTel.ts +257 -0
- package/src/Connector/RaynetCRMUniversalActivityDetail.ts +121 -0
- package/src/Connector/RaynetCRMUniversalCreateActivity.ts +46 -0
- package/src/Connector/RaynetCRMUniversalDeleteActivity.ts +33 -0
- package/src/Connector/RaynetCRMUniversalUpdateActivity.ts +40 -0
- package/src/Connector/__tests__/Data/RaynetCRMGetVoipByTel/input.json +8 -0
- package/src/Connector/__tests__/Data/RaynetCRMGetVoipByTel/mock.json +216 -0
- package/src/Connector/__tests__/Data/RaynetCRMGetVoipByTel/output.json +217 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalActivityDetail/input.json +22 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalActivityDetail/mock.json +84 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalActivityDetail/output.json +83 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalCreateActivity/input.json +83 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalCreateActivity/mock.json +10 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalCreateActivity/output.json +11 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalDeleteActivity/input.json +9 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalDeleteActivity/mock.json +7 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalDeleteActivity/output.json +8 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalUpdateActivity/input.json +83 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalUpdateActivity/mock.json +7 -0
- package/src/Connector/__tests__/Data/RaynetCRMUniversalUpdateActivity/output.json +8 -0
- package/src/Connector/__tests__/RaynetCRMGetVoipByTel.ts +18 -0
- package/src/Connector/__tests__/RaynetCRMUniversalActivityDetail.ts +18 -0
- package/src/Connector/__tests__/RaynetCRMUniversalCreateActivity.ts +18 -0
- package/src/Connector/__tests__/RaynetCRMUniversalDeleteActivity.ts +18 -0
- package/src/Connector/__tests__/RaynetCRMUniversalUpdateActivity.ts +18 -0
- package/src/RaynetCRMApplication.ts +82 -0
- package/test/dataProvider.ts +40 -0
- package/tsconfig.json +8 -0
- package/tsconfig.prod.json +13 -0
- package/tsconfig.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
|
|
2
|
+
import ResponseDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResponseDto';
|
|
3
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
4
|
+
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
|
|
5
|
+
|
|
6
|
+
export const NAME = 'raynet-crm-get-contact-persons';
|
|
7
|
+
export const LIMIT = 1000;
|
|
8
|
+
|
|
9
|
+
export default class RaynetCRMGetContactPersons extends ABatchNode {
|
|
10
|
+
|
|
11
|
+
protected limit = LIMIT;
|
|
12
|
+
|
|
13
|
+
public getName(): string {
|
|
14
|
+
return NAME;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async processAction(dto: BatchProcessDto<IInput>): Promise<BatchProcessDto> {
|
|
18
|
+
const email = this.getData(dto);
|
|
19
|
+
const page = Number(dto.getBatchCursor('0'));
|
|
20
|
+
|
|
21
|
+
const req = await this.getApplication().getRequestDto(
|
|
22
|
+
dto,
|
|
23
|
+
await this.getApplicationInstallFromProcess(dto),
|
|
24
|
+
HttpMethods.GET,
|
|
25
|
+
`person?offset=${page}&limit=${this.limit}${email ? `&contactInfo.email=${email}` : ''}`,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return this.processResponse(dto, await this.getSender().send<IResponse>(req, [200]), page);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected getData(dto: BatchProcessDto<IInput>): string {
|
|
32
|
+
return dto.getJsonData().email ?? '';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected processResponse(dto: BatchProcessDto, resp: ResponseDto<IResponse>, page: number): BatchProcessDto {
|
|
36
|
+
const { totalCount } = resp.getJsonBody();
|
|
37
|
+
|
|
38
|
+
if (totalCount && totalCount > this.limit * (page + 1)) {
|
|
39
|
+
dto.setBatchCursor(String(page + 1));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return dto.setItemList(resp.getJsonBody().data);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface IInput {
|
|
48
|
+
email?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
52
|
+
export interface IResponse {
|
|
53
|
+
success: string;
|
|
54
|
+
totalCount: number;
|
|
55
|
+
data: {
|
|
56
|
+
id: number;
|
|
57
|
+
titleBefore: string;
|
|
58
|
+
firstName: string;
|
|
59
|
+
lastName: string;
|
|
60
|
+
titleAfter: string;
|
|
61
|
+
primaryRelationship: {
|
|
62
|
+
id: number;
|
|
63
|
+
type: string;
|
|
64
|
+
company: {
|
|
65
|
+
id: number;
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
owner: {
|
|
70
|
+
id: number;
|
|
71
|
+
fullName: string;
|
|
72
|
+
};
|
|
73
|
+
contactInfo: {
|
|
74
|
+
email: string;
|
|
75
|
+
email2: string;
|
|
76
|
+
tel1: string;
|
|
77
|
+
tel1Type: string;
|
|
78
|
+
tel2?: unknown;
|
|
79
|
+
tel2Type?: unknown;
|
|
80
|
+
www?: unknown;
|
|
81
|
+
otherContact?: unknown;
|
|
82
|
+
};
|
|
83
|
+
privateAddress: {
|
|
84
|
+
city: string;
|
|
85
|
+
country: string;
|
|
86
|
+
countryCode: string;
|
|
87
|
+
province?: unknown;
|
|
88
|
+
street: string;
|
|
89
|
+
zipCode: string;
|
|
90
|
+
};
|
|
91
|
+
category: {
|
|
92
|
+
id: number;
|
|
93
|
+
value: string;
|
|
94
|
+
};
|
|
95
|
+
personClassification1: {
|
|
96
|
+
id: number;
|
|
97
|
+
value: string;
|
|
98
|
+
};
|
|
99
|
+
personClassification2: {
|
|
100
|
+
id: number;
|
|
101
|
+
value: string;
|
|
102
|
+
};
|
|
103
|
+
personClassification3: {
|
|
104
|
+
id: number;
|
|
105
|
+
value: string;
|
|
106
|
+
};
|
|
107
|
+
salutation: string;
|
|
108
|
+
birthday: string;
|
|
109
|
+
language: {
|
|
110
|
+
id: number;
|
|
111
|
+
value: string;
|
|
112
|
+
};
|
|
113
|
+
maritalStatus: {
|
|
114
|
+
id: number;
|
|
115
|
+
value: string;
|
|
116
|
+
};
|
|
117
|
+
gender: string;
|
|
118
|
+
companyAddress: {
|
|
119
|
+
address: {
|
|
120
|
+
id: number;
|
|
121
|
+
city: string;
|
|
122
|
+
country: string;
|
|
123
|
+
countryCode: string;
|
|
124
|
+
province?: unknown;
|
|
125
|
+
street: string;
|
|
126
|
+
zipCode: string;
|
|
127
|
+
};
|
|
128
|
+
territory?: unknown;
|
|
129
|
+
};
|
|
130
|
+
customFields?: unknown;
|
|
131
|
+
'rowInfo.createdAt': string;
|
|
132
|
+
'rowInfo.createdBy': string;
|
|
133
|
+
'rowInfo.updatedAt': string;
|
|
134
|
+
'rowInfo.updatedBy': string;
|
|
135
|
+
'rowInfo.rowAccess'?: unknown;
|
|
136
|
+
'rowInfo.rowState'?: unknown;
|
|
137
|
+
securityLevel: {
|
|
138
|
+
id: number;
|
|
139
|
+
name: string;
|
|
140
|
+
};
|
|
141
|
+
notice: string;
|
|
142
|
+
activeUserAccount: boolean;
|
|
143
|
+
keyman: boolean;
|
|
144
|
+
tags: unknown[];
|
|
145
|
+
_version: number;
|
|
146
|
+
inlineGdpr: {
|
|
147
|
+
id: number;
|
|
148
|
+
validFrom: string;
|
|
149
|
+
validTill: string;
|
|
150
|
+
legalTitle: string;
|
|
151
|
+
templateName: string;
|
|
152
|
+
gdprTemplate: number;
|
|
153
|
+
}[];
|
|
154
|
+
}[];
|
|
155
|
+
}
|
|
156
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
|
|
2
|
+
import Webhook from '@orchesty/nodejs-sdk/dist/lib/Application/Database/Webhook';
|
|
3
|
+
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
|
|
4
|
+
import TopologyRunner from '@orchesty/nodejs-sdk/dist/lib/Topology/TopologyRunner';
|
|
5
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
6
|
+
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
|
|
7
|
+
import ResultCode from '@orchesty/nodejs-sdk/dist/lib/Utils/ResultCode';
|
|
8
|
+
import crypto from 'crypto';
|
|
9
|
+
import RaynetCRMApplication from '../RaynetCRMApplication';
|
|
10
|
+
|
|
11
|
+
export const NAME = 'raynet-crm-subscribe-webhook';
|
|
12
|
+
|
|
13
|
+
export function getEntities(): string[] {
|
|
14
|
+
return ['Task', 'Email', 'Meeting', 'Letter', 'PhoneCall', 'Event'];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class RaynetCRMSubscribeWebhook extends ABatchNode {
|
|
18
|
+
|
|
19
|
+
public getName(): string {
|
|
20
|
+
return NAME;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
|
|
24
|
+
const app = this.getApplication<RaynetCRMApplication>();
|
|
25
|
+
|
|
26
|
+
const webhookIndex = Number(dto.getBatchCursor('0'));
|
|
27
|
+
const webhooks = app.getWebhookSubscriptions();
|
|
28
|
+
|
|
29
|
+
if (webhooks.length > 0) {
|
|
30
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
31
|
+
const repo = this.getDbClient().getRepository(Webhook);
|
|
32
|
+
|
|
33
|
+
const token = this.getRandomToken();
|
|
34
|
+
const requestDto = app.getRequestDto(
|
|
35
|
+
dto,
|
|
36
|
+
appInstall,
|
|
37
|
+
HttpMethods.PUT,
|
|
38
|
+
'webhook',
|
|
39
|
+
{
|
|
40
|
+
url: TopologyRunner.getWebhookUrl(
|
|
41
|
+
webhooks[webhookIndex].getTopology(),
|
|
42
|
+
webhooks[webhookIndex].getNode(),
|
|
43
|
+
token,
|
|
44
|
+
),
|
|
45
|
+
events: webhooks[webhookIndex].getName().split(','),
|
|
46
|
+
entityFilter: getEntities(),
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
let res;
|
|
51
|
+
try {
|
|
52
|
+
res = await this.getSender().send<IResponseJson>(requestDto, [201]);
|
|
53
|
+
const respBody = res.getJsonBody();
|
|
54
|
+
|
|
55
|
+
await repo.insert(new Webhook()
|
|
56
|
+
.setWebhookId(respBody.data.uuid)
|
|
57
|
+
.setUser(appInstall.getUser())
|
|
58
|
+
.setNode(webhooks[webhookIndex].getNode())
|
|
59
|
+
.setToken(token)
|
|
60
|
+
.setApplication(app.getName())
|
|
61
|
+
.setTopology(webhooks[webhookIndex].getTopology())
|
|
62
|
+
.setName(webhooks[webhookIndex].getName()));
|
|
63
|
+
|
|
64
|
+
if (webhooks.length - 1 > webhookIndex) {
|
|
65
|
+
dto.setBatchCursor((webhookIndex + 1).toString());
|
|
66
|
+
}
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
68
|
+
} catch (e) {
|
|
69
|
+
appInstall.setEnabled(false);
|
|
70
|
+
await this.getDbClient().getRepository(ApplicationInstall).update(appInstall);
|
|
71
|
+
|
|
72
|
+
dto.setStopProcess(ResultCode.STOP_AND_FAILED, res?.getBody() ?? 'Webhook could not be registered!');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return dto;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private getRandomToken(): string {
|
|
80
|
+
return crypto.randomBytes(64).toString('hex');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface IResponseJson {
|
|
86
|
+
success: boolean;
|
|
87
|
+
data: {
|
|
88
|
+
uuid: string;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Webhook from '@orchesty/nodejs-sdk/dist/lib/Application/Database/Webhook';
|
|
2
|
+
import WebhookRepository from '@orchesty/nodejs-sdk/dist/lib/Application/Database/WebhookRepository';
|
|
3
|
+
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
|
|
4
|
+
import OnRepeatException from '@orchesty/nodejs-sdk/dist/lib/Exception/OnRepeatException';
|
|
5
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
6
|
+
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
|
|
7
|
+
import { StatusCodes } from 'http-status-codes';
|
|
8
|
+
import RaynetCRMApplication from '../RaynetCRMApplication';
|
|
9
|
+
|
|
10
|
+
export const NAME = 'raynet-crm-unregister-webhook';
|
|
11
|
+
|
|
12
|
+
export default class RaynetCRMUnregisterWebhook extends ABatchNode {
|
|
13
|
+
|
|
14
|
+
public getName(): string {
|
|
15
|
+
return NAME;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
|
|
19
|
+
const app = this.getApplication<RaynetCRMApplication>();
|
|
20
|
+
|
|
21
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto, null, true);
|
|
22
|
+
|
|
23
|
+
const repo = this.getDbClient().getRepository(Webhook) as WebhookRepository;
|
|
24
|
+
const webhooks = await repo.findMany({ users: [appInstall.getUser()], apps: [app.getName()] });
|
|
25
|
+
|
|
26
|
+
if (webhooks && webhooks.length > 0) {
|
|
27
|
+
const webhookId = webhooks[0].getWebhookId();
|
|
28
|
+
const requestDto = app.getRequestDto(
|
|
29
|
+
dto,
|
|
30
|
+
appInstall,
|
|
31
|
+
HttpMethods.DELETE,
|
|
32
|
+
`webhook/${webhookId}`,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const res = await this.getSender().send(requestDto);
|
|
36
|
+
if (res.getResponseCode() !== StatusCodes.OK && res.getResponseCode() !== StatusCodes.NOT_FOUND) {
|
|
37
|
+
webhooks[0].setUnsubscribeFailed(true);
|
|
38
|
+
await repo.update(webhooks[0]);
|
|
39
|
+
throw new OnRepeatException(60, 10, res.getBody());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
await repo.remove(webhooks[0]);
|
|
43
|
+
|
|
44
|
+
if (webhooks.length > 1) {
|
|
45
|
+
dto.setBatchCursor('next');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return dto;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET https://app.raynet.cz/api/v2/activity?offset=0&limit=1000&rowInfo.lastModifiedAt[GE]=1970-1-1%200:0&dateFormat=ISO8601&scheduledFrom=2017-04-15T03:00:50.7579581Z",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"success": true,
|
|
6
|
+
"totalCount": 1,
|
|
7
|
+
"data": [
|
|
8
|
+
{
|
|
9
|
+
"_entityName": "Meeting",
|
|
10
|
+
"id": 2,
|
|
11
|
+
"title": "ZRDZ-Meeting-",
|
|
12
|
+
"personal": true,
|
|
13
|
+
"status": "SCHEDULED",
|
|
14
|
+
"priority": "DEFAULT",
|
|
15
|
+
"category": null,
|
|
16
|
+
"activity": null,
|
|
17
|
+
"company": null,
|
|
18
|
+
"person": null,
|
|
19
|
+
"lead": null,
|
|
20
|
+
"project": null,
|
|
21
|
+
"businessCase": null,
|
|
22
|
+
"offer": null,
|
|
23
|
+
"salesOrder": null,
|
|
24
|
+
"scheduledFrom": "2024-02-08T15:00:00.000+01:00",
|
|
25
|
+
"scheduledTill": "2024-02-08T15:30:00.000+01:00",
|
|
26
|
+
"completed": null,
|
|
27
|
+
"description": "<p>ZTSR</p>",
|
|
28
|
+
"solution": null,
|
|
29
|
+
"tags": [],
|
|
30
|
+
"rowInfo.createdAt": "2024-02-05T09:33:13.833+01:00",
|
|
31
|
+
"rowInfo.createdBy": "fila.r@hanaboso.com",
|
|
32
|
+
"rowInfo.updatedAt": "2024-02-07T12:42:24.900+01:00",
|
|
33
|
+
"rowInfo.updatedBy": "fila.r@hanaboso.com",
|
|
34
|
+
"rowInfo.rowAccess": null,
|
|
35
|
+
"rowInfo.rowState": null,
|
|
36
|
+
"securityLevel": {
|
|
37
|
+
"id": 1,
|
|
38
|
+
"name": "Sdílená"
|
|
39
|
+
},
|
|
40
|
+
"_version": 7,
|
|
41
|
+
"customFields": {},
|
|
42
|
+
"participants": [
|
|
43
|
+
{
|
|
44
|
+
"owner": true,
|
|
45
|
+
"role": "FROM",
|
|
46
|
+
"name": "Richard Fíla",
|
|
47
|
+
"person": 2,
|
|
48
|
+
"company": null,
|
|
49
|
+
"lead": null
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"recurrence": null,
|
|
53
|
+
"meetingPlace": null,
|
|
54
|
+
"companyAddress": {
|
|
55
|
+
"city": null,
|
|
56
|
+
"country": null,
|
|
57
|
+
"province": null,
|
|
58
|
+
"street": null,
|
|
59
|
+
"zipCode": null
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": [
|
|
6
|
+
{
|
|
7
|
+
"body": "{\"_entityName\":\"Meeting\",\"id\":2,\"title\":\"ZRDZ-Meeting-\",\"personal\":true,\"status\":\"SCHEDULED\",\"priority\":\"DEFAULT\",\"category\":null,\"activity\":null,\"company\":null,\"person\":null,\"lead\":null,\"project\":null,\"businessCase\":null,\"offer\":null,\"salesOrder\":null,\"scheduledFrom\":\"2024-02-08T15:00:00.000+01:00\",\"scheduledTill\":\"2024-02-08T15:30:00.000+01:00\",\"completed\":null,\"description\":\"<p>ZTSR</p>\",\"solution\":null,\"tags\":[],\"rowInfo.createdAt\":\"2024-02-05T09:33:13.833+01:00\",\"rowInfo.createdBy\":\"fila.r@hanaboso.com\",\"rowInfo.updatedAt\":\"2024-02-07T12:42:24.900+01:00\",\"rowInfo.updatedBy\":\"fila.r@hanaboso.com\",\"rowInfo.rowAccess\":null,\"rowInfo.rowState\":null,\"securityLevel\":{\"id\":1,\"name\":\"Sdílená\"},\"_version\":7,\"customFields\":{},\"participants\":[{\"owner\":true,\"role\":\"FROM\",\"name\":\"Richard Fíla\",\"person\":2,\"company\":null,\"lead\":null}],\"recurrence\":null,\"meetingPlace\":null,\"companyAddress\":{\"city\":null,\"country\":null,\"province\":null,\"street\":null,\"zipCode\":null}}",
|
|
8
|
+
"headers": {}
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET https://app.raynet.cz/api/v2/activity?offset=0&limit=1000&rowInfo.lastModifiedAt[GE]=1970-1-1%200:0&dateFormat=ISO8601",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"success": true,
|
|
6
|
+
"totalCount": 1,
|
|
7
|
+
"data": [
|
|
8
|
+
{
|
|
9
|
+
"_entityName": "Meeting",
|
|
10
|
+
"id": 2,
|
|
11
|
+
"title": "ZRDZ-Meeting-",
|
|
12
|
+
"personal": true,
|
|
13
|
+
"status": "SCHEDULED",
|
|
14
|
+
"priority": "DEFAULT",
|
|
15
|
+
"category": null,
|
|
16
|
+
"activity": null,
|
|
17
|
+
"company": null,
|
|
18
|
+
"person": null,
|
|
19
|
+
"lead": null,
|
|
20
|
+
"project": null,
|
|
21
|
+
"businessCase": null,
|
|
22
|
+
"offer": null,
|
|
23
|
+
"salesOrder": null,
|
|
24
|
+
"scheduledFrom": "2024-02-08T15:00:00.000+01:00",
|
|
25
|
+
"scheduledTill": "2024-02-08T15:30:00.000+01:00",
|
|
26
|
+
"completed": null,
|
|
27
|
+
"description": "<p>ZTSR</p>",
|
|
28
|
+
"solution": null,
|
|
29
|
+
"tags": [],
|
|
30
|
+
"rowInfo.createdAt": "2024-02-05T09:33:13.833+01:00",
|
|
31
|
+
"rowInfo.createdBy": "fila.r@hanaboso.com",
|
|
32
|
+
"rowInfo.updatedAt": "2024-02-07T12:42:24.900+01:00",
|
|
33
|
+
"rowInfo.updatedBy": "fila.r@hanaboso.com",
|
|
34
|
+
"rowInfo.rowAccess": null,
|
|
35
|
+
"rowInfo.rowState": null,
|
|
36
|
+
"securityLevel": {
|
|
37
|
+
"id": 1,
|
|
38
|
+
"name": "Sdílená"
|
|
39
|
+
},
|
|
40
|
+
"_version": 7,
|
|
41
|
+
"customFields": {},
|
|
42
|
+
"participants": [
|
|
43
|
+
{
|
|
44
|
+
"owner": true,
|
|
45
|
+
"role": "FROM",
|
|
46
|
+
"name": "Richard Fíla",
|
|
47
|
+
"person": 2,
|
|
48
|
+
"company": null,
|
|
49
|
+
"lead": null
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"recurrence": null,
|
|
53
|
+
"meetingPlace": null,
|
|
54
|
+
"companyAddress": {
|
|
55
|
+
"city": null,
|
|
56
|
+
"country": null,
|
|
57
|
+
"province": null,
|
|
58
|
+
"street": null,
|
|
59
|
+
"zipCode": null
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": [
|
|
6
|
+
{
|
|
7
|
+
"body": "{\"_entityName\":\"Meeting\",\"id\":2,\"title\":\"ZRDZ-Meeting-\",\"personal\":true,\"status\":\"SCHEDULED\",\"priority\":\"DEFAULT\",\"category\":null,\"activity\":null,\"company\":null,\"person\":null,\"lead\":null,\"project\":null,\"businessCase\":null,\"offer\":null,\"salesOrder\":null,\"scheduledFrom\":\"2024-02-08T15:00:00.000+01:00\",\"scheduledTill\":\"2024-02-08T15:30:00.000+01:00\",\"completed\":null,\"description\":\"<p>ZTSR</p>\",\"solution\":null,\"tags\":[],\"rowInfo.createdAt\":\"2024-02-05T09:33:13.833+01:00\",\"rowInfo.createdBy\":\"fila.r@hanaboso.com\",\"rowInfo.updatedAt\":\"2024-02-07T12:42:24.900+01:00\",\"rowInfo.updatedBy\":\"fila.r@hanaboso.com\",\"rowInfo.rowAccess\":null,\"rowInfo.rowState\":null,\"securityLevel\":{\"id\":1,\"name\":\"Sdílená\"},\"_version\":7,\"customFields\":{},\"participants\":[{\"owner\":true,\"role\":\"FROM\",\"name\":\"Richard Fíla\",\"person\":2,\"company\":null,\"lead\":null}],\"recurrence\":null,\"meetingPlace\":null,\"companyAddress\":{\"city\":null,\"country\":null,\"province\":null,\"street\":null,\"zipCode\":null}}",
|
|
8
|
+
"headers": {}
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET https://app.raynet.cz/api/v2/company?offset=0&limit=1000&primaryAddress-contactInfo.email=neco@neco.cz",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"success": "true",
|
|
6
|
+
"totalCount": 1,
|
|
7
|
+
"data": [
|
|
8
|
+
{
|
|
9
|
+
"id": 2,
|
|
10
|
+
"name": "Test s.r.o.",
|
|
11
|
+
"titleBefore": null,
|
|
12
|
+
"firstName": null,
|
|
13
|
+
"lastName": null,
|
|
14
|
+
"titleAfter": null,
|
|
15
|
+
"person": false,
|
|
16
|
+
"role": "B_PARTNER",
|
|
17
|
+
"state": "B_ACTUAL",
|
|
18
|
+
"rating": "A",
|
|
19
|
+
"owner": {
|
|
20
|
+
"id": 1,
|
|
21
|
+
"fullName": "RAYNET CRM"
|
|
22
|
+
},
|
|
23
|
+
"regNumber": "123456789",
|
|
24
|
+
"taxNumber": "CZ123456789",
|
|
25
|
+
"taxNumber2": null,
|
|
26
|
+
"taxPayer": "YES",
|
|
27
|
+
"bankAccount": null,
|
|
28
|
+
"databox": null,
|
|
29
|
+
"court": null,
|
|
30
|
+
"primaryAddress": {
|
|
31
|
+
"id": 2,
|
|
32
|
+
"primary": true,
|
|
33
|
+
"contactAddress": false,
|
|
34
|
+
"address": {
|
|
35
|
+
"id": 2,
|
|
36
|
+
"city": "Ostrava-Slezská Ostrava",
|
|
37
|
+
"country": "Česká republika",
|
|
38
|
+
"name": "Sídlo klienta",
|
|
39
|
+
"province": "Moravskoslezský kraj",
|
|
40
|
+
"street": "Těšínská",
|
|
41
|
+
"zipCode": "710 00",
|
|
42
|
+
"lat": 49.2499446,
|
|
43
|
+
"lng": 13.703011
|
|
44
|
+
},
|
|
45
|
+
"territory": {
|
|
46
|
+
"id": 91,
|
|
47
|
+
"value": "Morava"
|
|
48
|
+
},
|
|
49
|
+
"contactInfo": {
|
|
50
|
+
"email": "test@test.cz",
|
|
51
|
+
"email2": "test2@test.cz",
|
|
52
|
+
"primary": true,
|
|
53
|
+
"tel1": "123 456 789",
|
|
54
|
+
"tel1Type": "mobil",
|
|
55
|
+
"tel2": "987 654 321",
|
|
56
|
+
"tel2Type": "pevná linka",
|
|
57
|
+
"www": "www.test.cz",
|
|
58
|
+
"otherContact": null
|
|
59
|
+
},
|
|
60
|
+
"extIds": null
|
|
61
|
+
},
|
|
62
|
+
"contactAddress": {
|
|
63
|
+
"id": 3,
|
|
64
|
+
"primary": false,
|
|
65
|
+
"contactAddress": true,
|
|
66
|
+
"address": {
|
|
67
|
+
"id": 3,
|
|
68
|
+
"city": "Ostrava-Moravská Ostrava",
|
|
69
|
+
"country": "Česká republika",
|
|
70
|
+
"name": "Provozovna",
|
|
71
|
+
"province": "Moravskoslezský kraj",
|
|
72
|
+
"street": "Českobratrská 113",
|
|
73
|
+
"zipCode": "702 00",
|
|
74
|
+
"lat": null,
|
|
75
|
+
"lng": null
|
|
76
|
+
},
|
|
77
|
+
"territory": {
|
|
78
|
+
"id": 91,
|
|
79
|
+
"value": "Morava"
|
|
80
|
+
},
|
|
81
|
+
"contactInfo": {
|
|
82
|
+
"email": "provozovna@test.cz",
|
|
83
|
+
"email2": null,
|
|
84
|
+
"primary": true,
|
|
85
|
+
"tel1": "444 444 444",
|
|
86
|
+
"tel1Type": "mobil",
|
|
87
|
+
"tel2": "111 111 111",
|
|
88
|
+
"tel2Type": "pevná linka",
|
|
89
|
+
"www": null,
|
|
90
|
+
"otherContact": null
|
|
91
|
+
},
|
|
92
|
+
"extIds": null
|
|
93
|
+
},
|
|
94
|
+
"category": {
|
|
95
|
+
"id": 15,
|
|
96
|
+
"value": "Zákazník"
|
|
97
|
+
},
|
|
98
|
+
"turnover": {
|
|
99
|
+
"id": 82,
|
|
100
|
+
"value": "do 1 mil. Kč"
|
|
101
|
+
},
|
|
102
|
+
"economyActivity": {
|
|
103
|
+
"id": 92,
|
|
104
|
+
"value": "obor 1"
|
|
105
|
+
},
|
|
106
|
+
"companyClassification1": {
|
|
107
|
+
"id": 93,
|
|
108
|
+
"value": "kla 1"
|
|
109
|
+
},
|
|
110
|
+
"companyClassification2": {
|
|
111
|
+
"id": 94,
|
|
112
|
+
"value": "kla 2"
|
|
113
|
+
},
|
|
114
|
+
"companyClassification3": {
|
|
115
|
+
"id": 95,
|
|
116
|
+
"value": "kla 3"
|
|
117
|
+
},
|
|
118
|
+
"paymentTerm": {
|
|
119
|
+
"id": 64,
|
|
120
|
+
"value": "7 dní"
|
|
121
|
+
},
|
|
122
|
+
"contactSource": {
|
|
123
|
+
"id": 62,
|
|
124
|
+
"value": "e-mail"
|
|
125
|
+
},
|
|
126
|
+
"birthday": null,
|
|
127
|
+
"notice": "poznamka ke klientovi",
|
|
128
|
+
"tags": [
|
|
129
|
+
"stitek1",
|
|
130
|
+
"stitek 2"
|
|
131
|
+
],
|
|
132
|
+
"customFields": null,
|
|
133
|
+
"rowInfo.createdAt": "2022-06-18 13:19",
|
|
134
|
+
"rowInfo.createdBy": "demo@raynet.cz",
|
|
135
|
+
"rowInfo.updatedAt": "2022-09-22 14:17",
|
|
136
|
+
"rowInfo.updatedBy": "demo@raynet.cz",
|
|
137
|
+
"rowInfo.rowAccess": null,
|
|
138
|
+
"rowInfo.rowState": null,
|
|
139
|
+
"securityLevel": {
|
|
140
|
+
"id": 1,
|
|
141
|
+
"name": "Sdílená"
|
|
142
|
+
},
|
|
143
|
+
"inlineGdpr": [
|
|
144
|
+
{
|
|
145
|
+
"id": 1,
|
|
146
|
+
"validFrom": "2022-01-01",
|
|
147
|
+
"validTill": "2022-01-01",
|
|
148
|
+
"legalTitle": "LEGITIMATE_INTEREST",
|
|
149
|
+
"templateName": "Opravněný zájem",
|
|
150
|
+
"gdprTemplate": 1
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"_version": 16
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": [
|
|
6
|
+
{
|
|
7
|
+
"body": "{\"id\":2,\"name\":\"Test s.r.o.\",\"titleBefore\":null,\"firstName\":null,\"lastName\":null,\"titleAfter\":null,\"person\":false,\"role\":\"B_PARTNER\",\"state\":\"B_ACTUAL\",\"rating\":\"A\",\"owner\":{\"id\":1,\"fullName\":\"RAYNET CRM\"},\"regNumber\":\"123456789\",\"taxNumber\":\"CZ123456789\",\"taxNumber2\":null,\"taxPayer\":\"YES\",\"bankAccount\":null,\"databox\":null,\"court\":null,\"primaryAddress\":{\"id\":2,\"primary\":true,\"contactAddress\":false,\"address\":{\"id\":2,\"city\":\"Ostrava-Slezská Ostrava\",\"country\":\"Česká republika\",\"name\":\"Sídlo klienta\",\"province\":\"Moravskoslezský kraj\",\"street\":\"Těšínská\",\"zipCode\":\"710 00\",\"lat\":49.2499446,\"lng\":13.703011},\"territory\":{\"id\":91,\"value\":\"Morava\"},\"contactInfo\":{\"email\":\"test@test.cz\",\"email2\":\"test2@test.cz\",\"primary\":true,\"tel1\":\"123 456 789\",\"tel1Type\":\"mobil\",\"tel2\":\"987 654 321\",\"tel2Type\":\"pevná linka\",\"www\":\"www.test.cz\",\"otherContact\":null},\"extIds\":null},\"contactAddress\":{\"id\":3,\"primary\":false,\"contactAddress\":true,\"address\":{\"id\":3,\"city\":\"Ostrava-Moravská Ostrava\",\"country\":\"Česká republika\",\"name\":\"Provozovna\",\"province\":\"Moravskoslezský kraj\",\"street\":\"Českobratrská 113\",\"zipCode\":\"702 00\",\"lat\":null,\"lng\":null},\"territory\":{\"id\":91,\"value\":\"Morava\"},\"contactInfo\":{\"email\":\"provozovna@test.cz\",\"email2\":null,\"primary\":true,\"tel1\":\"444 444 444\",\"tel1Type\":\"mobil\",\"tel2\":\"111 111 111\",\"tel2Type\":\"pevná linka\",\"www\":null,\"otherContact\":null},\"extIds\":null},\"category\":{\"id\":15,\"value\":\"Zákazník\"},\"turnover\":{\"id\":82,\"value\":\"do 1 mil. Kč\"},\"economyActivity\":{\"id\":92,\"value\":\"obor 1\"},\"companyClassification1\":{\"id\":93,\"value\":\"kla 1\"},\"companyClassification2\":{\"id\":94,\"value\":\"kla 2\"},\"companyClassification3\":{\"id\":95,\"value\":\"kla 3\"},\"paymentTerm\":{\"id\":64,\"value\":\"7 dní\"},\"contactSource\":{\"id\":62,\"value\":\"e-mail\"},\"birthday\":null,\"notice\":\"poznamka ke klientovi\",\"tags\":[\"stitek1\",\"stitek 2\"],\"customFields\":null,\"rowInfo.createdAt\":\"2022-06-18 13:19\",\"rowInfo.createdBy\":\"demo@raynet.cz\",\"rowInfo.updatedAt\":\"2022-09-22 14:17\",\"rowInfo.updatedBy\":\"demo@raynet.cz\",\"rowInfo.rowAccess\":null,\"rowInfo.rowState\":null,\"securityLevel\":{\"id\":1,\"name\":\"Sdílená\"},\"inlineGdpr\":[{\"id\":1,\"validFrom\":\"2022-01-01\",\"validTill\":\"2022-01-01\",\"legalTitle\":\"LEGITIMATE_INTEREST\",\"templateName\":\"Opravněný zájem\",\"gdprTemplate\":1}],\"_version\":16}",
|
|
8
|
+
"headers": {}
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|