@silexpert/core 2.0.69 → 2.0.70
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/api/resources/Account.d.ts +1 -0
- package/dist/api/resources/Account.d.ts.map +1 -1
- package/dist/api/resources/Account.js +3 -0
- package/dist/api/resources/Account.js.map +1 -1
- package/dist/api/resources/Acd.d.ts +2 -1
- package/dist/api/resources/Acd.d.ts.map +1 -1
- package/dist/api/resources/Acd.js +3 -0
- package/dist/api/resources/Acd.js.map +1 -1
- package/dist/api/resources/Library.d.ts +1 -0
- package/dist/api/resources/Library.d.ts.map +1 -1
- package/dist/api/resources/Library.js +8 -0
- package/dist/api/resources/Library.js.map +1 -1
- package/dist/api/resources/Notification.d.ts +2 -1
- package/dist/api/resources/Notification.d.ts.map +1 -1
- package/dist/api/resources/Notification.js +3 -0
- package/dist/api/resources/Notification.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/Enum/Ged.d.ts +2 -1
- package/dist/types/Enum/Ged.d.ts.map +1 -1
- package/dist/types/Enum/Ged.js +1 -0
- package/dist/types/Enum/Ged.js.map +1 -1
- package/dist/types/Interface/api/account/Create.d.ts +5 -1
- package/dist/types/Interface/api/account/Create.d.ts.map +1 -1
- package/dist/types/Interface/api/account/Create.js +38 -4
- package/dist/types/Interface/api/account/Create.js.map +1 -1
- package/dist/types/Interface/api/acd/Vat.d.ts +52 -0
- package/dist/types/Interface/api/acd/Vat.d.ts.map +1 -0
- package/dist/types/Interface/api/acd/Vat.js +14 -0
- package/dist/types/Interface/api/acd/Vat.js.map +1 -0
- package/dist/types/Interface/api/docoon/Create.d.ts +9 -0
- package/dist/types/Interface/api/docoon/Create.d.ts.map +1 -1
- package/dist/types/Interface/api/docoon/Create.js.map +1 -1
- package/dist/types/Interface/api/docoon/Read.d.ts +106 -0
- package/dist/types/Interface/api/docoon/Read.d.ts.map +1 -1
- package/dist/types/Interface/api/docoon/Read.js.map +1 -1
- package/dist/types/Interface/api/einvoicing/SyncFlowStatusResult.d.ts +12 -0
- package/dist/types/Interface/api/einvoicing/SyncFlowStatusResult.d.ts.map +1 -0
- package/dist/types/Interface/api/einvoicing/SyncFlowStatusResult.js +2 -0
- package/dist/types/Interface/api/einvoicing/SyncFlowStatusResult.js.map +1 -0
- package/dist/types/Interface/api/notification/CreateInternalNotification.d.ts +17 -0
- package/dist/types/Interface/api/notification/CreateInternalNotification.d.ts.map +1 -0
- package/dist/types/Interface/api/notification/CreateInternalNotification.js +98 -0
- package/dist/types/Interface/api/notification/CreateInternalNotification.js.map +1 -0
- package/dist/types/Interface/api/product/CreateProduct.d.ts +1 -0
- package/dist/types/Interface/api/product/CreateProduct.d.ts.map +1 -1
- package/dist/types/Interface/api/product/CreateProduct.js +8 -1
- package/dist/types/Interface/api/product/CreateProduct.js.map +1 -1
- package/dist/types/Interface/models/IAccount.d.ts +1 -0
- package/dist/types/Interface/models/IAccount.d.ts.map +1 -1
- package/dist/types/Interface/models/IAccount.js +1 -0
- package/dist/types/Interface/models/IAccount.js.map +1 -1
- package/dist/types/Interface/models/IAccountingFile.d.ts +0 -1
- package/dist/types/Interface/models/IAccountingFile.d.ts.map +1 -1
- package/dist/types/Interface/models/IAccountingFile.js +0 -1
- package/dist/types/Interface/models/IAccountingFile.js.map +1 -1
- package/dist/types/Interface/models/IEInvoicing.d.ts +1 -1
- package/dist/types/Interface/models/IEInvoicing.d.ts.map +1 -1
- package/dist/types/Interface/models/IEInvoicing.js.map +1 -1
- package/dist/types/Interface/models/IProduct.d.ts +3 -0
- package/dist/types/Interface/models/IProduct.d.ts.map +1 -1
- package/dist/types/Interface/models/IProduct.js +2 -0
- package/dist/types/Interface/models/IProduct.js.map +1 -1
- package/dist/types/Interface/models/IProductInvoice.d.ts +3 -0
- package/dist/types/Interface/models/IProductInvoice.d.ts.map +1 -1
- package/dist/types/Interface/models/IProductInvoice.js +2 -0
- package/dist/types/Interface/models/IProductInvoice.js.map +1 -1
- package/dist/types/Interface/models/ISocietyGescom.d.ts +1 -0
- package/dist/types/Interface/models/ISocietyGescom.d.ts.map +1 -1
- package/dist/types/Interface/models/ISocietyGescom.js +2 -0
- package/dist/types/Interface/models/ISocietyGescom.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/acdVat.d.ts +4 -0
- package/dist/utils/acdVat.d.ts.map +1 -0
- package/dist/utils/acdVat.js +57 -0
- package/dist/utils/acdVat.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/tests/acdVat.spec.d.ts +2 -0
- package/dist/utils/tests/acdVat.spec.d.ts.map +1 -0
- package/dist/utils/tests/acdVat.spec.js +25 -0
- package/dist/utils/tests/acdVat.spec.js.map +1 -0
- package/dist/utils/tests/brands.spec.d.ts +2 -0
- package/dist/utils/tests/brands.spec.d.ts.map +1 -0
- package/dist/utils/tests/brands.spec.js +25 -0
- package/dist/utils/tests/brands.spec.js.map +1 -0
- package/package.json +1 -1
- package/ts/api/resources/Account.ts +4 -0
- package/ts/api/resources/Acd.ts +5 -1
- package/ts/api/resources/Library.ts +9 -0
- package/ts/api/resources/Notification.ts +5 -1
- package/ts/index.ts +1 -0
- package/ts/types/Enum/Ged.ts +1 -0
- package/ts/types/Interface/api/account/Create.ts +29 -3
- package/ts/types/Interface/api/acd/Vat.ts +52 -0
- package/ts/types/Interface/api/docoon/Create.ts +10 -0
- package/ts/types/Interface/api/docoon/Read.ts +114 -0
- package/ts/types/Interface/api/einvoicing/SyncFlowStatusResult.ts +12 -0
- package/ts/types/Interface/api/notification/CreateInternalNotification.ts +64 -0
- package/ts/types/Interface/api/product/CreateProduct.ts +6 -1
- package/ts/types/Interface/models/IAccount.ts +1 -0
- package/ts/types/Interface/models/IAccountingFile.ts +0 -1
- package/ts/types/Interface/models/IEInvoicing.ts +1 -1
- package/ts/types/Interface/models/IProduct.ts +3 -0
- package/ts/types/Interface/models/IProductInvoice.ts +3 -0
- package/ts/types/Interface/models/ISocietyGescom.ts +2 -0
- package/ts/types/index.ts +3 -0
- package/ts/utils/acdVat.ts +63 -0
- package/ts/utils/index.ts +1 -0
- package/ts/utils/tests/acdVat.spec.ts +26 -0
- package/ts/utils/tests/brands.spec.ts +31 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IVat } from './IVat.js';
|
|
2
2
|
import { ISociety } from './ISociety.js';
|
|
3
|
+
import { IAccount } from './IAccount.js';
|
|
3
4
|
|
|
4
5
|
// products
|
|
5
6
|
export class IProduct {
|
|
@@ -15,6 +16,7 @@ export class IProduct {
|
|
|
15
16
|
amountOfPurchase: number | null;
|
|
16
17
|
marginVatType?: number;
|
|
17
18
|
idSociety: number;
|
|
19
|
+
idAccount?: number | null;
|
|
18
20
|
createdAt?: Date | null;
|
|
19
21
|
updatedAt?: Date | null;
|
|
20
22
|
deletedAt?: Date | null;
|
|
@@ -22,4 +24,5 @@ export class IProduct {
|
|
|
22
24
|
// Associations
|
|
23
25
|
vat?: IVat;
|
|
24
26
|
society?: ISociety;
|
|
27
|
+
account?: IAccount;
|
|
25
28
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IVat } from './IVat.js';
|
|
2
2
|
import { IProduct } from './IProduct.js';
|
|
3
|
+
import type { IAccount } from './IAccount.js';
|
|
3
4
|
import { DiscountType } from '../../Enum/CommercialManagement.js';
|
|
4
5
|
|
|
5
6
|
// itemsEstimates
|
|
@@ -7,6 +8,7 @@ export class IProductInvoice {
|
|
|
7
8
|
id?: number;
|
|
8
9
|
idEstimateInvoice: number;
|
|
9
10
|
idProduct: number | null;
|
|
11
|
+
idAccount?: number | null;
|
|
10
12
|
idVat: number;
|
|
11
13
|
marginVatType?: number;
|
|
12
14
|
amountOfPurchase: number | null;
|
|
@@ -26,4 +28,5 @@ export class IProductInvoice {
|
|
|
26
28
|
// Associations
|
|
27
29
|
vat?: IVat;
|
|
28
30
|
product?: IProduct;
|
|
31
|
+
account?: IAccount;
|
|
29
32
|
}
|
|
@@ -47,6 +47,8 @@ export class ISocietyGescom {
|
|
|
47
47
|
idSociety?: number | null;
|
|
48
48
|
shouldHideBrandName?: boolean;
|
|
49
49
|
shouldHideEmailHeader?: boolean;
|
|
50
|
+
// Regroupe les ecritures comptables par compte pour l export des ecritures comptables.
|
|
51
|
+
areEntriesGroupedByAccount?: boolean;
|
|
50
52
|
customerBlockBorderThickness?: number | null;
|
|
51
53
|
customerBlockBorderColor?: string | null;
|
|
52
54
|
lineSeparationThickness?: number | null;
|
package/ts/types/index.ts
CHANGED
|
@@ -540,6 +540,7 @@ export * from './Enum/Kyc.js';
|
|
|
540
540
|
|
|
541
541
|
// Interfaces API
|
|
542
542
|
export * from './Interface/api/accountingTransaction/Create.js';
|
|
543
|
+
export * from './Interface/api/acd/Vat.js';
|
|
543
544
|
export * from './Interface/api/acd/Create.js';
|
|
544
545
|
export * from './Interface/api/authentification/AuthenticationResponse.js';
|
|
545
546
|
export * from './Interface/api/exercice/ReadExercice.js';
|
|
@@ -939,6 +940,7 @@ export * from './Interface/api/calendarEvent/calendarEvent.js';
|
|
|
939
940
|
export * from './Interface/api/checklist/Read.js';
|
|
940
941
|
export * from './Interface/api/checklist/Query.js';
|
|
941
942
|
export * from './Interface/api/checklist/Update.js';
|
|
943
|
+
export * from './Interface/api/notification/CreateInternalNotification.js';
|
|
942
944
|
export * from './Interface/api/notification/CreateNotification.js';
|
|
943
945
|
export * from './Interface/api/notification/Delete.js';
|
|
944
946
|
export * from './Interface/api/notification/Update.js';
|
|
@@ -975,6 +977,7 @@ export * from './Interface/api/commercialManagement/Create.js';
|
|
|
975
977
|
export * from './Interface/api/commercialManagement/Read.js';
|
|
976
978
|
export * from './Interface/api/commercialManagement/Query.js';
|
|
977
979
|
export * from './Interface/api/commercialManagement/Update.js';
|
|
980
|
+
export * from './Interface/api/einvoicing/SyncFlowStatusResult.js';
|
|
978
981
|
export * from './Interface/api/commercialOffer/Query.js';
|
|
979
982
|
export * from './Interface/api/documentSection/Update.js';
|
|
980
983
|
export * from './Interface/api/connector/CreateConnector.js';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Vat } from '../types/Enum/Vat.js';
|
|
2
|
+
import { AcdVatCode } from '../types/Interface/api/acd/Vat.js';
|
|
3
|
+
|
|
4
|
+
export function idVatToAcdVatCode(idVat?: number | null): AcdVatCode | null {
|
|
5
|
+
if (!idVat) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const vat = Object.values(Vat).find((currentVat) => currentVat.id === idVat);
|
|
10
|
+
|
|
11
|
+
if (!vat) {
|
|
12
|
+
return AcdVatCode.NON_AFFECTE;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (vat.isVatIntracom) {
|
|
16
|
+
return AcdVatCode.INTRACOM;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (vat.isVatImportation) {
|
|
20
|
+
return AcdVatCode.AUTOL;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
switch (vat.value) {
|
|
24
|
+
case 2.1:
|
|
25
|
+
return AcdVatCode.REDUIT_2_1;
|
|
26
|
+
case 5.5:
|
|
27
|
+
return AcdVatCode.REDUIT_5_5;
|
|
28
|
+
case 10:
|
|
29
|
+
return AcdVatCode.REDUIT_10;
|
|
30
|
+
case 20:
|
|
31
|
+
return AcdVatCode.NORMAL;
|
|
32
|
+
case 0:
|
|
33
|
+
return null;
|
|
34
|
+
default:
|
|
35
|
+
return AcdVatCode.NON_AFFECTE;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function acdVatCodeToIdVat(acdVatCode?: AcdVatCode | null): number | null {
|
|
40
|
+
switch (acdVatCode) {
|
|
41
|
+
case AcdVatCode.NORMAL:
|
|
42
|
+
return Vat.TX_20.id;
|
|
43
|
+
case AcdVatCode.REDUIT_10:
|
|
44
|
+
return Vat.TX_10.id;
|
|
45
|
+
case AcdVatCode.REDUIT_5_5:
|
|
46
|
+
return Vat.TX_5_5.id;
|
|
47
|
+
case AcdVatCode.REDUIT_2_1:
|
|
48
|
+
return Vat.TX_2_1.id;
|
|
49
|
+
case AcdVatCode.INTRACOM:
|
|
50
|
+
// L'information de taux est perdue dans le code ACD, on retombe sur l'intracom a 20% par defaut.
|
|
51
|
+
return Vat.INTRACOM_TX_20.id;
|
|
52
|
+
case AcdVatCode.AUTOL:
|
|
53
|
+
// L'information de taux est perdue dans le code ACD, on retombe sur l'importation a 20% par defaut.
|
|
54
|
+
return Vat.IMPORTATION_TX_20.id;
|
|
55
|
+
case AcdVatCode.NON_AFFECTE:
|
|
56
|
+
case AcdVatCode.ONI:
|
|
57
|
+
case AcdVatCode.SUR_IMMOBILISATION:
|
|
58
|
+
case AcdVatCode.SPECIAL:
|
|
59
|
+
case null:
|
|
60
|
+
case undefined:
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
package/ts/utils/index.ts
CHANGED
|
@@ -20,5 +20,6 @@ export * from './bankAccount.js';
|
|
|
20
20
|
export * from './commercialOffer.js';
|
|
21
21
|
export * from './societyApproval.js';
|
|
22
22
|
export * from './commercialManagement/saleEmail.js';
|
|
23
|
+
export * from './acdVat.js';
|
|
23
24
|
export * from './transforms/boolean.transform.js';
|
|
24
25
|
export * from './transforms/number.transform.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { Vat } from '../../types/Enum/Vat.js';
|
|
3
|
+
import { AcdVatCode } from '../../types/Interface/api/acd/Vat.js';
|
|
4
|
+
import { acdVatCodeToIdVat, idVatToAcdVatCode } from '../acdVat.js';
|
|
5
|
+
|
|
6
|
+
describe('acdVat utils', () => {
|
|
7
|
+
test('should map internal VAT ids to ACD VAT codes', () => {
|
|
8
|
+
expect(idVatToAcdVatCode(Vat.TX_20.id)).toBe(AcdVatCode.NORMAL);
|
|
9
|
+
expect(idVatToAcdVatCode(Vat.TX_10.id)).toBe(AcdVatCode.REDUIT_10);
|
|
10
|
+
expect(idVatToAcdVatCode(Vat.TX_5_5.id)).toBe(AcdVatCode.REDUIT_5_5);
|
|
11
|
+
expect(idVatToAcdVatCode(Vat.TX_2_1.id)).toBe(AcdVatCode.REDUIT_2_1);
|
|
12
|
+
expect(idVatToAcdVatCode(Vat.INTRACOM_TX_20.id)).toBe(AcdVatCode.INTRACOM);
|
|
13
|
+
expect(idVatToAcdVatCode(Vat.IMPORTATION_TX_20.id)).toBe(AcdVatCode.AUTOL);
|
|
14
|
+
expect(idVatToAcdVatCode(Vat.WITHOUT_TAXE.id)).toBeNull();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('should map ACD VAT codes back to internal VAT ids', () => {
|
|
18
|
+
expect(acdVatCodeToIdVat(AcdVatCode.NORMAL)).toBe(Vat.TX_20.id);
|
|
19
|
+
expect(acdVatCodeToIdVat(AcdVatCode.REDUIT_10)).toBe(Vat.TX_10.id);
|
|
20
|
+
expect(acdVatCodeToIdVat(AcdVatCode.REDUIT_5_5)).toBe(Vat.TX_5_5.id);
|
|
21
|
+
expect(acdVatCodeToIdVat(AcdVatCode.REDUIT_2_1)).toBe(Vat.TX_2_1.id);
|
|
22
|
+
expect(acdVatCodeToIdVat(AcdVatCode.INTRACOM)).toBe(Vat.INTRACOM_TX_20.id);
|
|
23
|
+
expect(acdVatCodeToIdVat(AcdVatCode.AUTOL)).toBe(Vat.IMPORTATION_TX_20.id);
|
|
24
|
+
expect(acdVatCodeToIdVat(AcdVatCode.NON_AFFECTE)).toBeNull();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test, vi } from 'vitest';
|
|
2
|
+
import { getBrand, getBrandNameByNodeEnv, isItThisEnv } from '../brands.js';
|
|
3
|
+
|
|
4
|
+
afterEach(() => {
|
|
5
|
+
vi.restoreAllMocks();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe('brands utils', () => {
|
|
9
|
+
test('should fallback to Clementine for unknown environments', () => {
|
|
10
|
+
expect(getBrandNameByNodeEnv('my-custom-env')).toBe('Clementine');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('should keep explicit environment mapping for legalstart', () => {
|
|
14
|
+
expect(getBrandNameByNodeEnv('api.legalstart.fr')).toBe('Legalstart');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('should return Clementine brand by default in dev', () => {
|
|
18
|
+
const brand = getBrand({ nodeEnv: 'dev' });
|
|
19
|
+
|
|
20
|
+
expect(brand.name).toBe('Clementine');
|
|
21
|
+
expect(brand.idTypeBrand).toBe(1);
|
|
22
|
+
expect(isItThisEnv('Clementine', 'dev')).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('should return first legalstart brand when fixed idTypeBrand is not found', () => {
|
|
26
|
+
const brand = getBrand({ nodeEnv: 'legalstart' });
|
|
27
|
+
|
|
28
|
+
expect(brand.name).toBe('LegalStart');
|
|
29
|
+
expect(brand.idTypeBrand).toBe(1);
|
|
30
|
+
});
|
|
31
|
+
});
|