@silexpert/core 1.0.173 → 1.0.175

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 (64) hide show
  1. package/es/api/resources/CommercialImport.d.ts +8 -0
  2. package/es/api/resources/CommercialImport.d.ts.map +1 -0
  3. package/es/api/resources/CommercialImport.js +21 -0
  4. package/es/api/resources/CommercialImport.js.map +1 -0
  5. package/es/api/resources.d.ts +2 -0
  6. package/es/api/resources.d.ts.map +1 -1
  7. package/es/api/resources.js +2 -0
  8. package/es/api/resources.js.map +1 -1
  9. package/es/types/Enum/CommercialImportHeader.d.ts +12 -0
  10. package/es/types/Enum/CommercialImportHeader.d.ts.map +1 -0
  11. package/es/types/Enum/CommercialImportHeader.js +102 -0
  12. package/es/types/Enum/CommercialImportHeader.js.map +1 -0
  13. package/es/types/Enum/Ged.d.ts +1 -0
  14. package/es/types/Enum/Ged.d.ts.map +1 -1
  15. package/es/types/Enum/Ged.js +1 -1
  16. package/es/types/Enum/Ged.js.map +1 -1
  17. package/es/types/Interface/api/commercialImport/Create.d.ts +8 -0
  18. package/es/types/Interface/api/commercialImport/Create.d.ts.map +1 -0
  19. package/es/types/Interface/api/commercialImport/Create.js +27 -0
  20. package/es/types/Interface/api/commercialImport/Create.js.map +1 -0
  21. package/es/types/Interface/api/commercialImport/Query.d.ts +12 -0
  22. package/es/types/Interface/api/commercialImport/Query.d.ts.map +1 -0
  23. package/es/types/Interface/api/commercialImport/Query.js +23 -0
  24. package/es/types/Interface/api/commercialImport/Query.js.map +1 -0
  25. package/es/types/Interface/api/commercialImport/Read.d.ts +40 -0
  26. package/es/types/Interface/api/commercialImport/Read.d.ts.map +1 -0
  27. package/es/types/Interface/api/commercialImport/Read.js +2 -0
  28. package/es/types/Interface/api/commercialImport/Read.js.map +1 -0
  29. package/es/types/Interface/models/IApiError.d.ts +4 -0
  30. package/es/types/Interface/models/IApiError.d.ts.map +1 -1
  31. package/es/types/Interface/models/IApiError.js +5 -0
  32. package/es/types/Interface/models/IApiError.js.map +1 -1
  33. package/es/types/index.d.ts +4 -0
  34. package/es/types/index.d.ts.map +1 -1
  35. package/es/types/index.js +4 -0
  36. package/es/types/index.js.map +1 -1
  37. package/js/api/resources/CommercialImport.js +35 -0
  38. package/js/api/resources/CommercialImport.js.map +1 -0
  39. package/js/api/resources.js +3 -1
  40. package/js/api/resources.js.map +1 -1
  41. package/js/types/Enum/CommercialImportHeader.js +107 -0
  42. package/js/types/Enum/CommercialImportHeader.js.map +1 -0
  43. package/js/types/Enum/Ged.js +1 -1
  44. package/js/types/Enum/Ged.js.map +1 -1
  45. package/js/types/Interface/api/commercialImport/Create.js +24 -0
  46. package/js/types/Interface/api/commercialImport/Create.js.map +1 -0
  47. package/js/types/Interface/api/commercialImport/Query.js +24 -0
  48. package/js/types/Interface/api/commercialImport/Query.js.map +1 -0
  49. package/js/types/Interface/api/commercialImport/Read.js +6 -0
  50. package/js/types/Interface/api/commercialImport/Read.js.map +1 -0
  51. package/js/types/Interface/models/IApiError.js +5 -0
  52. package/js/types/Interface/models/IApiError.js.map +1 -1
  53. package/js/types/index.js +40 -0
  54. package/js/types/index.js.map +1 -1
  55. package/package.json +1 -1
  56. package/ts/api/resources/CommercialImport.ts +27 -0
  57. package/ts/api/resources.ts +3 -0
  58. package/ts/types/Enum/CommercialImportHeader.ts +112 -0
  59. package/ts/types/Enum/Ged.ts +1 -1
  60. package/ts/types/Interface/api/commercialImport/Create.ts +16 -0
  61. package/ts/types/Interface/api/commercialImport/Query.ts +34 -0
  62. package/ts/types/Interface/api/commercialImport/Read.ts +40 -0
  63. package/ts/types/Interface/models/IApiError.ts +6 -0
  64. package/ts/types/index.ts +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.0.173",
3
+ "version": "1.0.175",
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": "js/index.js",
@@ -0,0 +1,27 @@
1
+ import * as FormData from 'form-data';
2
+ import {
3
+ CreateCommercialTransactions, HeadersMappingImport, ImportRow, QueryHeader, QueryProcessCsv,
4
+
5
+ } from '../../types';
6
+ import { Resource } from '../Resource';
7
+
8
+ export class CommercialImport extends Resource {
9
+ getHeaders(payload: QueryHeader): Promise<HeadersMappingImport[]> {
10
+ return this.axios.$post('/commercial-management/imports/headers', payload);
11
+ }
12
+
13
+ mapping(file: File, payload: QueryProcessCsv): Promise<ImportRow[]> {
14
+ const formData = new FormData();
15
+ const entries = Object.entries(payload.mappingHeaders);
16
+ entries.map(([name, value]: [string, string]) => {
17
+ formData.append(name, value);
18
+ return [name, value];
19
+ });
20
+ formData.append('file', file);
21
+ return this.axios.$post('/commercial-management/imports/process-csv', formData, { headers: { 'Content-Type': 'multipart/form-data' } });
22
+ }
23
+
24
+ createTransactions(payload: CreateCommercialTransactions): Promise<boolean> {
25
+ return this.axios.$post('/commercial-management/imports/transactions', payload);
26
+ }
27
+ }
@@ -122,6 +122,7 @@ import { Quotation } from './resources/Quotation';
122
122
  import { Prestations } from './resources/Prestations';
123
123
  import { StatisticCustomerSuccess } from './resources/statistic/CustomerSuccess';
124
124
  import { UnpaidCallHistory } from './resources/UnpaidCallHistory';
125
+ import { CommercialImport } from './resources/CommercialImport';
125
126
 
126
127
  export const resources = {
127
128
  simulation: Simulation,
@@ -248,4 +249,6 @@ export const resources = {
248
249
  quotation: Quotation,
249
250
  prestations: Prestations,
250
251
  unpaidCallHistory: UnpaidCallHistory,
252
+ commercialImport: CommercialImport,
253
+
251
254
  };
@@ -0,0 +1,112 @@
1
+ export type CommercialImportHeaderContent = {
2
+ originalName:string;
3
+ name: string;
4
+ required: boolean,
5
+ description?: string;
6
+ relatedField?: string;
7
+ };
8
+ export type CommercialImportHeader = {
9
+ [key: string]: CommercialImportHeaderContent
10
+ };
11
+
12
+ export const commercialImportHeader: CommercialImportHeader = {
13
+ TAX_INCLUDED_AMOUNT: {
14
+ originalName: 'taxIncludedAmount',
15
+ name: 'Montant TTC',
16
+ required: true,
17
+ description: 'Montant total toutes taxes comprises',
18
+ },
19
+ TAX_EXCLUDED_AMOUNT_20: {
20
+ originalName: 'taxExcludedAmount_20',
21
+ name: 'Montant HT TVA 20%',
22
+ required: true,
23
+ description: 'Total hors taxes des prestations ou marchandises facturées avec la TVA 20%',
24
+ },
25
+ AMOUNT_VAT_20: {
26
+ originalName: 'amountVat_20',
27
+ name: 'Montant TVA 20%',
28
+ required: true,
29
+ description: 'Montant en euros de la TVA 20%',
30
+ relatedField: 'taxExcludedAmount_20',
31
+ },
32
+ TAX_EXCLUDED_10: {
33
+ originalName: 'taxExcludedAmount_10',
34
+ name: 'Montant HT TVA 10%',
35
+ required: true,
36
+ description: 'Total hors taxes des prestations ou marchandises facturées avec la TVA 10%',
37
+ },
38
+ AMOUNT_VAT_10: {
39
+ originalName: 'amountVat_10',
40
+ name: 'Montant TVA 10%',
41
+ required: true,
42
+ description: 'Montant en euros de la TVA 10%',
43
+ relatedField: 'taxExcludedAmount_10',
44
+ },
45
+ TAX_EXCLUDED_8_5: {
46
+ originalName: 'taxExcludedAmount_8_5',
47
+ name: 'Montant HT TVA 8,5%',
48
+ required: true,
49
+ description: 'Total hors taxes des prestations ou marchandises facturées avec la TVA 8,5%',
50
+ },
51
+ AMOUNT_VAT_8_5: {
52
+ originalName: 'amountVat_8_5',
53
+ name: 'Montant TVA 8,5%',
54
+ required: true,
55
+ description: 'Montant en euros de la TVA 8,5%',
56
+ relatedField: 'taxExcludedAmount_8_5',
57
+ },
58
+ TAX_EXCLUDED_5_5: {
59
+ originalName: 'taxExcludedAmount_5_5',
60
+ name: 'Montant HT TVA 5,5%',
61
+ required: true,
62
+ description: 'Total hors taxes des prestations ou marchandises facturées avec la TVA 5,5%',
63
+ },
64
+ AMOUNT_VAT_5_5: {
65
+ originalName: 'amountVat_5_5',
66
+ name: 'Montant TVA 5,5%',
67
+ required: true,
68
+ description: 'Montant en euros de la TVA 5,5%',
69
+ relatedField: 'taxExcludedAmount_5_5',
70
+ },
71
+ TAX_EXCLUDED_2_1: {
72
+ originalName: 'taxExcludedAmount_2_1',
73
+ name: 'Montant HT TVA 2,1%',
74
+ required: true,
75
+ description: 'Total hors taxes des prestations ou marchandises facturées avec la TVA 2,1%',
76
+ },
77
+ AMOUNT_VAT_2_1: {
78
+ originalName: 'amountVat_2_1',
79
+ name: 'Montant TVA 2,1%',
80
+ required: true,
81
+ description: 'Montant en euros de la TVA 2,1%',
82
+ relatedField: 'taxExcludedAmount_2_1',
83
+ },
84
+ TAX_EXCLUDED: {
85
+ originalName: 'taxExcludedAmount',
86
+ name: 'Montant sans TVA',
87
+ required: true,
88
+ description: 'Total hors taxes des prestations ou marchandises facturées sans TVA',
89
+ },
90
+ CUSTOMER_NAME: {
91
+ originalName: 'customerName',
92
+ name: 'Nom de client',
93
+ required: true,
94
+ description: 'Nom ou raison sociale de vos clients',
95
+ },
96
+ DATE_VALUE: {
97
+ originalName: 'dateValue',
98
+ name: 'date',
99
+ required: false,
100
+ description: 'Date d’émission des factures',
101
+ },
102
+ LABEL: {
103
+ originalName: 'Label',
104
+ name: 'Libellé',
105
+ required: false,
106
+ },
107
+ INVOICE_NUMBER: {
108
+ originalName: 'invoiceNumber',
109
+ name: 'Numéro de facture',
110
+ required: false,
111
+ },
112
+ };
@@ -33,7 +33,7 @@ export enum GedFolder {
33
33
  RSI_URSSAF = 27,
34
34
  // Previous GA balance & PV = 28,
35
35
  // Slips for the CFE = 29,
36
- // Suppliers / customers appendices = 30,
36
+ APPENDIX_PROVIDERS_CUSTOMERS = 30,
37
37
  MISCELLANEOUS = 31,
38
38
  // Legal Announcements = 32,
39
39
  CERTIFICATES = 33,
@@ -0,0 +1,16 @@
1
+ import { IsNumber } from 'class-validator';
2
+ import { ApiProperty } from '../../../../utils';
3
+ import { TFile } from '../file/TFile';
4
+ import { ImportRow } from './Read';
5
+
6
+ export class CreateCommercialTransactions {
7
+ @ApiProperty()
8
+ transactions: ImportRow[];
9
+
10
+ @ApiProperty()
11
+ @IsNumber()
12
+ type: number;
13
+
14
+ @ApiProperty()
15
+ file: TFile;
16
+ }
@@ -0,0 +1,34 @@
1
+ import { ApiProperty } from '../../../../utils';
2
+ import { TFile } from '../file/TFile';
3
+
4
+ export type MappingImport = {
5
+ [K in HeadersMappingImport]?: string
6
+ };
7
+
8
+ export type HeadersMappingImport =
9
+ 'dateValue' |
10
+ 'label' |
11
+ 'customerName' |
12
+ 'invoiceNumber' |
13
+ 'taxIncludedAmount' |
14
+ 'taxExcludedAmount' |
15
+ 'taxExcludedAmount_2_1' |
16
+ 'amountVat_2_1' |
17
+ 'taxExcludedAmount_5_5' |
18
+ 'amountVat_5_5' |
19
+ 'taxExcludedAmount_8_5' |
20
+ 'amountVat_8_5' |
21
+ 'taxExcludedAmount_10' |
22
+ 'amountVat_10' |
23
+ 'taxExcludedAmount_20' |
24
+ 'amountVat_20';
25
+
26
+ export class QueryHeader {
27
+ @ApiProperty()
28
+ file: TFile;
29
+ }
30
+
31
+ export class QueryProcessCsv {
32
+ @ApiProperty()
33
+ mappingHeaders: MappingImport;
34
+ }
@@ -0,0 +1,40 @@
1
+ export interface ImportRow {
2
+ taxIncludedAmount: number;
3
+ taxExcludedAmount: number;
4
+ amountVat: number;
5
+ taxExcludedAmount_20: number;
6
+ amountVat_20: number;
7
+ taxExcludedAmount_10: number;
8
+ amountVat_10: number;
9
+ taxExcludedAmount_8_5: number;
10
+ amountVat_8_5: number;
11
+ taxExcludedAmount_5_5: number;
12
+ amountVat_5_5: number;
13
+ taxExcludedAmount_2_1: number;
14
+ amountVat_2_1: number;
15
+ customerName: string;
16
+ dateValue?: string;
17
+ label?: string;
18
+ invoiceNumber?: string
19
+ line: number // the line in the csv
20
+ }
21
+
22
+ export interface ImportRawRow {
23
+ taxIncludedAmount: number;
24
+ taxExcludedAmount: number;
25
+ taxExcludedAmount_20: number;
26
+ amountVat_20: number;
27
+ taxExcludedAmount_10: number;
28
+ amountVat_10: number;
29
+ taxExcludedAmount_8_5: number;
30
+ amountVat_8_5: number;
31
+ taxExcludedAmount_5_5: number;
32
+ amountVat_5_5: number;
33
+ taxExcludedAmount_2_1: number;
34
+ amountVat_2_1: number;
35
+ customerName: string;
36
+ dateValue?: string;
37
+ label?: string;
38
+ invoiceNumber?: string,
39
+ line: number // the line in the csv
40
+ }
@@ -106,6 +106,12 @@ export enum Code {
106
106
  insertAccountingTransactionFailed = 'insert_accounting_transaction_failed',
107
107
  fecFileAlreadyExists = 'fec_file_already_exists',
108
108
 
109
+ // Import Commercial error
110
+ missingHeaders = 'missing_headers',
111
+ missingRequiredHeaders = 'missing_required_headers',
112
+ wrongVatAmount = 'wrong_vat_amount',
113
+ wrongAmountSum = 'wrong_amount_sum',
114
+
109
115
  // User creation
110
116
  userAlreadyExistWithSociety = 'user-already-exists',
111
117
  userDoesNotExists = 'user-does-not-exist',
package/ts/types/index.ts CHANGED
@@ -481,6 +481,7 @@ export * from './Enum/Holidays';
481
481
  export * from './Enum/AdminAcceptance';
482
482
  export * from './Enum/PrestationListType';
483
483
  export * from './Enum/UnpaidCallHistoryType';
484
+ export * from './Enum/CommercialImportHeader';
484
485
 
485
486
  // Interfaces API
486
487
  export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
@@ -893,6 +894,9 @@ export * from './Interface/api/quotation/ReadClientQuotation';
893
894
  export * from './Interface/api/prestations/QueryCreate';
894
895
  export * from './Interface/api/prestations/QueryUpdate';
895
896
  export * from './Interface/api/prestations/QueryGetAllPrestations';
897
+ export * from './Interface/api/commercialImport/Read';
898
+ export * from './Interface/api/commercialImport/Query';
899
+ export * from './Interface/api/commercialImport/Create';
896
900
 
897
901
  // Enums types
898
902
  export * from './Interface/enum/Util';