@cemiar/cemiarlink-sdk 1.0.21 → 1.0.22
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/package.json +1 -1
- package/dist/exceptions/EpicException.d.ts +0 -3
- package/dist/exceptions/EpicException.js +0 -10
- package/dist/exceptions/MissingInfo.d.ts +0 -3
- package/dist/exceptions/MissingInfo.js +0 -10
- package/dist/exceptions/NotProcessYet.d.ts +0 -3
- package/dist/exceptions/NotProcessYet.js +0 -10
- package/dist/models/admin/BusMessage.d.ts +0 -4
- package/dist/models/admin/BusMessage.js +0 -2
- package/dist/models/admin/Counter.d.ts +0 -8
- package/dist/models/admin/Counter.js +0 -2
- package/dist/models/admin/Email.d.ts +0 -49
- package/dist/models/admin/Email.js +0 -2
- package/dist/models/admin/ExcelSheet.d.ts +0 -5
- package/dist/models/admin/ExcelSheet.js +0 -2
- package/dist/models/admin/ExtractTable.d.ts +0 -37
- package/dist/models/admin/ExtractTable.js +0 -2
- package/dist/models/admin/IDictionary.d.ts +0 -3
- package/dist/models/admin/IDictionary.js +0 -2
- package/dist/models/admin/KimobyResult.d.ts +0 -17
- package/dist/models/admin/KimobyResult.js +0 -2
- package/dist/models/admin/PdfReader.d.ts +0 -26
- package/dist/models/admin/PdfReader.js +0 -2
- package/dist/models/admin/Primaco.d.ts +0 -14
- package/dist/models/admin/Primaco.js +0 -2
- package/dist/models/epic/Activity.d.ts +0 -83
- package/dist/models/epic/Activity.js +0 -2
- package/dist/models/epic/AdditionalInterest.d.ts +0 -15
- package/dist/models/epic/AdditionalInterest.js +0 -2
- package/dist/models/epic/Address.d.ts +0 -10
- package/dist/models/epic/Address.js +0 -2
- package/dist/models/epic/Attachment.d.ts +0 -51
- package/dist/models/epic/Attachment.js +0 -2
- package/dist/models/epic/Broker.d.ts +0 -38
- package/dist/models/epic/Broker.js +0 -2
- package/dist/models/epic/Claim.d.ts +0 -24
- package/dist/models/epic/Claim.js +0 -2
- package/dist/models/epic/Commission.d.ts +0 -76
- package/dist/models/epic/Commission.js +0 -2
- package/dist/models/epic/Company.d.ts +0 -9
- package/dist/models/epic/Company.js +0 -2
- package/dist/models/epic/Contact.d.ts +0 -49
- package/dist/models/epic/Contact.js +0 -2
- package/dist/models/epic/Customer.d.ts +0 -99
- package/dist/models/epic/Customer.js +0 -2
- package/dist/models/epic/DirectBillCommission.d.ts +0 -18
- package/dist/models/epic/DirectBillCommission.js +0 -2
- package/dist/models/epic/Driver.d.ts +0 -67
- package/dist/models/epic/Driver.js +0 -2
- package/dist/models/epic/Employee.d.ts +0 -145
- package/dist/models/epic/Employee.js +0 -2
- package/dist/models/epic/GeneralLedgerReconcileBank.d.ts +0 -117
- package/dist/models/epic/GeneralLedgerReconcileBank.js +0 -2
- package/dist/models/epic/Habitational.d.ts +0 -156
- package/dist/models/epic/Habitational.js +0 -2
- package/dist/models/epic/JournalEntry.d.ts +0 -69
- package/dist/models/epic/JournalEntry.js +0 -2
- package/dist/models/epic/Line.d.ts +0 -169
- package/dist/models/epic/Line.js +0 -2
- package/dist/models/epic/Lookup.d.ts +0 -5
- package/dist/models/epic/Lookup.js +0 -2
- package/dist/models/epic/MultiCarrierSchedule.d.ts +0 -70
- package/dist/models/epic/MultiCarrierSchedule.js +0 -11
- package/dist/models/epic/Opportunity.d.ts +0 -45
- package/dist/models/epic/Opportunity.js +0 -2
- package/dist/models/epic/OptionType.d.ts +0 -4
- package/dist/models/epic/OptionType.js +0 -2
- package/dist/models/epic/PayableContract.d.ts +0 -19
- package/dist/models/epic/PayableContract.js +0 -2
- package/dist/models/epic/Policy.d.ts +0 -129
- package/dist/models/epic/Policy.js +0 -2
- package/dist/models/epic/PolicyV2.d.ts +0 -157
- package/dist/models/epic/PolicyV2.js +0 -2
- package/dist/models/epic/Receipt.d.ts +0 -142
- package/dist/models/epic/Receipt.js +0 -2
- package/dist/models/epic/RenewalStage.d.ts +0 -5
- package/dist/models/epic/RenewalStage.js +0 -2
- package/dist/models/epic/Response.d.ts +0 -9
- package/dist/models/epic/Response.js +0 -2
- package/dist/models/epic/ServiceSummary.d.ts +0 -16
- package/dist/models/epic/ServiceSummary.js +0 -8
- package/dist/models/epic/ServicingContact.d.ts +0 -6
- package/dist/models/epic/ServicingContact.js +0 -2
- package/dist/models/epic/Transaction.d.ts +0 -261
- package/dist/models/epic/Transaction.js +0 -2
- package/dist/models/epic/Vehicle.d.ts +0 -87
- package/dist/models/epic/Vehicle.js +0 -2
- package/dist/models/mail/EmailAttachment.d.ts +0 -5
- package/dist/models/mail/EmailAttachment.js +0 -2
- package/dist/models/mail/EmailReport.d.ts +0 -10
- package/dist/models/mail/EmailReport.js +0 -2
- package/dist/models/mail/GetEmailReportOptions.d.ts +0 -5
- package/dist/models/mail/GetEmailReportOptions.js +0 -2
- package/dist/models/mail/GmailMail.d.ts +0 -8
- package/dist/models/mail/GmailMail.js +0 -2
- package/dist/models/mail/TransactionWatchList.d.ts +0 -7
- package/dist/models/mail/TransactionWatchList.js +0 -2
- package/dist/models/sharepoint/Sharepoint.d.ts +0 -25
- package/dist/models/sharepoint/Sharepoint.js +0 -2
- package/dist/services/Admin.d.ts +0 -40
- package/dist/services/Admin.js +0 -222
- package/dist/services/BaseEpicService.d.ts +0 -16
- package/dist/services/BaseEpicService.js +0 -107
- package/dist/services/Epic.d.ts +0 -129
- package/dist/services/Epic.js +0 -313
- package/dist/services/JobEpicService.d.ts +0 -11
- package/dist/services/JobEpicService.js +0 -21
- package/dist/services/Mail.d.ts +0 -52
- package/dist/services/Mail.js +0 -318
- package/dist/services/MultiCarrierScheduleEpicService.d.ts +0 -12
- package/dist/services/MultiCarrierScheduleEpicService.js +0 -24
- package/dist/services/SharepointService.d.ts +0 -13
- package/dist/services/SharepointService.js +0 -44
- package/dist/utils/AxiosClient.d.ts +0 -6
- package/dist/utils/AxiosClient.js +0 -35
- package/dist/utils/DeepPartial.d.ts +0 -3
- package/dist/utils/DeepPartial.js +0 -2
- package/dist/utils/Excel.d.ts +0 -8
- package/dist/utils/Excel.js +0 -99
package/dist/services/Admin.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { ClassificationResult, PdfReaderBody, PdfReaderResponse } from "../models/admin/PdfReader";
|
|
3
|
-
import { AzureOCRResponse, ExtractBody, ExtractInsurerResponse, ExtractTableResponse, TableExtractBody } from "../models/admin/ExtractTable";
|
|
4
|
-
import { FlashPaymentRequest } from "../models/admin/Primaco";
|
|
5
|
-
import { Counter } from "../models/admin/Counter";
|
|
6
|
-
import { BusMessagePayload } from "../models/admin/BusMessage";
|
|
7
|
-
import { Email, EmailAws, SendMailResult } from "../models/admin/Email";
|
|
8
|
-
/**
|
|
9
|
-
* AdminService provides administration features for tasks, reports, PDF documents, data extraction, messaging, and emails.
|
|
10
|
-
* It offers methods to interact with the Cemiar admin API for various business operations.
|
|
11
|
-
*/
|
|
12
|
-
export declare class AdminService {
|
|
13
|
-
axiosInstance: AxiosInstance;
|
|
14
|
-
taskId?: string;
|
|
15
|
-
constructor(adminUrl: string | undefined, headers: object, taskId?: string);
|
|
16
|
-
updateCemiarTask(status: string): Promise<void>;
|
|
17
|
-
pdfReader(route: string, issuingCompany: string, payload: object): Promise<PdfReaderResponse>;
|
|
18
|
-
pdfCompare(payload: PdfReaderBody, apiVersion: string): Promise<Buffer>;
|
|
19
|
-
pdfCompareExcel(payload: PdfReaderBody, apiVersion: string): Promise<Buffer>;
|
|
20
|
-
extractTableFromBase64(payload: TableExtractBody): Promise<ExtractTableResponse[]>;
|
|
21
|
-
extractInsurerFromBase64(payload: ExtractBody): Promise<ExtractInsurerResponse>;
|
|
22
|
-
extractVehicles(payload: object): Promise<any>;
|
|
23
|
-
azureOCRExtraction(payload: object): Promise<AzureOCRResponse[]>;
|
|
24
|
-
getPdfText(fileContentBase64: string, engine?: string, page?: string): Promise<string[]>;
|
|
25
|
-
sendTextMessage(message: string, phoneNumber: string, name: string, enterprise: string | undefined): Promise<void>;
|
|
26
|
-
getModuleConfig(): Promise<any>;
|
|
27
|
-
getReportData<T>(date: string, fileName: string, sheetNumber: number): Promise<T[]>;
|
|
28
|
-
getTestData<T>(fileName: string, sheetNumber: number): Promise<T[]>;
|
|
29
|
-
saveTestResult<T>(result: T[], fileName: string): Promise<void>;
|
|
30
|
-
removeReportFiles(date: string, fileName: string): Promise<void>;
|
|
31
|
-
unSyncFiles(): Promise<void>;
|
|
32
|
-
createReport(sheatData: string[][], headers: string[], name: string): Promise<void>;
|
|
33
|
-
getPrimacoFlashPaymentLink(request: FlashPaymentRequest, enterprise: string | undefined): Promise<any>;
|
|
34
|
-
getCounter(taskId: string): Promise<Counter>;
|
|
35
|
-
updateCounter(counterId: string, numberOfRequest: number): Promise<any>;
|
|
36
|
-
classifyDocument(insurer: string, fileContentBase64: string): Promise<ClassificationResult[]>;
|
|
37
|
-
sendMessagesToQueue(queue: string, messages: BusMessagePayload): Promise<void>;
|
|
38
|
-
sendNotification(notification: Email): Promise<void>;
|
|
39
|
-
sendEmailAws(emailBody: EmailAws): Promise<SendMailResult>;
|
|
40
|
-
}
|
package/dist/services/Admin.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AdminService = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const MissingInfo_1 = require("../exceptions/MissingInfo");
|
|
10
|
-
const Excel_1 = __importDefault(require("../utils/Excel"));
|
|
11
|
-
const AxiosClient_1 = require("../utils/AxiosClient");
|
|
12
|
-
/**
|
|
13
|
-
* AdminService provides administration features for tasks, reports, PDF documents, data extraction, messaging, and emails.
|
|
14
|
-
* It offers methods to interact with the Cemiar admin API for various business operations.
|
|
15
|
-
*/
|
|
16
|
-
class AdminService {
|
|
17
|
-
constructor(adminUrl, headers, taskId) {
|
|
18
|
-
this.taskId = taskId;
|
|
19
|
-
this.axiosInstance = new AxiosClient_1.AxiosClient(adminUrl, headers).getInstance();
|
|
20
|
-
}
|
|
21
|
-
async updateCemiarTask(status) {
|
|
22
|
-
const dateTime = new Date();
|
|
23
|
-
const nextDate = new Date().setDate(new Date().getDate() + 1);
|
|
24
|
-
// update the task with the last run date and the next run date with status 200
|
|
25
|
-
await this.axiosInstance.put('task/' + this.taskId, {
|
|
26
|
-
lastRunDate: dateTime,
|
|
27
|
-
nextRunDueDate: nextDate,
|
|
28
|
-
lastStatus: status,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
async pdfReader(route, issuingCompany, payload) {
|
|
32
|
-
const { data: pdfReaderResponse } = await this.axiosInstance.post('pdfReader/' + route + '/' + issuingCompany, payload);
|
|
33
|
-
return pdfReaderResponse;
|
|
34
|
-
}
|
|
35
|
-
async pdfCompare(payload, apiVersion) {
|
|
36
|
-
const response = await this.axiosInstance.post(`pdfReader/compare/${apiVersion}`, payload, {
|
|
37
|
-
responseType: 'arraybuffer',
|
|
38
|
-
});
|
|
39
|
-
return response.data;
|
|
40
|
-
}
|
|
41
|
-
async pdfCompareExcel(payload, apiVersion) {
|
|
42
|
-
const response = await this.axiosInstance.post(`pdfReader/compare/${apiVersion}/excel`, payload, {
|
|
43
|
-
responseType: 'arraybuffer',
|
|
44
|
-
});
|
|
45
|
-
return response.data;
|
|
46
|
-
}
|
|
47
|
-
async extractTableFromBase64(payload) {
|
|
48
|
-
const { data: extraction } = await this.axiosInstance.post('pdfReader/extractTable', payload);
|
|
49
|
-
return extraction;
|
|
50
|
-
}
|
|
51
|
-
async extractInsurerFromBase64(payload) {
|
|
52
|
-
const { data: extraction } = await this.axiosInstance.post('pdfReader/insurerExtractor', payload);
|
|
53
|
-
return extraction;
|
|
54
|
-
}
|
|
55
|
-
async extractVehicles(payload) {
|
|
56
|
-
const result = await this.axiosInstance.post(`pdfReader/extractVehicles`, payload);
|
|
57
|
-
return result.data;
|
|
58
|
-
}
|
|
59
|
-
async azureOCRExtraction(payload) {
|
|
60
|
-
const { data: extraction } = await this.axiosInstance.post('pdfReader/azureOCR', payload);
|
|
61
|
-
return extraction.data;
|
|
62
|
-
}
|
|
63
|
-
async getPdfText(fileContentBase64, engine, page) {
|
|
64
|
-
let url = "pdfReader/base64ToText";
|
|
65
|
-
const queryParams = [];
|
|
66
|
-
if (engine && engine !== "") {
|
|
67
|
-
queryParams.push(`engine=${engine}`);
|
|
68
|
-
}
|
|
69
|
-
if (page && page !== "") {
|
|
70
|
-
queryParams.push(`page=${page}`);
|
|
71
|
-
}
|
|
72
|
-
if (queryParams.length > 0) {
|
|
73
|
-
url = `${url}?${queryParams.join("&")}`;
|
|
74
|
-
}
|
|
75
|
-
const response = await this.axiosInstance.post(url, {
|
|
76
|
-
base64: fileContentBase64,
|
|
77
|
-
});
|
|
78
|
-
return response.data;
|
|
79
|
-
}
|
|
80
|
-
async sendTextMessage(message, phoneNumber, name, enterprise) {
|
|
81
|
-
var _a;
|
|
82
|
-
try {
|
|
83
|
-
await this.axiosInstance.post('kimoby/send/' + enterprise, {
|
|
84
|
-
to: phoneNumber,
|
|
85
|
-
message: message,
|
|
86
|
-
name: name,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 400) {
|
|
91
|
-
throw new MissingInfo_1.MissingInfo(error.response.data.message);
|
|
92
|
-
}
|
|
93
|
-
throw error;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
async getModuleConfig() {
|
|
97
|
-
const { data: result } = await this.axiosInstance.get('task/' + this.taskId);
|
|
98
|
-
return result[0].config;
|
|
99
|
-
}
|
|
100
|
-
async getReportData(date, fileName, sheetNumber) {
|
|
101
|
-
let data = [];
|
|
102
|
-
let filePath = `./temp/Rapport ${fileName} du ${date}`;
|
|
103
|
-
if (fs_1.default.existsSync(`${filePath}.csv`)) {
|
|
104
|
-
data = await Excel_1.default.getFromCSV(`${filePath}.csv`);
|
|
105
|
-
}
|
|
106
|
-
else if (fs_1.default.existsSync(`${filePath}.xlsx`)) {
|
|
107
|
-
data = await Excel_1.default.getFromXLSX(`${filePath}.xlsx`, sheetNumber);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
return [];
|
|
111
|
-
}
|
|
112
|
-
return data;
|
|
113
|
-
}
|
|
114
|
-
async getTestData(fileName, sheetNumber) {
|
|
115
|
-
let data = [];
|
|
116
|
-
let filePath = `./test/${fileName}`;
|
|
117
|
-
if (fs_1.default.existsSync(`${filePath}.csv`)) {
|
|
118
|
-
data = await Excel_1.default.getFromCSV(`${filePath}.csv`);
|
|
119
|
-
}
|
|
120
|
-
else if (fs_1.default.existsSync(`${filePath}.xlsx`)) {
|
|
121
|
-
data = await Excel_1.default.getFromXLSX(`${filePath}.xlsx`, sheetNumber);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
return [];
|
|
125
|
-
}
|
|
126
|
-
return data;
|
|
127
|
-
}
|
|
128
|
-
async saveTestResult(result, fileName) {
|
|
129
|
-
let filePath = `./test/${fileName}Result.ts`;
|
|
130
|
-
fs_1.default.writeFileSync(filePath, JSON.stringify(result));
|
|
131
|
-
}
|
|
132
|
-
async removeReportFiles(date, fileName) {
|
|
133
|
-
if (fs_1.default.existsSync(`./temp/Rapport ${fileName} du ${date}.xlsx`)) {
|
|
134
|
-
fs_1.default.unlinkSync(`./temp/Rapport ${fileName} du ${date}.xlsx`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
async unSyncFiles() {
|
|
138
|
-
const invoiceFormats = ['docx', 'pdf', 'xlsx', 'eml', 'csv', 'html'];
|
|
139
|
-
const directory = './result/';
|
|
140
|
-
if (!fs_1.default.existsSync(directory)) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
fs_1.default.readdirSync(directory).forEach((file) => {
|
|
144
|
-
for (const format of invoiceFormats) {
|
|
145
|
-
const fileType = file.split('.')[file.split('.').length - 1];
|
|
146
|
-
if (fileType.includes(format)) {
|
|
147
|
-
const filePath = path_1.default.join(directory, file);
|
|
148
|
-
fs_1.default.unlinkSync(filePath);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
async createReport(sheatData, headers, name) {
|
|
154
|
-
if (name.includes('.xlsx')) {
|
|
155
|
-
Excel_1.default.createFile(sheatData, headers, name);
|
|
156
|
-
}
|
|
157
|
-
if (name.includes('.csv')) {
|
|
158
|
-
Excel_1.default.appendFile(headers, name);
|
|
159
|
-
for (const row of sheatData) {
|
|
160
|
-
Excel_1.default.appendFile(row, name);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
//DO NOT USE
|
|
165
|
-
async getPrimacoFlashPaymentLink(request, enterprise) {
|
|
166
|
-
var _a;
|
|
167
|
-
try {
|
|
168
|
-
return await this.axiosInstance.post(`primaco/${enterprise}/flash`, request);
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 400) {
|
|
172
|
-
throw new MissingInfo_1.MissingInfo(error.response.data.message);
|
|
173
|
-
}
|
|
174
|
-
throw error;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
async getCounter(taskId) {
|
|
178
|
-
var _a;
|
|
179
|
-
try {
|
|
180
|
-
const { data: result } = await this.axiosInstance.get(`counter?taskID=${taskId}`);
|
|
181
|
-
return result[0];
|
|
182
|
-
}
|
|
183
|
-
catch (error) {
|
|
184
|
-
if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 400) {
|
|
185
|
-
throw new MissingInfo_1.MissingInfo(error.response.data.message);
|
|
186
|
-
}
|
|
187
|
-
throw error;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
async updateCounter(counterId, numberOfRequest) {
|
|
191
|
-
var _a;
|
|
192
|
-
try {
|
|
193
|
-
return await this.axiosInstance.put(`counter/${counterId}`, {
|
|
194
|
-
numberOfRequest: numberOfRequest,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
catch (error) {
|
|
198
|
-
if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 400) {
|
|
199
|
-
throw new MissingInfo_1.MissingInfo(error.response.data.message);
|
|
200
|
-
}
|
|
201
|
-
throw error;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
async classifyDocument(insurer, fileContentBase64) {
|
|
205
|
-
const result = await this.axiosInstance.post(`/pdfReader/classifyDocument/${insurer}`, {
|
|
206
|
-
base64: fileContentBase64,
|
|
207
|
-
metadata: {},
|
|
208
|
-
});
|
|
209
|
-
return result.data;
|
|
210
|
-
}
|
|
211
|
-
async sendMessagesToQueue(queue, messages) {
|
|
212
|
-
await this.axiosInstance.post('/busMessages/' + queue, messages);
|
|
213
|
-
}
|
|
214
|
-
async sendNotification(notification) {
|
|
215
|
-
await this.axiosInstance.post('/sendEmail', notification);
|
|
216
|
-
}
|
|
217
|
-
async sendEmailAws(emailBody) {
|
|
218
|
-
const result = await this.axiosInstance.post('/mail/send', emailBody);
|
|
219
|
-
return result.data;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
exports.AdminService = AdminService;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
/**
|
|
3
|
-
* BaseEpicService provides common HTTP methods and error handling for Epic API services.
|
|
4
|
-
* It wraps Axios and offers generic get, getOne, put, post, and delete methods for API communication.
|
|
5
|
-
*/
|
|
6
|
-
export declare class BaseEpicService {
|
|
7
|
-
axiosInstance: AxiosInstance;
|
|
8
|
-
constructor(epicUrl: string | undefined, headers: any);
|
|
9
|
-
private handleError;
|
|
10
|
-
get(endpoint: string, queryParams?: object): Promise<any>;
|
|
11
|
-
getOne(endpoint: string, id: string | number, queryParams?: object): Promise<any>;
|
|
12
|
-
put(endpoint: string, data: object, queryParams?: object): Promise<string>;
|
|
13
|
-
post(endpoint: string, data: object): Promise<string | string[]>;
|
|
14
|
-
delete(endpoint: string, id: string): Promise<string>;
|
|
15
|
-
buildQueryString(queryParams: object): string;
|
|
16
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseEpicService = void 0;
|
|
4
|
-
const AxiosClient_1 = require("../utils/AxiosClient");
|
|
5
|
-
/**
|
|
6
|
-
* BaseEpicService provides common HTTP methods and error handling for Epic API services.
|
|
7
|
-
* It wraps Axios and offers generic get, getOne, put, post, and delete methods for API communication.
|
|
8
|
-
*/
|
|
9
|
-
class BaseEpicService {
|
|
10
|
-
constructor(epicUrl, headers) {
|
|
11
|
-
this.axiosInstance = new AxiosClient_1.AxiosClient(epicUrl, headers).getInstance();
|
|
12
|
-
}
|
|
13
|
-
handleError(axiosResponse) {
|
|
14
|
-
if (axiosResponse.bodyError) {
|
|
15
|
-
throw new Error(JSON.stringify(axiosResponse.bodyError, null, 2));
|
|
16
|
-
}
|
|
17
|
-
throw new Error(axiosResponse.message || axiosResponse.Message);
|
|
18
|
-
}
|
|
19
|
-
async get(endpoint, queryParams = {}) {
|
|
20
|
-
const queryString = this.buildQueryString(queryParams);
|
|
21
|
-
const url = `${endpoint}?${queryString}`;
|
|
22
|
-
try {
|
|
23
|
-
const { data: axiosResponse } = await this.axiosInstance.get(url);
|
|
24
|
-
return axiosResponse.result;
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
if (error.response && error.response.data) {
|
|
28
|
-
throw this.handleError(error.response.data);
|
|
29
|
-
}
|
|
30
|
-
throw new Error(error.message);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async getOne(endpoint, id, queryParams = {}) {
|
|
34
|
-
let url;
|
|
35
|
-
if (queryParams !== null) {
|
|
36
|
-
const queryString = this.buildQueryString(queryParams);
|
|
37
|
-
url = `${endpoint}/${id}?${queryString}`;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
url = `${endpoint}/${id}`;
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
const { data: axiosResponse } = await this.axiosInstance.get(url);
|
|
44
|
-
return axiosResponse.result;
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
if (error.response && error.response.data) {
|
|
48
|
-
throw this.handleError(error.response.data);
|
|
49
|
-
}
|
|
50
|
-
throw new Error(error.message);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async put(endpoint, data, queryParams = {}) {
|
|
54
|
-
const queryString = this.buildQueryString(queryParams);
|
|
55
|
-
const url = `${endpoint}?${queryString}`;
|
|
56
|
-
try {
|
|
57
|
-
const { data: axiosResponse } = await this.axiosInstance.put(url, data);
|
|
58
|
-
axiosResponse.result = axiosResponse.result.replace(/ /g, '');
|
|
59
|
-
if (axiosResponse.result.split(':')) {
|
|
60
|
-
return axiosResponse.result.split(':')[1];
|
|
61
|
-
}
|
|
62
|
-
return axiosResponse.result.split(':')[1];
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
if (error.response && error.response.data) {
|
|
66
|
-
throw this.handleError(error.response.data);
|
|
67
|
-
}
|
|
68
|
-
throw new Error(error.message);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async post(endpoint, data) {
|
|
72
|
-
try {
|
|
73
|
-
const { data: axiosResponse } = await this.axiosInstance.post(endpoint, data);
|
|
74
|
-
axiosResponse.result = axiosResponse.result.replace(/ /g, '');
|
|
75
|
-
const responseArray = axiosResponse.result.split(':')[1].split(',');
|
|
76
|
-
if (responseArray.length === 1) {
|
|
77
|
-
return responseArray[0];
|
|
78
|
-
}
|
|
79
|
-
return responseArray;
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
if (error.response && error.response.data) {
|
|
83
|
-
throw this.handleError(error.response.data);
|
|
84
|
-
}
|
|
85
|
-
throw new Error(error.message);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async delete(endpoint, id) {
|
|
89
|
-
const url = `${endpoint}/${id}`;
|
|
90
|
-
try {
|
|
91
|
-
const { data: axiosResponse } = await this.axiosInstance.delete(url);
|
|
92
|
-
return axiosResponse.result;
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
if (error.response && error.response.data) {
|
|
96
|
-
throw this.handleError(error.response.data);
|
|
97
|
-
}
|
|
98
|
-
throw new Error(error.message);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
buildQueryString(queryParams) {
|
|
102
|
-
return Object.entries(queryParams)
|
|
103
|
-
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
104
|
-
.join('&');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.BaseEpicService = BaseEpicService;
|
package/dist/services/Epic.d.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { Activity, CreateActivity } from '../models/epic/Activity';
|
|
2
|
-
import { AdditionalInterest } from '../models/epic/AdditionalInterest';
|
|
3
|
-
import { Attachment, AttachmentDetail, CreateAttachment } from '../models/epic/Attachment';
|
|
4
|
-
import { Claim } from '../models/epic/Claim';
|
|
5
|
-
import { Commission } from '../models/epic/Commission';
|
|
6
|
-
import { Company } from '../models/epic/Company';
|
|
7
|
-
import { Contact, CreateContact } from '../models/epic/Contact';
|
|
8
|
-
import { CreateCustomer, Customer } from '../models/epic/Customer';
|
|
9
|
-
import { DirectBillCommission } from '../models/epic/DirectBillCommission';
|
|
10
|
-
import { Driver } from '../models/epic/Driver';
|
|
11
|
-
import { GeneralLedgerReconcileBank } from '../models/epic/GeneralLedgerReconcileBank';
|
|
12
|
-
import { Habitational } from '../models/epic/Habitational';
|
|
13
|
-
import { Line } from '../models/epic/Line';
|
|
14
|
-
import { LookUp } from '../models/epic/Lookup';
|
|
15
|
-
import { Opportunity } from '../models/epic/Opportunity';
|
|
16
|
-
import { PayableContract } from '../models/epic/PayableContract';
|
|
17
|
-
import { CreatePolicy, Policy } from '../models/epic/Policy';
|
|
18
|
-
import { PolicyV2, PolicyV2Model } from '../models/epic/PolicyV2';
|
|
19
|
-
import { Receipt } from '../models/epic/Receipt';
|
|
20
|
-
import { RenewalStage } from '../models/epic/RenewalStage';
|
|
21
|
-
import { BaseEpicService } from './BaseEpicService';
|
|
22
|
-
import { JobEpicService } from './JobEpicService';
|
|
23
|
-
import { MultiCarrierScheduleEpicService } from './MultiCarrierScheduleEpicService';
|
|
24
|
-
import { Broker } from '../models/epic/Broker';
|
|
25
|
-
import { Employee } from '../models/epic/Employee';
|
|
26
|
-
import { CreatePaymentTransaction, CreateTransaction, FinanceTransaction, FinanceTransactionResult, Transaction, TransactionApplyCreditsToDebits } from '../models/epic/Transaction';
|
|
27
|
-
import { Vehicle } from '../models/epic/Vehicle';
|
|
28
|
-
import { CreateJournalEntry, JournalEntry } from '../models/epic/JournalEntry';
|
|
29
|
-
/**
|
|
30
|
-
* EpicService provides methods to interact with the Epic API for activities, attachments, policies, transactions, and more.
|
|
31
|
-
* It extends BaseEpicService and includes job and multi-carrier schedule services for specialized operations.
|
|
32
|
-
*/
|
|
33
|
-
export declare class EpicService extends BaseEpicService {
|
|
34
|
-
job: JobEpicService;
|
|
35
|
-
multiCarrierSchedule: MultiCarrierScheduleEpicService;
|
|
36
|
-
constructor(epicUrl: string | undefined, headers: any);
|
|
37
|
-
getActivity(activityId: string): Promise<Activity>;
|
|
38
|
-
getActivities(queryParams: object): Promise<Activity[]>;
|
|
39
|
-
updateActivity(activityId: string, payload: object): Promise<string>;
|
|
40
|
-
createActivity(payload: CreateActivity): Promise<string | string[]>;
|
|
41
|
-
copyActivity(id: string, payload: object): Promise<string>;
|
|
42
|
-
getAttachments(queryParams: object): Promise<Attachment[]>;
|
|
43
|
-
getAttachment(attachmentId: string): Promise<Attachment>;
|
|
44
|
-
updateAttachment(attachmentId: string, payload: object): Promise<string>;
|
|
45
|
-
createAttachment(payload: CreateAttachment): Promise<string | string[]>;
|
|
46
|
-
getAttachmentContent(attachmentId: string): Promise<AttachmentDetail>;
|
|
47
|
-
deleteAttachment(attachmentId: string): Promise<string>;
|
|
48
|
-
getPolicies(queryParams: object): Promise<Policy[]>;
|
|
49
|
-
getPolicy(id: string): Promise<Policy>;
|
|
50
|
-
renewPolicy(id: string, payload: object): Promise<string>;
|
|
51
|
-
updatePolicy(id: string, payload: object): Promise<string>;
|
|
52
|
-
issuePolicy(id: string, payload: object): Promise<string>;
|
|
53
|
-
cancelPolicy(id: string, payload: object): Promise<string>;
|
|
54
|
-
endorsePolicy(id: string, payload: object): Promise<string>;
|
|
55
|
-
createPolicy(payload: CreatePolicy): Promise<string | string[]>;
|
|
56
|
-
getPoliciesV2(queryParams: object): Promise<PolicyV2[]>;
|
|
57
|
-
getPolicyV2(id: string): Promise<PolicyV2>;
|
|
58
|
-
createPolicyV2(payload: object): Promise<string>;
|
|
59
|
-
updatePolicyV2(id: string, payload: object): Promise<string>;
|
|
60
|
-
renewPolicyV2(payload: PolicyV2Model.RenewPolicy): Promise<string>;
|
|
61
|
-
endorseExistingLinePolicyV2(payload: PolicyV2Model.EndorseExistingLine): Promise<void>;
|
|
62
|
-
cancelPolicyV2(payload: PolicyV2Model.CancelPolicy): Promise<string>;
|
|
63
|
-
issuePolicyV2(payload: PolicyV2Model.IssuePolicy): Promise<void>;
|
|
64
|
-
issueEndorsementPolicyV2(payload: PolicyV2Model.IssueEndorsement): Promise<void>;
|
|
65
|
-
issueCancellationPolicyV2(payload: PolicyV2Model.IssueCancellation): Promise<void>;
|
|
66
|
-
getPolicyV2RenewalStages(ids: number[]): Promise<RenewalStage[]>;
|
|
67
|
-
getEmployee(id: string): Promise<Broker>;
|
|
68
|
-
getEmployees(queryParams: object): Promise<Broker[]>;
|
|
69
|
-
getEmployeeV2(id: number): Promise<Employee>;
|
|
70
|
-
getEmployeesV2(queryParams: object): Promise<Employee[]>;
|
|
71
|
-
createEmployee(payload: object): Promise<string>;
|
|
72
|
-
updateEmployee(id: number, payload: object): Promise<string>;
|
|
73
|
-
getLookUp(queryParams: object): Promise<LookUp[]>;
|
|
74
|
-
getContact(id: string, queryParams: object): Promise<Contact>;
|
|
75
|
-
getContacts(queryParams: object): Promise<Contact[]>;
|
|
76
|
-
createContact(payload: CreateContact): Promise<string | string[]>;
|
|
77
|
-
updateContact(id: string, accountType: string, payload: object): Promise<string>;
|
|
78
|
-
getTransactions(queryParams: object): Promise<Transaction[]>;
|
|
79
|
-
getTransaction(transactionId: string): Promise<Transaction>;
|
|
80
|
-
financeTransaction(transactionId: string, payload: FinanceTransaction): Promise<string | FinanceTransactionResult>;
|
|
81
|
-
reverseTransaction(transactionId: string, payload: object): Promise<string>;
|
|
82
|
-
transactionApplyCreditsToDebits(transactionId: string, payload: TransactionApplyCreditsToDebits): Promise<Receipt[]>;
|
|
83
|
-
updateTransaction(transactionId: string, payload: object): Promise<string>;
|
|
84
|
-
createTransaction(payload: CreateTransaction): Promise<string | string[]>;
|
|
85
|
-
createPaymentTransaction(payload: CreatePaymentTransaction): Promise<string | string[]>;
|
|
86
|
-
getCompany(companyId: string): Promise<Company>;
|
|
87
|
-
getCompanies(queryParams: object): Promise<Company[]>;
|
|
88
|
-
getCustomers(queryParams: object): Promise<Customer[]>;
|
|
89
|
-
getCustomer(clientId: string): Promise<Customer>;
|
|
90
|
-
updateCustomer(clientId: string, payload: object): Promise<string>;
|
|
91
|
-
createCustomer(payload: CreateCustomer): Promise<string | string[]>;
|
|
92
|
-
getHabitationals(queryParams: object): Promise<Habitational[]>;
|
|
93
|
-
getCommissions(commissionId: string, queryParams: object): Promise<Commission>;
|
|
94
|
-
getCommission(commissionId: string): Promise<Commission>;
|
|
95
|
-
getOpportunity(opportunityId: string): Promise<Opportunity>;
|
|
96
|
-
getOpportunities(queryParams: object): Promise<Opportunity[]>;
|
|
97
|
-
updateOpportunity(opportunityId: string, payload: object): Promise<string>;
|
|
98
|
-
createOpportunity(payload: object): Promise<string | string[]>;
|
|
99
|
-
getClaim(claimId: string): Promise<Claim>;
|
|
100
|
-
getClaims(queryParams: object): Promise<Claim[]>;
|
|
101
|
-
getPersonalAutoVehicles(queryParams: object): Promise<Vehicle[]>;
|
|
102
|
-
getPersonalAutoDrivers(queryParams: object): Promise<Driver[]>;
|
|
103
|
-
getCommercialAutoVehicles(queryParams: object): Promise<Vehicle[]>;
|
|
104
|
-
getCommercialAutoDrivers(queryParams: object): Promise<Driver[]>;
|
|
105
|
-
getPolicyLine(lineId: string): Promise<Line>;
|
|
106
|
-
getPolicyLines(queryParams: object): Promise<Line[]>;
|
|
107
|
-
createPolicyLine(policyLine: object): Promise<string>;
|
|
108
|
-
updatePolicyLine(lineId: string, payload: object): Promise<string>;
|
|
109
|
-
getDirectBillCommission(commissionId: string): Promise<DirectBillCommission>;
|
|
110
|
-
getDirectBillCommissions(queryParams: object): Promise<DirectBillCommission[]>;
|
|
111
|
-
updateDirectBillCommission(commissionId: string, payload: object): Promise<string>;
|
|
112
|
-
getReceipts(queryParams: object): Promise<Receipt[]>;
|
|
113
|
-
getReceipt(receiptId: string): Promise<Receipt>;
|
|
114
|
-
updateReceipt(receiptId: string, payload: object): Promise<string>;
|
|
115
|
-
createReceipt(payload: object): Promise<string | string[]>;
|
|
116
|
-
receiptApplyCreditsToDebits(receiptId: string, payload: object): Promise<Receipt[]>;
|
|
117
|
-
getPayableContracts(queryParams: object): Promise<PayableContract[]>;
|
|
118
|
-
getPayableContract(payableContractId: string, queryParams: object): Promise<PayableContract[]>;
|
|
119
|
-
getGeneralLedgerReconcileBanks(queryParams: object): Promise<GeneralLedgerReconcileBank[]>;
|
|
120
|
-
getGeneralLedgerReconcileBank(bankId: string): Promise<GeneralLedgerReconcileBank>;
|
|
121
|
-
createGeneralLedgerReconcileBank(payload: Partial<GeneralLedgerReconcileBank>): Promise<string | string[]>;
|
|
122
|
-
updateGeneralLedgerBank(bankId: string, payload: object): Promise<string>;
|
|
123
|
-
getAdditionalInterests(queryParams: object): Promise<AdditionalInterest[]>;
|
|
124
|
-
getJournalEntry(journalEntryId: string): Promise<JournalEntry>;
|
|
125
|
-
getJournalEntries(queryParams: object): Promise<JournalEntry[]>;
|
|
126
|
-
createJournalEntry(payload: CreateJournalEntry): Promise<string | string[]>;
|
|
127
|
-
updateJournalEntry(journalEntryId: string, payload: JournalEntry): Promise<string>;
|
|
128
|
-
}
|
|
129
|
-
export type EpicServiceType = EpicService;
|