Skip to content

feat: taxation settings UX, regime-aware tributos profile, IBGE fallback and municipality fixes#86

Merged
vitormattos merged 11 commits intomainfrom
feat/module-wide-money-percent-affixes
Apr 1, 2026
Merged

feat: taxation settings UX, regime-aware tributos profile, IBGE fallback and municipality fixes#86
vitormattos merged 11 commits intomainfrom
feat/module-wide-money-percent-affixes

Conversation

@vitormattos
Copy link
Copy Markdown
Member

Summary

This PR consolidates multiple rounds of improvements to the NFS-e taxation settings and emission flow:

Taxation Settings Simplification

  • Remove the tributacao_federal_mode radio group — percentage_profile mode is now fixed/enforced via hidden input
  • Remove deprecated stored amount fields (base_calculo, valor_pis, valor_cofins) from validation and persistence; purge them from existing settings on save
  • Relabel IRRF, CSLL, CP fields as percentage inputs with UI hints
  • Rename piscofins_base_calculo string key to piscofins_preview_note (computed note, not user input)
  • Add BrasilAPI as IBGE fallback for the municipalities endpoint; return graceful 200 with empty data instead of 502 when both sources fail
  • Add BrasilAPI retry(2,150) on municipality queries

Regime-aware Tributos Profile

  • Detect opcao_simples_nacional at emission time: use tributos_fed/est/mun_sn keys when the company is a Simples Nacional optant; use tributos_fed/est/mun_p keys otherwise
  • Emit totalTributosPercentualFederal/Estadual/Municipal fields into DpsData (requires nfse-php companion PR)
  • Guard company_id() call in resolveCompanyId() with try/catch to prevent broken test environment failures from Company::getCurrent()
  • Show only the relevant tributos profile section (P or SN) based on the saved opcao_simples_nacional setting

Municipality UF → IBGE Reset (front-end fix)

  • loadMunicipalities() now clears both ibgeHidden and ibgeDisplay before fetching so stale IBGE codes from the previous UF are never submitted

Tests & E2E

  • SettingsControllerTest: add municipality fallback + graceful failure paths
  • InvoiceControllerTest: cover regime-aware profile selection and XML element ordering
  • OperationalViewsExistenceTest: extend view existence assertions
  • nfse-settings.spec.ts: add E2E for municipality IBGE reset when UF changes
  • nfse-emission.spec.ts: extend emission flow specs with tributos and XML field assertions

Package dependency

…centage hints

Signed-off-by: Vitor Mattos <vitor@php.rio>
…icas de percentual

Signed-off-by: Vitor Mattos <vitor@php.rio>
…t fields, add BrasilAPI fallback

Signed-off-by: Vitor Mattos <vitor@php.rio>
…rage

Signed-off-by: Vitor Mattos <vitor@php.rio>
…, emit totalTributosPercentual

Signed-off-by: Vitor Mattos <vitor@php.rio>
…overage

Signed-off-by: Vitor Mattos <vitor@php.rio>
…d municipality IBGE reset on UF change

Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
…XML field assertions

Signed-off-by: Vitor Mattos <vitor@php.rio>
@vitormattos vitormattos force-pushed the feat/module-wide-money-percent-affixes branch from cc03902 to a2b3de9 Compare April 1, 2026 21:06
…tion behavior

Signed-off-by: Vitor Mattos <vitor@php.rio>
@vitormattos vitormattos merged commit e051465 into main Apr 1, 2026
9 checks passed
@vitormattos vitormattos deleted the feat/module-wide-money-percent-affixes branch April 1, 2026 21:14
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