@silexpert/core 2.0.54 → 2.0.55
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/Docoon.d.ts +3 -1
- package/dist/api/resources/Docoon.d.ts.map +1 -1
- package/dist/api/resources/Docoon.js +6 -0
- package/dist/api/resources/Docoon.js.map +1 -1
- package/dist/types/Enum/ReasonNotSubscribed.d.ts.map +1 -1
- package/dist/types/Enum/ReasonNotSubscribed.js +12 -0
- package/dist/types/Enum/ReasonNotSubscribed.js.map +1 -1
- package/dist/types/Interface/api/config/ConfigType.d.ts +1 -0
- package/dist/types/Interface/api/config/ConfigType.d.ts.map +1 -1
- package/dist/types/Interface/api/config/ConfigType.js.map +1 -1
- package/dist/types/Interface/api/docoon/Create.d.ts +41 -0
- package/dist/types/Interface/api/docoon/Create.d.ts.map +1 -0
- package/dist/types/Interface/api/docoon/Create.js +2 -0
- package/dist/types/Interface/api/docoon/Create.js.map +1 -0
- package/dist/types/Interface/api/docoon/Read.d.ts +83 -26
- 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/kyc/Create.d.ts +2 -0
- package/dist/types/Interface/api/kyc/Create.d.ts.map +1 -1
- package/dist/types/Interface/api/kyc/Create.js +16 -0
- package/dist/types/Interface/api/kyc/Create.js.map +1 -1
- package/dist/types/Interface/models/IEInvoicingKycAndMandate.d.ts +1 -0
- package/dist/types/Interface/models/IEInvoicingKycAndMandate.d.ts.map +1 -1
- package/dist/types/Interface/models/IEInvoicingKycAndMandate.js +1 -0
- package/dist/types/Interface/models/IEInvoicingKycAndMandate.js.map +1 -1
- package/dist/types/Interface/models/ISociety.d.ts +3 -1
- package/dist/types/Interface/models/ISociety.d.ts.map +1 -1
- package/dist/types/Interface/models/ISociety.js +2 -0
- package/dist/types/Interface/models/ISociety.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/vat/registration.d.ts.map +1 -1
- package/dist/utils/vat/registration.js +16 -7
- package/dist/utils/vat/registration.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/Docoon.ts +15 -1
- package/ts/types/Enum/ReasonNotSubscribed.ts +12 -0
- package/ts/types/Interface/api/config/ConfigType.ts +1 -0
- package/ts/types/Interface/api/docoon/Create.ts +42 -0
- package/ts/types/Interface/api/docoon/Read.ts +91 -26
- package/ts/types/Interface/api/kyc/Create.ts +12 -0
- package/ts/types/Interface/models/IEInvoicingKycAndMandate.ts +1 -0
- package/ts/types/Interface/models/ISociety.ts +3 -0
- package/ts/types/index.ts +1 -0
- package/ts/utils/vat/registration.ts +19 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import { isDefined } from 'class-validator';
|
|
3
|
-
import { sumBy
|
|
3
|
+
import { sumBy } from 'lodash-es';
|
|
4
4
|
import { CerfaType, CustomerVatType, RegistrationState, RegistrationTickState, TaxType, } from '../../types/index.js';
|
|
5
5
|
const waitingState = {
|
|
6
6
|
state: RegistrationTickState.IN_PROGRESS,
|
|
@@ -79,12 +79,21 @@ export function getTicks(registration) {
|
|
|
79
79
|
date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,
|
|
80
80
|
details: [],
|
|
81
81
|
},
|
|
82
|
-
...
|
|
83
|
-
state
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
...[...declaration.states].reverse().map((d) => {
|
|
83
|
+
let state = d.isError ? RegistrationTickState.FAILED : RegistrationTickState.FINISHED;
|
|
84
|
+
if (d.isError && d.name === 'REJECTED_BY_RECIPIENT' && d.stateDetailsHistory) {
|
|
85
|
+
const hasAcceptedDeclaration = d.stateDetailsHistory.some((h) => !h.isError && (h.name?.toLowerCase().includes('accept') || h.label?.toLowerCase().includes('accept')));
|
|
86
|
+
if (hasAcceptedDeclaration) {
|
|
87
|
+
state = RegistrationTickState.FINISHED;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
state,
|
|
92
|
+
title: d.label ?? null,
|
|
93
|
+
details: d?.stateDetailsHistory,
|
|
94
|
+
date: d.date ?? null,
|
|
95
|
+
};
|
|
96
|
+
}),
|
|
88
97
|
];
|
|
89
98
|
for (let index = declaration.states.length; index < 3; index += 1) {
|
|
90
99
|
response.push({ ...waitingState, title: null });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../ts/utils/vat/registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAKL,SAAS,EACT,eAAe,EAMf,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,GACR,MAAM,sBAAsB,CAAC;AAG9B,MAAM,YAAY,GAAyB;IACzC,KAAK,EAAE,qBAAqB,CAAC,WAAW;IACxC,KAAK,EAAE,wBAAwB;IAC/B,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,YAA8B;IACrD,MAAM,YAAY,GAA2B,YAAY,CAAC,QAAQ,EAAE,YAAY,IAAI,EAAE,CAAC;IACvF,MAAM,OAAO,GAAyB,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;IAErE,IAAI,YAAY,CAAC,KAAK,KAAK,iBAAiB,CAAC,WAAW,EAAE,CAAC;QACzD,MAAM,IAAI,GAA6B,EAAE,CAAC;QAE1C,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG;gBACb;oBACE,I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AAE,CAAC;QACd,UAAU,EAAE,CAAC;KACd,CAAC;AACJ,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport { isDefined } from 'class-validator';\nimport { sumBy, reverse } from 'lodash-es';\nimport {\n AnyCerfa2571Century,\n AnyCerfa3310_Century,\n Cerfa2573_2024,\n Cerfa3514_2022,\n CerfaType,\n CustomerVatType,\n IRegistration,\n InterchangeHistory,\n ReadDeclaration,\n ReadRegistration,\n ReadRegistrationTick,\n RegistrationState,\n RegistrationTickState,\n TaxType,\n} from '../../types/index.js';\nimport { AnyCerfa3517Century } from '../../types/Interface/api/cerfa/3517.js';\n\nconst waitingState: ReadRegistrationTick = {\n state: RegistrationTickState.IN_PROGRESS,\n title: 'En cours de traitement',\n details: [],\n date: null,\n isPayment: false,\n};\n\nexport function getTicks(registration: ReadRegistration): ReadRegistrationTick[][] {\n const declarations: Array<ReadDeclaration> = registration.response?.declarations ?? [];\n const history: InterchangeHistory[] = registration.response?.history;\n\n if (registration.state === RegistrationState.IN_PROGRESS) {\n const data: ReadRegistrationTick[][] = [];\n\n declarations.forEach((declaration) => {\n const result = [\n {\n type:\n isDefined(declaration?.type) && isDefined(declaration?.declarationType?.label)\n ? `${declaration?.type} - ${declaration?.declarationType?.label}`\n : null,\n state: RegistrationTickState.FINISHED,\n title: 'Déclaration envoyée',\n details: [],\n date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,\n isPayment: false,\n },\n waitingState,\n waitingState,\n waitingState,\n ];\n\n if (registration.amountToPay && registration.amountToPay > 0) {\n result.push({\n ...waitingState,\n isPayment: true,\n });\n }\n\n data.push(result);\n });\n\n return data;\n }\n if ([RegistrationState.ACCEPTED, RegistrationState.REFUSED].includes(registration.state)) {\n const data: ReadRegistrationTick[][] = [];\n\n if (!declarations.length) {\n const response: ReadRegistrationTick[] = [\n {\n type: null,\n state: RegistrationTickState.FINISHED,\n title: 'Déclaration envoyée',\n date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,\n details: [],\n },\n {\n state: RegistrationTickState.FAILED,\n title: history?.find((h) => h.isError)?.label ?? '',\n details: history?.find((h) => h.isError)?.stateDetailsHistory ?? [],\n date: history?.find((h) => h.isError)?.date ?? null,\n },\n waitingState,\n waitingState,\n ];\n\n if (registration.amountToPay && registration.amountToPay > 0) {\n response.push({\n ...waitingState,\n isPayment: true,\n });\n }\n\n data.push(response);\n }\n\n declarations.forEach((declaration) => {\n const response: ReadRegistrationTick[] = [\n {\n type:\n isDefined(declaration?.type) && isDefined(declaration?.declarationType?.label)\n ? `${declaration?.type} - ${declaration?.declarationType?.label}`\n : null,\n state: RegistrationTickState.FINISHED,\n title: 'Déclaration envoyée',\n date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,\n details: [],\n },\n ...reverse(declaration.states).map((d: InterchangeHistory) => ({\n state: d.isError ? RegistrationTickState.FAILED : RegistrationTickState.FINISHED,\n title: d.label ?? null,\n details: d?.stateDetailsHistory,\n date: d.date ?? null,\n })),\n ];\n\n for (let index = declaration.states.length; index < 3; index += 1) {\n response.push({ ...waitingState, title: null });\n }\n\n if (isDefined(declaration.payment)) {\n response.push({\n state: declaration.payment.isError\n ? RegistrationTickState.FAILED\n : declaration.payment.isError === null\n ? RegistrationTickState.IN_PROGRESS\n : RegistrationTickState.FINISHED,\n title: declaration.payment?.label ?? '',\n details: [],\n isPayment: true,\n date: declaration.payment.date ?? null,\n });\n }\n data.push(response);\n });\n\n return data;\n }\n\n return [];\n}\n\nexport function getTypeAndAmountFromRegistration(registration: IRegistration): {\n type: CustomerVatType | null;\n amount: number | null;\n collectable: number;\n deductible: number;\n amountBase?: number;\n regulationAdd?: number;\n regulationDeduct?: number;\n reportFromPrevious?: number;\n} {\n if (registration.idCerfaType === CerfaType.CERFA_3310) {\n const payload = registration.payload.cerfa3310 as AnyCerfa3310_Century;\n const other = {\n collectable: payload.vat?.grossDue,\n deductible: payload.vat?.deductible.total,\n regulationAdd: payload.vat?.sumToAdd,\n regulationDeduct: payload.vat?.deductible?.toImpute,\n reportFromPrevious: payload.vat?.deductible?.report,\n };\n if (payload?.isNil) return { type: CustomerVatType.VAT_TO_NIL, amount: 0, ...other };\n if (payload?.toPay?.total > 0) return { type: CustomerVatType.VAT_TO_PAY, amount: payload.toPay.total, ...other };\n if (payload?.credit?.refundAsked > 0)\n return { type: CustomerVatType.VAT_REFUND, amount: payload.credit.refundAsked, ...other };\n if (payload?.credit?.toReport > 0)\n return { type: CustomerVatType.VAT_REPORT, amount: payload.credit.toReport, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n }\n if (registration.idCerfaType === CerfaType.CERFA_3514) {\n const payload = registration.payload.cerfa3514 as Cerfa3514_2022;\n const other = { collectable: payload.vatAmountCollected, deductible: payload.vatAmountDeductible };\n if (payload?.vatAmountToPay > 0)\n return { type: CustomerVatType.VAT_TO_PAY, amount: payload.vatAmountToPay, ...other };\n if (payload?.vatRefundedOnInvests)\n return { type: CustomerVatType.VAT_REFUND, amount: payload.vatRefundedOnInvests, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n }\n if (registration.idCerfaType === CerfaType.CERFA_3517) {\n const payload = registration.payload.cerfa3517 as AnyCerfa3517Century;\n const other = {\n collectable: payload.other.total,\n deductible: payload.deductible.total,\n amountBase: payload?.total,\n };\n if (payload?.isNil) return { type: CustomerVatType.VAT_TO_NIL, amount: 0, ...other };\n if (payload?.recapitulation?.toPay > 0)\n return { type: CustomerVatType.VAT_TO_PAY, amount: payload?.recapitulation?.toPay, ...other };\n if (payload?.recapitulation?.refund > 0)\n return { type: CustomerVatType.VAT_REFUND, amount: payload?.recapitulation?.refund, ...other };\n if (payload?.recapitulation?.creditToReport > 0 || payload?.recapitulation?.imputedCredit > 0)\n return {\n type: CustomerVatType.VAT_REPORT,\n amount: payload?.recapitulation?.creditToReport ?? payload?.recapitulation?.imputedCredit,\n ...other,\n };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n }\n if (\n [\n CerfaType.CERFA_2571_2023_A,\n CerfaType.CERFA_2571_2023_B,\n CerfaType.CERFA_2571_2023_C,\n CerfaType.CERFA_2571_2023_D,\n ].includes(registration.idCerfaType)\n ) {\n const payload = registration.payload.cerfa2571 as AnyCerfa2571Century;\n\n if (registration.customerIsRegime?.type === TaxType.TO_PAY) {\n return {\n type: CustomerVatType.VAT_TO_PAY,\n amount: payload.companyTax.toPay.total,\n collectable: 0,\n deductible: 0,\n };\n } else if (registration.customerIsRegime?.type === TaxType.REFUND) {\n return {\n type: CustomerVatType.VAT_REFUND,\n amount: registration.customerIsRegime?.amount,\n collectable: 0,\n deductible: 0,\n };\n } else if (registration.customerIsRegime?.type === TaxType.REPORTABLE) {\n return {\n type: CustomerVatType.VAT_REPORT,\n amount: registration.customerIsRegime?.amount,\n collectable: 0,\n deductible: 0,\n };\n }\n\n return { type: CustomerVatType.VAT_TO_PAY, amount: payload.companyTax.toPay.total, collectable: 0, deductible: 0 };\n }\n if ([CerfaType.CERFA_2573].includes(registration.idCerfaType)) {\n const payload = registration.payload?.cerfa2573 as Cerfa2573_2024;\n return {\n type: CustomerVatType.VAT_REFUND,\n amount: sumBy(payload?.refunds ?? [], (r) => r?.amount ?? 0),\n collectable: 0,\n deductible: 0,\n };\n }\n\n return {\n type: null,\n amount: null,\n collectable: 0,\n deductible: 0,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../ts/utils/vat/registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAKL,SAAS,EACT,eAAe,EAMf,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,GACR,MAAM,sBAAsB,CAAC;AAG9B,MAAM,YAAY,GAAyB;IACzC,KAAK,EAAE,qBAAqB,CAAC,WAAW;IACxC,KAA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AChC,MAAM,EAAE,YAAY,CAAC,gBAAgB,EAAE,MAAM;gBAC7C,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,CAAC;aACd,CAAC;QACJ,CAAC;aAAM,IAAI,YAAY,CAAC,gBAAgB,EAAE,IAAI,KAAK,OAAO,CAAC,UAAU,EAAE,CAAC;YACtE,OAAO;gBACL,IAAI,EAAE,eAAe,CAAC,UAAU;gBAChC,MAAM,EAAE,YAAY,CAAC,gBAAgB,EAAE,MAAM;gBAC7C,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,CAAC;aACd,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IACrH,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9D,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,SAA2B,CAAC;QAClE,OAAO;YACL,IAAI,EAAE,eAAe,CAAC,UAAU;YAChC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;YAC5D,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,CAAC;SACd,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;KACd,CAAC;AACJ,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport { isDefined } from 'class-validator';\nimport { sumBy } from 'lodash-es';\nimport {\n AnyCerfa2571Century,\n AnyCerfa3310_Century,\n Cerfa2573_2024,\n Cerfa3514_2022,\n CerfaType,\n CustomerVatType,\n IRegistration,\n InterchangeHistory,\n ReadDeclaration,\n ReadRegistration,\n ReadRegistrationTick,\n RegistrationState,\n RegistrationTickState,\n TaxType,\n} from '../../types/index.js';\nimport { AnyCerfa3517Century } from '../../types/Interface/api/cerfa/3517.js';\n\nconst waitingState: ReadRegistrationTick = {\n state: RegistrationTickState.IN_PROGRESS,\n title: 'En cours de traitement',\n details: [],\n date: null,\n isPayment: false,\n};\n\nexport function getTicks(registration: ReadRegistration): ReadRegistrationTick[][] {\n const declarations: Array<ReadDeclaration> = registration.response?.declarations ?? [];\n const history: InterchangeHistory[] = registration.response?.history;\n\n if (registration.state === RegistrationState.IN_PROGRESS) {\n const data: ReadRegistrationTick[][] = [];\n\n declarations.forEach((declaration) => {\n const result = [\n {\n type:\n isDefined(declaration?.type) && isDefined(declaration?.declarationType?.label)\n ? `${declaration?.type} - ${declaration?.declarationType?.label}`\n : null,\n state: RegistrationTickState.FINISHED,\n title: 'Déclaration envoyée',\n details: [],\n date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,\n isPayment: false,\n },\n waitingState,\n waitingState,\n waitingState,\n ];\n\n if (registration.amountToPay && registration.amountToPay > 0) {\n result.push({\n ...waitingState,\n isPayment: true,\n });\n }\n\n data.push(result);\n });\n\n return data;\n }\n if ([RegistrationState.ACCEPTED, RegistrationState.REFUSED].includes(registration.state)) {\n const data: ReadRegistrationTick[][] = [];\n\n if (!declarations.length) {\n const response: ReadRegistrationTick[] = [\n {\n type: null,\n state: RegistrationTickState.FINISHED,\n title: 'Déclaration envoyée',\n date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,\n details: [],\n },\n {\n state: RegistrationTickState.FAILED,\n title: history?.find((h) => h.isError)?.label ?? '',\n details: history?.find((h) => h.isError)?.stateDetailsHistory ?? [],\n date: history?.find((h) => h.isError)?.date ?? null,\n },\n waitingState,\n waitingState,\n ];\n\n if (registration.amountToPay && registration.amountToPay > 0) {\n response.push({\n ...waitingState,\n isPayment: true,\n });\n }\n\n data.push(response);\n }\n\n declarations.forEach((declaration) => {\n const response: ReadRegistrationTick[] = [\n {\n type:\n isDefined(declaration?.type) && isDefined(declaration?.declarationType?.label)\n ? `${declaration?.type} - ${declaration?.declarationType?.label}`\n : null,\n state: RegistrationTickState.FINISHED,\n title: 'Déclaration envoyée',\n date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,\n details: [],\n },\n ...[...declaration.states].reverse().map((d: InterchangeHistory) => {\n let state = d.isError ? RegistrationTickState.FAILED : RegistrationTickState.FINISHED;\n if (d.isError && d.name === 'REJECTED_BY_RECIPIENT' && d.stateDetailsHistory) {\n const hasAcceptedDeclaration = d.stateDetailsHistory.some(\n (h) =>\n !h.isError && (h.name?.toLowerCase().includes('accept') || h.label?.toLowerCase().includes('accept')),\n );\n if (hasAcceptedDeclaration) {\n state = RegistrationTickState.FINISHED;\n }\n }\n return {\n state,\n title: d.label ?? null,\n details: d?.stateDetailsHistory,\n date: d.date ?? null,\n };\n }),\n ];\n\n for (let index = declaration.states.length; index < 3; index += 1) {\n response.push({ ...waitingState, title: null });\n }\n\n if (isDefined(declaration.payment)) {\n response.push({\n state: declaration.payment.isError\n ? RegistrationTickState.FAILED\n : declaration.payment.isError === null\n ? RegistrationTickState.IN_PROGRESS\n : RegistrationTickState.FINISHED,\n title: declaration.payment?.label ?? '',\n details: [],\n isPayment: true,\n date: declaration.payment.date ?? null,\n });\n }\n data.push(response);\n });\n\n return data;\n }\n\n return [];\n}\n\nexport function getTypeAndAmountFromRegistration(registration: IRegistration): {\n type: CustomerVatType | null;\n amount: number | null;\n collectable: number;\n deductible: number;\n amountBase?: number;\n regulationAdd?: number;\n regulationDeduct?: number;\n reportFromPrevious?: number;\n} {\n if (registration.idCerfaType === CerfaType.CERFA_3310) {\n const payload = registration.payload.cerfa3310 as AnyCerfa3310_Century;\n const other = {\n collectable: payload.vat?.grossDue,\n deductible: payload.vat?.deductible.total,\n regulationAdd: payload.vat?.sumToAdd,\n regulationDeduct: payload.vat?.deductible?.toImpute,\n reportFromPrevious: payload.vat?.deductible?.report,\n };\n if (payload?.isNil) return { type: CustomerVatType.VAT_TO_NIL, amount: 0, ...other };\n if (payload?.toPay?.total > 0) return { type: CustomerVatType.VAT_TO_PAY, amount: payload.toPay.total, ...other };\n if (payload?.credit?.refundAsked > 0)\n return { type: CustomerVatType.VAT_REFUND, amount: payload.credit.refundAsked, ...other };\n if (payload?.credit?.toReport > 0)\n return { type: CustomerVatType.VAT_REPORT, amount: payload.credit.toReport, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n }\n if (registration.idCerfaType === CerfaType.CERFA_3514) {\n const payload = registration.payload.cerfa3514 as Cerfa3514_2022;\n const other = { collectable: payload.vatAmountCollected, deductible: payload.vatAmountDeductible };\n if (payload?.vatAmountToPay > 0)\n return { type: CustomerVatType.VAT_TO_PAY, amount: payload.vatAmountToPay, ...other };\n if (payload?.vatRefundedOnInvests)\n return { type: CustomerVatType.VAT_REFUND, amount: payload.vatRefundedOnInvests, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n }\n if (registration.idCerfaType === CerfaType.CERFA_3517) {\n const payload = registration.payload.cerfa3517 as AnyCerfa3517Century;\n const other = {\n collectable: payload.other.total,\n deductible: payload.deductible.total,\n amountBase: payload?.total,\n };\n if (payload?.isNil) return { type: CustomerVatType.VAT_TO_NIL, amount: 0, ...other };\n if (payload?.recapitulation?.toPay > 0)\n return { type: CustomerVatType.VAT_TO_PAY, amount: payload?.recapitulation?.toPay, ...other };\n if (payload?.recapitulation?.refund > 0)\n return { type: CustomerVatType.VAT_REFUND, amount: payload?.recapitulation?.refund, ...other };\n if (payload?.recapitulation?.creditToReport > 0 || payload?.recapitulation?.imputedCredit > 0)\n return {\n type: CustomerVatType.VAT_REPORT,\n amount: payload?.recapitulation?.creditToReport ?? payload?.recapitulation?.imputedCredit,\n ...other,\n };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n }\n if (\n [\n CerfaType.CERFA_2571_2023_A,\n CerfaType.CERFA_2571_2023_B,\n CerfaType.CERFA_2571_2023_C,\n CerfaType.CERFA_2571_2023_D,\n ].includes(registration.idCerfaType)\n ) {\n const payload = registration.payload.cerfa2571 as AnyCerfa2571Century;\n\n if (registration.customerIsRegime?.type === TaxType.TO_PAY) {\n return {\n type: CustomerVatType.VAT_TO_PAY,\n amount: payload.companyTax.toPay.total,\n collectable: 0,\n deductible: 0,\n };\n } else if (registration.customerIsRegime?.type === TaxType.REFUND) {\n return {\n type: CustomerVatType.VAT_REFUND,\n amount: registration.customerIsRegime?.amount,\n collectable: 0,\n deductible: 0,\n };\n } else if (registration.customerIsRegime?.type === TaxType.REPORTABLE) {\n return {\n type: CustomerVatType.VAT_REPORT,\n amount: registration.customerIsRegime?.amount,\n collectable: 0,\n deductible: 0,\n };\n }\n\n return { type: CustomerVatType.VAT_TO_PAY, amount: payload.companyTax.toPay.total, collectable: 0, deductible: 0 };\n }\n if ([CerfaType.CERFA_2573].includes(registration.idCerfaType)) {\n const payload = registration.payload?.cerfa2573 as Cerfa2573_2024;\n return {\n type: CustomerVatType.VAT_REFUND,\n amount: sumBy(payload?.refunds ?? [], (r) => r?.amount ?? 0),\n collectable: 0,\n deductible: 0,\n };\n }\n\n return {\n type: null,\n amount: null,\n collectable: 0,\n deductible: 0,\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
QueryDirectoryLine,
|
|
3
|
+
ReadDirectoryLine,
|
|
4
|
+
ReadDocoonDirectoryLineAdded,
|
|
5
|
+
ReadDocoonTenantDirectoryLines,
|
|
6
|
+
RelaunchDirectoryLine,
|
|
7
|
+
} from '../../types/index.js';
|
|
2
8
|
import { Resource } from '../Resource.js';
|
|
3
9
|
|
|
4
10
|
export class Docoon extends Resource {
|
|
@@ -9,4 +15,12 @@ export class Docoon extends Resource {
|
|
|
9
15
|
getDirectoyLineForSociety(idSociety: number, params: QueryDirectoryLine): Promise<ReadDirectoryLine> {
|
|
10
16
|
return this.axios.$get(`/societies/${idSociety}/docoon/directory-line`, { params });
|
|
11
17
|
}
|
|
18
|
+
|
|
19
|
+
getDirectoryLinesById(idSociety: number): Promise<ReadDocoonTenantDirectoryLines> {
|
|
20
|
+
return this.axios.$get(`/societies/${idSociety}/docoon/tenant/directory-line`, {});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
relaunchDirectoryLine(params: RelaunchDirectoryLine): Promise<ReadDocoonDirectoryLineAdded> {
|
|
24
|
+
return this.axios.$post('docoon/directory-line/relauch', params);
|
|
25
|
+
}
|
|
12
26
|
}
|
|
@@ -221,4 +221,16 @@ export const ReasonNotSubscribed = [
|
|
|
221
221
|
hidden: false,
|
|
222
222
|
isOver: null,
|
|
223
223
|
},
|
|
224
|
+
{
|
|
225
|
+
id: 39,
|
|
226
|
+
text: 'Logiciel facturation seul',
|
|
227
|
+
hidden: false,
|
|
228
|
+
isOver: [40],
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: 40,
|
|
232
|
+
text: 'Envoyé Teamsystem',
|
|
233
|
+
hidden: false,
|
|
234
|
+
isOver: null,
|
|
235
|
+
},
|
|
224
236
|
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type CreateLegalEntity = {
|
|
2
|
+
name: string;
|
|
3
|
+
legalId: string;
|
|
4
|
+
isEnabled: boolean;
|
|
5
|
+
legalIdSchemeId?: string;
|
|
6
|
+
code?: string;
|
|
7
|
+
isTaxable?: boolean;
|
|
8
|
+
taxCountryCode?: string;
|
|
9
|
+
personType?: 'PRIVATE_PERSON' | 'MORAL_PERSON_PRIVATE' | 'MORAL_PERSON_PUBLIC';
|
|
10
|
+
taxId?: string;
|
|
11
|
+
legalForm?: string;
|
|
12
|
+
capital?: number;
|
|
13
|
+
structures?: CreateLegalEntiyStructure[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type CreateLegalEntiyStructure = {
|
|
17
|
+
legalIdSchemeId?: string;
|
|
18
|
+
isEnabled?: boolean;
|
|
19
|
+
address?: {
|
|
20
|
+
name?: string;
|
|
21
|
+
street?: string;
|
|
22
|
+
city?: string;
|
|
23
|
+
zipCode?: string;
|
|
24
|
+
postBox?: string;
|
|
25
|
+
additionalInfo?: string;
|
|
26
|
+
country?: string;
|
|
27
|
+
};
|
|
28
|
+
mainActivity?: {
|
|
29
|
+
name?: string;
|
|
30
|
+
code?: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type RelaunchDirectoryLine = {
|
|
35
|
+
directoryLineId: string;
|
|
36
|
+
directoryLineInfo: {
|
|
37
|
+
name: string;
|
|
38
|
+
dateFrom: string;
|
|
39
|
+
dateTo?: string | null;
|
|
40
|
+
addressingIdentifier: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -101,54 +101,119 @@ export interface ReadDocoonLegalEntity {
|
|
|
101
101
|
legalId: string;
|
|
102
102
|
legalIdSchemeId: string;
|
|
103
103
|
taxCountryCode: string;
|
|
104
|
-
taxId
|
|
104
|
+
taxId?: string;
|
|
105
105
|
legalForm: string;
|
|
106
106
|
capital: string;
|
|
107
|
-
outsideReform:
|
|
107
|
+
outsideReform: boolean;
|
|
108
108
|
isEnabled: boolean;
|
|
109
|
+
isTaxable: boolean;
|
|
110
|
+
personType: 'PRIVATE_PERSON' | 'MORAL_PERSON_PRIVATE' | 'MORAL_PERSON_PUBLIC';
|
|
109
111
|
primaryStructureId: string;
|
|
110
|
-
parentStructureId: string;
|
|
112
|
+
parentStructureId: string | null;
|
|
111
113
|
structures: {
|
|
112
114
|
id: string;
|
|
113
|
-
code: string;
|
|
114
|
-
name: string;
|
|
115
|
+
code: string | null;
|
|
116
|
+
name: string | null;
|
|
115
117
|
tenantId: string;
|
|
116
118
|
legalId: string;
|
|
117
119
|
legalIdSchemeId: string;
|
|
118
|
-
isEnabled:
|
|
120
|
+
isEnabled: boolean;
|
|
119
121
|
parentStructureId: string;
|
|
120
|
-
countryCode: string;
|
|
121
|
-
startDate: string;
|
|
122
|
-
endDate: string;
|
|
123
|
-
structureType: string;
|
|
122
|
+
countryCode: string | null;
|
|
123
|
+
startDate: string | null;
|
|
124
|
+
endDate: string | null;
|
|
125
|
+
structureType: string | null;
|
|
124
126
|
address: {
|
|
125
|
-
name: string;
|
|
126
|
-
street: string;
|
|
127
|
-
zipCode: string;
|
|
128
|
-
postBox: string;
|
|
129
|
-
city: string;
|
|
130
|
-
additionalInfo: string;
|
|
131
|
-
country: string;
|
|
127
|
+
name: string | null;
|
|
128
|
+
street: string | null;
|
|
129
|
+
zipCode: string | null;
|
|
130
|
+
postBox: string | null;
|
|
131
|
+
city: string | null;
|
|
132
|
+
additionalInfo: string | null;
|
|
133
|
+
country: string | null;
|
|
132
134
|
};
|
|
133
135
|
mainActivity: {
|
|
134
|
-
name: string;
|
|
135
|
-
code: string;
|
|
136
|
+
name: string | null;
|
|
137
|
+
code: string | null;
|
|
136
138
|
};
|
|
137
|
-
};
|
|
139
|
+
}[];
|
|
138
140
|
pdpProperties: {
|
|
139
|
-
isVerified:
|
|
140
|
-
isMandated:
|
|
141
|
+
isVerified: boolean;
|
|
142
|
+
isMandated: boolean;
|
|
141
143
|
verifiedDate: string;
|
|
142
144
|
pdpDirection: {
|
|
143
|
-
outBound:
|
|
144
|
-
inBound:
|
|
145
|
+
outBound: boolean;
|
|
146
|
+
inBound: boolean;
|
|
145
147
|
};
|
|
146
148
|
taxation: {
|
|
147
|
-
isSingleTaxPayer:
|
|
149
|
+
isSingleTaxPayer: boolean;
|
|
148
150
|
singleTaxPayerStructureId: string;
|
|
149
151
|
taxSystem: string;
|
|
150
152
|
taxRegime: string;
|
|
151
153
|
};
|
|
152
|
-
pdpMandates: string;
|
|
154
|
+
pdpMandates: string[];
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface ReadDocoonLegalEntityListResponse {
|
|
159
|
+
data: {
|
|
160
|
+
legalEntityList: {
|
|
161
|
+
edges: ReadDocoonLegalEntity[];
|
|
162
|
+
pageInfo: {
|
|
163
|
+
hasNextPage: boolean;
|
|
164
|
+
endCursor: string | null;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface ReadDocoonLegalEntityResponse {
|
|
171
|
+
data: {
|
|
172
|
+
legalEntityItems: ReadDocoonLegalEntity[];
|
|
153
173
|
};
|
|
154
174
|
}
|
|
175
|
+
|
|
176
|
+
export interface ReadDocoonMandateResponse {
|
|
177
|
+
data: {
|
|
178
|
+
addDocumentJob: ReadDocoonMandate;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface ReadDocoonMandate {
|
|
183
|
+
id: string;
|
|
184
|
+
tenantId: string;
|
|
185
|
+
trackingId: string;
|
|
186
|
+
documents: ReadDocoonMandateDocument[];
|
|
187
|
+
attachments: any[];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export type ReadDocoonMandateDocument = {
|
|
191
|
+
id: string;
|
|
192
|
+
hash: string;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export interface ReadDocoonLegalEntityWithMandateResponse {
|
|
196
|
+
data: {
|
|
197
|
+
runActionOnLegalEntity: string;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface ReadDocoonDirectoryLineAdded {
|
|
202
|
+
id: string;
|
|
203
|
+
creationDate: string;
|
|
204
|
+
lastModificationDate: string;
|
|
205
|
+
tenantId: string;
|
|
206
|
+
structureId: string;
|
|
207
|
+
name: string;
|
|
208
|
+
addressingIdentifier: string;
|
|
209
|
+
status: string;
|
|
210
|
+
message: string;
|
|
211
|
+
dateFrom: string;
|
|
212
|
+
dateTo: string | null;
|
|
213
|
+
flowError: string | null;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface ReadDocoonTenantDirectoryLines {
|
|
217
|
+
tenantId: string;
|
|
218
|
+
directoryLines: ReadDocoonDirectoryLineAdded[];
|
|
219
|
+
}
|
|
@@ -42,6 +42,12 @@ export class CreateUserKyc {
|
|
|
42
42
|
@IsString()
|
|
43
43
|
@IsOptional()
|
|
44
44
|
eInvoiceAddress?: string;
|
|
45
|
+
|
|
46
|
+
@ApiPropertyOptional()
|
|
47
|
+
@IsBoolean()
|
|
48
|
+
@ToBoolean()
|
|
49
|
+
@IsOptional()
|
|
50
|
+
mobileRedirection?: boolean;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
export class FinishProcess {
|
|
@@ -63,6 +69,12 @@ export class FinishProcess {
|
|
|
63
69
|
@ApiProperty()
|
|
64
70
|
@IsObject()
|
|
65
71
|
metadata: FinishProcessMetadata;
|
|
72
|
+
|
|
73
|
+
@ApiPropertyOptional()
|
|
74
|
+
@IsBoolean()
|
|
75
|
+
@ToBoolean()
|
|
76
|
+
@IsOptional()
|
|
77
|
+
bypassDocumentSent?: boolean;
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
export type FinishProcessMetadata = {
|
|
@@ -12,6 +12,7 @@ export class IEInvoicingKycAndMandate {
|
|
|
12
12
|
mandateStatus?: string | null; // COMPLETED | REJECTED
|
|
13
13
|
onboardingStatus?: string | null; // DRAFT | IN_PROGRESS | COMPLETED | REJECTED | ACTION_NEEDED | EXPIRED | CANCELLED
|
|
14
14
|
sentToDocoon: boolean;
|
|
15
|
+
docoonDirectoryLineId?: string | null; // id at docoon
|
|
15
16
|
idSociety: number;
|
|
16
17
|
idMandateFile?: number | null;
|
|
17
18
|
idKycControlReportFile?: number | null;
|
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
IRegulation,
|
|
62
62
|
IGeneralConditionOfSale,
|
|
63
63
|
IConstitutionHistory,
|
|
64
|
+
IEInvoicingKycAndMandate,
|
|
64
65
|
} from '../../index.js';
|
|
65
66
|
import { IBrandType } from './IBrandType.js';
|
|
66
67
|
import { IFile } from './IFile.js';
|
|
@@ -143,6 +144,7 @@ export class ISociety {
|
|
|
143
144
|
isCreatedInApp?: number;
|
|
144
145
|
passwordIsuite?: string | null;
|
|
145
146
|
unpaidState?: number | null;
|
|
147
|
+
informationFromKycLockedDate?: Date | null;
|
|
146
148
|
|
|
147
149
|
// Associations
|
|
148
150
|
accounts?: IAccount[];
|
|
@@ -207,4 +209,5 @@ export class ISociety {
|
|
|
207
209
|
businessSectors?: IBusinessSector[];
|
|
208
210
|
calendarEvents?: ICalendarEvent[];
|
|
209
211
|
constitutionHistories?: IConstitutionHistory[];
|
|
212
|
+
kycMandate?: IEInvoicingKycAndMandate[];
|
|
210
213
|
}
|
package/ts/types/index.ts
CHANGED
|
@@ -1175,6 +1175,7 @@ export * from './Interface/api/webex/WebexRegistrant.js';
|
|
|
1175
1175
|
export * from './Interface/api/bankAccount/Benchmark.js';
|
|
1176
1176
|
export * from './Interface/api/docoon/Query.js';
|
|
1177
1177
|
export * from './Interface/api/docoon/Read.js';
|
|
1178
|
+
export * from './Interface/api/docoon/Create.js';
|
|
1178
1179
|
export * from './Interface/api/authentification/FinalizeMobileApprovalDto.js';
|
|
1179
1180
|
export * from './Interface/api/formalism/Create.js';
|
|
1180
1181
|
export * from './Interface/api/authentification/ProviderAuthDto.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import { isDefined } from 'class-validator';
|
|
3
|
-
import { sumBy
|
|
3
|
+
import { sumBy } from 'lodash-es';
|
|
4
4
|
import {
|
|
5
5
|
AnyCerfa2571Century,
|
|
6
6
|
AnyCerfa3310_Century,
|
|
@@ -108,12 +108,24 @@ export function getTicks(registration: ReadRegistration): ReadRegistrationTick[]
|
|
|
108
108
|
date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,
|
|
109
109
|
details: [],
|
|
110
110
|
},
|
|
111
|
-
...
|
|
112
|
-
state
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
...[...declaration.states].reverse().map((d: InterchangeHistory) => {
|
|
112
|
+
let state = d.isError ? RegistrationTickState.FAILED : RegistrationTickState.FINISHED;
|
|
113
|
+
if (d.isError && d.name === 'REJECTED_BY_RECIPIENT' && d.stateDetailsHistory) {
|
|
114
|
+
const hasAcceptedDeclaration = d.stateDetailsHistory.some(
|
|
115
|
+
(h) =>
|
|
116
|
+
!h.isError && (h.name?.toLowerCase().includes('accept') || h.label?.toLowerCase().includes('accept')),
|
|
117
|
+
);
|
|
118
|
+
if (hasAcceptedDeclaration) {
|
|
119
|
+
state = RegistrationTickState.FINISHED;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
state,
|
|
124
|
+
title: d.label ?? null,
|
|
125
|
+
details: d?.stateDetailsHistory,
|
|
126
|
+
date: d.date ?? null,
|
|
127
|
+
};
|
|
128
|
+
}),
|
|
117
129
|
];
|
|
118
130
|
|
|
119
131
|
for (let index = declaration.states.length; index < 3; index += 1) {
|