Tax excpetion texts

This commit is contained in:
2026-08-11 14:54:33 +02:00
parent 09f9767eb7
commit 5031d3bde0
5 changed files with 179 additions and 33 deletions
+17 -7
View File
@@ -52,7 +52,7 @@ class TenantTaxInformationTest extends TestCase
public function test_taxable_sets_rate_and_clears_exemption(): void
{
$this->tenant->update(['tax_exemption_reason' => 'small_business', 'tax_exemption_note' => 'alt']);
$this->tenant->update(['tax_exemption_reason' => 'ustg_19', 'tax_exemption_note' => 'alt']);
$response = $this->runAction(taxLiable: true, vatRate: 7, reason: null);
@@ -67,14 +67,14 @@ class TenantTaxInformationTest extends TestCase
public function test_exemption_reason_persists_and_clears_rate(): void
{
$response = $this->runAction(taxLiable: false, vatRate: 19, reason: 'youth_welfare');
$response = $this->runAction(taxLiable: false, vatRate: 19, reason: 'ustg_4_25a');
$this->assertTrue($response->success);
$fresh = $this->tenant->fresh();
$this->assertFalse($fresh->tax_liable);
$this->assertSame(0, $fresh->vat_rate);
$this->assertSame('youth_welfare', $fresh->tax_exemption_reason);
$this->assertSame('ustg_4_25a', $fresh->tax_exemption_reason);
$this->assertNull($fresh->tax_exemption_note);
}
@@ -111,7 +111,7 @@ class TenantTaxInformationTest extends TestCase
public function test_pricing_mode_resets_to_inclusive_when_exempt(): void
{
$this->runAction(taxLiable: false, vatRate: 0, reason: 'small_business', mode: 'add_on');
$this->runAction(taxLiable: false, vatRate: 0, reason: 'ustg_19', mode: 'add_on');
$this->assertSame('inclusive', $this->tenant->fresh()->vat_pricing_mode);
}
@@ -119,13 +119,23 @@ class TenantTaxInformationTest extends TestCase
{
$this->assertSame(
'Gemäß § 19 UStG wird keine Umsatzsteuer berechnet.',
TaxExemptionReason::where('slug', 'small_business')->first()->invoiceText(),
TaxExemptionReason::where('slug', 'ustg_19')->first()->invoiceText(),
);
$this->assertSame(
'Die Leistung ist gemäß § 4 Nr. 25 UStG von der Umsatzsteuer befreit.',
TaxExemptionReason::where('slug', 'youth_welfare')->first()->invoiceText(),
'Die Leistung ist gemäß § 4 Nr. 25 Buchst. a UStG von der Umsatzsteuer befreit.',
TaxExemptionReason::where('slug', 'ustg_4_25a')->first()->invoiceText(),
);
$this->assertSame(
'Die Leistung ist gemäß § 4 Nr. 24 UStG von der Umsatzsteuer befreit.',
TaxExemptionReason::where('slug', 'ustg_4_24')->first()->invoiceText(),
);
// Freitext-Grund liefert den mitgegebenen Text statt eines festen Rechnungshinweises.
$this->assertSame('Mein Text', TaxExemptionReason::where('slug', 'custom')->first()->invoiceText('Mein Text'));
}
public function test_options_are_ordered(): void
{
$slugs = array_column(TaxExemptionReason::options(), 'value');
$this->assertSame(['ustg_19', 'ustg_4_24', 'ustg_4_25a', 'ustg_4_22a', 'custom'], $slugs);
}
}