@silexpert/core 1.1.397 → 1.1.400

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 (202) hide show
  1. package/dist/cjs/api/resources/GeneralLedger.d.ts +0 -4
  2. package/dist/cjs/api/resources/GeneralLedger.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/GeneralLedger.js +0 -20
  4. package/dist/cjs/api/resources/GeneralLedger.js.map +1 -1
  5. package/dist/cjs/api/resources/IncomeStatement.d.ts +0 -2
  6. package/dist/cjs/api/resources/IncomeStatement.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/IncomeStatement.js +0 -10
  8. package/dist/cjs/api/resources/IncomeStatement.js.map +1 -1
  9. package/dist/cjs/api/resources/Journal.d.ts +0 -2
  10. package/dist/cjs/api/resources/Journal.d.ts.map +1 -1
  11. package/dist/cjs/api/resources/Journal.js +0 -7
  12. package/dist/cjs/api/resources/Journal.js.map +1 -1
  13. package/dist/cjs/api/resources/Payment.d.ts +7 -1
  14. package/dist/cjs/api/resources/Payment.d.ts.map +1 -1
  15. package/dist/cjs/api/resources/Payment.js +15 -0
  16. package/dist/cjs/api/resources/Payment.js.map +1 -1
  17. package/dist/cjs/api/resources/Provision.d.ts +0 -2
  18. package/dist/cjs/api/resources/Provision.d.ts.map +1 -1
  19. package/dist/cjs/api/resources/Provision.js +0 -4
  20. package/dist/cjs/api/resources/Provision.js.map +1 -1
  21. package/dist/cjs/api/resources/SalariesFile.d.ts +0 -2
  22. package/dist/cjs/api/resources/SalariesFile.d.ts.map +1 -1
  23. package/dist/cjs/api/resources/SalariesFile.js +0 -4
  24. package/dist/cjs/api/resources/SalariesFile.js.map +1 -1
  25. package/dist/cjs/api/resources/Stocks.d.ts +0 -4
  26. package/dist/cjs/api/resources/Stocks.d.ts.map +1 -1
  27. package/dist/cjs/api/resources/Stocks.js +0 -8
  28. package/dist/cjs/api/resources/Stocks.js.map +1 -1
  29. package/dist/cjs/index.d.ts +1 -0
  30. package/dist/cjs/index.d.ts.map +1 -1
  31. package/dist/cjs/index.js +1 -0
  32. package/dist/cjs/index.js.map +1 -1
  33. package/dist/cjs/types/Enum/BrandClementine.d.ts.map +1 -1
  34. package/dist/cjs/types/Enum/BrandClementine.js +1 -0
  35. package/dist/cjs/types/Enum/BrandClementine.js.map +1 -1
  36. package/dist/cjs/types/Enum/ConnectorType.d.ts +2 -1
  37. package/dist/cjs/types/Enum/ConnectorType.d.ts.map +1 -1
  38. package/dist/cjs/types/Enum/ConnectorType.js +1 -0
  39. package/dist/cjs/types/Enum/ConnectorType.js.map +1 -1
  40. package/dist/cjs/types/Enum/JobTitle.d.ts +3 -1
  41. package/dist/cjs/types/Enum/JobTitle.d.ts.map +1 -1
  42. package/dist/cjs/types/Enum/JobTitle.js +13 -1
  43. package/dist/cjs/types/Enum/JobTitle.js.map +1 -1
  44. package/dist/cjs/types/Enum/PaymentRecovery.d.ts +51 -0
  45. package/dist/cjs/types/Enum/PaymentRecovery.d.ts.map +1 -0
  46. package/dist/cjs/types/Enum/PaymentRecovery.js +57 -0
  47. package/dist/cjs/types/Enum/PaymentRecovery.js.map +1 -0
  48. package/dist/cjs/types/Interface/api/PaymentRecovery/Caarl.d.ts +140 -0
  49. package/dist/cjs/types/Interface/api/PaymentRecovery/Caarl.d.ts.map +1 -0
  50. package/dist/cjs/types/Interface/api/PaymentRecovery/Caarl.js +3 -0
  51. package/dist/cjs/types/Interface/api/PaymentRecovery/Caarl.js.map +1 -0
  52. package/dist/cjs/types/Interface/api/PaymentRecovery/Create.d.ts +49 -0
  53. package/dist/cjs/types/Interface/api/PaymentRecovery/Create.d.ts.map +1 -0
  54. package/dist/cjs/types/Interface/api/PaymentRecovery/Create.js +162 -0
  55. package/dist/cjs/types/Interface/api/PaymentRecovery/Create.js.map +1 -0
  56. package/dist/cjs/types/Interface/api/PaymentRecovery/Query.d.ts +14 -0
  57. package/dist/cjs/types/Interface/api/PaymentRecovery/Query.d.ts.map +1 -0
  58. package/dist/cjs/types/Interface/api/PaymentRecovery/Query.js +72 -0
  59. package/dist/cjs/types/Interface/api/PaymentRecovery/Query.js.map +1 -0
  60. package/dist/cjs/types/Interface/api/PaymentRecovery/Read.d.ts +50 -0
  61. package/dist/cjs/types/Interface/api/PaymentRecovery/Read.d.ts.map +1 -0
  62. package/dist/cjs/types/Interface/api/PaymentRecovery/Read.js +3 -0
  63. package/dist/cjs/types/Interface/api/PaymentRecovery/Read.js.map +1 -0
  64. package/dist/cjs/types/Interface/models/IApiError.d.ts +1 -0
  65. package/dist/cjs/types/Interface/models/IApiError.d.ts.map +1 -1
  66. package/dist/cjs/types/Interface/models/IApiError.js +1 -0
  67. package/dist/cjs/types/Interface/models/IApiError.js.map +1 -1
  68. package/dist/cjs/types/Interface/models/IFile.d.ts +4 -1
  69. package/dist/cjs/types/Interface/models/IFile.d.ts.map +1 -1
  70. package/dist/cjs/types/Interface/models/IFile.js.map +1 -1
  71. package/dist/cjs/types/Interface/models/IPaymentRecovery.d.ts +17 -0
  72. package/dist/cjs/types/Interface/models/IPaymentRecovery.d.ts.map +1 -0
  73. package/dist/cjs/types/Interface/models/IPaymentRecovery.js +3 -0
  74. package/dist/cjs/types/Interface/models/IPaymentRecovery.js.map +1 -0
  75. package/dist/cjs/types/index.d.ts +5 -0
  76. package/dist/cjs/types/index.d.ts.map +1 -1
  77. package/dist/cjs/types/index.js +5 -0
  78. package/dist/cjs/types/index.js.map +1 -1
  79. package/dist/cjs/utils/brands.d.ts +1 -0
  80. package/dist/cjs/utils/brands.d.ts.map +1 -1
  81. package/dist/cjs/utils/brands.js.map +1 -1
  82. package/dist/cjs/utils/commercialManagement/recovery.d.ts +7 -0
  83. package/dist/cjs/utils/commercialManagement/recovery.d.ts.map +1 -0
  84. package/dist/cjs/utils/commercialManagement/recovery.js +31 -0
  85. package/dist/cjs/utils/commercialManagement/recovery.js.map +1 -0
  86. package/dist/cjs/utils/decorators/isE164PhoneNumber.decorator.d.ts +6 -0
  87. package/dist/cjs/utils/decorators/isE164PhoneNumber.decorator.d.ts.map +1 -0
  88. package/dist/cjs/utils/decorators/isE164PhoneNumber.decorator.js +25 -0
  89. package/dist/cjs/utils/decorators/isE164PhoneNumber.decorator.js.map +1 -0
  90. package/dist/mjs/api/resources/GeneralLedger.d.ts +0 -4
  91. package/dist/mjs/api/resources/GeneralLedger.d.ts.map +1 -1
  92. package/dist/mjs/api/resources/GeneralLedger.js +0 -20
  93. package/dist/mjs/api/resources/GeneralLedger.js.map +1 -1
  94. package/dist/mjs/api/resources/IncomeStatement.d.ts +0 -2
  95. package/dist/mjs/api/resources/IncomeStatement.d.ts.map +1 -1
  96. package/dist/mjs/api/resources/IncomeStatement.js +0 -10
  97. package/dist/mjs/api/resources/IncomeStatement.js.map +1 -1
  98. package/dist/mjs/api/resources/Journal.d.ts +0 -2
  99. package/dist/mjs/api/resources/Journal.d.ts.map +1 -1
  100. package/dist/mjs/api/resources/Journal.js +0 -7
  101. package/dist/mjs/api/resources/Journal.js.map +1 -1
  102. package/dist/mjs/api/resources/Payment.d.ts +7 -1
  103. package/dist/mjs/api/resources/Payment.d.ts.map +1 -1
  104. package/dist/mjs/api/resources/Payment.js +15 -0
  105. package/dist/mjs/api/resources/Payment.js.map +1 -1
  106. package/dist/mjs/api/resources/Provision.d.ts +0 -2
  107. package/dist/mjs/api/resources/Provision.d.ts.map +1 -1
  108. package/dist/mjs/api/resources/Provision.js +0 -4
  109. package/dist/mjs/api/resources/Provision.js.map +1 -1
  110. package/dist/mjs/api/resources/SalariesFile.d.ts +0 -2
  111. package/dist/mjs/api/resources/SalariesFile.d.ts.map +1 -1
  112. package/dist/mjs/api/resources/SalariesFile.js +0 -4
  113. package/dist/mjs/api/resources/SalariesFile.js.map +1 -1
  114. package/dist/mjs/api/resources/Stocks.d.ts +0 -4
  115. package/dist/mjs/api/resources/Stocks.d.ts.map +1 -1
  116. package/dist/mjs/api/resources/Stocks.js +0 -8
  117. package/dist/mjs/api/resources/Stocks.js.map +1 -1
  118. package/dist/mjs/index.d.ts +1 -0
  119. package/dist/mjs/index.d.ts.map +1 -1
  120. package/dist/mjs/index.js +1 -0
  121. package/dist/mjs/index.js.map +1 -1
  122. package/dist/mjs/types/Enum/BrandClementine.d.ts.map +1 -1
  123. package/dist/mjs/types/Enum/BrandClementine.js +1 -0
  124. package/dist/mjs/types/Enum/BrandClementine.js.map +1 -1
  125. package/dist/mjs/types/Enum/ConnectorType.d.ts +2 -1
  126. package/dist/mjs/types/Enum/ConnectorType.d.ts.map +1 -1
  127. package/dist/mjs/types/Enum/ConnectorType.js +1 -0
  128. package/dist/mjs/types/Enum/ConnectorType.js.map +1 -1
  129. package/dist/mjs/types/Enum/JobTitle.d.ts +3 -1
  130. package/dist/mjs/types/Enum/JobTitle.d.ts.map +1 -1
  131. package/dist/mjs/types/Enum/JobTitle.js +13 -1
  132. package/dist/mjs/types/Enum/JobTitle.js.map +1 -1
  133. package/dist/mjs/types/Enum/PaymentRecovery.d.ts +51 -0
  134. package/dist/mjs/types/Enum/PaymentRecovery.d.ts.map +1 -0
  135. package/dist/mjs/types/Enum/PaymentRecovery.js +54 -0
  136. package/dist/mjs/types/Enum/PaymentRecovery.js.map +1 -0
  137. package/dist/mjs/types/Interface/api/PaymentRecovery/Caarl.d.ts +140 -0
  138. package/dist/mjs/types/Interface/api/PaymentRecovery/Caarl.d.ts.map +1 -0
  139. package/dist/mjs/types/Interface/api/PaymentRecovery/Caarl.js +2 -0
  140. package/dist/mjs/types/Interface/api/PaymentRecovery/Caarl.js.map +1 -0
  141. package/dist/mjs/types/Interface/api/PaymentRecovery/Create.d.ts +49 -0
  142. package/dist/mjs/types/Interface/api/PaymentRecovery/Create.d.ts.map +1 -0
  143. package/dist/mjs/types/Interface/api/PaymentRecovery/Create.js +182 -0
  144. package/dist/mjs/types/Interface/api/PaymentRecovery/Create.js.map +1 -0
  145. package/dist/mjs/types/Interface/api/PaymentRecovery/Query.d.ts +14 -0
  146. package/dist/mjs/types/Interface/api/PaymentRecovery/Query.d.ts.map +1 -0
  147. package/dist/mjs/types/Interface/api/PaymentRecovery/Query.js +75 -0
  148. package/dist/mjs/types/Interface/api/PaymentRecovery/Query.js.map +1 -0
  149. package/dist/mjs/types/Interface/api/PaymentRecovery/Read.d.ts +50 -0
  150. package/dist/mjs/types/Interface/api/PaymentRecovery/Read.d.ts.map +1 -0
  151. package/dist/mjs/types/Interface/api/PaymentRecovery/Read.js +2 -0
  152. package/dist/mjs/types/Interface/api/PaymentRecovery/Read.js.map +1 -0
  153. package/dist/mjs/types/Interface/models/IApiError.d.ts +1 -0
  154. package/dist/mjs/types/Interface/models/IApiError.d.ts.map +1 -1
  155. package/dist/mjs/types/Interface/models/IApiError.js +1 -0
  156. package/dist/mjs/types/Interface/models/IApiError.js.map +1 -1
  157. package/dist/mjs/types/Interface/models/IFile.d.ts +4 -1
  158. package/dist/mjs/types/Interface/models/IFile.d.ts.map +1 -1
  159. package/dist/mjs/types/Interface/models/IFile.js.map +1 -1
  160. package/dist/mjs/types/Interface/models/IPaymentRecovery.d.ts +17 -0
  161. package/dist/mjs/types/Interface/models/IPaymentRecovery.d.ts.map +1 -0
  162. package/dist/mjs/types/Interface/models/IPaymentRecovery.js +2 -0
  163. package/dist/mjs/types/Interface/models/IPaymentRecovery.js.map +1 -0
  164. package/dist/mjs/types/index.d.ts +5 -0
  165. package/dist/mjs/types/index.d.ts.map +1 -1
  166. package/dist/mjs/types/index.js +5 -0
  167. package/dist/mjs/types/index.js.map +1 -1
  168. package/dist/mjs/utils/brands.d.ts +1 -0
  169. package/dist/mjs/utils/brands.d.ts.map +1 -1
  170. package/dist/mjs/utils/brands.js.map +1 -1
  171. package/dist/mjs/utils/commercialManagement/recovery.d.ts +7 -0
  172. package/dist/mjs/utils/commercialManagement/recovery.d.ts.map +1 -0
  173. package/dist/mjs/utils/commercialManagement/recovery.js +26 -0
  174. package/dist/mjs/utils/commercialManagement/recovery.js.map +1 -0
  175. package/dist/mjs/utils/decorators/isE164PhoneNumber.decorator.d.ts +6 -0
  176. package/dist/mjs/utils/decorators/isE164PhoneNumber.decorator.d.ts.map +1 -0
  177. package/dist/mjs/utils/decorators/isE164PhoneNumber.decorator.js +22 -0
  178. package/dist/mjs/utils/decorators/isE164PhoneNumber.decorator.js.map +1 -0
  179. package/package.json +2 -1
  180. package/ts/api/resources/GeneralLedger.ts +0 -23
  181. package/ts/api/resources/IncomeStatement.ts +1 -12
  182. package/ts/api/resources/Journal.ts +1 -9
  183. package/ts/api/resources/Payment.ts +22 -1
  184. package/ts/api/resources/Provision.ts +0 -5
  185. package/ts/api/resources/SalariesFile.ts +0 -5
  186. package/ts/api/resources/Stocks.ts +0 -10
  187. package/ts/index.ts +1 -0
  188. package/ts/types/Enum/BrandClementine.ts +1 -0
  189. package/ts/types/Enum/ConnectorType.ts +1 -0
  190. package/ts/types/Enum/JobTitle.ts +13 -1
  191. package/ts/types/Enum/PaymentRecovery.ts +52 -0
  192. package/ts/types/Interface/api/PaymentRecovery/Caarl.ts +144 -0
  193. package/ts/types/Interface/api/PaymentRecovery/Create.ts +136 -0
  194. package/ts/types/Interface/api/PaymentRecovery/Query.ts +49 -0
  195. package/ts/types/Interface/api/PaymentRecovery/Read.ts +52 -0
  196. package/ts/types/Interface/models/IApiError.ts +1 -0
  197. package/ts/types/Interface/models/IFile.ts +4 -1
  198. package/ts/types/Interface/models/IPaymentRecovery.ts +18 -0
  199. package/ts/types/index.ts +5 -0
  200. package/ts/utils/brands.ts +1 -0
  201. package/ts/utils/commercialManagement/recovery.ts +26 -0
  202. package/ts/utils/decorators/isE164PhoneNumber.decorator.ts +16 -0
@@ -0,0 +1,136 @@
1
+ import { IsDateString, IsEmail, IsIBAN, IsIn, IsInt, IsOptional, IsPositive, IsPostalCode, IsString, MinLength, Validate, ValidateNested } from 'class-validator';
2
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
+ import { PaymentRecoveryStatus } from '../../../Enum/PaymentRecovery';
4
+ import { IsE164PhoneNumber } from '../../../../utils/decorators/isE164PhoneNumber.decorator';
5
+
6
+ type CaarlFilePayload = {
7
+ bufferString: string;
8
+ name: string;
9
+ };
10
+
11
+ export interface UploadRecoveryDocuments {
12
+ subscriptionId: string;
13
+ files: {
14
+ rib: CaarlFilePayload;
15
+ invoice: CaarlFilePayload;
16
+ };
17
+ }
18
+
19
+ class DebtorPayload {
20
+ @ApiProperty()
21
+ @IsIn(['M.', 'Mme'])
22
+ civility: 'M.' | 'Mme';
23
+
24
+ @ApiProperty()
25
+ @IsString()
26
+ @MinLength(2)
27
+ firstname: string;
28
+
29
+ @ApiProperty()
30
+ @IsString()
31
+ @MinLength(2)
32
+ lastname: string;
33
+
34
+ @ApiProperty()
35
+ @IsEmail()
36
+ email: string;
37
+
38
+ @ApiProperty()
39
+ @Validate(IsE164PhoneNumber, { message: 'Numéro de téléphone du créancier invalide' })
40
+ phone: string;
41
+
42
+ @ApiProperty()
43
+ @IsString()
44
+ @MinLength(2)
45
+ address: string;
46
+
47
+ @ApiProperty()
48
+ @IsPostalCode('any')
49
+ zipCode: string;
50
+
51
+ @ApiProperty()
52
+ @IsString()
53
+ @MinLength(2)
54
+ city: string;
55
+
56
+ @ApiPropertyOptional()
57
+ @IsString()
58
+ @IsOptional()
59
+ legalForm?: string;
60
+
61
+ @ApiPropertyOptional()
62
+ @IsString()
63
+ @IsOptional()
64
+ siren?: string;
65
+
66
+ @ApiPropertyOptional()
67
+ @IsString()
68
+ @IsOptional()
69
+ companyName?: string;
70
+ }
71
+
72
+ class InvoicePayload {
73
+ @ApiProperty()
74
+ @IsDateString()
75
+ emissionDate: string;
76
+
77
+ @ApiProperty({ comment: 'Amount in cents' })
78
+ @IsInt()
79
+ @IsPositive()
80
+ amountTotalTaxIncluded: number;
81
+
82
+ @ApiProperty({ comment: 'Amount in cents' })
83
+ @IsInt()
84
+ @IsPositive()
85
+ unpaidAmountTaxIncluded: number;
86
+
87
+ @ApiProperty()
88
+ @IsString()
89
+ reference: string;
90
+ }
91
+
92
+ class CreditorPayload {
93
+ @ApiProperty()
94
+ @IsIBAN()
95
+ iban: string;
96
+
97
+ @ApiProperty()
98
+ @IsInt()
99
+ idRibFile: number;
100
+
101
+ @ApiPropertyOptional({ comment: 'Required if subscription doesn\'t have siren field' })
102
+ @IsString()
103
+ @IsOptional()
104
+ siren?: string | null;
105
+
106
+ @ApiProperty({ comment: 'Required if subscription doesn\'t have telephone field' })
107
+ @Validate(IsE164PhoneNumber, { message: 'Numéro de téléphone du créditeur invalide' })
108
+ phone?: string | null;
109
+ }
110
+
111
+ export class CreatePaymentRecovery {
112
+ @ValidateNested()
113
+ invoice: InvoicePayload;
114
+
115
+ @ValidateNested()
116
+ debtor: DebtorPayload;
117
+
118
+ @ValidateNested()
119
+ creditor: CreditorPayload;
120
+ }
121
+
122
+ export class AskProcessPaymentRecovery {
123
+ @ApiProperty()
124
+ @IsString()
125
+ @MinLength(2)
126
+ subject: string;
127
+
128
+ @ApiProperty()
129
+ @IsString()
130
+ @MinLength(2)
131
+ content: string;
132
+
133
+ @ApiProperty()
134
+ @IsString()
135
+ type: PaymentRecoveryStatus.CUSTOM_CANCELLATION | PaymentRecoveryStatus.CUSTOM_RECOVERED | 'askCertificate';
136
+ }
@@ -0,0 +1,49 @@
1
+ import { IsBoolean, IsDateString, IsOptional, IsString } from 'class-validator';
2
+ import { ApiPropertyOptional } from '../../../../utils';
3
+ import { RequiredQueryPaginate } from '../BasePaginate';
4
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
5
+
6
+ export class QueryPaymentRecoveryPaginated extends RequiredQueryPaginate {
7
+ @ApiPropertyOptional()
8
+ @IsBoolean()
9
+ @ToBoolean()
10
+ @IsOptional()
11
+ isDescending?: boolean;
12
+
13
+ @ApiPropertyOptional()
14
+ @IsDateString()
15
+ @IsOptional()
16
+ startDate?: string;
17
+
18
+ @ApiPropertyOptional()
19
+ @IsDateString()
20
+ @IsOptional()
21
+ endDate?: string;
22
+
23
+ @ApiPropertyOptional()
24
+ @IsString()
25
+ @IsOptional()
26
+ search?: string;
27
+
28
+ @ApiPropertyOptional()
29
+ @IsOptional()
30
+ @IsString()
31
+ status?: 'recovered' | 'notRecovered' | 'waiting';
32
+ }
33
+
34
+ export class QueryPaymentRecoveryStatistic {
35
+ @ApiPropertyOptional()
36
+ @IsDateString()
37
+ @IsOptional()
38
+ startDate?: string;
39
+
40
+ @ApiPropertyOptional()
41
+ @IsDateString()
42
+ @IsOptional()
43
+ endDate?: string;
44
+
45
+ @ApiPropertyOptional()
46
+ @IsString()
47
+ @IsOptional()
48
+ search?: string;
49
+ }
@@ -0,0 +1,52 @@
1
+ import { PaymentRecoveryStatus } from '../../../Enum/PaymentRecovery';
2
+ import { IFile } from '../../models/IFile';
3
+ import { IThirdParty } from '../../models/IThirdParty';
4
+ import { CaarlEvent } from './Caarl';
5
+
6
+ export interface ReadPaymentRecoveryClaim {
7
+ status: PaymentRecoveryStatus;
8
+ type: string;
9
+ events: CaarlEvent[];
10
+ iban: string;
11
+ debtor: {
12
+ firstname: string;
13
+ lastname: string;
14
+ email: string;
15
+ phone: string;
16
+ address: string;
17
+ zipCode: string;
18
+ city: string;
19
+ };
20
+ }
21
+
22
+ export interface ReadPaymentRecovery {
23
+ id: number;
24
+ status: PaymentRecoveryStatus;
25
+ externalId: string;
26
+ thirdParty: IThirdParty;
27
+ invoice: {
28
+ file: IFile;
29
+ amountTotalTaxIncluded: number;
30
+ amountTotalTaxExcluded: number;
31
+ title: string;
32
+ reference: string;
33
+ };
34
+ lastSync: Date | null;
35
+ createdAt: Date;
36
+ updatedAt: Date;
37
+ }
38
+
39
+ export interface ReadPaymentRecoveryStatistic {
40
+ recovered: {
41
+ count: number;
42
+ amount: number;
43
+ };
44
+ waiting: {
45
+ count: number;
46
+ amount: number;
47
+ };
48
+ notRecovered: {
49
+ count: number;
50
+ amount: number;
51
+ };
52
+ }
@@ -9,6 +9,7 @@ export enum Code {
9
9
  tokenFailure = 'token_authentication_failure',
10
10
  authenticationFailure = 'authentication_credentials_failure',
11
11
  notFound = 'resource_not_found',
12
+ forbidden = 'forbidden',
12
13
  fileNotFound = 'file_not_found',
13
14
  validationError = 'resource_validation_error',
14
15
  constraintError = 'resource_constraint_error',
@@ -1,7 +1,8 @@
1
1
  import { IAttachmentFile } from './IAttachmentFile';
2
2
  import { IFolderFile } from './IFolderFile';
3
3
  import { IFileType } from './IFileType';
4
- import { ICommercialMail, IMail, IMailAttachment } from '../..';
4
+ import { ICommercialMail, IEstimateInvoice, IMail, IMailAttachment } from '../..';
5
+ import { IPaymentRecovery } from './IPaymentRecovery';
5
6
 
6
7
  // files
7
8
  export interface IFile {
@@ -21,4 +22,6 @@ export interface IFile {
21
22
  commercialMails?: ICommercialMail[];
22
23
  mails?: IMail[];
23
24
  mailAttachment?: IMailAttachment | null;
25
+ paymentRecovery?: IPaymentRecovery | null;
26
+ estimateInvoice?: IEstimateInvoice | null;
24
27
  }
@@ -0,0 +1,18 @@
1
+ import { PaymentRecoveryStatus } from '../../Enum/PaymentRecovery';
2
+ import { IFile } from './IFile';
3
+ import { IPayment } from './IPayment';
4
+
5
+ export interface IPaymentRecovery {
6
+ id?: number;
7
+ externalId: string;
8
+ status: PaymentRecoveryStatus;
9
+ lastSync: Date | null;
10
+ metadata: any | null;
11
+ idFile: number;
12
+ idPayment: number | null;
13
+ createdAt?: Date;
14
+ updatedAt?: Date;
15
+
16
+ file?: IFile;
17
+ payment?: IPayment | null;
18
+ }
package/ts/types/index.ts CHANGED
@@ -552,6 +552,7 @@ export * from './Enum/StatusRating';
552
552
  export * from './Enum/TypeSupportForNotation';
553
553
  export * from './Enum/ToRecallRating';
554
554
  export * from './Enum/PrevisionalForm';
555
+ export * from './Enum/PaymentRecovery';
555
556
 
556
557
  // Interfaces API
557
558
  export * from './Interface/api/exercice/ReadExercice';
@@ -1102,6 +1103,10 @@ export * from './Interface/api/companyCreationForm/CreateCompanyCreationForm';
1102
1103
  export * from './Interface/api/companyCreationForm/UpdateCompanyCreationForm';
1103
1104
  export * from './Interface/api/companyCreationForm/CompanyCreationFormPayload';
1104
1105
  export * from './Interface/api/sellsy/CreateInvoicesSellsy';
1106
+ export * from './Interface/api/PaymentRecovery/Create';
1107
+ export * from './Interface/api/PaymentRecovery/Caarl';
1108
+ export * from './Interface/api/PaymentRecovery/Read';
1109
+ export * from './Interface/api/PaymentRecovery/Query';
1105
1110
  export * from './Interface/api/previsionalForm/PrevisionalFormPayload';
1106
1111
  export * from './Interface/api/previsionalForm/CreatePrevisionalForm';
1107
1112
  export * from './Interface/api/toDoExpress/Query';
@@ -48,6 +48,7 @@ export type Brand = {
48
48
  support?: string;
49
49
  tva?: string;
50
50
  wb?: string;
51
+ recovery?: string;
51
52
  },
52
53
  listPhones?: {
53
54
  contact: string;
@@ -0,0 +1,26 @@
1
+ import { PaymentRecoveryStatus, PaymentRecoveryTag, Vat } from '../../types';
2
+
3
+ const CARL_RECOVERY_FEES_PERCENTAGE = 15;
4
+ const CARL_RECOVERY_REDUCED_FEES_PERCENTAGE = 10;
5
+ const CAARL_MINIMUM_AMOUNT_FOR_REDUCED_FEES = 5001;
6
+
7
+ export const CAARL_WAITING_STATUS: PaymentRecoveryStatus[] = [PaymentRecoveryStatus.OPENED, PaymentRecoveryStatus.SENT_TO_AMICABLE, PaymentRecoveryStatus.AMICABLE_SETTLEMENT, PaymentRecoveryStatus.SENT_TO_COURT, PaymentRecoveryStatus.FEES_PAID, PaymentRecoveryStatus.IP_SUBMITTED_TO_COURT, PaymentRecoveryStatus.IP_OK, PaymentRecoveryStatus.IP_SIGNIFIED, PaymentRecoveryStatus.CUSTOM_RECOVERED, PaymentRecoveryStatus.CUSTOM_CANCELLATION];
8
+ export const CAARL_RECOVERED_STATUS: PaymentRecoveryStatus[] = [PaymentRecoveryStatus.CLOSED_PAYED];
9
+ export const CAARL_NOT_RECOVERED_STATUS: PaymentRecoveryStatus[] = [PaymentRecoveryStatus.CLOSED_DISPUTE, PaymentRecoveryStatus.CLOSED_FAILED, PaymentRecoveryStatus.CLOSED_RJ, PaymentRecoveryStatus.CLOSED_LJ, PaymentRecoveryStatus.CLOSED_IP_KO];
10
+
11
+ export function getRecoveryFeesFromAmountTotalTaxIncluded(amount: number): number {
12
+
13
+ const rate = amount >= CAARL_MINIMUM_AMOUNT_FOR_REDUCED_FEES ? CARL_RECOVERY_REDUCED_FEES_PERCENTAGE : CARL_RECOVERY_FEES_PERCENTAGE;
14
+
15
+ const feesTaxExcluded = amount * (rate / 100);
16
+ const feesTax = feesTaxExcluded * (Vat.TX_20.value / 100);
17
+
18
+ return feesTaxExcluded + feesTax;
19
+ }
20
+
21
+ export function getStatusGroup(status: PaymentRecoveryStatus): PaymentRecoveryTag {
22
+ if (CAARL_WAITING_STATUS.includes(status)) { return PaymentRecoveryTag.WAITING; }
23
+ if (CAARL_RECOVERED_STATUS.includes(status)) { return PaymentRecoveryTag.RECOVERED; }
24
+ if (CAARL_NOT_RECOVERED_STATUS.includes(status)) { return PaymentRecoveryTag.NOT_RECOVERED; }
25
+ return PaymentRecoveryTag.WAITING;
26
+ }
@@ -0,0 +1,16 @@
1
+ import { isDefined, ValidatorConstraint, ValidatorConstraintInterface } from 'class-validator';
2
+ import { parsePhoneNumberFromString } from 'libphonenumber-js';
3
+
4
+
5
+
6
+ @ValidatorConstraint({ name: 'isE164Phone', async: false })
7
+ export class IsE164PhoneNumber implements ValidatorConstraintInterface {
8
+ validate(text: string) {
9
+ const phoneNumber = parsePhoneNumberFromString(text);
10
+ return isDefined(phoneNumber) && phoneNumber.number === text && phoneNumber.isValid();
11
+ }
12
+
13
+ defaultMessage() {
14
+ return 'Numéro de téléphone invalide';
15
+ }
16
+ }