@silexpert/core 1.1.42 → 1.1.46

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 (29) hide show
  1. package/es/types/Interface/api/aspone/ReadInterchange.d.ts +1 -1
  2. package/es/types/Interface/api/aspone/ReadInterchange.d.ts.map +1 -1
  3. package/es/types/Interface/api/aspone/ReadInterchange.js.map +1 -1
  4. package/es/types/Interface/api/cerfa/ReadCerfa.d.ts +4 -0
  5. package/es/types/Interface/api/cerfa/ReadCerfa.d.ts.map +1 -1
  6. package/es/types/Interface/api/cerfa/ReadCerfa.js.map +1 -1
  7. package/es/utils/vat/3310/century23.d.ts.map +1 -1
  8. package/es/utils/vat/3310/century23.js +112 -87
  9. package/es/utils/vat/3310/century23.js.map +1 -1
  10. package/es/utils/vat/3517/century23.d.ts +2 -35
  11. package/es/utils/vat/3517/century23.d.ts.map +1 -1
  12. package/es/utils/vat/3517/century23.js +167 -165
  13. package/es/utils/vat/3517/century23.js.map +1 -1
  14. package/es/utils/vat/registration.js +2 -2
  15. package/es/utils/vat/registration.js.map +1 -1
  16. package/js/types/Interface/api/aspone/ReadInterchange.js.map +1 -1
  17. package/js/types/Interface/api/cerfa/ReadCerfa.js.map +1 -1
  18. package/js/utils/vat/3310/century23.js +114 -77
  19. package/js/utils/vat/3310/century23.js.map +1 -1
  20. package/js/utils/vat/3517/century23.js +144 -140
  21. package/js/utils/vat/3517/century23.js.map +1 -1
  22. package/js/utils/vat/registration.js +2 -2
  23. package/js/utils/vat/registration.js.map +1 -1
  24. package/package.json +1 -1
  25. package/ts/types/Interface/api/aspone/ReadInterchange.ts +1 -1
  26. package/ts/types/Interface/api/cerfa/ReadCerfa.ts +2 -1
  27. package/ts/utils/vat/3310/century23.ts +128 -87
  28. package/ts/utils/vat/3517/century23.ts +170 -162
  29. package/ts/utils/vat/registration.ts +2 -2
@@ -20,7 +20,7 @@ export function getTicks(registration) {
20
20
  state: RegistrationTickState.FINISHED,
21
21
  title: 'Déclaration envoyée',
22
22
  details: [],
23
- date: registration.sendAt ? dayjs(registration.sendAt).format('YYYY-MM-DD') : null,
23
+ date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,
24
24
  isPayment: false,
25
25
  },
26
26
  waitingState,
@@ -42,7 +42,7 @@ export function getTicks(registration) {
42
42
  {
43
43
  state: RegistrationTickState.FINISHED,
44
44
  title: 'Déclaration envoyée',
45
- date: registration.sendAt ? dayjs(registration.sendAt).format('YYYY-MM-DD') : null,
45
+ date: registration.sendAt ? dayjs(registration.sendAt).toISOString() : null,
46
46
  details: [],
47
47
  },
48
48
  ...reverse(declaration.states).map((d) => {
@@ -1 +1 @@
1
- {"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../ts/utils/vat/registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAGL,SAAS,EACT,eAAe,EAIyB,iBAAiB,EAAE,qBAAqB,GACjF,MAAM,aAAa,CAAC;AAGrB,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,MAAA,MAAA,YAAY,CAAC,QAAQ,0CAAE,YAAY,mCAAI,EAAE,CAAC;IAEvF,IAAI,YAAY,CAAC,KAAK,KAAK,iBAAiB,CAAC,WAAW,EAAE;QACxD,MAAM,IAAI,GAA6B,EAAE,CAAC;QAE1C,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE;YACxB,MAAM,MAAM,GAAG;gBACb;oBACE,KAAK,EAAE,qBA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E,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE,MAAM,IAAK,KAAK,EAAG;QACxI,IAAI,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE,cAAc,IAAG,CAAC,IAAI,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE,aAAa,IAAG,CAAC;YAAE,uBAAS,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE,cAAc,mCAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,0CAAE,aAAa,IAAK,KAAK,EAAG;QAChP,uBAAS,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,IAAK,KAAK,EAAG;KAClE;IAED,OAAO;QACL,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC;KACxD,CAAC;AACJ,CAAC","sourcesContent":["import * as dayjs from 'dayjs';\nimport { isDefined } from 'class-validator';\nimport { reverse } from 'lodash';\nimport {\n Cerfa3310_2023,\n Cerfa3514_2022,\n CerfaType,\n CustomerVatType,\n IRegistration,\n InterchangeHistory,\n ReadDeclaration,\n ReadRegistration, ReadRegistrationTick, RegistrationState, RegistrationTickState,\n} from '../../types';\nimport { Cerfa3517_2023 } from '../../types/Interface/api/cerfa/3517';\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\n if (registration.state === RegistrationState.IN_PROGRESS) {\n const data: ReadRegistrationTick[][] = [];\n\n declarations.forEach(() => {\n const result = [\n {\n state: RegistrationTickState.FINISHED,\n title: 'Déclaration envoyée',\n details: [],\n date: registration.sendAt ? dayjs(registration.sendAt).format('YYYY-MM-DD') : 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 } if ([RegistrationState.ACCEPTED, RegistrationState.REFUSED].includes(registration.state)) {\n const data: ReadRegistrationTick[][] = [];\n declarations.forEach((declaration) => {\n const response: ReadRegistrationTick[] = [\n {\n state: RegistrationTickState.FINISHED,\n title: 'Déclaration envoyée',\n date: registration.sendAt ? dayjs(registration.sendAt).format('YYYY-MM-DD') : 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 ? RegistrationTickState.FAILED : declaration.payment.isError === null ? RegistrationTickState.IN_PROGRESS : 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): { type: CustomerVatType | null; amount: number | null; collectable: number; deductible: number; } {\n if (registration.idCerfaType === CerfaType.CERFA_3310) {\n const payload = registration.payload.cerfa3310 as Cerfa3310_2023;\n const other = { collectable: payload.vat.grossDue, deductible: payload.vat.deductible.total };\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) return { type: CustomerVatType.VAT_REFUND, amount: payload.credit.refundAsked, ...other };\n if (payload?.credit?.toReport > 0) return { type: CustomerVatType.VAT_REPORT, amount: payload.credit.toReport, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n } if (registration.idCerfaType === CerfaType.CERFA_3514) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const payload = registration.payload.cerfa3514 as Cerfa3514_2022;\n const other = { collectable: payload.vatAmountCollected, deductible: payload.vatAmountDeductible };\n if (payload?.vatAmountToPay > 0) return { type: CustomerVatType.VAT_TO_PAY, amount: payload.vatAmountToPay, ...other };\n if (payload?.vatRefundedOnInvests) return { type: CustomerVatType.VAT_REFUND, amount: payload.vatRefundedOnInvests, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n } if (registration.idCerfaType === CerfaType.CERFA_3517) {\n const payload = registration.payload.cerfa3517 as Cerfa3517_2023;\n const other = { collectable: payload.other.total, deductible: payload.deductible.total };\n if (payload?.isNil) return { type: CustomerVatType.VAT_TO_NIL, amount: 0, ...other };\n if (payload?.recapitulation?.toPay > 0) return { type: CustomerVatType.VAT_TO_PAY, amount: payload?.recapitulation?.toPay, ...other };\n if (payload?.recapitulation?.refund > 0) return { type: CustomerVatType.VAT_REFUND, amount: payload?.recapitulation?.refund, ...other };\n if (payload?.recapitulation?.creditToReport > 0 || payload?.recapitulation?.imputedCredit > 0) return { type: CustomerVatType.VAT_REPORT, amount: payload?.recapitulation?.creditToReport ?? payload?.recapitulation?.imputedCredit, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n }\n\n return {\n type: null, amount: null, collectable: 0, deductible: 0,\n };\n}"]}
1
+ {"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../ts/utils/vat/registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OA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AAE,CAAC,IAAK,KAAK,EAAG;KAClE;IAED,OAAO;QACL,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC;KACxD,CAAC;AACJ,CAAC","sourcesContent":["import * as dayjs from 'dayjs';\nimport { isDefined } from 'class-validator';\nimport { reverse } from 'lodash';\nimport {\n Cerfa3310_2023,\n Cerfa3514_2022,\n CerfaType,\n CustomerVatType,\n IRegistration,\n InterchangeHistory,\n ReadDeclaration,\n ReadRegistration, ReadRegistrationTick, RegistrationState, RegistrationTickState,\n} from '../../types';\nimport { Cerfa3517_2023 } from '../../types/Interface/api/cerfa/3517';\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\n if (registration.state === RegistrationState.IN_PROGRESS) {\n const data: ReadRegistrationTick[][] = [];\n\n declarations.forEach(() => {\n const result = [\n {\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 } if ([RegistrationState.ACCEPTED, RegistrationState.REFUSED].includes(registration.state)) {\n const data: ReadRegistrationTick[][] = [];\n declarations.forEach((declaration) => {\n const response: ReadRegistrationTick[] = [\n {\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 ? RegistrationTickState.FAILED : declaration.payment.isError === null ? RegistrationTickState.IN_PROGRESS : 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): { type: CustomerVatType | null; amount: number | null; collectable: number; deductible: number; } {\n if (registration.idCerfaType === CerfaType.CERFA_3310) {\n const payload = registration.payload.cerfa3310 as Cerfa3310_2023;\n const other = { collectable: payload.vat.grossDue, deductible: payload.vat.deductible.total };\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) return { type: CustomerVatType.VAT_REFUND, amount: payload.credit.refundAsked, ...other };\n if (payload?.credit?.toReport > 0) return { type: CustomerVatType.VAT_REPORT, amount: payload.credit.toReport, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n } if (registration.idCerfaType === CerfaType.CERFA_3514) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const payload = registration.payload.cerfa3514 as Cerfa3514_2022;\n const other = { collectable: payload.vatAmountCollected, deductible: payload.vatAmountDeductible };\n if (payload?.vatAmountToPay > 0) return { type: CustomerVatType.VAT_TO_PAY, amount: payload.vatAmountToPay, ...other };\n if (payload?.vatRefundedOnInvests) return { type: CustomerVatType.VAT_REFUND, amount: payload.vatRefundedOnInvests, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n } if (registration.idCerfaType === CerfaType.CERFA_3517) {\n const payload = registration.payload.cerfa3517 as Cerfa3517_2023;\n const other = { collectable: payload.other.total, deductible: payload.deductible.total };\n if (payload?.isNil) return { type: CustomerVatType.VAT_TO_NIL, amount: 0, ...other };\n if (payload?.recapitulation?.toPay > 0) return { type: CustomerVatType.VAT_TO_PAY, amount: payload?.recapitulation?.toPay, ...other };\n if (payload?.recapitulation?.refund > 0) return { type: CustomerVatType.VAT_REFUND, amount: payload?.recapitulation?.refund, ...other };\n if (payload?.recapitulation?.creditToReport > 0 || payload?.recapitulation?.imputedCredit > 0) return { type: CustomerVatType.VAT_REPORT, amount: payload?.recapitulation?.creditToReport ?? payload?.recapitulation?.imputedCredit, ...other };\n return { type: CustomerVatType.VAT_TO_PAY, amount: 0, ...other };\n }\n\n return {\n type: null, amount: null, collectable: 0, deductible: 0,\n };\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ReadInterchange.js","names":["ReadDeclaration","exports","ReadInterchange","RedactorAddress","Redactor"],"sources":["../../../../../ts/types/Interface/api/aspone/ReadInterchange.ts"],"sourcesContent":["import { AsponeFormFields } from '../cerfa/ReadCerfa';\n\nexport type PaymentState = {\n isError: boolean | null;\n details: string[]; // Obsolete\n label: string | null;\n date: string | null;\n};\n\nexport type Interchange = {\n name: string | null;\n label: string | null;\n isError: boolean;\n isFinal: boolean;\n date: string | null;\n detailledLabel?: string | null\n};\n\nexport type InterchangeState = Array<Interchange>;\n\nexport type InterchangeHistory = Interchange & { stateDetailsHistory: InterchangeState };\n\nexport class ReadDeclaration {\n idDeclaration: string;\n type: string;\n declarationType: {\n code: string | null;\n label: string | null\n };\n payment: PaymentState;\n dld: any;\n states: InterchangeHistory[];\n}\n\nexport class ReadInterchange {\n idDeposit: string;\n date: string;\n idInterchange: string;\n history: InterchangeHistory[];\n declarations: ReadDeclaration[];\n}\n\nexport class RedactorAddress {\n adresseNumero: string;\n adresseType: string | null;\n adresseVoie: string;\n adresseComplement: string;\n adresseCodePostal: string;\n adresseVille: string;\n adresseCodePays: string;\n}\n\nexport class Redactor {\n siret: string;\n designation: string;\n designationSuite1: string;\n adresse: RedactorAddress;\n referenceDossier: string;\n}\n\ntype Tag = 'Valeur' | 'AdresseVille' | 'AdresseVoie' | 'AdresseCodePays' | 'AdresseComplement' | 'AdresseCodePostal' | 'AdresseHameau' | 'Telephone' | 'Designation' | 'DesignationSuite1' | 'DesignationSuite2' | 'Identifiant' | 'TexteLibre1' | 'TexteLibre2' | 'TexteLibre3' | 'TexteLibre4' | 'TexteLibre5' | 'DesignationSuite3' | 'AdresseNumero' | 'Iban' | 'Bic' | 'TitulaireDesignation';\ntype Tags = Array<{ description: string; tag: Tag; value: any }>;\n\nexport interface FieldForGeneration {\n tag?: Tag;\n tags?: Tags,\n description?: string;\n key: string;\n value?: any;\n isMultiple: boolean;\n}\n\nexport interface PayloadForRegistration {\n isTest: boolean;\n redactor: Redactor;\n indebted: any;\n forms: AsponeFormFields;\n xml?: string\n}"],"mappings":";;;;;AAsBM,MAAOA,eAAe;AAU3BC,OAAA,CAVYD,eAAe,GAAfA,eAAe;AAYtB,MAAOE,eAAe;AAM3BD,OAAA,CANYC,eAAe,GAAfA,eAAe;AAQtB,MAAOC,eAAe;AAQ3BF,OAAA,CARYE,eAAe,GAAfA,eAAe;AAUtB,MAAOC,QAAQ;AAMpBH,OAAA,CANYG,QAAQ,GAARA,QAAQ"}
1
+ {"version":3,"file":"ReadInterchange.js","names":["ReadDeclaration","exports","ReadInterchange","RedactorAddress","Redactor"],"sources":["../../../../../ts/types/Interface/api/aspone/ReadInterchange.ts"],"sourcesContent":["import { AsponeFormFields } from '../cerfa/ReadCerfa';\n\nexport type PaymentState = {\n isError: boolean | null;\n details: string[]; // Obsolete\n label: string | null;\n date: string | null;\n};\n\nexport type Interchange = {\n name: string | null;\n label: string | null;\n isError: boolean;\n isFinal: boolean;\n date: string | null;\n detailledLabel?: string | null\n};\n\nexport type InterchangeState = Array<Interchange>;\n\nexport type InterchangeHistory = Interchange & { stateDetailsHistory: InterchangeState };\n\nexport class ReadDeclaration {\n idDeclaration: string;\n type: string;\n declarationType: {\n code: string | null;\n label: string | null\n };\n payment: PaymentState;\n dld: any;\n states: InterchangeHistory[];\n}\n\nexport class ReadInterchange {\n idDeposit: string;\n date: string;\n idInterchange: string;\n history: InterchangeHistory[];\n declarations: ReadDeclaration[];\n}\n\nexport class RedactorAddress {\n adresseNumero: string;\n adresseType: string | null;\n adresseVoie: string;\n adresseComplement: string;\n adresseCodePostal: string;\n adresseVille: string;\n adresseCodePays: string;\n}\n\nexport class Redactor {\n siret: string;\n designation: string;\n designationSuite1: string;\n adresse: RedactorAddress;\n referenceDossier: string;\n}\n\ntype Tag = 'Valeur' | 'AdresseVille' | 'AdresseVoie' | 'AdresseCodePays' | 'AdresseComplement' | 'AdresseCodePostal' | 'AdresseHameau' | 'Telephone' | 'Designation' | 'DesignationSuite1' | 'DesignationSuite2' | 'Identifiant' | 'TexteLibre1' | 'TexteLibre2' | 'TexteLibre3' | 'TexteLibre4' | 'TexteLibre5' | 'DesignationSuite3' | 'AdresseNumero' | 'Iban' | 'Bic' | 'TitulaireDesignation' | 'TitulaireDesignationSuite';\ntype Tags = Array<{ description: string; tag: Tag; value: any }>;\n\nexport interface FieldForGeneration {\n tag?: Tag;\n tags?: Tags,\n description?: string;\n key: string;\n value?: any;\n isMultiple: boolean;\n}\n\nexport interface PayloadForRegistration {\n isTest: boolean;\n redactor: Redactor;\n indebted: any;\n forms: AsponeFormFields;\n xml?: string\n}"],"mappings":";;;;;AAsBM,MAAOA,eAAe;AAU3BC,OAAA,CAVYD,eAAe,GAAfA,eAAe;AAYtB,MAAOE,eAAe;AAM3BD,OAAA,CANYC,eAAe,GAAfA,eAAe;AAQtB,MAAOC,eAAe;AAQ3BF,OAAA,CARYE,eAAe,GAAfA,eAAe;AAUtB,MAAOC,QAAQ;AAMpBH,OAAA,CANYG,QAAQ,GAARA,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReadCerfa.js","names":["CerfaFormValue","exports"],"sources":["../../../../../ts/types/Interface/api/cerfa/ReadCerfa.ts"],"sourcesContent":["import { CerfaType } from '../../../Enum/CerfaType';\nimport {\n Cerfa3519_2017,\n FieldForGeneration, PayloadCerfa3519_2017, QuestionWording,\n} from '../../..';\nimport { Question } from '../../../Enum/BalanceSheetQuestion';\nimport { TerminationType } from '../../../Enum/AnswerTypeValue';\nimport { Cerfa3310_2023 } from './3310';\nimport { getCerfa3519Century17Payload } from '../../../../utils/vat/3519/century17';\nimport { getCerfa3519Century23RegistrationFields } from '../../../../utils/vat/3519/century23';\n\nexport type CerfaPayloadFormField = {\n label: string;\n key: string;\n type: 'text' | 'string' | 'number' | 'boolean' | 'date';\n visibleIf?: string;\n columns?: number;\n};\n\nexport class CerfaFormValue { key: string; value: string | number | boolean | null; }\n\nexport type CerfaPayloadForm = {\n sectionName: string;\n childrens: CerfaPayloadForm | CerfaPayloadFormField[]\n};\n\nexport type AnnexVatDocument = {\n shouldInclude: (data: Cerfa3310_2023) => boolean;\n name: string;\n century: string;\n payload: (amount: number, payload: PayloadCerfa3519_2017) => ReturnType<typeof getCerfa3519Century17Payload>,\n asponePayload: (data: Cerfa3519_2017) => ReturnType<typeof getCerfa3519Century23RegistrationFields>\n fields: CerfaPayloadForm[];\n fileName: '3519-2017';\n};\n\nexport type VatDocument = {\n idCerfaType: CerfaType,\n name: string;\n century: string, // Millésime du formulaire ASPONE\n centuries: number[],\n payload: (...args: any[]) => any,\n asponePayload: (...args: any[]) => any,\n fields: Array<CerfaPayloadForm>,\n fileName: '3310-2023' | '3514-2022' | '3517-2023';\n annex?: AnnexVatDocument;\n};\n\nexport interface ReadCerfaToComplete {\n declaration: CerfaType;\n annex: CerfaType | null\n}\nexport interface ReadCerfaDocument {\n file: any;\n payload: any;\n}\nexport interface Accountant {\n has: boolean;\n name: string | null;\n phone: string | null;\n address: CerfaAddress;\n}\nexport interface CouncilDetails {\n has: boolean;\n name: string | null;\n phone: string | null;\n address: CerfaAddress;\n}\nexport interface EcfDetails {\n has: boolean;\n name: string | null;\n address: CerfaAddress;\n}\nexport interface ViewerDetails {\n has: boolean;\n name: string;\n address: CerfaAddress\n number: string | null;\n}\nexport interface CerfaAddress {\n number: string;\n street: string;\n zipCode: string;\n city: string;\n country: {\n name: string | null,\n code: string | null\n }\n full: string;\n}\n\nexport type CerfaAnswers = {\n [key in keyof typeof QuestionWording\n | keyof typeof Question]: any\n};\n\nexport type Termination = {\n type: TerminationType,\n date: string | null\n};\n\nexport type AsponeFormFields = Array<{ name: string; fields: FieldForGeneration[] }>;"],"mappings":";;;;;AAmBM,MAAOA,cAAc;AAA0DC,OAAA,CAAxED,cAAc,GAAdA,cAAc"}
1
+ {"version":3,"file":"ReadCerfa.js","names":["CerfaFormValue","exports"],"sources":["../../../../../ts/types/Interface/api/cerfa/ReadCerfa.ts"],"sourcesContent":["import { CerfaType } from '../../../Enum/CerfaType';\nimport {\n Cerfa3519_2017,\n FieldForGeneration, PayloadCerfa3519_2017, QuestionWording,\n} from '../../..';\nimport { Question } from '../../../Enum/BalanceSheetQuestion';\nimport { TerminationType } from '../../../Enum/AnswerTypeValue';\nimport { Cerfa3310_2023 } from './3310';\nimport { getCerfa3519Century17Payload } from '../../../../utils/vat/3519/century17';\nimport { getCerfa3519Century23RegistrationFields } from '../../../../utils/vat/3519/century23';\n\nexport type CerfaPayloadFormField = {\n label: string;\n key: string;\n type: 'text' | 'string' | 'number' | 'boolean' | 'date';\n visibleIf?: string;\n columns?: number;\n};\n\nexport class CerfaFormValue { key: string; value: string | number | boolean | null; }\n\nexport type CerfaPayloadForm = {\n sectionName: string;\n childrens: CerfaPayloadForm | CerfaPayloadFormField[]\n};\n\nexport type AnnexVatDocument = {\n shouldInclude: (data: Cerfa3310_2023) => boolean;\n name: string;\n century: string;\n payload: (amount: number, payload: PayloadCerfa3519_2017) => ReturnType<typeof getCerfa3519Century17Payload>,\n asponePayload: (data: Cerfa3519_2017) => ReturnType<typeof getCerfa3519Century23RegistrationFields>\n fields: CerfaPayloadForm[];\n fileName: '3519-2017';\n};\n\nexport type VatDocument = {\n idCerfaType: CerfaType,\n name: string;\n century: string, // Millésime du formulaire ASPONE\n centuries: number[],\n payload: (...args: any[]) => any,\n asponePayload: (...args: any[]) => any,\n fields: Array<CerfaPayloadForm>,\n fileName: '3310-2023' | '3514-2022' | '3517-2023';\n annex?: AnnexVatDocument;\n};\n\nexport interface ReadCerfaToComplete {\n declaration: CerfaType;\n annex: CerfaType | null\n}\nexport interface ReadCerfaDocument {\n file: any;\n payload: any;\n}\nexport interface Accountant {\n has: boolean;\n name: string | null;\n phone: string | null;\n address: CerfaAddress;\n}\nexport interface CouncilDetails {\n has: boolean;\n name: string | null;\n phone: string | null;\n address: CerfaAddress;\n}\nexport interface EcfDetails {\n has: boolean;\n name: string | null;\n address: CerfaAddress;\n}\nexport interface ViewerDetails {\n has: boolean;\n name: string;\n address: CerfaAddress\n number: string | null;\n}\nexport interface CerfaAddress {\n number: string;\n street: string;\n zipCode: string;\n city: string;\n country: {\n name: string | null,\n code: string | null\n }\n full: string;\n}\n\nexport type CerfaAnswers = {\n [key in keyof typeof QuestionWording\n | keyof typeof Question]: any\n};\n\nexport type Termination = {\n type: TerminationType,\n date: string | null\n};\n\nexport type AsponeFormFields = Array<{ name: string; fields: FieldForGeneration[] }>;\nexport type AsponeFormField = { name: string; fields: FieldForGeneration[] };"],"mappings":";;;;;AAmBM,MAAOA,cAAc;AAA0DC,OAAA,CAAxED,cAAc,GAAdA,cAAc"}
@@ -53,12 +53,13 @@ function getCerfa3310Century23Payload(accountingEntries, payload, updatedEntries
53
53
  const taxedOther = (0, _utils.setZeroIfIsNegative)((0, _utils.getAmountByAccountNumber)(vatEntries.filter(ae => withTaxVat.includes(ae.idVat)), ['775'], 0, true));
54
54
  const intracommunityServiceAccounts = ['604', '611', '612', '613', '614', '615', '616', '617', '618', '619', '62'];
55
55
  const intracommunityServiceEntries = vatEntries.filter(ae => withTaxVat.includes(ae.idVat) && intracomVat.includes(ae.idVat));
56
- const taxedPurchaseOfIntracommunityService = (0, _utils.setZeroIfIsNegative)((0, _utils.getAmountByAccountNumber)(intracommunityServiceEntries, intracommunityServiceAccounts, 0, true));
56
+ // Case A3
57
+ const taxedPurchaseOfIntracommunityService = 0; /* setZeroIfIsNegative(getAmountByAccountNumber(intracommunityServiceEntries, intracommunityServiceAccounts, 0, true)); */
57
58
  const taxedImportEntries = vatEntries.filter(ae => importationVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat));
58
59
  const taxedImportAccounts = ['6'];
59
60
  const taxedImport = (0, _utils.setZeroIfIsNegative)((0, _utils.getAmountByAccountNumber)(taxedImportEntries, taxedImportAccounts, 0, true));
60
61
  const intracommunityAccounts2 = ['601', '602', '603', '605', '606', '607'];
61
- const taxedIntracommunityAcquisitions = (0, _utils.setZeroIfIsNegative)((0, _utils.getAmountByAccountNumber)(vatEntries.filter(ae => intracomVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat)), intracommunityAccounts2, 0, true));
62
+ const taxedIntracommunityAcquisitions = (0, _utils.getAmountByAccountNumber)(vatEntries.filter(ae => intracomVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat)), [...intracommunityAccounts2, ...intracommunityServiceAccounts], 0, true);
62
63
  // Opérations non taxées
63
64
  const untaxedExportationNotInEurope = (0, _utils.setZeroIfIsNegative)((0, _utils.getAmountByAccountNumber)(vatEntries.filter(ae => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), servicesAccounts, 0, true));
64
65
  const untaxedOther = (0, _utils.setZeroIfIsNegative)((0, _utils.getAmountByAccountNumber)(vatEntries.filter(ae => frenchVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['7'], 0, true));
@@ -88,7 +89,7 @@ function getCerfa3310Century23Payload(accountingEntries, payload, updatedEntries
88
89
  const importReducedRate2Dot1Tax = (0, _lodash.round)(importReducedRate2Dot1 * 0.021);
89
90
  const importReducedRate1Dot05 = (0, _utils.setZeroIfIsNegative)((0, _utils.getAmountByAccountNumber)(taxedImportEntries.filter(e => vats.filter(v => v.value === 1.05).map(v => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
90
91
  const importReducedRate1Dot05Tax = (0, _lodash.round)(importReducedRate1Dot05 * 0.0105);
91
- const intracommunityTax = (0, _utils.setZeroIfIsNegative)((0, _utils.getTaxAmountByAccountNumber)(intracommunityServiceEntries, [...intracommunityServiceAccounts, ...intracommunityAccounts2]));
92
+ const intracommunityTax = (0, _utils.setZeroIfIsNegative)((0, _utils.getTaxAmountByAccountNumber)(intracommunityServiceEntries, [...intracommunityServiceAccounts, ...intracommunityAccounts2], 0));
92
93
  // TVA Déductible
93
94
  const immobilizationTax = (0, _utils.setZeroIfIsNegative)((0, _utils.getTaxAmountByAccountNumber)(vatEntries, ['2']));
94
95
  const otherGoodsAndServices = (0, _utils.setZeroIfIsNegative)((0, _utils.getTaxAmountByAccountNumber)(vatEntries.filter(e => vats.filter(v => !v.isVatImportation).map(v => v.id).includes(e.idVat)), ['6']));
@@ -335,6 +336,106 @@ function getCerfa3310Century23Payload(accountingEntries, payload, updatedEntries
335
336
  function getCerfa3310Century23RegistrationFields(data) {
336
337
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
337
338
  const comment = (0, _utils.textFormatting)(data.declaration.comment);
339
+ const importFields = [];
340
+ if (data.vat.oilProducts.normalRate20.base > 0) {
341
+ importFields.push({
342
+ key: 'GS',
343
+ tag: 'Valeur',
344
+ isMultiple: false,
345
+ description: 'MOA Opérations imposables au taux normal 20 % sur les produits pétroliers : base HT',
346
+ value: data.vat.oilProducts.normalRate20.base
347
+ });
348
+ }
349
+ if (data.taxedOperations.import > 0) {
350
+ importFields.push({
351
+ key: 'DK',
352
+ tag: 'Valeur',
353
+ isMultiple: false,
354
+ description: 'MOA Opérations taxées HT - Importations (autres que les produits pétroliers',
355
+ value: data.taxedOperations.import
356
+ });
357
+ }
358
+ if (data.vat.oilProducts.normalRate20.tax > 0) {
359
+ importFields.push({
360
+ key: 'GT',
361
+ tag: 'Valeur',
362
+ isMultiple: false,
363
+ description: 'MOA Opérations imposables au taux normal 20 % sur les produits pétroliers : taxe due',
364
+ value: data.vat.oilProducts.normalRate20.tax
365
+ });
366
+ }
367
+ if (data.vat.oilProducts.reduceRate13.base > 0) {
368
+ importFields.push({
369
+ key: 'GU',
370
+ tag: 'Valeur',
371
+ isMultiple: false,
372
+ description: 'MOA Opérations imposables au taux réduit 13 % sur les produits pétroliers : base HT',
373
+ value: data.vat.oilProducts.reduceRate13.base
374
+ });
375
+ }
376
+ if (data.vat.oilProducts.reduceRate13.tax > 0) {
377
+ importFields.push({
378
+ key: 'GV',
379
+ tag: 'Valeur',
380
+ isMultiple: false,
381
+ description: 'MOA Opérations imposables au taux réduit 13 % sur les produits pétroliers : taxe due',
382
+ value: data.vat.oilProducts.reduceRate13.tax
383
+ });
384
+ }
385
+ if (data.vat.importations.normalRate20.base > 0) {
386
+ importFields.push({
387
+ key: 'LB',
388
+ tag: 'Valeur',
389
+ isMultiple: false,
390
+ description: 'MOA Importations - Taux normal 20 % Base HT',
391
+ value: data.vat.importations.normalRate20.base
392
+ });
393
+ }
394
+ if (data.vat.importations.reduceRate10.base > 0) {
395
+ importFields.push({
396
+ key: 'LD',
397
+ tag: 'Valeur',
398
+ isMultiple: false,
399
+ description: 'MOA Importations - Taux réduit 10 % Base HT',
400
+ value: data.vat.importations.reduceRate10.base
401
+ });
402
+ }
403
+ if (data.vat.importations.reduceRate8Dot5.base > 0) {
404
+ importFields.push({
405
+ key: 'LF',
406
+ tag: 'Valeur',
407
+ isMultiple: false,
408
+ description: 'MOA Importations - Taux réduit 8,5 % Base HT',
409
+ value: data.vat.importations.reduceRate8Dot5.base
410
+ });
411
+ }
412
+ if (data.vat.importations.reduceRate5Dot5.base > 0) {
413
+ importFields.push({
414
+ key: 'LH',
415
+ tag: 'Valeur',
416
+ isMultiple: false,
417
+ description: 'MOA Importations - Taux réduit 5,5 % Base HT',
418
+ value: data.vat.importations.reduceRate5Dot5.base
419
+ });
420
+ }
421
+ if (data.vat.importations.reduceRate2Dot1.base > 0) {
422
+ importFields.push({
423
+ key: 'LK',
424
+ tag: 'Valeur',
425
+ isMultiple: false,
426
+ description: 'MOA Importations - Taux réduit 2,1 % Base HT',
427
+ value: data.vat.importations.reduceRate2Dot1.base
428
+ });
429
+ }
430
+ if (data.vat.importations.reduceRate1Dot05.base > 0) {
431
+ importFields.push({
432
+ key: 'LM',
433
+ tag: 'Valeur',
434
+ isMultiple: false,
435
+ description: 'MOA Importations - Taux réduit 1,05 % Base HT',
436
+ value: data.vat.importations.reduceRate1Dot05.base
437
+ });
438
+ }
338
439
  return [{
339
440
  name: '3310CA3',
340
441
  fields: [{
@@ -523,12 +624,6 @@ function getCerfa3310Century23RegistrationFields(data) {
523
624
  isMultiple: false,
524
625
  description: 'MOA Opérations non taxées - Mises à la consommation de produits pétroliers 910759',
525
626
  value: data.untaxedOperations.oilProductsConsumption
526
- }, {
527
- key: 'DK',
528
- tag: 'Valeur',
529
- isMultiple: false,
530
- description: 'MOA Opérations taxées HT - Importations (autres que les produits pétroliers',
531
- value: data.taxedOperations.import
532
627
  }, {
533
628
  key: 'FB',
534
629
  tag: 'Valeur',
@@ -655,31 +750,7 @@ function getCerfa3310Century23RegistrationFields(data) {
655
750
  isMultiple: false,
656
751
  description: 'MOA Opérations imposables au taux réduit de 10% en France métropolitaine : Taxe due',
657
752
  value: data.vat.carrieredOutInFrance.reduceRate10.tax
658
- }, {
659
- key: 'GS',
660
- tag: 'Valeur',
661
- isMultiple: false,
662
- description: 'MOA Opérations imposables au taux normal 20 % sur les produits pétroliers : base HT',
663
- value: data.vat.oilProducts.normalRate20.base
664
- }, {
665
- key: 'GT',
666
- tag: 'Valeur',
667
- isMultiple: false,
668
- description: 'MOA Opérations imposables au taux normal 20 % sur les produits pétroliers : taxe due',
669
- value: data.vat.oilProducts.normalRate20.tax
670
- }, {
671
- key: 'GU',
672
- tag: 'Valeur',
673
- isMultiple: false,
674
- description: 'MOA Opérations imposables au taux réduit 13 % sur les produits pétroliers : base HT',
675
- value: data.vat.oilProducts.reduceRate13.base
676
- }, {
677
- key: 'GV',
678
- tag: 'Valeur',
679
- isMultiple: false,
680
- description: 'MOA Opérations imposables au taux réduit 13 % sur les produits pétroliers : taxe due',
681
- value: data.vat.oilProducts.reduceRate13.tax
682
- }, {
753
+ }, ...importFields, {
683
754
  key: 'HA',
684
755
  tag: 'Valeur',
685
756
  isMultiple: false,
@@ -853,72 +924,36 @@ function getCerfa3310Century23RegistrationFields(data) {
853
924
  isMultiple: false,
854
925
  description: 'MOA Opérations non taxées - Importations de produits pétroliers placées sous régime fiscal suspensif 911595',
855
926
  value: data.untaxedOperations.importPetrolInSuspensiveSystem
856
- }, {
857
- key: 'LB',
858
- tag: 'Valeur',
859
- isMultiple: false,
860
- description: 'MOA Importations - Taux normal 20 % Base HT',
861
- value: data.vat.importations.normalRate20.base
862
927
  }, {
863
928
  key: 'LC',
864
929
  tag: 'Valeur',
865
930
  isMultiple: false,
866
931
  description: 'MOA Importations - Taux normal 20 % Taxe due',
867
932
  value: data.vat.importations.normalRate20.tax
868
- }, {
869
- key: 'LD',
870
- tag: 'Valeur',
871
- isMultiple: false,
872
- description: 'MOA Importations - Taux réduit 10 % Base HT',
873
- value: data.vat.importations.reduceRate10.base
874
933
  }, {
875
934
  key: 'LE',
876
935
  tag: 'Valeur',
877
936
  isMultiple: false,
878
937
  description: 'MOA Importations - Taux réduit 10 % Taxe due',
879
938
  value: data.vat.importations.reduceRate10.tax
880
- }, {
881
- key: 'LF',
882
- tag: 'Valeur',
883
- isMultiple: false,
884
- description: 'MOA Importations - Taux réduit 8,5 % Base HT',
885
- value: data.vat.importations.reduceRate8Dot5.base
886
939
  }, {
887
940
  key: 'LG',
888
941
  tag: 'Valeur',
889
942
  isMultiple: false,
890
943
  description: 'MOA Importations - Taux réduit 8,5 % Taxe due',
891
944
  value: data.vat.importations.reduceRate8Dot5.tax
892
- }, {
893
- key: 'LH',
894
- tag: 'Valeur',
895
- isMultiple: false,
896
- description: 'MOA Importations - Taux réduit 5,5 % Base HT',
897
- value: data.vat.importations.reduceRate5Dot5.base
898
945
  }, {
899
946
  key: 'LJ',
900
947
  tag: 'Valeur',
901
948
  isMultiple: false,
902
949
  description: 'MOA Importations - Taux réduit 5,5 % Taxe due',
903
950
  value: data.vat.importations.reduceRate5Dot5.tax
904
- }, {
905
- key: 'LK',
906
- tag: 'Valeur',
907
- isMultiple: false,
908
- description: 'MOA Importations - Taux réduit 2,1 % Base HT',
909
- value: data.vat.importations.reduceRate2Dot1.base
910
951
  }, {
911
952
  key: 'LL',
912
953
  tag: 'Valeur',
913
954
  isMultiple: false,
914
955
  description: 'MOA Importations - Taux réduit 2,1 % Taxe due',
915
956
  value: data.vat.importations.reduceRate2Dot1.tax
916
- }, {
917
- key: 'LM',
918
- tag: 'Valeur',
919
- isMultiple: false,
920
- description: 'MOA Importations - Taux réduit 1,05 % Base HT',
921
- value: data.vat.importations.reduceRate1Dot05.base
922
957
  }, {
923
958
  key: 'LN',
924
959
  tag: 'Valeur',
@@ -937,13 +972,15 @@ function getCerfa3310Century23RegistrationFields(data) {
937
972
  isMultiple: false,
938
973
  description: 'MOA TVA antérieurement déduite à reverser, dont TVA sur les produits importés hors produits',
939
974
  value: data.vat.previouslyDeductedToBeReturned.otherThanOilProducts
940
- }, {
941
- key: 'LR',
942
- tag: 'Valeur',
943
- isMultiple: false,
944
- description: 'MOA Opérations internes réalisées entre membres d\'un assujetti unique 912152',
945
- value: data.untaxedOperations.internalUniq
946
- }, {
975
+ },
976
+ // {
977
+ // key: 'LR',
978
+ // tag: 'Valeur',
979
+ // isMultiple: false,
980
+ // description: 'MOA Opérations internes réalisées entre membres d\'un assujetti unique 912152',
981
+ // value: data.untaxedOperations.internalUniq,
982
+ // },
983
+ {
947
984
  key: 'LS',
948
985
  tag: 'Valeur',
949
986
  isMultiple: false,