Skip to content

Releases: oluosiname/steuer

v1.0.4

23 Dec 21:59

Choose a tag to compare

Release v1.0.4

Bug Fixes

Fixed Ambiguous Standard Format Tax Number Detection

Issue: Tax numbers in standard format (e.g., 32/462/02550 for Berlin) were being incorrectly auto-detected as other states (e.g., Baden-Württemberg) when no state code was provided.

Root Cause: Multiple German states share the same standard format patterns:

  • FF/BBB/UUUUP pattern is shared by 7 states: Baden-Württemberg, Berlin, Bremen, Hamburg, Niedersachsen, Rheinland-Pfalz, and Schleswig-Holstein
  • FFF/BBB/UUUUP pattern is shared by 6 states: Bayern, Brandenburg, Mecklenburg-Vorpommern, Sachsen, Sachsen-Anhalt, and Thüringen

When multiple states matched the same pattern, the code would return the first match (based on hash iteration order), leading to incorrect state detection.

Solution:

  • Updated find_state_by_standard_format to detect when multiple states match the same pattern
  • Return nil for ambiguous cases, requiring users to provide an explicit state parameter
  • This behavior now matches the existing handling of ambiguous federal format prefixes (e.g., prefix '3' shared by Brandenburg, Sachsen, and Sachsen-Anhalt)

Breaking Changes:

  • Tax numbers that previously auto-detected but are actually ambiguous will now raise UnsupportedStateError requiring explicit state specification
  • Examples of affected patterns:
    • 93/815/08152 - now requires state: 'BW' (or other matching state)
    • 32/462/02550 - now requires state: 'BE' (or other matching state)
    • 181/815/08155 - now requires state: 'BY' (or other matching state)
    • 013/815/08153 - now requires state: 'HE' (also matches general 3-digit pattern)
    • 010/815/08182 - now requires state: 'SL' (also matches general 3-digit pattern)

Migration Guide:
If you have code that relies on auto-detection for standard format tax numbers, update it to explicitly provide the state:

# Before (may have worked incorrectly)
Steuer.steuernummer('32/462/02550')  # Might have detected wrong state

# After (explicit state required for ambiguous patterns)
Steuer.steuernummer('32/462/02550', state: 'BE')  # Explicitly specify Berlin

Unambiguous Patterns:
The following patterns remain unambiguous and will continue to auto-detect:

  • Nordrhein-Westfalen: FFF/BBBB/UUUP format (e.g., 133/8150/8159)

Testing

  • Added comprehensive tests for ambiguous standard format cases
  • Updated existing tests to reflect new behavior
  • All 81 tests passing

Files Changed

  • lib/steuer/state_mapping.rb - Updated find_state_by_standard_format method
  • spec/steuer/state_mapping_spec.rb - Updated tests for ambiguous patterns
  • spec/steuer/steuernummer_spec.rb - Added tests for ambiguous standard formats
  • spec/steuer_spec.rb - Updated tests to require explicit state

Full Changelog: v1.0.2...v1.0.4

v1.0.1

02 Dec 17:52

Choose a tag to compare

Full Changelog: v1.0.0...v1.0.1

v0.3.0-alpha

17 Aug 14:27

Choose a tag to compare

v0.2.0-alpha

17 Aug 14:17

Choose a tag to compare

Alpha release

17 Aug 14:06

Choose a tag to compare