@silexpert/core 1.1.317 → 1.1.319
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/dist/cjs/api/resources/CalendarEvent.d.ts +2 -1
- package/dist/cjs/api/resources/CalendarEvent.d.ts.map +1 -1
- package/dist/cjs/api/resources/CalendarEvent.js +3 -0
- package/dist/cjs/api/resources/CalendarEvent.js.map +1 -1
- package/dist/cjs/api/resources/Project.d.ts +6 -0
- package/dist/cjs/api/resources/Project.d.ts.map +1 -0
- package/dist/cjs/api/resources/Project.js +16 -0
- package/dist/cjs/api/resources/Project.js.map +1 -0
- package/dist/cjs/api/resources/UserTimeSlot.d.ts +1 -0
- package/dist/cjs/api/resources/UserTimeSlot.d.ts.map +1 -1
- package/dist/cjs/api/resources/UserTimeSlot.js +3 -0
- package/dist/cjs/api/resources/UserTimeSlot.js.map +1 -1
- package/dist/cjs/api/resources.d.ts +2 -0
- package/dist/cjs/api/resources.d.ts.map +1 -1
- package/dist/cjs/api/resources.js +2 -0
- package/dist/cjs/api/resources.js.map +1 -1
- package/dist/cjs/types/Enum/BalanceSheet.js +14 -14
- package/dist/cjs/types/Enum/BalanceSheet.js.map +1 -1
- package/dist/cjs/types/Enum/BrandClementine.d.ts +5 -0
- package/dist/cjs/types/Enum/BrandClementine.d.ts.map +1 -1
- package/dist/cjs/types/Enum/BrandClementine.js +1 -0
- package/dist/cjs/types/Enum/BrandClementine.js.map +1 -1
- package/dist/cjs/types/Enum/MissionAcceptation.d.ts.map +1 -1
- package/dist/cjs/types/Enum/MissionAcceptation.js +1 -0
- package/dist/cjs/types/Enum/MissionAcceptation.js.map +1 -1
- package/dist/cjs/types/Enum/RoleDetail.d.ts +22 -0
- package/dist/cjs/types/Enum/RoleDetail.d.ts.map +1 -1
- package/dist/cjs/types/Enum/RoleDetail.js +22 -0
- package/dist/cjs/types/Enum/RoleDetail.js.map +1 -1
- package/dist/cjs/types/Enum/TimeSlot.d.ts +2 -1
- package/dist/cjs/types/Enum/TimeSlot.d.ts.map +1 -1
- package/dist/cjs/types/Enum/TimeSlot.js +10 -0
- package/dist/cjs/types/Enum/TimeSlot.js.map +1 -1
- package/dist/cjs/types/Interface/api/balanceSheet/ReadBalanceSheet.d.ts +1 -0
- package/dist/cjs/types/Interface/api/balanceSheet/ReadBalanceSheet.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/balanceSheet/ReadBalanceSheet.js.map +1 -1
- package/dist/cjs/types/Interface/api/calendarEvent/countCalendarEvent.d.ts +7 -0
- package/dist/cjs/types/Interface/api/calendarEvent/countCalendarEvent.d.ts.map +1 -0
- package/dist/cjs/types/Interface/api/calendarEvent/countCalendarEvent.js +38 -0
- package/dist/cjs/types/Interface/api/calendarEvent/countCalendarEvent.js.map +1 -0
- package/dist/cjs/types/Interface/api/ldap/NewLDAPUser.d.ts +20 -0
- package/dist/cjs/types/Interface/api/ldap/NewLDAPUser.d.ts.map +1 -0
- package/dist/cjs/types/Interface/api/ldap/NewLDAPUser.js +3 -0
- package/dist/cjs/types/Interface/api/ldap/NewLDAPUser.js.map +1 -0
- package/dist/cjs/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.d.ts +1 -0
- package/dist/cjs/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.js +4 -0
- package/dist/cjs/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.js.map +1 -1
- package/dist/cjs/types/Interface/api/payment/Util.d.ts +1 -0
- package/dist/cjs/types/Interface/api/payment/Util.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/payment/Util.js.map +1 -1
- package/dist/cjs/types/Interface/api/user/CreateCoworker.d.ts +5 -0
- package/dist/cjs/types/Interface/api/user/CreateCoworker.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/user/CreateCoworker.js +35 -2
- package/dist/cjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
- package/dist/cjs/types/Interface/api/user/CreateUser.d.ts +1 -0
- package/dist/cjs/types/Interface/api/user/CreateUser.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/user/CreateUser.js +5 -0
- package/dist/cjs/types/Interface/api/user/CreateUser.js.map +1 -1
- package/dist/cjs/types/Interface/models/IRole.d.ts +1 -0
- package/dist/cjs/types/Interface/models/IRole.d.ts.map +1 -1
- package/dist/cjs/types/Interface/models/IRole.js.map +1 -1
- package/dist/cjs/types/Interface/models/IStatistic.d.ts +1 -1
- package/dist/cjs/types/Interface/models/IStatistic.d.ts.map +1 -1
- package/dist/cjs/types/Interface/models/IStatistic.js.map +1 -1
- package/dist/cjs/types/index.d.ts +2 -0
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +2 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/utils/payment.d.ts +1 -0
- package/dist/cjs/utils/payment.d.ts.map +1 -1
- package/dist/cjs/utils/payment.js +18 -9
- package/dist/cjs/utils/payment.js.map +1 -1
- package/dist/mjs/api/resources/CalendarEvent.d.ts +2 -1
- package/dist/mjs/api/resources/CalendarEvent.d.ts.map +1 -1
- package/dist/mjs/api/resources/CalendarEvent.js +4 -0
- package/dist/mjs/api/resources/CalendarEvent.js.map +1 -1
- package/dist/mjs/api/resources/Project.d.ts +6 -0
- package/dist/mjs/api/resources/Project.d.ts.map +1 -0
- package/dist/mjs/api/resources/Project.js +12 -0
- package/dist/mjs/api/resources/Project.js.map +1 -0
- package/dist/mjs/api/resources/UserTimeSlot.d.ts +1 -0
- package/dist/mjs/api/resources/UserTimeSlot.d.ts.map +1 -1
- package/dist/mjs/api/resources/UserTimeSlot.js +5 -0
- package/dist/mjs/api/resources/UserTimeSlot.js.map +1 -1
- package/dist/mjs/api/resources.d.ts +2 -0
- package/dist/mjs/api/resources.d.ts.map +1 -1
- package/dist/mjs/api/resources.js +2 -0
- package/dist/mjs/api/resources.js.map +1 -1
- package/dist/mjs/types/Enum/BalanceSheet.js +14 -14
- package/dist/mjs/types/Enum/BalanceSheet.js.map +1 -1
- package/dist/mjs/types/Enum/BrandClementine.d.ts +5 -0
- package/dist/mjs/types/Enum/BrandClementine.d.ts.map +1 -1
- package/dist/mjs/types/Enum/BrandClementine.js +1 -0
- package/dist/mjs/types/Enum/BrandClementine.js.map +1 -1
- package/dist/mjs/types/Enum/MissionAcceptation.d.ts.map +1 -1
- package/dist/mjs/types/Enum/MissionAcceptation.js +1 -0
- package/dist/mjs/types/Enum/MissionAcceptation.js.map +1 -1
- package/dist/mjs/types/Enum/RoleDetail.d.ts +22 -0
- package/dist/mjs/types/Enum/RoleDetail.d.ts.map +1 -1
- package/dist/mjs/types/Enum/RoleDetail.js +22 -0
- package/dist/mjs/types/Enum/RoleDetail.js.map +1 -1
- package/dist/mjs/types/Enum/TimeSlot.d.ts +2 -1
- package/dist/mjs/types/Enum/TimeSlot.d.ts.map +1 -1
- package/dist/mjs/types/Enum/TimeSlot.js +10 -0
- package/dist/mjs/types/Enum/TimeSlot.js.map +1 -1
- package/dist/mjs/types/Interface/api/balanceSheet/ReadBalanceSheet.d.ts +1 -0
- package/dist/mjs/types/Interface/api/balanceSheet/ReadBalanceSheet.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/balanceSheet/ReadBalanceSheet.js.map +1 -1
- package/dist/mjs/types/Interface/api/calendarEvent/countCalendarEvent.d.ts +7 -0
- package/dist/mjs/types/Interface/api/calendarEvent/countCalendarEvent.d.ts.map +1 -0
- package/dist/mjs/types/Interface/api/calendarEvent/countCalendarEvent.js +38 -0
- package/dist/mjs/types/Interface/api/calendarEvent/countCalendarEvent.js.map +1 -0
- package/dist/mjs/types/Interface/api/ldap/NewLDAPUser.d.ts +20 -0
- package/dist/mjs/types/Interface/api/ldap/NewLDAPUser.d.ts.map +1 -0
- package/dist/mjs/types/Interface/api/ldap/NewLDAPUser.js +2 -0
- package/dist/mjs/types/Interface/api/ldap/NewLDAPUser.js.map +1 -0
- package/dist/mjs/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.d.ts +1 -0
- package/dist/mjs/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.js +5 -0
- package/dist/mjs/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.js.map +1 -1
- package/dist/mjs/types/Interface/api/payment/Util.d.ts +1 -0
- package/dist/mjs/types/Interface/api/payment/Util.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/payment/Util.js.map +1 -1
- package/dist/mjs/types/Interface/api/user/CreateCoworker.d.ts +5 -0
- package/dist/mjs/types/Interface/api/user/CreateCoworker.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/user/CreateCoworker.js +41 -3
- package/dist/mjs/types/Interface/api/user/CreateCoworker.js.map +1 -1
- package/dist/mjs/types/Interface/api/user/CreateUser.d.ts +1 -0
- package/dist/mjs/types/Interface/api/user/CreateUser.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/user/CreateUser.js +6 -0
- package/dist/mjs/types/Interface/api/user/CreateUser.js.map +1 -1
- package/dist/mjs/types/Interface/models/IRole.d.ts +1 -0
- package/dist/mjs/types/Interface/models/IRole.d.ts.map +1 -1
- package/dist/mjs/types/Interface/models/IRole.js.map +1 -1
- package/dist/mjs/types/Interface/models/IStatistic.d.ts +1 -1
- package/dist/mjs/types/Interface/models/IStatistic.d.ts.map +1 -1
- package/dist/mjs/types/Interface/models/IStatistic.js.map +1 -1
- package/dist/mjs/types/index.d.ts +2 -0
- package/dist/mjs/types/index.d.ts.map +1 -1
- package/dist/mjs/types/index.js +2 -0
- package/dist/mjs/types/index.js.map +1 -1
- package/dist/mjs/utils/payment.d.ts +1 -0
- package/dist/mjs/utils/payment.d.ts.map +1 -1
- package/dist/mjs/utils/payment.js +18 -9
- package/dist/mjs/utils/payment.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/CalendarEvent.ts +6 -0
- package/ts/api/resources/Project.ts +12 -0
- package/ts/api/resources/UserTimeSlot.ts +6 -0
- package/ts/api/resources.ts +2 -0
- package/ts/types/Enum/BalanceSheet.ts +14 -14
- package/ts/types/Enum/BrandClementine.ts +1 -0
- package/ts/types/Enum/MissionAcceptation.ts +1 -0
- package/ts/types/Enum/RoleDetail.ts +26 -0
- package/ts/types/Enum/TimeSlot.ts +10 -0
- package/ts/types/Interface/api/balanceSheet/ReadBalanceSheet.ts +1 -0
- package/ts/types/Interface/api/calendarEvent/countCalendarEvent.ts +20 -0
- package/ts/types/Interface/api/ldap/NewLDAPUser.ts +20 -0
- package/ts/types/Interface/api/machineLearning/CreateMachineLearningAnnotation.ts +3 -0
- package/ts/types/Interface/api/payment/Util.ts +1 -0
- package/ts/types/Interface/api/user/CreateCoworker.ts +32 -3
- package/ts/types/Interface/api/user/CreateUser.ts +4 -0
- package/ts/types/Interface/models/IRole.ts +1 -0
- package/ts/types/Interface/models/IStatistic.ts +1 -1
- package/ts/types/index.ts +2 -0
- package/ts/utils/payment.ts +20 -9
package/ts/utils/payment.ts
CHANGED
|
@@ -86,13 +86,22 @@ const calculateFees = (amount: number, goToClient: Date, paymentDate: Date):numb
|
|
|
86
86
|
* @param {number} nextYearlyAmountNonExpress - yearly amount of non express prestation for next years (HT)
|
|
87
87
|
* @param {PartialExercicePrestationExpress[]} listPartialExercicePrestationExpress - list of exercicePrestation linked to idPrestation -> used to get express
|
|
88
88
|
* @param {IRegulation[]} listRegulations - list of regulations linked to idPrestation (TTC)
|
|
89
|
+
* @param {Date} recoveryDate - date of recovery of the society
|
|
89
90
|
* @returns { IPayment[] } list of payment to create for billing auto, after each presta go to onBoarding
|
|
90
91
|
*/
|
|
91
92
|
const calculatePaymentsAuto = (params: ParamsForPaymentsAuto):PaymentAuto[] => {
|
|
92
|
-
const { idTypeBrand, goToClient, isWithApplicationFees, firstExerciceNonExpresssEndDate, idPrestation, idLegalForm, prestationList, idVat, yearlyAmountNonExpress, nextYearlyAmountNonExpress, listPartialExercicePrestationExpress, listRegulations } = params;
|
|
93
|
-
|
|
93
|
+
const { idTypeBrand, goToClient, isWithApplicationFees, firstExerciceNonExpresssEndDate, idPrestation, idLegalForm, prestationList, idVat, yearlyAmountNonExpress, nextYearlyAmountNonExpress, listPartialExercicePrestationExpress, listRegulations, recoveryDate } = params;
|
|
94
|
+
|
|
95
|
+
if (!yearlyAmountNonExpress) throw new Error('Le montant annuel des prestations non express ne peut pas être nul.');
|
|
96
|
+
|
|
97
|
+
let initializedPaymentDate = dayjs().endOf('month').diff(dayjs(), 'day') < 3/* || dayjs().date() >= 15 */
|
|
94
98
|
? dayjs().add(2, 'month').startOf('month').toDate()
|
|
95
99
|
: dayjs().add(1, 'month').startOf('month').toDate();
|
|
100
|
+
|
|
101
|
+
//Si date de reprise, alors on initialise à cette date
|
|
102
|
+
if (recoveryDate && dayjs(recoveryDate).isAfter(dayjs(), 'month')) {
|
|
103
|
+
initializedPaymentDate = dayjs(recoveryDate).startOf('month').toDate();
|
|
104
|
+
}
|
|
96
105
|
|
|
97
106
|
// On récupère la grille tarifaire pour savoir si les tarifs sont HT ou TTC
|
|
98
107
|
// et pour connaitre le montant du coût de l'app
|
|
@@ -205,13 +214,15 @@ const calculatePaymentsAuto = (params: ParamsForPaymentsAuto):PaymentAuto[] => {
|
|
|
205
214
|
// et on applique le taux de tva de la société
|
|
206
215
|
const amount = index < countExpressMonthlyPayment ? monthlyAmount : remainingAmountByExercicePrestation; //TTC
|
|
207
216
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
217
|
+
// On évite les paiements de moins d'0,01 € (pour les paymentsExpectations ayant une différence de 1 cents)
|
|
218
|
+
if (amount >= 0.005)
|
|
219
|
+
listPayments.push({
|
|
220
|
+
amount: Math.round(100 * amount) / 100,
|
|
221
|
+
datePayment: paymentDate,
|
|
222
|
+
idPrestation,
|
|
223
|
+
idPaymentMethod: PaymentMethod.DIRECT_DEBIT.id,
|
|
224
|
+
closingDate: exercicePrestation.endDate,
|
|
225
|
+
});
|
|
215
226
|
remainingAmountByExercicePrestation -= monthlyAmount;
|
|
216
227
|
paymentDate = dayjs(paymentDate).add(1, 'month').startOf('month').toDate();
|
|
217
228
|
}
|