feat(tax): split_component rule type + Germany Berlin profile#91
Merged
Conversation
Germany requires split-rate VAT on composite charges — 7% on the food portion of breakfast, 19% on the beverage portion. The existing tax engine applied one rate per charge type; this change introduces a rule type that taxes a percentage of the charge at its own rate, so multiple split_component rules on the same charge type stack to produce the correct effective rate. Schema - taxRuleTypeEnum: new value 'split_component' - tax_rules: new splitPercentage numeric(5,2) column (nullable) - Hand-authored migration 0001_split_component_tax.sql (drizzle-kit generate is broken in this repo; push-schema.ts mirrors the migration) TaxService - calculateTaxes: for split_component, tax = base × (splitPercentage/100) × (rate/100). Respects compounding (uses runningBase when isCompounding) - backCalculateFromInclusive: split_component contributes (rate × splitPercentage / 100) to the effective percentage rate - All math via decimal.js on string numerics (no parseFloat) DTOs - splitPercentage?: number with @ValidateIf(type==='split_component'), @min(0.01), @max(100), @IsNumber({maxDecimalPlaces: 2}) Seed - Germany Berlin profile with 5 rules: 1. Accommodation VAT 7% (room, room_upgrade) 2. City Tax Übernachtungsteuer 5% (room, business-exempt) 3. Food VAT 7% split_component 70% (breakfast/meal/half_board/full_board) 4. Beverage VAT 19% split_component 30% (same) 5. Standard VAT 19% (minibar/spa/parking/telephone/laundry) - Seeded inactive (demo property is US-based, one active profile/property) Tests: +7 in tax.service.spec.ts — split calc, back-calc, Berlin room + breakfast + minibar, business exemption, non-100% splits. 582/582 passing, build + typecheck + lint clean. Refs #87 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Germany requires split-rate VAT on composite charges: 7% on the food portion of breakfast, 19% on the beverage portion. The existing tax engine applied one rate per charge type — this adds a `split_component` rule type that taxes a configurable percentage of the charge at its own rate, so multiple rules stack to the correct effective rate.
Example
€20 breakfast in Berlin:
Changes
Test plan
Refs #87.
🤖 Generated with Claude Code