Skip to content

[FR E-Reporting] Implement invoice payment lifecycle tracking - #9659

Closed
Milica Đukić (djukicmilica) wants to merge 82 commits into
mainfrom
bugs/master_442216_Payments
Closed

[FR E-Reporting] Implement invoice payment lifecycle tracking#9659
Milica Đukić (djukicmilica) wants to merge 82 commits into
mainfrom
bugs/master_442216_Payments

Conversation

@djukicmilica

@djukicmilica Milica Đukić (djukicmilica) commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Why

French e-reporting regulation requires that when a payment is applied to an e-invoice, the Collected lifecycle status must be captured and reported to the Portail Public de Facturation (PPF). Currently, the EReporting FR app has no mechanism to track payment applications against e-invoices or to build the required XML lifecycle messages. This gap blocks compliance with the French e-invoicing mandate.

Summary

  • Added FR E-Invoice Lifecycle table to capture immutable lifecycle occurrences (payment applications, reversals) linked to e-documents and customer ledger entries
  • Added FR E-Invoice Lifecycle VAT table to store per-occurrence VAT breakdown lines with amounts and currency
  • Added FR E-Invoice Lifecycle Mgt. codeunit that subscribes to OnAfterInsertDtldCustLedgEntry and OnAfterInsertDtldCustLedgEntryUnapply to automatically capture payment lifecycle events
  • Added FR E-Invoice Lifecycle Msg. codeunit implementing IEDocMessageBuilder to produce CrossDomainAcknowledgementAndResponse XML messages per the French regulatory profile
  • Added FR E-Invoice Lifecycle Error and FR E-Invoice Lifecycle Worker codeunits for asynchronous processing with error handling
  • Added enums for lifecycle status (Deposited, Collected, PaymentCollected, etc.) and processing status (Queued, Sending, Sent, Failed)
  • Added page extensions on E-Document Service and E-Documents list to surface lifecycle configuration and navigation
  • Added FR E-Invoice Lifecycles list page for viewing captured occurrences
  • Added permission sets (EReportingFRObjects, EReportingFREdit, EReportingFRRead) and D365/Local permission set extensions
  • Added comprehensive tests covering payment application capture, reversal handling, VAT breakdown, and message building

Fixes
AB#637593

@djukicmilica
Milica Đukić (djukicmilica) requested a review from a team July 22, 2026 10:43
@github-actions github-actions Bot added the Team: Integrations GitHub request for Integrations area label Jul 22, 2026
Comment thread src/Apps/FR/EDocument_FR/EReportingFR/test/src/IdentificationTests.Codeunit.al Outdated
@djukicmilica Milica Đukić (djukicmilica) added Team: Finance GitHub request for Finance area and removed Team: Integrations GitHub request for Integrations area labels Jul 22, 2026
@github-actions github-actions Bot added Team: Integrations GitHub request for Integrations area and removed Team: Finance GitHub request for Finance area labels Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟠\ High\ Severity\ —\ AppSource}$

The pageextension declares a namespace but still adds unaffixed members to the base "E-Documents" page: field("Clearance Date"; ...) and action(ViewFREInvoiceLifecycles). A namespace only replaces the owned-object affix; members added to another publisher's page still need the registered app prefix or suffix, otherwise AppSourceCop AS0011 can reject the extension.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.12.4

@djukicmilica

Copy link
Copy Markdown
Contributor Author

Follow-up on the general review findings:

  • The Clearance Date tooltip is restored, and the new lifecycle action uses the FR-affixed control name. The pre-existing Clearance Date control name is retained to avoid changing an existing control identity.
  • Exact negative-test messages are intentional contract assertions; moving identical strings to labels would not reduce brittleness.
  • A PDF without embedded Factur-X data now raises the dedicated NoEmbeddedInvoiceErr, and malformed French Peppol post-processing raises an internal contextual ErrorInfo.
  • Lifecycle worker call-stack telemetry now uses TelemetryScope::ExtensionPublisher so implementation details remain publisher-only.
  • A real PDF/A-3 happy-path test remains unavailable because the repository contains no approved embedded-invoice PDF fixture or generator; a synthetic non-PDF blob would not exercise the production attachment path.

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Style}$

InsertAllowanceElement and InsertLineAllowanceElement declare AllowanceReasonLbl and LineDiscountLbl inside procedure-local var blocks. Per the referenced guidance, Labels should live in the codeunit's top-level var block so XLIFF extraction and translation keys remain stable across builds and review tooling.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.33.4

@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

The new negative import tests verify asserterror, but they pin Assert.ExpectedError to inline message text (for example at the unsupported-root-element case) instead of a shared label or assert helper. That makes the tests brittle to harmless wording/localization changes rather than to the actual validation behavior.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.33.4

@djukicmilica

Copy link
Copy Markdown
Contributor Author

Superseded by #10374, which contains this payment lifecycle implementation together with lifecycle message sending in a single PR targeting main.

auto-merge was automatically disabled August 19, 2026 10:37

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Team: Integrations GitHub request for Integrations area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants