Skip to content

Remove legacy DANFSE API optional guard and make XML-based generation explicit#141

Merged
vitormattos merged 1 commit into
mainfrom
fix/remove-danfse-api-legacy-guard
Jul 2, 2026
Merged

Remove legacy DANFSE API optional guard and make XML-based generation explicit#141
vitormattos merged 1 commit into
mainfrom
fix/remove-danfse-api-legacy-guard

Conversation

@vitormattos

Copy link
Copy Markdown
Member

Description

This PR removes a legacy optional guard in the DANFSE (PDF) artifact generation flow that was checking if the getDanfse() method exists before attempting to generate the DANFSE from an authorized NFS-e XML payload.

The guard was unnecessary since the nfse-php client always provides this method as part of its NfseClientInterface.

Changes

  • Remove is_callable() check: The code was guarding against a method that always exists in the client interface
  • Rename helper method: fetchDanfseArtifact()generateDanfseFromAuthorizedXml() to clarify that DANFSE generation requires authorized NFS-e XML
  • Simplify flow: Make the XML-based DANFSE generation unconditional and explicit
  • Update tests: Align the focused unit test to the new method name and behavior

Intent

The refactored flow now clearly expresses: authorized NFS-e XML → DANFSE PDF generation

This makes the dependency explicit and removes ambiguity about whether there was a fallback path or optional behavior that no longer exists.

Testing

  • Unit tests updated to reflect the new helper method name
  • The focused tests validate that:
    • generateDanfseFromAuthorizedXml() uses the raw XML from ReceiptData
    • DANFSE generation is called without optional checks
    • XML and PDF artifacts are stored independently

…ation explicit

The controller was checking if getDanfse() method exists before attempting
to generate the DANFSE (PDF) artifact. This legacy guard is unnecessary since
the nfse-php client always provides this method.

Changes:
- Remove is_callable() check for getDanfse() method
- Rename fetchDanfseArtifact() to generateDanfseFromAuthorizedXml() for clarity
- Make the XML-based DANFSE generation flow explicit and unconditional
- Update focused unit test to reflect the new method name

The flow now clearly expresses: authorized NFS-e XML → DANFSE PDF generation.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos force-pushed the fix/remove-danfse-api-legacy-guard branch from 277d4fb to f06d11b Compare July 2, 2026 18:26
@vitormattos vitormattos merged commit d5912ad into main Jul 2, 2026
9 checks passed
@vitormattos vitormattos deleted the fix/remove-danfse-api-legacy-guard branch July 2, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant