@bisondesk/core-sdk 1.0.162 → 1.0.164
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/lib/apis/leasing-administration.d.ts +4 -1
- package/lib/apis/leasing-administration.d.ts.map +1 -1
- package/lib/apis/leasing-administration.js +20 -1
- package/lib/apis/leasing-administration.js.map +1 -1
- package/lib/constants.d.ts +4 -2
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +5 -0
- package/lib/constants.js.map +1 -1
- package/lib/types/crm.d.ts +5 -0
- package/lib/types/crm.d.ts.map +1 -1
- package/lib/types/crm.js.map +1 -1
- package/lib/types/leads.d.ts +1 -0
- package/lib/types/leads.d.ts.map +1 -1
- package/lib/types/leasing-administration.d.ts +13 -0
- package/lib/types/leasing-administration.d.ts.map +1 -1
- package/lib/types/messages.d.ts +2 -0
- package/lib/types/messages.d.ts.map +1 -1
- package/lib/types/opportunities.d.ts +121 -30
- package/lib/types/opportunities.d.ts.map +1 -1
- package/lib/types/opportunities.js +27 -10
- package/lib/types/opportunities.js.map +1 -1
- package/lib/types/tenants.d.ts +1 -0
- package/lib/types/tenants.d.ts.map +1 -1
- package/lib/types/utils.d.ts +3 -2
- package/lib/types/utils.d.ts.map +1 -1
- package/lib/types/vehicles.d.ts +1 -0
- package/lib/types/vehicles.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/apis/leasing-administration.ts +33 -1
- package/src/constants.ts +5 -0
- package/src/types/crm.ts +5 -0
- package/src/types/leads.ts +1 -0
- package/src/types/leasing-administration.ts +15 -0
- package/src/types/messages.ts +2 -0
- package/src/types/opportunities.ts +134 -30
- package/src/types/tenants.ts +1 -0
- package/src/types/utils.ts +3 -2
- package/src/types/vehicles.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/types/notifications.d.ts +0 -19
- package/lib/types/notifications.d.ts.map +0 -1
- package/lib/types/notifications.js +0 -9
- package/lib/types/notifications.js.map +0 -1
- package/src/types/notifications.ts +0 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bisondesk/core-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.164",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rm -rf build dist lib *.tsbuildinfo",
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
},
|
|
12
12
|
"author": "TheTruckCompany",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@bisondesk/commons-sdk": "1.0.
|
|
14
|
+
"@bisondesk/commons-sdk": "1.0.164",
|
|
15
15
|
"joi": "17.4.0",
|
|
16
16
|
"lru-cache": "6.0.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/lru-cache": "5.1.0",
|
|
20
20
|
"@types/node": "16.11.7",
|
|
21
|
-
"typescript": "4.
|
|
21
|
+
"typescript": "4.6.3"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -4,9 +4,41 @@ import {
|
|
|
4
4
|
} from '@bisondesk/commons-sdk/lib/constants';
|
|
5
5
|
import { XError } from '@bisondesk/commons/lib/errors';
|
|
6
6
|
import fetch, { Response } from 'node-fetch';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
LeasingAdminUpload,
|
|
9
|
+
LeasingAdminUploadStatus,
|
|
10
|
+
NewLeasingAdminUploadRequest,
|
|
11
|
+
} from '../types/leasing-administration';
|
|
8
12
|
import { cleanHeaders, getAdminAuth } from './utils';
|
|
9
13
|
|
|
14
|
+
export const createLeasingAdminUpload = async (
|
|
15
|
+
tenantId: string,
|
|
16
|
+
data: NewLeasingAdminUploadRequest,
|
|
17
|
+
opts?: { serviceId: string }
|
|
18
|
+
): Promise<LeasingAdminUpload> => {
|
|
19
|
+
const auth = await getAdminAuth();
|
|
20
|
+
const response: Response = await fetch(
|
|
21
|
+
`${process.env.CORE_API_ORIGIN}/api/leasing/administration/uploads`,
|
|
22
|
+
{
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: cleanHeaders({
|
|
25
|
+
Authorization: auth,
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
28
|
+
[SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
|
|
29
|
+
}),
|
|
30
|
+
body: JSON.stringify(data),
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
if (response.ok) {
|
|
35
|
+
return response.json();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const body = await response.text();
|
|
39
|
+
throw new XError(response.statusText, { body, data, opts });
|
|
40
|
+
};
|
|
41
|
+
|
|
10
42
|
export const updateLeasingAdminUploadStatus = async (
|
|
11
43
|
tenantId: string,
|
|
12
44
|
handlerId: string,
|
package/src/constants.ts
CHANGED
|
@@ -82,15 +82,20 @@ export const MAX_PRICE = 100_000;
|
|
|
82
82
|
export const PRICE_ROUNDING = 1000;
|
|
83
83
|
export const KM_ROUNDING = 100_000;
|
|
84
84
|
|
|
85
|
+
//
|
|
86
|
+
// Leasing administration
|
|
87
|
+
//
|
|
85
88
|
export enum LeasingAdminUploadHandlers {
|
|
86
89
|
DhondtMonthly = 'dhondt-monthly-invoice',
|
|
87
90
|
DhondtProrata = 'dhondt-prorata-invoice',
|
|
88
91
|
Belfius = 'belfius-monthly-invoice',
|
|
92
|
+
ING = 'ing-monthly-invoice',
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
export enum LeasingAdminEntities {
|
|
92
96
|
Dhondt = 'dhondt',
|
|
93
97
|
Becris = 'becris',
|
|
98
|
+
ING = 'ing',
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
export enum LeasingAdminUploadErrors {
|
package/src/types/crm.ts
CHANGED
|
@@ -56,6 +56,11 @@ export type Organization = BaseOrganization & {
|
|
|
56
56
|
externalId?: number;
|
|
57
57
|
id: string;
|
|
58
58
|
debt?: OrganizationDebtInfo;
|
|
59
|
+
blocked?: boolean;
|
|
60
|
+
blockedAt?: string;
|
|
61
|
+
blockedBy?: string;
|
|
62
|
+
blockedReason?: string;
|
|
63
|
+
openOpportunitiesCount: number;
|
|
59
64
|
};
|
|
60
65
|
|
|
61
66
|
export type OrganizationDebtInfo = {
|
package/src/types/leads.ts
CHANGED
|
@@ -64,6 +64,21 @@ export type DhondtInvoiceLine = {
|
|
|
64
64
|
VoertuigVlootNummer: string;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
export type INGMetadata = {
|
|
68
|
+
capital: string;
|
|
69
|
+
chassisNumber: string;
|
|
70
|
+
emailId: string;
|
|
71
|
+
interest: string;
|
|
72
|
+
invoiceDate: string;
|
|
73
|
+
invoiceNumber: string;
|
|
74
|
+
pdfUrl: string;
|
|
75
|
+
stockNumber: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type INGAttachments = {
|
|
79
|
+
email: AttachmentValue;
|
|
80
|
+
};
|
|
81
|
+
|
|
67
82
|
export type DiffableDhondtInvoiceLine = DhondtInvoiceLine;
|
|
68
83
|
|
|
69
84
|
export type BelfiusRawInvoiceLine = {
|
package/src/types/messages.ts
CHANGED
|
@@ -45,6 +45,8 @@ export type TemplatedEmailRequest = {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export type EmailRequest = {
|
|
48
|
+
references?: string[] | string;
|
|
49
|
+
inReplyTo?: string; // messageId of the email to reply to
|
|
48
50
|
destinations: EmailDestination[];
|
|
49
51
|
replyTo?: EmailAddress;
|
|
50
52
|
source: EmailAddress;
|
|
@@ -1,65 +1,119 @@
|
|
|
1
|
+
import { Contact, Organization } from './crm';
|
|
2
|
+
import { AttachmentValue } from './fields';
|
|
1
3
|
import { Interest } from './leads';
|
|
4
|
+
import { DataRecord } from './utils';
|
|
2
5
|
import { Vehicle } from './vehicles';
|
|
3
6
|
|
|
4
|
-
enum OpportunityDealStatus {
|
|
7
|
+
export enum OpportunityDealStatus {
|
|
5
8
|
SALES_AGREED = 'sales_agreed',
|
|
6
9
|
FIRST_PAYMENT = 'first_payment',
|
|
7
10
|
FULL_PAYMENT = 'full_payment',
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
enum OpportunityStatus {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export enum OpportunityStatus {
|
|
14
|
+
PROSPECTION = 'prospection',
|
|
15
|
+
VEHICLE_DISCOVERY = 'vehicle_discovery',
|
|
16
|
+
QUOTE_EVALUATION = 'quote_evaluation',
|
|
17
|
+
VEHICLE_LOCKED = 'vehicle_locked',
|
|
18
|
+
QUOTE_ACCEPTED = 'quote_accepted',
|
|
19
|
+
CLOSED_WON = 'closed_won',
|
|
20
|
+
CLOSED_LOST = 'closed_lost',
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
enum OpportunityLogisticStatus {
|
|
23
|
+
export enum OpportunityLogisticStatus {
|
|
20
24
|
AT_ORIGIN = 'at_origin',
|
|
21
25
|
DELIVERED = 'delivered',
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
enum OpportunityType {
|
|
28
|
+
export enum OpportunityType {
|
|
25
29
|
LEASING = 'leasing',
|
|
26
30
|
SALES = 'sales',
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
export
|
|
30
|
-
|
|
33
|
+
export enum OpportunityLostReasonValues {
|
|
34
|
+
NOT_INTERESTED = 'not_interested',
|
|
35
|
+
NOT_ENOUGH_INFO = 'not_enough_info',
|
|
36
|
+
NO_RESPONSE = 'no_response',
|
|
37
|
+
QUOTE_REJECTED = 'quote_rejected',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export enum QuoteStatusValues {
|
|
41
|
+
CREATED = 'created',
|
|
42
|
+
VALIDATED = 'validated',
|
|
43
|
+
INVALIDATED = 'invalidated',
|
|
44
|
+
ACCEPTED = 'accepted',
|
|
45
|
+
REJECTED = 'rejected',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type BaseBid = {
|
|
31
49
|
vehicleId: string;
|
|
32
|
-
opportunityId
|
|
50
|
+
opportunityId?: string;
|
|
33
51
|
contactId: string;
|
|
34
52
|
amount: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type NewBid = BaseBid & {};
|
|
56
|
+
|
|
57
|
+
export type Bid = BaseBid & {
|
|
58
|
+
id: string;
|
|
35
59
|
createdAt: string;
|
|
36
60
|
createdBy: string;
|
|
37
61
|
};
|
|
38
62
|
|
|
39
|
-
export type
|
|
63
|
+
export type QuoteStatus = {
|
|
64
|
+
status: QuoteStatusValues;
|
|
65
|
+
date: string;
|
|
66
|
+
author: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type QuoteCalculatorValues = {
|
|
70
|
+
pruchasePrice: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type BaseQuote = {
|
|
40
74
|
id: string;
|
|
75
|
+
opportunityId: string;
|
|
76
|
+
vehicleId: string;
|
|
77
|
+
contactId: string;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
createdBy: string;
|
|
80
|
+
updatedAt: string;
|
|
81
|
+
updatedBy: string;
|
|
82
|
+
calculatorValues: QuoteCalculatorValues;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type NewQuote = BaseQuote & {
|
|
86
|
+
id?: undefined;
|
|
87
|
+
createdAt?: undefined;
|
|
88
|
+
createdBy?: undefined;
|
|
89
|
+
modifiedAt?: undefined;
|
|
90
|
+
modifiedBy?: undefined;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type Quote = BaseQuote & {
|
|
94
|
+
version: number;
|
|
95
|
+
status: QuoteStatus;
|
|
96
|
+
monthlyAmount: string;
|
|
97
|
+
residualAmount: string;
|
|
98
|
+
beforeDeliveryAmount: string;
|
|
99
|
+
roi: string;
|
|
100
|
+
cashflow: string;
|
|
101
|
+
profitability: string;
|
|
102
|
+
proformaPdf?: AttachmentValue;
|
|
103
|
+
quotePdf?: AttachmentValue;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type QuoteUpdate = {
|
|
107
|
+
status: QuoteStatus;
|
|
41
108
|
};
|
|
42
109
|
|
|
43
110
|
type BaseOpportunity = {
|
|
44
|
-
accountManager
|
|
45
|
-
|
|
111
|
+
accountManager: string;
|
|
112
|
+
type: OpportunityType;
|
|
46
113
|
organizationId?: string;
|
|
47
|
-
/** will not be filled if organizationId is present */
|
|
48
|
-
orgName?: string;
|
|
49
114
|
contactId?: string;
|
|
50
|
-
/** will not be filled if contactId is present */
|
|
51
|
-
contactName?: string;
|
|
52
115
|
vehicleId?: string;
|
|
53
|
-
|
|
54
|
-
bids?: Bid[];
|
|
55
|
-
dealStatus: OpportunityDealStatus;
|
|
56
|
-
logisticStatus: OpportunityLogisticStatus;
|
|
57
|
-
type: OpportunityType;
|
|
58
|
-
contractId?: string;
|
|
59
|
-
quotes?: Quote[];
|
|
60
|
-
amount: string;
|
|
61
|
-
status: OpportunityStatus;
|
|
62
|
-
interest: Interest;
|
|
116
|
+
source: string; // e.g. manual, website, autoscout, mobile...
|
|
63
117
|
};
|
|
64
118
|
|
|
65
119
|
export type NewOpportunity = BaseOpportunity & {
|
|
@@ -70,10 +124,60 @@ export type NewOpportunity = BaseOpportunity & {
|
|
|
70
124
|
modifiedBy?: undefined;
|
|
71
125
|
};
|
|
72
126
|
|
|
127
|
+
export type OpportunityDocument = {
|
|
128
|
+
type: string; // passport, driving_license, ...
|
|
129
|
+
displayName: string;
|
|
130
|
+
file: AttachmentValue;
|
|
131
|
+
};
|
|
132
|
+
|
|
73
133
|
export type Opportunity = BaseOpportunity & {
|
|
74
134
|
id: string;
|
|
75
135
|
createdAt: string;
|
|
76
136
|
createdBy: string;
|
|
77
137
|
modifiedAt: string;
|
|
78
138
|
modifiedBy: string;
|
|
139
|
+
lostAt?: string;
|
|
140
|
+
lostBy?: string;
|
|
141
|
+
lostReason?: OpportunityLostReasonValues;
|
|
142
|
+
deliveredAt?: string;
|
|
143
|
+
deliveredBy?: string;
|
|
144
|
+
status: OpportunityStatus;
|
|
145
|
+
dealStatus?: OpportunityDealStatus;
|
|
146
|
+
logisticStatus?: OpportunityLogisticStatus;
|
|
147
|
+
activeQuoteId?: string;
|
|
148
|
+
contractId?: string;
|
|
149
|
+
amount?: string;
|
|
150
|
+
interest?: Interest;
|
|
151
|
+
documents?: OpportunityDocument[];
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type OpportunityUpdate = {
|
|
155
|
+
vehicleId?: string | null;
|
|
156
|
+
accountManager?: string;
|
|
157
|
+
contactId?: string | null;
|
|
158
|
+
activeQuoteId?: string;
|
|
159
|
+
interest?: Interest | null;
|
|
160
|
+
lost?: boolean;
|
|
161
|
+
lostReason?: OpportunityLostReasonValues;
|
|
162
|
+
delivered?: boolean;
|
|
163
|
+
documents?: OpportunityDocument[];
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export type OpportunityBFF = {
|
|
167
|
+
opportunity: DataRecord<Opportunity>;
|
|
168
|
+
vehicle?: DataRecord<Vehicle>;
|
|
169
|
+
bids: DataRecord<Bid>[];
|
|
170
|
+
quotes: DataRecord<Quote>[];
|
|
171
|
+
customer?: {
|
|
172
|
+
contact: DataRecord<Contact>;
|
|
173
|
+
org?: DataRecord<Organization>;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type OpportunityEvent = {
|
|
178
|
+
opportunity: Opportunity;
|
|
179
|
+
action: 'create' | 'update' | 'delete';
|
|
180
|
+
actionAt: string;
|
|
181
|
+
userId: string;
|
|
182
|
+
tenantId: string;
|
|
79
183
|
};
|
package/src/types/tenants.ts
CHANGED
package/src/types/utils.ts
CHANGED