@movalib/movalib-commons 1.60.0 → 1.62.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.
@@ -1,56 +1,92 @@
1
- import Cookies from "js-cookie";
2
- import VehicleTire from "../models/VehicleTire";
3
- import { MovaFormField, MovaInterval } from "./Types";
1
+ import parsePhoneNumberFromString from "libphonenumber-js/max";
4
2
  import { CSSProperties } from "react";
5
- import { DayOfWeek, PartsApplicationType, VehiclePlateFormat } from "./Enums";
6
3
  import Schedule from "../models/Schedule";
4
+ import VehicleTire from "../models/VehicleTire";
5
+ import { DayOfWeek, PartsApplicationType, VehiclePlateFormat } from "./Enums";
6
+ import { MovaFormField, MovaInterval } from "./Types";
7
7
 
8
- export const getApplicationsShortLabels = (applications: PartsApplicationType[] | undefined): string => {
9
- if(!applications) {
10
- return '';
8
+ export const getApplicationsShortLabels = (
9
+ applications: PartsApplicationType[] | undefined
10
+ ): string => {
11
+ if (!applications) {
12
+ return "";
11
13
  }
12
-
13
- return applications.map(getApplicationShortLabel).join(' + ');
14
+
15
+ return applications.map(getApplicationShortLabel).join(" + ");
14
16
  };
15
17
 
16
- export const flexStart:CSSProperties = {
17
- display: 'flex',
18
- justifyContent: 'start',
19
- alignItems: 'center'
20
- }
18
+ export const flexStart: CSSProperties = {
19
+ display: "flex",
20
+ justifyContent: "start",
21
+ alignItems: "center",
22
+ };
21
23
 
22
- export const isSafariOniOS = ():boolean => {
24
+ export const isSafariOniOS = (): boolean => {
23
25
  const userAgent = window.navigator.userAgent;
24
- const iOS = !!userAgent.match(/iPad/i) || !!userAgent.match(/iPhone/i) || !!userAgent.match(/iPod/i);
26
+ const iOS =
27
+ !!userAgent.match(/iPad/i) ||
28
+ !!userAgent.match(/iPhone/i) ||
29
+ !!userAgent.match(/iPod/i);
25
30
  const webkit = !!userAgent.match(/WebKit/i);
26
31
  const criOS = !!userAgent.match(/CriOS/i);
27
-
32
+
28
33
  return iOS && webkit && !criOS;
29
- }
34
+ };
30
35
 
36
+ export const isInvalidMobileNumber = (phoneNumber = "") => {
37
+ if (!phoneNumber || typeof phoneNumber !== "string") return true;
38
+
39
+ // Nettoyage : supprime les espaces et convertit "00..." en "+..."
40
+ const cleaned = phoneNumber.replace(/\s+/g, "").replace(/^00/, "+");
41
+ // Si le numéro ne commence pas par +, on assume que c'est un numéro local français
42
+ const cleanedPhoneNumber = cleaned.startsWith("+")
43
+ ? cleaned
44
+ : `+33${cleaned.replace(/^0/, "")}`;
45
+
46
+ try {
47
+ const parsed = parsePhoneNumberFromString(cleanedPhoneNumber);
48
+ const type = parsed?.getType?.();
49
+ console.log(type);
50
+ console.log(parsed?.isValid());
51
+ console.log(["MOBILE", "MOBILE_OR_FIXED_LINE"].includes(type || ""));
52
+ return !(
53
+ parsed?.isValid() &&
54
+ ["MOBILE", "MOBILE_OR_FIXED_LINE"].includes(type || "")
55
+ );
56
+ } catch {
57
+ return true;
58
+ }
59
+ };
31
60
 
32
- export const FR_WEEK_DAYS: string[] = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'];
61
+ export const FR_WEEK_DAYS: string[] = [
62
+ "Lundi",
63
+ "Mardi",
64
+ "Mercredi",
65
+ "Jeudi",
66
+ "Vendredi",
67
+ "Samedi",
68
+ "Dimanche",
69
+ ];
33
70
 
34
71
  export const getDayOfWeekLabel = (day: DayOfWeek) => {
35
- if(day){
36
- return FR_WEEK_DAYS[getDayOfWeekIndex(day)]
72
+ if (day) {
73
+ return FR_WEEK_DAYS[getDayOfWeekIndex(day)];
37
74
  }
38
- }
75
+ };
39
76
 
40
77
  export const getDayOfWeekIndex = (day: DayOfWeek) => {
41
- if(day){
78
+ if (day) {
42
79
  // Convertir les valeurs de l'énumération en un tableau
43
80
  const daysArray = Object.values(DayOfWeek);
44
81
  return daysArray.indexOf(day);
45
82
  }
46
83
  return -1;
47
- }
48
-
84
+ };
49
85
 
50
86
  export const formatPhoneNumber = (phoneNumber: string): string => {
51
87
  let formattedNumber = "";
52
88
 
53
- if(phoneNumber){
89
+ if (phoneNumber) {
54
90
  for (let i = 0; i < phoneNumber.length; i++) {
55
91
  if (i > 0 && i % 2 === 0) {
56
92
  formattedNumber += ".";
@@ -62,87 +98,119 @@ export const formatPhoneNumber = (phoneNumber: string): string => {
62
98
  return formattedNumber;
63
99
  };
64
100
 
65
- export const getFormattedSchedule = (schedule: Schedule | null, dayIndex: number) => {
66
- if(schedule){
67
- return `${getFrenchDayLabel(schedule.dayOfWeek)} : ${getFormattedIntervals(schedule.intervals)}`
101
+ export const getFormattedSchedule = (
102
+ schedule: Schedule | null,
103
+ dayIndex: number
104
+ ) => {
105
+ if (schedule) {
106
+ return `${getFrenchDayLabel(
107
+ schedule.dayOfWeek
108
+ )} : ${getFormattedIntervals(schedule.intervals)}`;
68
109
  } else {
69
110
  return `${getFrenchDayLabel(getDayOfWeek(dayIndex))} : fermé`;
70
111
  }
71
- }
112
+ };
72
113
 
73
114
  export const getFormattedIntervals = (intervals: MovaInterval[]) => {
74
- if(intervals){
75
- let times:string = "";
76
- sortMovaIntervals(intervals).map((interval:MovaInterval, index) => {
77
- if(index > 0){
78
- times = `${times} | `;
115
+ if (intervals) {
116
+ let times: string = "";
117
+ sortMovaIntervals(intervals).map((interval: MovaInterval, index) => {
118
+ if (index > 0) {
119
+ times = `${times} | `;
79
120
  }
80
- times = `${times} ${formatTime(interval.startTime)} - ${formatTime(interval.endTime)}`
81
- })
121
+ times = `${times} ${formatTime(interval.startTime)} - ${formatTime(
122
+ interval.endTime
123
+ )}`;
124
+ });
82
125
  return times;
83
126
  }
84
- }
127
+ };
85
128
 
86
129
  export const formatTime = (date: string | Date | null) => {
87
- if(date){
88
- let strDate:string = date.toString();
130
+ if (date) {
131
+ let strDate: string = date.toString();
89
132
  return strDate.substring(0, 5);
90
133
  }
91
134
  };
92
135
 
93
136
  const sortMovaIntervals = (intervals: MovaInterval[]): MovaInterval[] => {
94
- if(intervals){
137
+ if (intervals) {
95
138
  return intervals.sort((a, b) => {
96
139
  // Convertir en Date si nécessaire
97
- const startTimeA = a.startTime instanceof Date ? a.startTime : new Date(a.startTime as string);
98
- const startTimeB = b.startTime instanceof Date ? b.startTime : new Date(b.startTime as string);
99
-
140
+ const startTimeA =
141
+ a.startTime instanceof Date
142
+ ? a.startTime
143
+ : new Date(a.startTime as string);
144
+ const startTimeB =
145
+ b.startTime instanceof Date
146
+ ? b.startTime
147
+ : new Date(b.startTime as string);
148
+
100
149
  // Gérer les valeurs nulles
101
150
  if (startTimeA === null && startTimeB === null) return 0;
102
151
  if (startTimeA === null) return 1;
103
152
  if (startTimeB === null) return -1;
104
-
153
+
105
154
  // Comparer les dates
106
155
  return startTimeA.getTime() - startTimeB.getTime();
107
156
  });
108
157
  }
109
158
  return [];
110
- }
159
+ };
111
160
 
112
- export const findScheduleByDayOfWeek = (schedules: Schedule[], dayIndex: number): Schedule | null => {
113
- const foundSchedule = schedules.find(schedule => schedule.dayOfWeek === getDayOfWeek(dayIndex));
161
+ export const findScheduleByDayOfWeek = (
162
+ schedules: Schedule[],
163
+ dayIndex: number
164
+ ): Schedule | null => {
165
+ const foundSchedule = schedules.find(
166
+ (schedule) => schedule.dayOfWeek === getDayOfWeek(dayIndex)
167
+ );
114
168
  return foundSchedule ? foundSchedule : null;
115
169
  };
116
170
 
117
- export const getDayOfWeek = (index:number) => {
171
+ export const getDayOfWeek = (index: number) => {
118
172
  switch (index) {
119
- case 0 : return DayOfWeek.MONDAY;
120
- case 1 : return DayOfWeek.TUESDAY;
121
- case 2 : return DayOfWeek.WEDNESDAY;
122
- case 3 : return DayOfWeek.THURSDAY;
123
- case 4 : return DayOfWeek.FRIDAY;
124
- case 5 : return DayOfWeek.SATURDAY;
125
- case 6 : return DayOfWeek.SUNDAY;
173
+ case 0:
174
+ return DayOfWeek.MONDAY;
175
+ case 1:
176
+ return DayOfWeek.TUESDAY;
177
+ case 2:
178
+ return DayOfWeek.WEDNESDAY;
179
+ case 3:
180
+ return DayOfWeek.THURSDAY;
181
+ case 4:
182
+ return DayOfWeek.FRIDAY;
183
+ case 5:
184
+ return DayOfWeek.SATURDAY;
185
+ case 6:
186
+ return DayOfWeek.SUNDAY;
126
187
  }
127
- }
188
+ };
128
189
 
129
- export const getFrenchDayLabel = (day:DayOfWeek | undefined) => {
190
+ export const getFrenchDayLabel = (day: DayOfWeek | undefined) => {
130
191
  switch (day) {
131
- case DayOfWeek.MONDAY: return 'Lundi';
132
- case DayOfWeek.TUESDAY: return 'Mardi';
133
- case DayOfWeek.WEDNESDAY: return 'Mercredi';
134
- case DayOfWeek.THURSDAY: return 'Jeudi';
135
- case DayOfWeek.FRIDAY: return 'Vendredi';
136
- case DayOfWeek.SATURDAY: return 'Samedi';
137
- case DayOfWeek.SUNDAY: return 'Dimanche';
192
+ case DayOfWeek.MONDAY:
193
+ return "Lundi";
194
+ case DayOfWeek.TUESDAY:
195
+ return "Mardi";
196
+ case DayOfWeek.WEDNESDAY:
197
+ return "Mercredi";
198
+ case DayOfWeek.THURSDAY:
199
+ return "Jeudi";
200
+ case DayOfWeek.FRIDAY:
201
+ return "Vendredi";
202
+ case DayOfWeek.SATURDAY:
203
+ return "Samedi";
204
+ case DayOfWeek.SUNDAY:
205
+ return "Dimanche";
138
206
  }
139
- }
207
+ };
140
208
 
141
- export const flexLeftRow:CSSProperties = {
142
- display: 'flex',
143
- justifyContent: 'start',
144
- alignItems: 'center'
145
- }
209
+ export const flexLeftRow: CSSProperties = {
210
+ display: "flex",
211
+ justifyContent: "start",
212
+ alignItems: "center",
213
+ };
146
214
 
147
215
  export const capitalizeFirstLetter = (str: string): string => {
148
216
  if (str.length === 0) {
@@ -153,45 +221,56 @@ export const capitalizeFirstLetter = (str: string): string => {
153
221
  const restOfString = str.slice(1);
154
222
 
155
223
  return firstChar + restOfString;
156
- }
157
-
158
- export const getApplicationShortLabel = (application:PartsApplicationType | undefined) => {
159
- if(application){
160
- switch(application){
161
- case PartsApplicationType.FRONT: return "AV";
162
- case PartsApplicationType.REAR: return "AR";
163
- case PartsApplicationType.FRONT_REAR: return "AV + AR";
164
- case PartsApplicationType.LEFT: return "G";
165
- case PartsApplicationType.RIGHT: return "D";
166
- case PartsApplicationType.LEFT_RIGHT: return "G + D";
167
- case PartsApplicationType.FRONT_LEFT: return "AVG";
168
- case PartsApplicationType.FRONT_RIGHT: return "AVD";
169
- case PartsApplicationType.REAR_LEFT: return "ARG";
170
- case PartsApplicationType.REAR_RIGHT: return "ARD";
224
+ };
225
+
226
+ export const getApplicationShortLabel = (
227
+ application: PartsApplicationType | undefined
228
+ ) => {
229
+ if (application) {
230
+ switch (application) {
231
+ case PartsApplicationType.FRONT:
232
+ return "AV";
233
+ case PartsApplicationType.REAR:
234
+ return "AR";
235
+ case PartsApplicationType.FRONT_REAR:
236
+ return "AV + AR";
237
+ case PartsApplicationType.LEFT:
238
+ return "G";
239
+ case PartsApplicationType.RIGHT:
240
+ return "D";
241
+ case PartsApplicationType.LEFT_RIGHT:
242
+ return "G + D";
243
+ case PartsApplicationType.FRONT_LEFT:
244
+ return "AVG";
245
+ case PartsApplicationType.FRONT_RIGHT:
246
+ return "AVD";
247
+ case PartsApplicationType.REAR_LEFT:
248
+ return "ARG";
249
+ case PartsApplicationType.REAR_RIGHT:
250
+ return "ARD";
171
251
  }
172
252
  }
173
253
  return "";
174
- }
254
+ };
175
255
 
176
- export const flexEnd:CSSProperties = {
177
- display: 'flex',
178
- justifyContent: 'end',
179
- alignItems: 'center'
180
- }
256
+ export const flexEnd: CSSProperties = {
257
+ display: "flex",
258
+ justifyContent: "end",
259
+ alignItems: "center",
260
+ };
181
261
 
182
- export const flexCenter:CSSProperties = {
183
- display: 'flex',
184
- justifyContent: 'center',
185
- alignItems: 'center'
186
- }
262
+ export const flexCenter: CSSProperties = {
263
+ display: "flex",
264
+ justifyContent: "center",
265
+ alignItems: "center",
266
+ };
187
267
 
188
268
  export const isEmpty = (data: Object): boolean => {
189
269
  return Object.keys(data).length === 0;
190
- }
270
+ };
191
271
 
192
272
  export const formatFrenchVehiclePlate = (input: string | undefined): string => {
193
- if(input){
194
-
273
+ if (input) {
195
274
  // On commence par détecter s'il s'agit d'un ancien ou nouveau format
196
275
  let plateFormat: VehiclePlateFormat | null = null;
197
276
 
@@ -204,21 +283,24 @@ export const formatFrenchVehiclePlate = (input: string | undefined): string => {
204
283
  }
205
284
 
206
285
  // Supprimer tous les caractères non alphanumériques
207
- let cleanedInput = input.replace(/[^A-Z0-9]/gi, '').toUpperCase();
286
+ let cleanedInput = input.replace(/[^A-Z0-9]/gi, "").toUpperCase();
208
287
 
209
- switch(plateFormat){
210
- case VehiclePlateFormat.FRENCH_NEW : {
288
+ switch (plateFormat) {
289
+ case VehiclePlateFormat.FRENCH_NEW: {
211
290
  // Ajouter des tirets aux positions appropriées
212
291
  if (cleanedInput.length >= 2) {
213
292
  cleanedInput = `${cleanedInput.slice(0, 2)}-${cleanedInput.slice(2)}`;
214
293
  }
215
294
  if (cleanedInput.length >= 6) {
216
- cleanedInput = `${cleanedInput.slice(0, 6)}-${cleanedInput.slice(6, 8)}`;
295
+ cleanedInput = `${cleanedInput.slice(0, 6)}-${cleanedInput.slice(
296
+ 6,
297
+ 8
298
+ )}`;
217
299
  }
218
300
  break;
219
301
  }
220
302
 
221
- case VehiclePlateFormat.FRENCH_OLD : {
303
+ case VehiclePlateFormat.FRENCH_OLD: {
222
304
  // Rien de particulier, pas de tiret sur les anciennes plaques
223
305
  break;
224
306
  }
@@ -231,25 +313,30 @@ export const formatFrenchVehiclePlate = (input: string | undefined): string => {
231
313
  };
232
314
 
233
315
  export const formatVehicleTire = (vehicleTire: VehicleTire) => {
234
- if(vehicleTire){
316
+ if (vehicleTire) {
235
317
  let concatened = `${vehicleTire.width}${vehicleTire.height}${vehicleTire.diameter}${vehicleTire.speedIndex}`;
236
318
  return formatVehicleTireStr(concatened);
237
319
  }
238
- return '';
239
- }
320
+ return "";
321
+ };
240
322
 
241
323
  export const formatVehicleTireStr = (input: string) => {
242
- let formatted = input.toUpperCase().replace(/[^0-9A-QS-Za-qs-z]/g, '').slice(0, 7);
324
+ let formatted = input
325
+ .toUpperCase()
326
+ .replace(/[^0-9A-QS-Za-qs-z]/g, "")
327
+ .slice(0, 7);
243
328
  if (formatted.length > 3) {
244
329
  formatted = `${formatted.substring(0, 3)} / ${formatted.substring(3)}`;
245
330
  }
246
331
  const indexOfRraw = input.indexOf("R");
247
- let toAdd = indexOfRraw !== -1 ? input.substring(indexOfRraw + 3) : '';
248
- if(toAdd.length > 0) {
249
- toAdd = ' ' + toAdd;
332
+ let toAdd = indexOfRraw !== -1 ? input.substring(indexOfRraw + 3) : "";
333
+ if (toAdd.length > 0) {
334
+ toAdd = " " + toAdd;
250
335
  }
251
- if(formatted.length > 8) {
252
- formatted = `${formatted.substring(0, 8)} R${formatted.substring(8)}${toAdd}`;
336
+ if (formatted.length > 8) {
337
+ formatted = `${formatted.substring(0, 8)} R${formatted.substring(
338
+ 8
339
+ )}${toAdd}`;
253
340
  }
254
341
  return formatted;
255
342
  };
@@ -262,13 +349,16 @@ export const formatVehicleTireStr = (input: string) => {
262
349
  * @param {string} errorMsg - Le message d'erreur à associer au champ si la validation échoue.
263
350
  * @returns {MovaFormField} - Le champ de formulaire avec les propriétés `error` et `isValid` mises à jour.
264
351
  */
265
- export const validateField = (field: MovaFormField | undefined, validator: (value: string) => boolean, errorMsg: string): MovaFormField => {
266
- if (field && !validator(field.value)) {
267
- return { value: field.value, error: errorMsg, isValid: false };
268
- } else if (field) {
269
- return { value: field.value, error: '', isValid: true };
270
- } else {
271
- return { value: '', error: '', isValid: true };
272
- }
273
- };
274
-
352
+ export const validateField = (
353
+ field: MovaFormField | undefined,
354
+ validator: (value: string) => boolean,
355
+ errorMsg: string
356
+ ): MovaFormField => {
357
+ if (field && !validator(field.value)) {
358
+ return { value: field.value, error: errorMsg, isValid: false };
359
+ } else if (field) {
360
+ return { value: field.value, error: "", isValid: true };
361
+ } else {
362
+ return { value: "", error: "", isValid: true };
363
+ }
364
+ };
@@ -1,57 +1,59 @@
1
+ import { isInvalidMobileNumber } from "./Tools";
2
+
1
3
  /**
2
4
  * Un email valide
3
5
  */
4
- const emailRegex:RegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
6
+ const emailRegex: RegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
5
7
 
6
8
  /**
7
- * Un mot de passe qui contient au moins une majuscule, une minuscule, un chiffre
9
+ * Un mot de passe qui contient au moins une majuscule, une minuscule, un chiffre
8
10
  * et un caractère spécial. La longueur du mot de passe doit être d'au moins 8 caractères.
9
11
  */
10
- const passwordRegex:RegExp = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
12
+ const passwordRegex: RegExp =
13
+ /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
11
14
 
12
15
  /**
13
- * Un numéro de téléphone (10 chiffres)
16
+ * Un numéro de téléphone (10 chiffres)
14
17
  */
15
- const phoneNumberRegex:RegExp = /^\d{0,10}$/;
18
+ const phoneNumberRegex: RegExp = /^\d{0,10}$/;
16
19
 
17
20
  /**
18
21
  * Un code postal (5 chiffres)
19
22
  */
20
- const postalCodeRegex:RegExp = /^\d{5}$/;
23
+ const postalCodeRegex: RegExp = /^\d{5}$/;
21
24
 
22
25
  /**
23
26
  * Une URL valide
24
27
  */
25
- const urlRegex:RegExp =/^(ftp|http|https):\/\/[^ "]+$/;
28
+ const urlRegex: RegExp = /^(ftp|http|https):\/\/[^ "]+$/;
26
29
 
27
30
  /**
28
31
  * Un nom pouvant contenir des lettres, chiffres d'une taille comprise entre 3 et 20 caractères
29
32
  */
30
- const userNameRegex:RegExp = /^[a-z0-9_-]{3,20}$/;
33
+ const userNameRegex: RegExp = /^[a-z0-9_-]{3,20}$/;
31
34
 
32
35
  /**
33
36
  * Un texte pouvant contenir des lettres, chiffres et quelques caractères spéciaux
34
37
  */
35
- const textRegex:RegExp = /^[a-zA-Z0-9\s.,!?'"()+=-_-éèçà]+$/;
36
-
38
+ const textRegex: RegExp = /^[a-zA-Z0-9\s.,!?'"()+=-_-éèçà]+$/;
37
39
 
38
- export function validatePhoneNumber(phoneNumber: string) : boolean {
39
- if (phoneNumber === null || phoneNumber === undefined || phoneNumber === '') {
40
- return false;
41
- }
42
- return phoneNumberRegex.test(phoneNumber);
40
+ export function validatePhoneNumber(phoneNumber: string): boolean {
41
+ if (phoneNumber === null || phoneNumber === undefined || phoneNumber === "") {
42
+ return false;
43
+ }
44
+ return !isInvalidMobileNumber(phoneNumber);
43
45
  }
44
46
 
45
- export function validateText(text: string) : boolean {
46
- if (text === null || text === undefined) {
47
- return false;
48
- }
49
- return textRegex.test(text);
47
+ export function validateText(text: string): boolean {
48
+ if (text === null || text === undefined) {
49
+ return false;
50
+ }
51
+ return textRegex.test(text);
50
52
  }
51
53
 
52
- export function validateEmail(email: string) : boolean {
53
- if (email === null || email === undefined) {
54
- return false;
55
- }
56
- return emailRegex.test(email);
57
- }
54
+ export function validateEmail(email: string): boolean {
55
+ if (email === null || email === undefined) {
56
+ return false;
57
+ }
58
+ return emailRegex.test(email);
59
+ }
@@ -15,7 +15,10 @@ export default class Document {
15
15
  reference?: string;
16
16
  rejectReason?: string;
17
17
  validateToken?: string;
18
-
18
+ remindersCount?: number;
19
+ totalAmountInclVat?: number;
20
+ lastSendingTime?: Date;
21
+ firstSendingTime?: Date;
19
22
  constructor(
20
23
  id: string,
21
24
  ownerId: number,
@@ -28,7 +31,11 @@ export default class Document {
28
31
  creationDate?: Date,
29
32
  updateDate?: Date,
30
33
  reference?: string,
31
- validateToken?: string
34
+ validateToken?: string,
35
+ remindersCount?: number,
36
+ totalAmountInclVat?: number,
37
+ lastSendingTime?: Date,
38
+ firstSendingTime?: Date
32
39
  ) {
33
40
  this.id = id;
34
41
  this.state = state;
@@ -42,6 +49,14 @@ export default class Document {
42
49
  this.updateDate = updateDate;
43
50
  this.reference = reference;
44
51
  this.validateToken = validateToken;
52
+ this.remindersCount = remindersCount;
53
+ this.totalAmountInclVat = totalAmountInclVat;
54
+ this.lastSendingTime = lastSendingTime
55
+ ? new Date(lastSendingTime)
56
+ : undefined;
57
+ this.firstSendingTime = firstSendingTime
58
+ ? new Date(firstSendingTime)
59
+ : undefined;
45
60
  }
46
61
 
47
62
  static findByTypeAndReference(