Releases: oluosiname/steuer
v1.0.4
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/UUUUPpattern is shared by 7 states: Baden-Württemberg, Berlin, Bremen, Hamburg, Niedersachsen, Rheinland-Pfalz, and Schleswig-HolsteinFFF/BBB/UUUUPpattern 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_formatto detect when multiple states match the same pattern - Return
nilfor ambiguous cases, requiring users to provide an explicitstateparameter - 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
UnsupportedStateErrorrequiring explicit state specification - Examples of affected patterns:
93/815/08152- now requiresstate: 'BW'(or other matching state)32/462/02550- now requiresstate: 'BE'(or other matching state)181/815/08155- now requiresstate: 'BY'(or other matching state)013/815/08153- now requiresstate: 'HE'(also matches general 3-digit pattern)010/815/08182- now requiresstate: '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 BerlinUnambiguous Patterns:
The following patterns remain unambiguous and will continue to auto-detect:
- Nordrhein-Westfalen:
FFF/BBBB/UUUPformat (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- Updatedfind_state_by_standard_formatmethodspec/steuer/state_mapping_spec.rb- Updated tests for ambiguous patternsspec/steuer/steuernummer_spec.rb- Added tests for ambiguous standard formatsspec/steuer_spec.rb- Updated tests to require explicit state
Full Changelog: v1.0.2...v1.0.4
v1.0.1
Full Changelog: v1.0.0...v1.0.1
v0.3.0-alpha
Full Changelog: v0.2.0-alpha...v0.3.0-alpha