@silexpert/core 1.1.343 → 1.1.344

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 (80) hide show
  1. package/dist/cjs/api/resources/Loan.d.ts +9 -11
  2. package/dist/cjs/api/resources/Loan.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/Loan.js +23 -17
  4. package/dist/cjs/api/resources/Loan.js.map +1 -1
  5. package/dist/cjs/types/Interface/api/bankAccount/Query.d.ts +1 -0
  6. package/dist/cjs/types/Interface/api/bankAccount/Query.d.ts.map +1 -1
  7. package/dist/cjs/types/Interface/api/bankAccount/Query.js +7 -0
  8. package/dist/cjs/types/Interface/api/bankAccount/Query.js.map +1 -1
  9. package/dist/cjs/types/Interface/api/exercice/ReadExercice.d.ts +7 -0
  10. package/dist/cjs/types/Interface/api/exercice/ReadExercice.d.ts.map +1 -0
  11. package/dist/cjs/types/Interface/api/exercice/ReadExercice.js +3 -0
  12. package/dist/cjs/types/Interface/api/exercice/ReadExercice.js.map +1 -0
  13. package/dist/cjs/types/Interface/api/loan/CreateLoan.d.ts +13 -2
  14. package/dist/cjs/types/Interface/api/loan/CreateLoan.d.ts.map +1 -1
  15. package/dist/cjs/types/Interface/api/loan/CreateLoan.js +53 -3
  16. package/dist/cjs/types/Interface/api/loan/CreateLoan.js.map +1 -1
  17. package/dist/cjs/types/Interface/api/loan/ReadLoan.d.ts +10 -0
  18. package/dist/cjs/types/Interface/api/loan/ReadLoan.d.ts.map +1 -0
  19. package/dist/cjs/types/Interface/api/loan/ReadLoan.js +3 -0
  20. package/dist/cjs/types/Interface/api/loan/ReadLoan.js.map +1 -0
  21. package/dist/cjs/types/Interface/api/loan/UpdateLoan.d.ts +0 -6
  22. package/dist/cjs/types/Interface/api/loan/UpdateLoan.d.ts.map +1 -1
  23. package/dist/cjs/types/Interface/api/loan/UpdateLoan.js +2 -36
  24. package/dist/cjs/types/Interface/api/loan/UpdateLoan.js.map +1 -1
  25. package/dist/cjs/types/Interface/models/ILoan.d.ts +7 -0
  26. package/dist/cjs/types/Interface/models/ILoan.d.ts.map +1 -1
  27. package/dist/cjs/types/Interface/models/ILoan.js.map +1 -1
  28. package/dist/cjs/types/Interface/models/ILoanEarlyRepayment.d.ts +12 -0
  29. package/dist/cjs/types/Interface/models/ILoanEarlyRepayment.d.ts.map +1 -0
  30. package/dist/cjs/types/Interface/models/ILoanEarlyRepayment.js +3 -0
  31. package/dist/cjs/types/Interface/models/ILoanEarlyRepayment.js.map +1 -0
  32. package/dist/cjs/types/index.d.ts +3 -0
  33. package/dist/cjs/types/index.d.ts.map +1 -1
  34. package/dist/cjs/types/index.js +3 -0
  35. package/dist/cjs/types/index.js.map +1 -1
  36. package/dist/mjs/api/resources/Loan.d.ts +9 -11
  37. package/dist/mjs/api/resources/Loan.d.ts.map +1 -1
  38. package/dist/mjs/api/resources/Loan.js +23 -17
  39. package/dist/mjs/api/resources/Loan.js.map +1 -1
  40. package/dist/mjs/types/Interface/api/bankAccount/Query.d.ts +1 -0
  41. package/dist/mjs/types/Interface/api/bankAccount/Query.d.ts.map +1 -1
  42. package/dist/mjs/types/Interface/api/bankAccount/Query.js +8 -0
  43. package/dist/mjs/types/Interface/api/bankAccount/Query.js.map +1 -1
  44. package/dist/mjs/types/Interface/api/exercice/ReadExercice.d.ts +7 -0
  45. package/dist/mjs/types/Interface/api/exercice/ReadExercice.d.ts.map +1 -0
  46. package/dist/mjs/types/Interface/api/exercice/ReadExercice.js +2 -0
  47. package/dist/mjs/types/Interface/api/exercice/ReadExercice.js.map +1 -0
  48. package/dist/mjs/types/Interface/api/loan/CreateLoan.d.ts +13 -2
  49. package/dist/mjs/types/Interface/api/loan/CreateLoan.d.ts.map +1 -1
  50. package/dist/mjs/types/Interface/api/loan/CreateLoan.js +61 -3
  51. package/dist/mjs/types/Interface/api/loan/CreateLoan.js.map +1 -1
  52. package/dist/mjs/types/Interface/api/loan/ReadLoan.d.ts +10 -0
  53. package/dist/mjs/types/Interface/api/loan/ReadLoan.d.ts.map +1 -0
  54. package/dist/mjs/types/Interface/api/loan/ReadLoan.js +2 -0
  55. package/dist/mjs/types/Interface/api/loan/ReadLoan.js.map +1 -0
  56. package/dist/mjs/types/Interface/api/loan/UpdateLoan.d.ts +0 -6
  57. package/dist/mjs/types/Interface/api/loan/UpdateLoan.d.ts.map +1 -1
  58. package/dist/mjs/types/Interface/api/loan/UpdateLoan.js +3 -43
  59. package/dist/mjs/types/Interface/api/loan/UpdateLoan.js.map +1 -1
  60. package/dist/mjs/types/Interface/models/ILoan.d.ts +7 -0
  61. package/dist/mjs/types/Interface/models/ILoan.d.ts.map +1 -1
  62. package/dist/mjs/types/Interface/models/ILoan.js.map +1 -1
  63. package/dist/mjs/types/Interface/models/ILoanEarlyRepayment.d.ts +12 -0
  64. package/dist/mjs/types/Interface/models/ILoanEarlyRepayment.d.ts.map +1 -0
  65. package/dist/mjs/types/Interface/models/ILoanEarlyRepayment.js +2 -0
  66. package/dist/mjs/types/Interface/models/ILoanEarlyRepayment.js.map +1 -0
  67. package/dist/mjs/types/index.d.ts +3 -0
  68. package/dist/mjs/types/index.d.ts.map +1 -1
  69. package/dist/mjs/types/index.js +3 -0
  70. package/dist/mjs/types/index.js.map +1 -1
  71. package/package.json +1 -1
  72. package/ts/api/resources/Loan.ts +28 -21
  73. package/ts/types/Interface/api/bankAccount/Query.ts +6 -0
  74. package/ts/types/Interface/api/exercice/ReadExercice.ts +6 -0
  75. package/ts/types/Interface/api/loan/CreateLoan.ts +45 -5
  76. package/ts/types/Interface/api/loan/ReadLoan.ts +9 -0
  77. package/ts/types/Interface/api/loan/UpdateLoan.ts +3 -31
  78. package/ts/types/Interface/models/ILoan.ts +7 -0
  79. package/ts/types/Interface/models/ILoanEarlyRepayment.ts +13 -0
  80. package/ts/types/index.ts +3 -0
@@ -1,28 +1,23 @@
1
1
  import { Resource } from '../Resource';
2
2
  import {
3
- CreateLoanForm, IAccount, ILoan, UpdateLoanForm,
3
+ CreateEarlyRepayment,
4
+ CreateLoanForm, IAccount, ILoan, ILoanEarlyRepayment, UpdateLoanForm,
4
5
  } from '../../types';
5
6
 
6
7
  export class Loan extends Resource {
7
- /** @deprecated use getAll() */
8
- getLoans(): Promise<ILoan[]> {
9
- return this.axios.$get('/loans');
10
- }
11
-
12
8
  getAll(idSociety: number): Promise<ILoan[]> {
13
9
  return this.axios.$get(`/societies/${idSociety}/loans`);
14
10
  }
15
11
 
16
- getLoan(params: { idLoan: number }): Promise<ILoan> {
17
- return this.axios.$get(`/loan/${params.idLoan}`);
12
+ get(id: number): Promise<ILoan> {
13
+ return this.axios.$get(`/loan/${id}`);
18
14
  }
19
15
 
20
-
21
- createLoan(params: CreateLoanForm): Promise<ILoan> {
16
+ create(idSociety: number, params: CreateLoanForm): Promise<ILoan> {
22
17
  const formData = new FormData();
23
18
 
24
19
  Object.entries(params).forEach(([key, value]) => {
25
- if (value || value === 0) {
20
+ if (value !== undefined && value !== null) {
26
21
  formData.append(key, `${value}`);
27
22
  }
28
23
  });
@@ -31,23 +26,35 @@ export class Loan extends Resource {
31
26
  formData.append('files', file);
32
27
  });
33
28
 
34
- return this.axios.$post('/loan', formData, { headers: { 'Content-Type': 'multipart/form-data' } });
29
+ return this.axios.$post(`/societies/${idSociety}/loans`, formData, { headers: { 'Content-Type': 'multipart/form-data' } });
35
30
  }
36
31
 
37
- updateLoan(idLoan: number, payload: UpdateLoanForm): Promise<ILoan> {
38
- return this.axios.$put(`/loan/${idLoan}`, payload);
32
+ update(id: number, payload: UpdateLoanForm): Promise<ILoan> {
33
+ return this.axios.$put(`/loan/${id}`, payload);
39
34
  }
40
35
 
41
- deleteLoan(idLoan: number): Promise<true> {
42
- return this.axios.$delete(`/loan/${idLoan}`);
43
- }
44
-
45
- /** @deprecated use getAllAccounts() */
46
- accounts(): Promise<IAccount[]> {
47
- return this.axios.$get('/loans/accounts');
36
+ delete(id: number): Promise<true> {
37
+ return this.axios.$delete(`/loan/${id}`);
48
38
  }
49
39
 
50
40
  getAllAccounts(idSociety: number): Promise<IAccount[]> {
51
41
  return this.axios.$get(`/societies/${idSociety}/loans/accounts`);
52
42
  }
43
+
44
+ createEarlyRepayment(idLoan: number, payload: CreateEarlyRepayment): Promise<ILoanEarlyRepayment> {
45
+ return this.axios.$post(`/loans/${idLoan}/early-repayments`, payload);
46
+ }
47
+
48
+ deleteEarlyRepayment(idLoan: number, idEarlyRepayment: number): Promise<true> {
49
+ return this.axios.$delete(`/loans/${idLoan}/early-repayments/${idEarlyRepayment}`);
50
+ }
51
+
52
+ getDepreciationFile(idLoan: number): Promise<Buffer> {
53
+ return this.axios.$get(`/loans/${idLoan}/depreciation-files`, {
54
+ responseType: 'arraybuffer',
55
+ headers: {
56
+ Accept: 'application/pdf',
57
+ },
58
+ });
59
+ }
53
60
  }
@@ -79,4 +79,10 @@ export class QueryBankAccount {
79
79
  @IsInt()
80
80
  @IsEnum(PartnerTransactionType)
81
81
  idPartnerType?: PartnerTransactionType;
82
+
83
+ @ApiPropertyOptional()
84
+ @IsOptional()
85
+ @IsBoolean()
86
+ @ToBoolean()
87
+ withCheckBalance?: boolean;
82
88
  }
@@ -0,0 +1,6 @@
1
+ export interface ReadExercice {
2
+ name: string;
3
+ id: number | null;
4
+ startDate: string;
5
+ endDate: string;
6
+ }
@@ -1,11 +1,14 @@
1
- import { IsNumber, IsOptional, IsString } from 'class-validator';
1
+ import { IsBoolean, IsDate, IsNumber, IsString } from 'class-validator';
2
2
  import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
3
4
 
4
5
  export class CreateLoanForm {
5
6
  @ApiProperty({ description: 'Désignation' })
7
+ @IsString()
6
8
  name: string;
7
9
 
8
10
  @ApiProperty({ description: 'Désignation de l\'organisme' })
11
+ @IsString()
9
12
  lenderDesignation: string;
10
13
 
11
14
  @ApiProperty()
@@ -26,18 +29,55 @@ export class CreateLoanForm {
26
29
 
27
30
  @ApiPropertyOptional()
28
31
  @IsNumber()
29
- @IsOptional()
30
- monthDuration?: number;
32
+ monthDuration: number;
31
33
 
32
34
  @ApiPropertyOptional()
33
35
  @IsNumber()
34
- @IsOptional()
35
- rate?: number;
36
+ rate: number;
36
37
 
37
38
  @ApiProperty()
38
39
  @IsNumber()
39
40
  idExercice: number;
40
41
 
42
+ @ApiProperty()
43
+ @IsNumber()
44
+ annuity: number;
45
+
46
+ @ApiProperty()
47
+ @IsString()
48
+ unlockDate: string;
49
+
50
+ @ApiProperty()
51
+ @IsString()
52
+ firstDueDate: string;
53
+
54
+ @ApiProperty()
55
+ @IsNumber()
56
+ commission: number;
57
+
58
+ @ApiProperty()
59
+ @IsNumber()
60
+ insurance: number;
61
+
62
+ @ApiProperty()
63
+ @IsBoolean()
64
+ @ToBoolean()
65
+ shouldProrate: boolean;
66
+
41
67
  @ApiPropertyOptional()
42
68
  files?: File[];
69
+ }
70
+
71
+ export class CreateEarlyRepayment {
72
+ @ApiProperty()
73
+ @IsNumber()
74
+ amount: number;
75
+
76
+ @ApiProperty()
77
+ @IsDate()
78
+ date: Date;
79
+
80
+ @ApiProperty()
81
+ @IsNumber()
82
+ annuity: number;
43
83
  }
@@ -0,0 +1,9 @@
1
+ export type ReadLoanSchedule = {
2
+ date: string;
3
+ annuity: number;
4
+ interest: number;
5
+ insurance: number;
6
+ commission: number;
7
+ capital: number;
8
+ remain: number;
9
+ };
@@ -1,8 +1,10 @@
1
- import { IsNumber, IsOptional, IsString } from 'class-validator';
1
+ import { IsOptional, IsString } from 'class-validator';
2
2
  import { ApiPropertyOptional } from '../../../../utils';
3
3
 
4
4
  export class UpdateLoanForm {
5
5
  @ApiPropertyOptional()
6
+ @IsString()
7
+ @IsOptional()
6
8
  name?: string;
7
9
 
8
10
  @ApiPropertyOptional()
@@ -14,34 +16,4 @@ export class UpdateLoanForm {
14
16
  @IsString()
15
17
  @IsOptional()
16
18
  number?: string;
17
-
18
- @ApiPropertyOptional()
19
- @IsNumber()
20
- @IsOptional()
21
- amount?: number;
22
-
23
- @ApiPropertyOptional()
24
- @IsNumber()
25
- @IsOptional()
26
- assetBeforeExercice?: number;
27
-
28
- @ApiPropertyOptional()
29
- @IsNumber()
30
- @IsOptional()
31
- assetAfterExercice?: number;
32
-
33
- @ApiPropertyOptional()
34
- @IsNumber()
35
- @IsOptional()
36
- idExercice?: number;
37
-
38
- @ApiPropertyOptional()
39
- @IsNumber()
40
- @IsOptional()
41
- monthDuration?: number;
42
-
43
- @ApiPropertyOptional()
44
- @IsNumber()
45
- @IsOptional()
46
- rate?: number;
47
19
  }
@@ -2,6 +2,7 @@ import { ISociety } from './ISociety';
2
2
  import { IExercice } from './IExercice';
3
3
  import { IAccount } from './IAccount';
4
4
  import { ILoanFile } from './ILoanFile';
5
+ import { ILoanEarlyRepayment } from './ILoanEarlyRepayment';
5
6
 
6
7
  export interface ILoan {
7
8
  id?: number;
@@ -14,6 +15,11 @@ export interface ILoan {
14
15
  assetAfterExercice: number;
15
16
  monthDuration?: number;
16
17
  rate?: number;
18
+ annuity: number | null;
19
+ unlockDate: Date | null;
20
+ firstDueDate: Date | null;
21
+ commission: number | null;
22
+ insurance: number | null;
17
23
  idExercice: number;
18
24
  idSociety: number;
19
25
  idAccountRefund: number;
@@ -33,4 +39,5 @@ export interface ILoan {
33
39
  accountCommission?: IAccount;
34
40
  accountReleaseLoanCapital?: IAccount;
35
41
  loanFiles?: ILoanFile[];
42
+ earlyRepayments?: ILoanEarlyRepayment[];
36
43
  }
@@ -0,0 +1,13 @@
1
+ import { ILoan } from './ILoan';
2
+
3
+ export interface ILoanEarlyRepayment {
4
+ id?: number;
5
+ amount: number;
6
+ date: Date;
7
+ annuity: number;
8
+ idLoan: number;
9
+ createdAt?: Date;
10
+ updatedAt?: Date;
11
+
12
+ loan?: ILoan;
13
+ }
package/ts/types/index.ts CHANGED
@@ -333,6 +333,7 @@ export * from './Interface/models/IExpertAnnuary';
333
333
  export * from './Interface/models/IUserTimeSlot';
334
334
  export * from './Interface/models/ICompanyCreationForm';
335
335
  export * from './Interface/models/IAnnotation';
336
+ export * from './Interface/models/ILoanEarlyRepayment';
336
337
 
337
338
 
338
339
  // Schemas
@@ -544,6 +545,7 @@ export * from './Enum/Contest';
544
545
  export * from './Enum/LetterResponseType';
545
546
 
546
547
  // Interfaces API
548
+ export * from './Interface/api/exercice/ReadExercice';
547
549
  export * from './Interface/api/kilometricAllowance/ReadKilometricAllowance';
548
550
  export * from './Interface/api/cashAndExpense/Query';
549
551
  export * from './Interface/api/cerfa/das2';
@@ -814,6 +816,7 @@ export * from './Interface/api/promoCode/UpdatePromoCode';
814
816
  export * from './Interface/api/promoCode/CreatePromoCode';
815
817
  export * from './Interface/api/balanceBankAccount/CreateBudgetBalanceBankAccount';
816
818
  export * from './Interface/api/loan/CreateLoan';
819
+ export * from './Interface/api/loan/ReadLoan';
817
820
  export * from './Interface/api/stock/StocksType';
818
821
  export * from './Interface/api/lettering/QueryRegroupLettering';
819
822
  // export * from './Interface/api/stock/StockEntries';