@silexpert/core 1.1.306 → 1.1.308

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.
Files changed (112) hide show
  1. package/dist/cjs/api/resources/Commercial.d.ts +4 -1
  2. package/dist/cjs/api/resources/Commercial.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/Commercial.js +3 -0
  4. package/dist/cjs/api/resources/Commercial.js.map +1 -1
  5. package/dist/cjs/types/Enum/Card.d.ts +24 -2
  6. package/dist/cjs/types/Enum/Card.d.ts.map +1 -1
  7. package/dist/cjs/types/Enum/Card.js +26 -0
  8. package/dist/cjs/types/Enum/Card.js.map +1 -1
  9. package/dist/cjs/types/Enum/PriceGridClementine.d.ts +22 -0
  10. package/dist/cjs/types/Enum/PriceGridClementine.d.ts.map +1 -1
  11. package/dist/cjs/types/Enum/PriceGridClementine.js +27 -1
  12. package/dist/cjs/types/Enum/PriceGridClementine.js.map +1 -1
  13. package/dist/cjs/types/Enum/PriceGridLegalstart.d.ts +8 -0
  14. package/dist/cjs/types/Enum/PriceGridLegalstart.d.ts.map +1 -1
  15. package/dist/cjs/types/Enum/PriceGridLegalstart.js +8 -0
  16. package/dist/cjs/types/Enum/PriceGridLegalstart.js.map +1 -1
  17. package/dist/cjs/types/Enum/PriceGridPourcentage.d.ts +10 -0
  18. package/dist/cjs/types/Enum/PriceGridPourcentage.d.ts.map +1 -1
  19. package/dist/cjs/types/Enum/PriceGridPourcentage.js +84 -0
  20. package/dist/cjs/types/Enum/PriceGridPourcentage.js.map +1 -1
  21. package/dist/cjs/types/Enum/StatisticType.d.ts +2 -1
  22. package/dist/cjs/types/Enum/StatisticType.d.ts.map +1 -1
  23. package/dist/cjs/types/Enum/StatisticType.js +1 -0
  24. package/dist/cjs/types/Enum/StatisticType.js.map +1 -1
  25. package/dist/cjs/types/Interface/api/commercial/QueryGetStatsHistory.d.ts +7 -0
  26. package/dist/cjs/types/Interface/api/commercial/QueryGetStatsHistory.d.ts.map +1 -0
  27. package/dist/cjs/types/Interface/api/commercial/QueryGetStatsHistory.js +42 -0
  28. package/dist/cjs/types/Interface/api/commercial/QueryGetStatsHistory.js.map +1 -0
  29. package/dist/cjs/types/Interface/api/payment/Util.d.ts +3 -0
  30. package/dist/cjs/types/Interface/api/payment/Util.d.ts.map +1 -1
  31. package/dist/cjs/types/Interface/api/payment/Util.js.map +1 -1
  32. package/dist/cjs/types/Interface/api/statistic/QueryInternal.d.ts +1 -1
  33. package/dist/cjs/types/Interface/api/statistic/QueryInternal.d.ts.map +1 -1
  34. package/dist/cjs/types/Interface/api/statistic/QueryInternal.js +5 -5
  35. package/dist/cjs/types/Interface/api/statistic/QueryInternal.js.map +1 -1
  36. package/dist/cjs/types/index.d.ts +1 -0
  37. package/dist/cjs/types/index.d.ts.map +1 -1
  38. package/dist/cjs/types/index.js +1 -0
  39. package/dist/cjs/types/index.js.map +1 -1
  40. package/dist/cjs/utils/payment.d.ts +1 -0
  41. package/dist/cjs/utils/payment.d.ts.map +1 -1
  42. package/dist/cjs/utils/payment.js +68 -59
  43. package/dist/cjs/utils/payment.js.map +1 -1
  44. package/dist/cjs/utils/prestation.d.ts +60 -0
  45. package/dist/cjs/utils/prestation.d.ts.map +1 -1
  46. package/dist/cjs/utils/prestation.js +4 -3
  47. package/dist/cjs/utils/prestation.js.map +1 -1
  48. package/dist/cjs/utils/tests/payment.spec.js +72 -36
  49. package/dist/cjs/utils/tests/payment.spec.js.map +1 -1
  50. package/dist/mjs/api/resources/Commercial.d.ts +4 -1
  51. package/dist/mjs/api/resources/Commercial.d.ts.map +1 -1
  52. package/dist/mjs/api/resources/Commercial.js +7 -0
  53. package/dist/mjs/api/resources/Commercial.js.map +1 -1
  54. package/dist/mjs/types/Enum/Card.d.ts +24 -2
  55. package/dist/mjs/types/Enum/Card.d.ts.map +1 -1
  56. package/dist/mjs/types/Enum/Card.js +26 -0
  57. package/dist/mjs/types/Enum/Card.js.map +1 -1
  58. package/dist/mjs/types/Enum/PriceGridClementine.d.ts +22 -0
  59. package/dist/mjs/types/Enum/PriceGridClementine.d.ts.map +1 -1
  60. package/dist/mjs/types/Enum/PriceGridClementine.js +27 -1
  61. package/dist/mjs/types/Enum/PriceGridClementine.js.map +1 -1
  62. package/dist/mjs/types/Enum/PriceGridLegalstart.d.ts +8 -0
  63. package/dist/mjs/types/Enum/PriceGridLegalstart.d.ts.map +1 -1
  64. package/dist/mjs/types/Enum/PriceGridLegalstart.js +8 -0
  65. package/dist/mjs/types/Enum/PriceGridLegalstart.js.map +1 -1
  66. package/dist/mjs/types/Enum/PriceGridPourcentage.d.ts +10 -0
  67. package/dist/mjs/types/Enum/PriceGridPourcentage.d.ts.map +1 -1
  68. package/dist/mjs/types/Enum/PriceGridPourcentage.js +84 -0
  69. package/dist/mjs/types/Enum/PriceGridPourcentage.js.map +1 -1
  70. package/dist/mjs/types/Enum/StatisticType.d.ts +2 -1
  71. package/dist/mjs/types/Enum/StatisticType.d.ts.map +1 -1
  72. package/dist/mjs/types/Enum/StatisticType.js +1 -0
  73. package/dist/mjs/types/Enum/StatisticType.js.map +1 -1
  74. package/dist/mjs/types/Interface/api/commercial/QueryGetStatsHistory.d.ts +7 -0
  75. package/dist/mjs/types/Interface/api/commercial/QueryGetStatsHistory.d.ts.map +1 -0
  76. package/dist/mjs/types/Interface/api/commercial/QueryGetStatsHistory.js +42 -0
  77. package/dist/mjs/types/Interface/api/commercial/QueryGetStatsHistory.js.map +1 -0
  78. package/dist/mjs/types/Interface/api/payment/Util.d.ts +3 -0
  79. package/dist/mjs/types/Interface/api/payment/Util.d.ts.map +1 -1
  80. package/dist/mjs/types/Interface/api/payment/Util.js.map +1 -1
  81. package/dist/mjs/types/Interface/api/statistic/QueryInternal.d.ts +1 -1
  82. package/dist/mjs/types/Interface/api/statistic/QueryInternal.d.ts.map +1 -1
  83. package/dist/mjs/types/Interface/api/statistic/QueryInternal.js +3 -3
  84. package/dist/mjs/types/Interface/api/statistic/QueryInternal.js.map +1 -1
  85. package/dist/mjs/types/index.d.ts +1 -0
  86. package/dist/mjs/types/index.d.ts.map +1 -1
  87. package/dist/mjs/types/index.js +1 -0
  88. package/dist/mjs/types/index.js.map +1 -1
  89. package/dist/mjs/utils/payment.d.ts +1 -0
  90. package/dist/mjs/utils/payment.d.ts.map +1 -1
  91. package/dist/mjs/utils/payment.js +68 -59
  92. package/dist/mjs/utils/payment.js.map +1 -1
  93. package/dist/mjs/utils/prestation.d.ts +60 -0
  94. package/dist/mjs/utils/prestation.d.ts.map +1 -1
  95. package/dist/mjs/utils/prestation.js +1 -1
  96. package/dist/mjs/utils/prestation.js.map +1 -1
  97. package/dist/mjs/utils/tests/payment.spec.js +72 -36
  98. package/dist/mjs/utils/tests/payment.spec.js.map +1 -1
  99. package/package.json +1 -1
  100. package/ts/api/resources/Commercial.ts +8 -0
  101. package/ts/types/Enum/Card.ts +27 -0
  102. package/ts/types/Enum/PriceGridClementine.ts +27 -1
  103. package/ts/types/Enum/PriceGridLegalstart.ts +8 -0
  104. package/ts/types/Enum/PriceGridPourcentage.ts +84 -0
  105. package/ts/types/Enum/StatisticType.ts +1 -0
  106. package/ts/types/Interface/api/commercial/QueryGetStatsHistory.ts +26 -0
  107. package/ts/types/Interface/api/payment/Util.ts +3 -0
  108. package/ts/types/Interface/api/statistic/QueryInternal.ts +1 -1
  109. package/ts/types/index.ts +1 -0
  110. package/ts/utils/payment.ts +70 -63
  111. package/ts/utils/prestation.ts +3 -1
  112. package/ts/utils/tests/payment.spec.ts +72 -36
@@ -7,6 +7,7 @@ describe('Payment', () => {
7
7
  const idPrestation = 1;
8
8
  const idSociety = 1;
9
9
  const yearlyAmountNonExpress = 1800;
10
+ const nextYearlyAmountNonExpress = 1800;
10
11
  const appCost = 14.9;
11
12
  const firstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate();
12
13
  const prestationList = {
@@ -73,7 +74,8 @@ describe('Payment', () => {
73
74
  try {
74
75
  prestationList.hidden = true;
75
76
  calculatePaymentsAuto({
76
- goToClient: dayjs().toDate(),
77
+ idTypeBrand: 1,
78
+ goToClient: dayjs('2024-06-06').toDate(),
77
79
  firstExerciceNonExpresssEndDate,
78
80
  idPrestation,
79
81
  prestationList: {
@@ -83,7 +85,8 @@ describe('Payment', () => {
83
85
  idVat,
84
86
  listPartialExercicePrestationExpress,
85
87
  listRegulations,
86
- yearlyAmountNonExpress
88
+ yearlyAmountNonExpress,
89
+ nextYearlyAmountNonExpress
87
90
  });
88
91
  }
89
92
  catch (error) {
@@ -96,14 +99,16 @@ describe('Payment', () => {
96
99
  expect.assertions(2);
97
100
  try {
98
101
  calculatePaymentsAuto({
99
- goToClient: dayjs().toDate(),
102
+ idTypeBrand: 1,
103
+ goToClient: dayjs('2024-06-06').toDate(),
100
104
  firstExerciceNonExpresssEndDate,
101
105
  idPrestation,
102
106
  prestationList,
103
107
  idVat,
104
108
  listPartialExercicePrestationExpress,
105
109
  listRegulations: [],
106
- yearlyAmountNonExpress
110
+ yearlyAmountNonExpress,
111
+ nextYearlyAmountNonExpress
107
112
  });
108
113
  }
109
114
  catch (error) {
@@ -116,14 +121,16 @@ describe('Payment', () => {
116
121
  expect.assertions(2);
117
122
  try {
118
123
  calculatePaymentsAuto({
119
- goToClient: dayjs().toDate(),
124
+ idTypeBrand: 1,
125
+ goToClient: dayjs('2024-06-06').toDate(),
120
126
  firstExerciceNonExpresssEndDate,
121
127
  idPrestation,
122
128
  prestationList,
123
129
  idVat,
124
130
  listPartialExercicePrestationExpress,
125
131
  listRegulations: [{ processed: true }],
126
- yearlyAmountNonExpress
132
+ yearlyAmountNonExpress,
133
+ nextYearlyAmountNonExpress
127
134
  });
128
135
  }
129
136
  catch (error) {
@@ -138,14 +145,16 @@ describe('Payment', () => {
138
145
  // express
139
146
  test('if only one express, monthly payments of actual exo should be in parallel of express monthly payments, smoothed in number of remaining months (mini 3 months) (if not in 3 last month)', async () => {
140
147
  const payments = calculatePaymentsAuto({
141
- goToClient: dayjs().toDate(),
148
+ idTypeBrand: 1,
149
+ goToClient: dayjs('2024-06-06').toDate(),
142
150
  firstExerciceNonExpresssEndDate,
143
151
  idPrestation,
144
152
  prestationList,
145
153
  idVat,
146
154
  listPartialExercicePrestationExpress: [listPartialExercicePrestationExpress[0]],
147
155
  listRegulations,
148
- yearlyAmountNonExpress
156
+ yearlyAmountNonExpress,
157
+ nextYearlyAmountNonExpress
149
158
  });
150
159
  const firstExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) < 0)[0].datePayment;
151
160
  const firstNonExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) === 0)[0].datePayment;
@@ -153,14 +162,16 @@ describe('Payment', () => {
153
162
  });
154
163
  test('if more than one express, monthly payments of actual exo should be in a row of express monthly payments and smoothed, smoothed in number of remaining months after express monthly payments (mini 3 months) (if in 3 last month of exercice)', async () => {
155
164
  const payments = calculatePaymentsAuto({
156
- goToClient: dayjs().toDate(),
165
+ idTypeBrand: 1,
166
+ goToClient: dayjs('2024-06-06').toDate(),
157
167
  firstExerciceNonExpresssEndDate,
158
168
  idPrestation,
159
169
  prestationList,
160
170
  idVat,
161
171
  listPartialExercicePrestationExpress,
162
172
  listRegulations,
163
- yearlyAmountNonExpress
173
+ yearlyAmountNonExpress,
174
+ nextYearlyAmountNonExpress
164
175
  });
165
176
  const lastExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) < 0).splice(-1)?.[0]?.datePayment;
166
177
  const firstNonExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) === 0)?.[0]?.datePayment;
@@ -173,7 +184,8 @@ describe('Payment', () => {
173
184
  const nbMonthDelay = 6;
174
185
  const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();
175
186
  const payments = calculatePaymentsAuto({
176
- goToClient: dayjs().toDate(),
187
+ idTypeBrand: 1,
188
+ goToClient: dayjs('2024-06-06').toDate(),
177
189
  firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate,
178
190
  idPrestation,
179
191
  prestationList,
@@ -183,7 +195,8 @@ describe('Payment', () => {
183
195
  amount: 50,
184
196
  amountUsed: 0,
185
197
  }],
186
- yearlyAmountNonExpress
198
+ yearlyAmountNonExpress,
199
+ nextYearlyAmountNonExpress
187
200
  });
188
201
  // const listNonExpressPayments = payments.filter(p => p.closingDate === newFirstExerciceNonExpresssEndDate);
189
202
  const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);
@@ -194,7 +207,8 @@ describe('Payment', () => {
194
207
  const nbMonthDelay = 1;
195
208
  const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();
196
209
  const payments = calculatePaymentsAuto({
197
- goToClient: dayjs().toDate(),
210
+ idTypeBrand: 1,
211
+ goToClient: dayjs('2024-06-06').toDate(),
198
212
  firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate,
199
213
  idPrestation,
200
214
  prestationList,
@@ -204,7 +218,8 @@ describe('Payment', () => {
204
218
  amount: 50,
205
219
  amountUsed: 0,
206
220
  }],
207
- yearlyAmountNonExpress
221
+ yearlyAmountNonExpress,
222
+ nextYearlyAmountNonExpress
208
223
  });
209
224
  const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);
210
225
  expect(listNonExpressPayments.length).toStrictEqual(3);
@@ -219,14 +234,16 @@ describe('Payment', () => {
219
234
  amountUsed: 0,
220
235
  }];
221
236
  const payments = calculatePaymentsAuto({
222
- goToClient: dayjs().toDate(),
237
+ idTypeBrand: 1,
238
+ goToClient: dayjs('2024-06-06').toDate(),
223
239
  firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate,
224
240
  idPrestation,
225
241
  prestationList,
226
242
  idVat,
227
243
  listPartialExercicePrestationExpress: [],
228
244
  listRegulations: newListRegulations,
229
- yearlyAmountNonExpress
245
+ yearlyAmountNonExpress,
246
+ nextYearlyAmountNonExpress
230
247
  });
231
248
  const diff = yearlyAmountNonExpress - newListRegulations.reduce((acc, r) => acc + r.amount - r.amountUsed, 0);
232
249
  const amount = Math.round(100 * diff / nbMonthDelay) / 100;
@@ -241,14 +258,16 @@ describe('Payment', () => {
241
258
  amountUsed: 0,
242
259
  }];
243
260
  const payments = calculatePaymentsAuto({
244
- goToClient: dayjs().toDate(),
261
+ idTypeBrand: 1,
262
+ goToClient: dayjs('2024-06-06').toDate(),
245
263
  firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate,
246
264
  idPrestation,
247
265
  prestationList,
248
266
  idVat,
249
267
  listPartialExercicePrestationExpress: [],
250
268
  listRegulations: newListRegulations,
251
- yearlyAmountNonExpress
269
+ yearlyAmountNonExpress,
270
+ nextYearlyAmountNonExpress
252
271
  });
253
272
  const diff = yearlyAmountNonExpress - newListRegulations.reduce((acc, r) => acc + r.amount - r.amountUsed, 0);
254
273
  const amount = Math.round(100 * diff / 3) / 100;
@@ -260,7 +279,8 @@ describe('Payment', () => {
260
279
  MockDate.set(mockedDate);
261
280
  const newFirstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate();
262
281
  const payments = calculatePaymentsAuto({
263
- goToClient: dayjs().toDate(),
282
+ idTypeBrand: 1,
283
+ goToClient: dayjs('2024-06-06').toDate(),
264
284
  firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate,
265
285
  idPrestation,
266
286
  prestationList,
@@ -270,7 +290,8 @@ describe('Payment', () => {
270
290
  amount: 50,
271
291
  amountUsed: 0,
272
292
  }],
273
- yearlyAmountNonExpress
293
+ yearlyAmountNonExpress,
294
+ nextYearlyAmountNonExpress
274
295
  });
275
296
  const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);
276
297
  expect(Math.round(100 * listNonExpressPayments[0].amount * 1.0275) / 100).toStrictEqual(listNonExpressPayments.splice(-2)[0].amount);
@@ -281,7 +302,8 @@ describe('Payment', () => {
281
302
  MockDate.set(mockedDate);
282
303
  const newFirstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate();
283
304
  const payments = calculatePaymentsAuto({
284
- goToClient: dayjs().toDate(),
305
+ idTypeBrand: 1,
306
+ goToClient: dayjs('2024-06-06').toDate(),
285
307
  firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate,
286
308
  idPrestation,
287
309
  prestationList,
@@ -291,7 +313,8 @@ describe('Payment', () => {
291
313
  amount: 50,
292
314
  amountUsed: 0,
293
315
  }],
294
- yearlyAmountNonExpress
316
+ yearlyAmountNonExpress,
317
+ nextYearlyAmountNonExpress
295
318
  });
296
319
  const listNonExpressPayments = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-06-01')) === 0);
297
320
  expect(listNonExpressPayments[0].amount).toStrictEqual(listNonExpressPayments.splice(-2)[0].amount);
@@ -302,7 +325,8 @@ describe('Payment', () => {
302
325
  MockDate.set(mockedDate);
303
326
  const newFirstExerciceNonExpresssEndDate = dayjs().add(12, 'month').endOf('month').toDate();
304
327
  const payments = calculatePaymentsAuto({
305
- goToClient: dayjs().toDate(),
328
+ idTypeBrand: 1,
329
+ goToClient: dayjs('2024-06-06').toDate(),
306
330
  firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate,
307
331
  idPrestation,
308
332
  prestationList,
@@ -312,7 +336,8 @@ describe('Payment', () => {
312
336
  amount: 50,
313
337
  amountUsed: 50,
314
338
  }],
315
- yearlyAmountNonExpress
339
+ yearlyAmountNonExpress,
340
+ nextYearlyAmountNonExpress
316
341
  });
317
342
  const paymentsOfFirstExo = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-06-01')) === 0).splice(-1)[0].amount ?? 0;
318
343
  const paymentsOfSecondExo = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-07-01')) === 0).splice(-1)[0].amount ?? 0;
@@ -331,14 +356,16 @@ describe('Payment', () => {
331
356
  startDate: dayjs().startOf('month').toDate(),
332
357
  };
333
358
  const payments = calculatePaymentsAuto({
334
- goToClient: dayjs().toDate(),
359
+ idTypeBrand: 1,
360
+ goToClient: dayjs('2024-06-06').toDate(),
335
361
  firstExerciceNonExpresssEndDate,
336
362
  idPrestation,
337
363
  prestationList,
338
364
  idVat,
339
365
  listPartialExercicePrestationExpress: listPartialExercicePrestationExpressCloned,
340
366
  listRegulations,
341
- yearlyAmountNonExpress
367
+ yearlyAmountNonExpress,
368
+ nextYearlyAmountNonExpress
342
369
  });
343
370
  expect(payments.length).toBeGreaterThanOrEqual(4);
344
371
  expect(dayjs(payments[payments.length - 1].datePayment).diff(dayjs(payments?.[0]?.datePayment), 'month')).toBeGreaterThan(0);
@@ -347,7 +374,8 @@ describe('Payment', () => {
347
374
  const mockedDate = dayjs('2024-03-15').toDate();
348
375
  MockDate.set(mockedDate);
349
376
  const payments = calculatePaymentsAuto({
350
- goToClient: dayjs().toDate(),
377
+ idTypeBrand: 1,
378
+ goToClient: dayjs('2024-06-06').toDate(),
351
379
  firstExerciceNonExpresssEndDate,
352
380
  idPrestation,
353
381
  prestationList,
@@ -361,7 +389,8 @@ describe('Payment', () => {
361
389
  idPaymentMethod: PaymentMethod.BANK_CARD.id,
362
390
  idSociety,
363
391
  }],
364
- yearlyAmountNonExpress
392
+ yearlyAmountNonExpress,
393
+ nextYearlyAmountNonExpress
365
394
  });
366
395
  expect(payments.length).toBeGreaterThanOrEqual(2);
367
396
  expect(payments[0]).toMatchObject({
@@ -382,14 +411,16 @@ describe('Payment', () => {
382
411
  const mockedDate = dayjs('2024-03-29').toDate();
383
412
  MockDate.set(mockedDate);
384
413
  const payments = calculatePaymentsAuto({
385
- goToClient: dayjs().toDate(),
414
+ idTypeBrand: 1,
415
+ goToClient: dayjs('2024-06-06').toDate(),
386
416
  firstExerciceNonExpresssEndDate,
387
417
  idPrestation,
388
418
  prestationList,
389
419
  idVat,
390
420
  listPartialExercicePrestationExpress,
391
421
  listRegulations,
392
- yearlyAmountNonExpress
422
+ yearlyAmountNonExpress,
423
+ nextYearlyAmountNonExpress
393
424
  });
394
425
  expect(payments.length).toBeGreaterThanOrEqual(4);
395
426
  expect(payments?.[0]?.datePayment).toStrictEqual(dayjs(mockedDate).add(2, 'month').startOf('month').toDate());
@@ -399,34 +430,39 @@ describe('Payment', () => {
399
430
  const mockedDate = dayjs('2024-03-29').toDate();
400
431
  MockDate.set(mockedDate);
401
432
  const payments = calculatePaymentsAuto({
402
- goToClient: dayjs().toDate(),
433
+ idTypeBrand: 1,
434
+ goToClient: dayjs('2024-06-06').toDate(),
403
435
  firstExerciceNonExpresssEndDate,
404
436
  idPrestation,
405
437
  prestationList,
406
438
  idVat,
407
439
  listPartialExercicePrestationExpress,
408
440
  listRegulations,
409
- yearlyAmountNonExpress
441
+ yearlyAmountNonExpress,
442
+ nextYearlyAmountNonExpress
410
443
  });
411
444
  expect(payments.length).toBeGreaterThanOrEqual(4);
412
445
  expect(dayjs(payments[payments.length - 1].datePayment).month()).toStrictEqual(11);
413
446
  });
414
447
  test('first payment and last payment should have at least one year difference (ex. : 23 - 24)', async () => {
415
448
  const payments = calculatePaymentsAuto({
416
- goToClient: dayjs().toDate(),
449
+ idTypeBrand: 1,
450
+ goToClient: dayjs('2024-06-06').toDate(),
417
451
  firstExerciceNonExpresssEndDate,
418
452
  idPrestation,
419
453
  prestationList,
420
454
  idVat,
421
455
  listPartialExercicePrestationExpress: [],
422
456
  listRegulations,
423
- yearlyAmountNonExpress
457
+ yearlyAmountNonExpress,
458
+ nextYearlyAmountNonExpress
424
459
  });
425
460
  expect(dayjs(payments.slice(-1)?.[0]?.datePayment).diff(dayjs(payments?.[0]?.datePayment), 'year', true)).toBeGreaterThan(1);
426
461
  });
427
462
  test('real case : idSociety 114440', async () => {
428
463
  const payments = calculatePaymentsAuto({
429
- goToClient: dayjs().toDate(),
464
+ idTypeBrand: 1,
465
+ goToClient: dayjs('2024-06-06').toDate(),
430
466
  firstExerciceNonExpresssEndDate: dayjs('2024-12-31').toDate(),
431
467
  idPrestation,
432
468
  prestationList,
@@ -440,7 +476,7 @@ describe('Payment', () => {
440
476
  idPaymentMethod: PaymentMethod.BANK_CARD.id,
441
477
  idSociety,
442
478
  }],
443
- yearlyAmountNonExpress: 1433
479
+ yearlyAmountNonExpress: 1433, nextYearlyAmountNonExpress: 1433
444
480
  });
445
481
  expect(dayjs(payments.slice(-1)?.[0]?.datePayment).diff(dayjs(payments?.[0]?.datePayment), 'year', true)).toBeGreaterThan(1);
446
482
  });
@@ -1 +1 @@
1
- {"version":3,"file":"payment.spec.js","sourceRoot":"","sources":["../../../../ts/utils/tests/payment.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,GAAG,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGnD,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,MAAM,YAAY,GAAG,CAAC,CAAC;QACvB,MAAM,SAAS,GAAG,CAAC,CAAC;QACpB,MAAM,sBAAsB,GAAG,IAAI,CAAC;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC;QAErB,MAAM,+BAA+B,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QACzF,MAAM,cAAc,GAAG;YACrB,EAAE,EAAE,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,KAAK;YACf,aAAa,EAAE,KAAK;YACpB,aAAa,EAAE,IAA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AAU,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE;gBAC5B,+BAA+B,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE;gBAC7D,YAAY;gBACZ,cAAc;gBACd,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE;gBACnB,oCAAoC,EAAE,EAAE;gBACxC,eAAe,EAAE,CAAC;wBAChB,MAAM,EAAE,MAAM;wBACd,UAAU,EAAE,CAAC;wBACb,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE;wBAClC,SAAS,EAAE,KAAK;wBAChB,eAAe,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE;wBAC3C,SAAS;qBACV,CAAC;gBACF,sBAAsB,EAAE,IAAI;aAAE,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC/H,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as dayjs from 'dayjs';\nimport { IRegulation, Vat, PaymentMethod } from '../../types';\nimport MockDate from 'mockdate';\n\nimport { calculatePaymentsAuto } from '../payment';\nimport { PartialExercicePrestationExpress } from '../../types/Interface/api/payment/Util';\n\ndescribe('Payment', () => {\n describe('calculatePayments', () => {\n const idPrestation = 1;\n const idSociety = 1;\n const yearlyAmountNonExpress = 1800;\n const appCost = 14.9;\n\n const firstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate(); \n const prestationList = {\n id: 34,\n name: 'Compta Pro',\n isComptable: true,\n isJuridique: false,\n isSocial: false,\n isAttestation: false,\n inAverageCart: true,\n isBack: false,\n minimumPrice: null,\n price: null,\n isCatalog: false,\n isPlannable: false,\n hidden: false,\n isComplementary: false,\n signaturePosition: '400,54,569,90',\n signaturePage: 7,\n };\n const idVat = Vat.TX_10.id;\n const vatRate = Object.values(Vat).find(v => v.id === idVat)?.value ?? 20;\n const listPartialExercicePrestationExpress:PartialExercicePrestationExpress[] = [\n {\n startDate: dayjs().subtract(2, 'year').startOf('month').toDate(), \n endDate: dayjs().subtract(13, 'month').endOf('month').toDate(), \n countExpressMonthlyPayment: 2,\n totalAmount: 1200,\n },\n {\n startDate: dayjs().subtract(1, 'year').startOf('month').toDate(), \n endDate: dayjs().subtract(1, 'month').endOf('month').toDate(), \n countExpressMonthlyPayment: 2,\n totalAmount: 1800,\n },\n ];\n const listRegulations:IRegulation[] = [{\n amount: 600,\n amountUsed: 0,\n date: new Date(),\n processed: true,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }, {\n amount: 300,\n amountUsed: 0,\n date: new Date(),\n processed: true,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }, {\n amount: 300,\n amountUsed: 300,\n date: new Date(),\n processed: true,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }];\n\n // =====================\n // errors handling\n // =====================\n test('should return error if prestationList doesn\\'t correspond (!hidden, isCatalog, isComptable)', () => {\n expect.assertions(2);\n try {\n prestationList.hidden = true;\n calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList: {\n ...prestationList,\n isCatalog: true,\n },\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations,\n yearlyAmountNonExpress });\n } catch (error) {\n expect(error).toBeInstanceOf(Error);\n // @ts-ignore\n expect(error.message).toStrictEqual('Ce type de prestation ne correspond pas aux conditions attendues.');\n }\n });\n test('should return error if listRegulations is empty', () => {\n expect.assertions(2);\n try {\n calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations: [],\n yearlyAmountNonExpress });\n } catch (error) {\n expect(error).toBeInstanceOf(Error);\n // @ts-ignore\n expect(error.message).toStrictEqual('List of regulations can not be empty');\n }\n });\n test('should listRegulations contain amount and amountUsed', () => {\n expect.assertions(2);\n try {\n calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations: [{ processed: true } as IRegulation],\n yearlyAmountNonExpress });\n } catch (error) {\n expect(error).toBeInstanceOf(Error);\n // @ts-ignore\n expect(error.message).toStrictEqual('Amount and amountUsed are missing for regulations');\n }\n });\n\n // =====================\n // logical\n // =====================\n // express\n test('if only one express, monthly payments of actual exo should be in parallel of express monthly payments, smoothed in number of remaining months (mini 3 months) (if not in 3 last month)', async () => {\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [listPartialExercicePrestationExpress[0]],\n listRegulations,\n yearlyAmountNonExpress });\n\n const firstExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) < 0)[0].datePayment;\n const firstNonExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) === 0)[0].datePayment;\n expect(dayjs(firstNonExpressDatePayment).diff(firstExpressDatePayment, 'month')).toStrictEqual(0);\n });\n test('if more than one express, monthly payments of actual exo should be in a row of express monthly payments and smoothed, smoothed in number of remaining months after express monthly payments (mini 3 months) (if in 3 last month of exercice)', async () => {\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations,\n yearlyAmountNonExpress });\n\n const lastExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) < 0).splice(-1)?.[0]?.datePayment;\n const firstNonExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) === 0)?.[0]?.datePayment;\n expect(dayjs(firstNonExpressDatePayment).diff(lastExpressDatePayment, 'month')).toStrictEqual(1);\n });\n // non express\n test('should return a number of payments equal to nb of remaining months in exercice (if not in 3 last months)', async () => {\n const mockedDate = dayjs('2024-05-15').toDate();\n MockDate.set(mockedDate);\n \n const nbMonthDelay = 6;\n const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();\n\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation],\n yearlyAmountNonExpress });\n\n // const listNonExpressPayments = payments.filter(p => p.closingDate === newFirstExerciceNonExpresssEndDate);\n const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);\n expect(listNonExpressPayments.length).toStrictEqual(nbMonthDelay);\n \n MockDate.reset();\n });\n test('should return a number of payments equal to 3 (if in 3 last month of exercice)', async () => {\n const nbMonthDelay = 1;\n const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();\n\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation],\n yearlyAmountNonExpress });\n\n const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);\n expect(listNonExpressPayments.length).toStrictEqual(3);\n });\n test('should (yearlyAmountNonExpress - sum of listRegulations) / count of monthly payments be equal to monthly payment amount (if not in 3 last month)', async () => {\n const mockedDate = dayjs('2024-05-15').toDate();\n MockDate.set(mockedDate);\n \n const nbMonthDelay = 6;\n const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();\n const newListRegulations = [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation];\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: newListRegulations,\n yearlyAmountNonExpress });\n \n const diff = yearlyAmountNonExpress - newListRegulations.reduce((acc, r:IRegulation) => acc + r.amount - r.amountUsed, 0);\n const amount = Math.round(100 * diff / nbMonthDelay) / 100;\n\n expect(payments[0].amount).toStrictEqual(Math.round(100 * amount * ((100 + vatRate) / 100)) / 100);\n \n MockDate.reset();\n });\n test('should (totalAmount - firstPaymentAmount) / 3 be equal to monthly payment amount (if in 3 last month of exercice)', async () => {\n const nbMonthDelay = 1;\n const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();\n const newListRegulations = [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation];\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: newListRegulations,\n yearlyAmountNonExpress });\n\n const diff = yearlyAmountNonExpress - newListRegulations.reduce((acc, r:IRegulation) => acc + r.amount - r.amountUsed, 0);\n const amount = Math.round(100 * diff / 3) / 100;\n\n expect(payments[0].amount).toStrictEqual(Math.round(100 * amount * ((100 + vatRate) / 100)) / 100);\n });\n // annual price increase\n test('should apply annual price increase (2,75%) if signed before last 3 months of civil year', async () => {\n const mockedDate = dayjs('2024-08-15').toDate();\n MockDate.set(mockedDate);\n\n const newFirstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate();\n\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation],\n yearlyAmountNonExpress });\n\n const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);\n expect(Math.round(100 * listNonExpressPayments[0].amount * 1.0275) / 100).toStrictEqual(listNonExpressPayments.splice(-2)[0].amount);\n\n MockDate.reset();\n });\n test('should not apply annual price increase (2,75%) if signed in last 3 months of civil year', async () => {\n const mockedDate = dayjs('2024-11-15').toDate();\n MockDate.set(mockedDate);\n \n const newFirstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate();\n \n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation],\n yearlyAmountNonExpress });\n \n const listNonExpressPayments = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-06-01')) === 0);\n expect(listNonExpressPayments[0].amount).toStrictEqual(listNonExpressPayments.splice(-2)[0].amount);\n \n MockDate.reset();\n });\n\n test('should apply 14,9€ HT increase for the second exercice created (only offered on first exo) (no rules for 3 last months)', async () => {\n const mockedDate = dayjs('2024-06-15').toDate();\n MockDate.set(mockedDate);\n \n const newFirstExerciceNonExpresssEndDate = dayjs().add(12, 'month').endOf('month').toDate();\n \n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 50,\n } as IRegulation],\n yearlyAmountNonExpress });\n \n const paymentsOfFirstExo = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-06-01')) === 0).splice(-1)[0].amount ?? 0;\n const paymentsOfSecondExo = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-07-01')) === 0).splice(-1)[0].amount ?? 0;\n expect(paymentsOfFirstExo + appCost * ((100 + vatRate) / 100)).toStrictEqual(paymentsOfSecondExo);\n \n MockDate.reset();\n });\n \n // misc\n test('should payments been generated sorted by exercices start date', async () => {\n const listPartialExercicePrestationExpressCloned = [...listPartialExercicePrestationExpress];\n listPartialExercicePrestationExpressCloned[0] = { \n ...listPartialExercicePrestationExpress[0],\n startDate: dayjs().add(1, 'year').startOf('month').toDate(), \n };\n listPartialExercicePrestationExpressCloned[1] = { \n ...listPartialExercicePrestationExpress[1],\n startDate: dayjs().startOf('month').toDate(), \n };\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: listPartialExercicePrestationExpressCloned,\n listRegulations,\n yearlyAmountNonExpress });\n expect(payments.length).toBeGreaterThanOrEqual(4);\n expect(dayjs(payments[payments.length - 1].datePayment).diff(dayjs(payments?.[0]?.datePayment), 'month')).toBeGreaterThan(0);\n });\n test('if regulations are bigger than sum exercice prestation amounts, should pass some exercice payments', async () => {\n const mockedDate = dayjs('2024-03-15').toDate();\n MockDate.set(mockedDate);\n\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations: [{\n amount: 2000,\n amountUsed: 0,\n date: new Date(),\n processed: true,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }],\n yearlyAmountNonExpress });\n expect(payments.length).toBeGreaterThanOrEqual(2);\n expect(payments[0]).toMatchObject(\n {\n amount: 550,\n datePayment: dayjs(mockedDate).add(1, 'month').startOf('month').toDate(),\n idPrestation: 1,\n idPaymentMethod: 1,\n });\n expect(payments[1]).toMatchObject(\n {\n amount: 550,\n datePayment: dayjs(mockedDate).add(2, 'month').startOf('month').toDate(),\n idPrestation: 1,\n idPaymentMethod: 1,\n });\n MockDate.reset();\n });\n test('should not consider actual month if signed in last 3 days of month', async () => {\n const mockedDate = dayjs('2024-03-29').toDate();\n MockDate.set(mockedDate);\n\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations,\n yearlyAmountNonExpress });\n expect(payments.length).toBeGreaterThanOrEqual(4);\n expect(payments?.[0]?.datePayment).toStrictEqual(dayjs(mockedDate).add(2, 'month').startOf('month').toDate());\n MockDate.reset();\n });\n test('last payment returned should be last of a year (12/XX)', async () => {\n const mockedDate = dayjs('2024-03-29').toDate();\n MockDate.set(mockedDate);\n\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations,\n yearlyAmountNonExpress });\n expect(payments.length).toBeGreaterThanOrEqual(4);\n expect(dayjs(payments[payments.length - 1].datePayment).month()).toStrictEqual(11);\n });\n test('first payment and last payment should have at least one year difference (ex. : 23 - 24)', async () => {\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations,\n yearlyAmountNonExpress });\n expect(dayjs(payments.slice(-1)?.[0]?.datePayment).diff(dayjs(payments?.[0]?.datePayment), 'year', true)).toBeGreaterThan(1);\n });\n test('real case : idSociety 114440', async () => {\n const payments = calculatePaymentsAuto({ \n goToClient: dayjs().toDate(),\n firstExerciceNonExpresssEndDate: dayjs('2024-12-31').toDate(), \n idPrestation,\n prestationList,\n idVat: Vat.TX_20.id,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 1006.8,\n amountUsed: 0,\n date: dayjs('2024-06-06').toDate(), \n processed: false,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }],\n yearlyAmountNonExpress: 1433 });\n expect(dayjs(payments.slice(-1)?.[0]?.datePayment).diff(dayjs(payments?.[0]?.datePayment), 'year', true)).toBeGreaterThan(1);\n });\n });\n});"]}
1
+ {"version":3,"file":"payment.spec.js","sourceRoot":"","sources":["../../../../ts/utils/tests/payment.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,GAAG,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGnD,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,MAAM,YAAY,GAAG,CAAC,CAAC;QACvB,MAAM,SAAS,GAAG,CAAC,CAAC;QACpB,MAAM,sBAAsB,GAAG,IAAI,CAAC;QACpC,MAAM,0BAA0B,GAAG,IAAI,CAAC;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC;QAErB,MAAM,+BAA+B,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QACzF,MAAM,cAAc,GAAG;YACrB,EAAE,EAAE,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,KAAK;YACf,aA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AC,YAAY,CAAC,CAAC,MAAM,EAAE;wBAClC,SAAS,EAAE,KAAK;wBAChB,eAAe,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE;wBAC3C,SAAS;qBACV,CAAC;gBACF,sBAAsB,EAAE,IAAI,EAAE,0BAA0B,EAAE,IAAI;aAAE,CAAC,CAAC;YACpE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC/H,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as dayjs from 'dayjs';\nimport { IRegulation, Vat, PaymentMethod } from '../../types';\nimport MockDate from 'mockdate';\n\nimport { calculatePaymentsAuto } from '../payment';\nimport { PartialExercicePrestationExpress } from '../../types/Interface/api/payment/Util';\n\ndescribe('Payment', () => {\n describe('calculatePayments', () => {\n const idPrestation = 1;\n const idSociety = 1;\n const yearlyAmountNonExpress = 1800;\n const nextYearlyAmountNonExpress = 1800;\n const appCost = 14.9;\n\n const firstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate(); \n const prestationList = {\n id: 34,\n name: 'Compta Pro',\n isComptable: true,\n isJuridique: false,\n isSocial: false,\n isAttestation: false,\n inAverageCart: true,\n isBack: false,\n minimumPrice: null,\n price: null,\n isCatalog: false,\n isPlannable: false,\n hidden: false,\n isComplementary: false,\n signaturePosition: '400,54,569,90',\n signaturePage: 7,\n };\n const idVat = Vat.TX_10.id;\n const vatRate = Object.values(Vat).find(v => v.id === idVat)?.value ?? 20;\n const listPartialExercicePrestationExpress:PartialExercicePrestationExpress[] = [\n {\n startDate: dayjs().subtract(2, 'year').startOf('month').toDate(), \n endDate: dayjs().subtract(13, 'month').endOf('month').toDate(), \n countExpressMonthlyPayment: 2,\n totalAmount: 1200,\n },\n {\n startDate: dayjs().subtract(1, 'year').startOf('month').toDate(), \n endDate: dayjs().subtract(1, 'month').endOf('month').toDate(), \n countExpressMonthlyPayment: 2,\n totalAmount: 1800,\n },\n ];\n const listRegulations:IRegulation[] = [{\n amount: 600,\n amountUsed: 0,\n date: new Date(),\n processed: true,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }, {\n amount: 300,\n amountUsed: 0,\n date: new Date(),\n processed: true,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }, {\n amount: 300,\n amountUsed: 300,\n date: new Date(),\n processed: true,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }];\n\n // =====================\n // errors handling\n // =====================\n test('should return error if prestationList doesn\\'t correspond (!hidden, isCatalog, isComptable)', () => {\n expect.assertions(2);\n try {\n prestationList.hidden = true;\n calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList: {\n ...prestationList,\n isCatalog: true,\n },\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n } catch (error) {\n expect(error).toBeInstanceOf(Error);\n // @ts-ignore\n expect(error.message).toStrictEqual('Ce type de prestation ne correspond pas aux conditions attendues.');\n }\n });\n test('should return error if listRegulations is empty', () => {\n expect.assertions(2);\n try {\n calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations: [],\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n } catch (error) {\n expect(error).toBeInstanceOf(Error);\n // @ts-ignore\n expect(error.message).toStrictEqual('List of regulations can not be empty');\n }\n });\n test('should listRegulations contain amount and amountUsed', () => {\n expect.assertions(2);\n try {\n calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations: [{ processed: true } as IRegulation],\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n } catch (error) {\n expect(error).toBeInstanceOf(Error);\n // @ts-ignore\n expect(error.message).toStrictEqual('Amount and amountUsed are missing for regulations');\n }\n });\n\n // =====================\n // logical\n // =====================\n // express\n test('if only one express, monthly payments of actual exo should be in parallel of express monthly payments, smoothed in number of remaining months (mini 3 months) (if not in 3 last month)', async () => {\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [listPartialExercicePrestationExpress[0]],\n listRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n\n const firstExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) < 0)[0].datePayment;\n const firstNonExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) === 0)[0].datePayment;\n expect(dayjs(firstNonExpressDatePayment).diff(firstExpressDatePayment, 'month')).toStrictEqual(0);\n });\n test('if more than one express, monthly payments of actual exo should be in a row of express monthly payments and smoothed, smoothed in number of remaining months after express monthly payments (mini 3 months) (if in 3 last month of exercice)', async () => {\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n\n const lastExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) < 0).splice(-1)?.[0]?.datePayment;\n const firstNonExpressDatePayment = payments.filter(p => dayjs(p.closingDate).diff(firstExerciceNonExpresssEndDate) === 0)?.[0]?.datePayment;\n expect(dayjs(firstNonExpressDatePayment).diff(lastExpressDatePayment, 'month')).toStrictEqual(1);\n });\n // non express\n test('should return a number of payments equal to nb of remaining months in exercice (if not in 3 last months)', async () => {\n const mockedDate = dayjs('2024-05-15').toDate();\n MockDate.set(mockedDate);\n \n const nbMonthDelay = 6;\n const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();\n\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation],\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n\n // const listNonExpressPayments = payments.filter(p => p.closingDate === newFirstExerciceNonExpresssEndDate);\n const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);\n expect(listNonExpressPayments.length).toStrictEqual(nbMonthDelay);\n \n MockDate.reset();\n });\n test('should return a number of payments equal to 3 (if in 3 last month of exercice)', async () => {\n const nbMonthDelay = 1;\n const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();\n\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation],\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n\n const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);\n expect(listNonExpressPayments.length).toStrictEqual(3);\n });\n test('should (yearlyAmountNonExpress - sum of listRegulations) / count of monthly payments be equal to monthly payment amount (if not in 3 last month)', async () => {\n const mockedDate = dayjs('2024-05-15').toDate();\n MockDate.set(mockedDate);\n \n const nbMonthDelay = 6;\n const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();\n const newListRegulations = [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation];\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: newListRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n \n const diff = yearlyAmountNonExpress - newListRegulations.reduce((acc, r:IRegulation) => acc + r.amount - r.amountUsed, 0);\n const amount = Math.round(100 * diff / nbMonthDelay) / 100;\n\n expect(payments[0].amount).toStrictEqual(Math.round(100 * amount * ((100 + vatRate) / 100)) / 100);\n \n MockDate.reset();\n });\n test('should (totalAmount - firstPaymentAmount) / 3 be equal to monthly payment amount (if in 3 last month of exercice)', async () => {\n const nbMonthDelay = 1;\n const newFirstExerciceNonExpresssEndDate = dayjs().add(nbMonthDelay, 'month').endOf('month').toDate();\n const newListRegulations = [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation];\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: newListRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n\n const diff = yearlyAmountNonExpress - newListRegulations.reduce((acc, r:IRegulation) => acc + r.amount - r.amountUsed, 0);\n const amount = Math.round(100 * diff / 3) / 100;\n\n expect(payments[0].amount).toStrictEqual(Math.round(100 * amount * ((100 + vatRate) / 100)) / 100);\n });\n // annual price increase\n test('should apply annual price increase (2,75%) if signed before last 3 months of civil year', async () => {\n const mockedDate = dayjs('2024-08-15').toDate();\n MockDate.set(mockedDate);\n\n const newFirstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate();\n\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation],\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n\n const listNonExpressPayments = payments.filter(p => dayjs(p.closingDate).diff(newFirstExerciceNonExpresssEndDate) === 0);\n expect(Math.round(100 * listNonExpressPayments[0].amount * 1.0275) / 100).toStrictEqual(listNonExpressPayments.splice(-2)[0].amount);\n\n MockDate.reset();\n });\n test('should not apply annual price increase (2,75%) if signed in last 3 months of civil year', async () => {\n const mockedDate = dayjs('2024-11-15').toDate();\n MockDate.set(mockedDate);\n \n const newFirstExerciceNonExpresssEndDate = dayjs().add(11, 'month').endOf('month').toDate();\n \n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 0,\n } as IRegulation],\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n \n const listNonExpressPayments = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-06-01')) === 0);\n expect(listNonExpressPayments[0].amount).toStrictEqual(listNonExpressPayments.splice(-2)[0].amount);\n \n MockDate.reset();\n });\n\n test('should apply 14,9€ HT increase for the second exercice created (only offered on first exo) (no rules for 3 last months)', async () => {\n const mockedDate = dayjs('2024-06-15').toDate();\n MockDate.set(mockedDate);\n \n const newFirstExerciceNonExpresssEndDate = dayjs().add(12, 'month').endOf('month').toDate();\n \n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate: newFirstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 50,\n amountUsed: 50,\n } as IRegulation],\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n \n const paymentsOfFirstExo = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-06-01')) === 0).splice(-1)[0].amount ?? 0;\n const paymentsOfSecondExo = payments.filter(p => dayjs(p.datePayment).diff(dayjs('2025-07-01')) === 0).splice(-1)[0].amount ?? 0;\n expect(paymentsOfFirstExo + appCost * ((100 + vatRate) / 100)).toStrictEqual(paymentsOfSecondExo);\n \n MockDate.reset();\n });\n \n // misc\n test('should payments been generated sorted by exercices start date', async () => {\n const listPartialExercicePrestationExpressCloned = [...listPartialExercicePrestationExpress];\n listPartialExercicePrestationExpressCloned[0] = { \n ...listPartialExercicePrestationExpress[0],\n startDate: dayjs().add(1, 'year').startOf('month').toDate(), \n };\n listPartialExercicePrestationExpressCloned[1] = { \n ...listPartialExercicePrestationExpress[1],\n startDate: dayjs().startOf('month').toDate(), \n };\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: listPartialExercicePrestationExpressCloned,\n listRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n expect(payments.length).toBeGreaterThanOrEqual(4);\n expect(dayjs(payments[payments.length - 1].datePayment).diff(dayjs(payments?.[0]?.datePayment), 'month')).toBeGreaterThan(0);\n });\n test('if regulations are bigger than sum exercice prestation amounts, should pass some exercice payments', async () => {\n const mockedDate = dayjs('2024-03-15').toDate();\n MockDate.set(mockedDate);\n\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations: [{\n amount: 2000,\n amountUsed: 0,\n date: new Date(),\n processed: true,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }],\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n expect(payments.length).toBeGreaterThanOrEqual(2);\n expect(payments[0]).toMatchObject(\n {\n amount: 550,\n datePayment: dayjs(mockedDate).add(1, 'month').startOf('month').toDate(),\n idPrestation: 1,\n idPaymentMethod: 1,\n });\n expect(payments[1]).toMatchObject(\n {\n amount: 550,\n datePayment: dayjs(mockedDate).add(2, 'month').startOf('month').toDate(),\n idPrestation: 1,\n idPaymentMethod: 1,\n });\n MockDate.reset();\n });\n test('should not consider actual month if signed in last 3 days of month', async () => {\n const mockedDate = dayjs('2024-03-29').toDate();\n MockDate.set(mockedDate);\n\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n expect(payments.length).toBeGreaterThanOrEqual(4);\n expect(payments?.[0]?.datePayment).toStrictEqual(dayjs(mockedDate).add(2, 'month').startOf('month').toDate());\n MockDate.reset();\n });\n test('last payment returned should be last of a year (12/XX)', async () => {\n const mockedDate = dayjs('2024-03-29').toDate();\n MockDate.set(mockedDate);\n\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress,\n listRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n expect(payments.length).toBeGreaterThanOrEqual(4);\n expect(dayjs(payments[payments.length - 1].datePayment).month()).toStrictEqual(11);\n });\n test('first payment and last payment should have at least one year difference (ex. : 23 - 24)', async () => {\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate, \n idPrestation,\n prestationList,\n idVat,\n listPartialExercicePrestationExpress: [],\n listRegulations,\n yearlyAmountNonExpress,\n nextYearlyAmountNonExpress });\n expect(dayjs(payments.slice(-1)?.[0]?.datePayment).diff(dayjs(payments?.[0]?.datePayment), 'year', true)).toBeGreaterThan(1);\n });\n test('real case : idSociety 114440', async () => {\n const payments = calculatePaymentsAuto({ \n idTypeBrand: 1,\n goToClient: dayjs('2024-06-06').toDate(),\n firstExerciceNonExpresssEndDate: dayjs('2024-12-31').toDate(), \n idPrestation,\n prestationList,\n idVat: Vat.TX_20.id,\n listPartialExercicePrestationExpress: [],\n listRegulations: [{\n amount: 1006.8,\n amountUsed: 0,\n date: dayjs('2024-06-06').toDate(), \n processed: false,\n idPaymentMethod: PaymentMethod.BANK_CARD.id,\n idSociety,\n }],\n yearlyAmountNonExpress: 1433, nextYearlyAmountNonExpress: 1433 });\n expect(dayjs(payments.slice(-1)?.[0]?.datePayment).diff(dayjs(payments?.[0]?.datePayment), 'year', true)).toBeGreaterThan(1);\n });\n });\n});"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.1.306",
3
+ "version": "1.1.308",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "dist/cjs/index.js",
@@ -2,6 +2,7 @@ import { CancelToken } from 'axios';
2
2
  import { Resource } from '../Resource';
3
3
  import {
4
4
  QueryPaginatedSocietyWithStatsCa, BasePaginate, SocietyWithStatsCaParams, QueryGetStats, QueryFetchDialogDatasInfosOk, QueryFetchDialogDatasDocsOk, ReadInvalidFieldState, GedFileType, QueryPaginatedNewProspect,
5
+ QueryGetStatsHistory,
5
6
  } from '../../types';
6
7
  import { Society } from './Society';
7
8
 
@@ -20,6 +21,13 @@ export class Commercial extends Resource {
20
21
  params,
21
22
  });
22
23
  }
24
+ getStatsHistory(params: QueryGetStatsHistory, cancelToken?: CancelToken, signal?: AbortSignal): Promise<{ [key: string]: number }> {
25
+ return this.axios.$get('/commercial/stats-history', {
26
+ ...(cancelToken ? { cancelToken } : {}),
27
+ ...(signal ? { signal } : {}),
28
+ params,
29
+ });
30
+ }
23
31
  fetchDialogDatasInfosOk(params: QueryFetchDialogDatasInfosOk, cancelToken?: CancelToken, signal?: AbortSignal): Promise<Society> {
24
32
  return this.axios.$get('/commercial/datas-infos-ok', {
25
33
  ...(cancelToken ? { cancelToken } : {}),
@@ -1,3 +1,5 @@
1
+ import { Role } from './Role';
2
+
1
3
  export enum CardType {
2
4
  BALANCE_SHEET = 1,
3
5
  BALANCE_SHEET_INTERMEDIATE = 2,
@@ -6,6 +8,8 @@ export enum CardType {
6
8
  BALANCE_SHEET_EXPRESS = 5,
7
9
  VAT = 6,
8
10
  // REINFORCED_CHECKLIST = 7,
11
+ CHECK_BALANCE_ANNOTATION_NEW_CLIENT = 8,
12
+ CHECK_BALANCE_ANNOTATION = 9,
9
13
  }
10
14
 
11
15
  export enum CardState {
@@ -23,6 +27,7 @@ export enum CardGroupEnum {
23
27
  BALANCE_SHEET_GROUP = 1,
24
28
  VAT_GROUP = 2,
25
29
  // REINFORCED_CHECKLIST_GROUP = 3,
30
+ ACCEPTATION_GROUP = 4,
26
31
  }
27
32
 
28
33
  export const CardGroup = [
@@ -30,20 +35,30 @@ export const CardGroup = [
30
35
  id: CardGroupEnum.BALANCE_SHEET_GROUP,
31
36
  label: 'Bilans',
32
37
  types: [CardType.BALANCE_SHEET, CardType.BALANCE_SHEET_INTERMEDIATE, CardType.BALANCE_SHEET_PREVISIONAL, CardType.BALANCE_SHEET_LIQUIDATION, CardType.BALANCE_SHEET_EXPRESS] as CardType[],
38
+ roles: [Role.FRONT_OFFICE],
33
39
  maxByDay: 3,
34
40
  },
35
41
  {
36
42
  id: CardGroupEnum.VAT_GROUP,
37
43
  label: 'Déclarations',
38
44
  types: [CardType.VAT] as CardType[],
45
+ roles: [Role.FRONT_OFFICE],
39
46
  maxByDay: 6,
40
47
  },
41
48
  // {
42
49
  // id: CardGroupEnum.REINFORCED_CHECKLIST_GROUP,
43
50
  // label: 'Checklist',
44
51
  // types: [CardType.REINFORCED_CHECKLIST],
52
+ // roles: [Role.FRONT_OFFICE],
45
53
  // maxByDay: 6,
46
54
  // },
55
+ {
56
+ id: CardGroupEnum.ACCEPTATION_GROUP,
57
+ label: 'Contrôle solde bancaire & annotations',
58
+ types: [CardType.CHECK_BALANCE_ANNOTATION_NEW_CLIENT, CardType.CHECK_BALANCE_ANNOTATION] as CardType[],
59
+ roles: [Role.DATA_OFFICER],
60
+ maxByDay: 25,
61
+ },
47
62
  ] as const;
48
63
 
49
64
  export const CardTypeLabel = [
@@ -88,6 +103,18 @@ export const CardTypeLabel = [
88
103
  // label: 'Checklist',
89
104
  // groupId: CardGroupEnum.REINFORCED_CHECKLIST_GROUP,
90
105
  // },
106
+ {
107
+ id: CardType.CHECK_BALANCE_ANNOTATION_NEW_CLIENT,
108
+ label: 'Contrôle solde bancaire & mise en place annotation nouveau client',
109
+ refLabel: 'LABNC',
110
+ groupId: CardGroupEnum.ACCEPTATION_GROUP,
111
+ },
112
+ {
113
+ id: CardType.CHECK_BALANCE_ANNOTATION,
114
+ label: 'Contrôle solde bancaire & contrôle annotations client',
115
+ refLabel: 'LABC',
116
+ groupId: CardGroupEnum.ACCEPTATION_GROUP,
117
+ },
91
118
  ] as const;
92
119
 
93
120
  export interface UserCardsStats {