Skip to content

Commit

Permalink
Inkomstenbelasting (#56)
Browse files Browse the repository at this point in the history
* Adds inkomstenbelasting, bump schema

* werkende inkomstenbelasting

* inkomstenbelasting

* adds frontend component
  • Loading branch information
anneschuth authored Mar 6, 2025
1 parent b27e490 commit ef21d1d
Show file tree
Hide file tree
Showing 30 changed files with 1,779 additions and 76 deletions.
85 changes: 85 additions & 0 deletions features/inkomstenbelasting.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Feature: Berekening Inkomstenbelasting
Als burger
Wil ik weten hoeveel inkomstenbelasting ik verschuldigd ben
Zodat ik mijn financiën kan plannen

Background:
Given de datum is "2025-03-01"
And een persoon met BSN "999993653"

Scenario: Berekening inkomstenbelasting voor alleenstaande met inkomen uit verschillende boxen
Given de volgende RvIG personen gegevens:
| bsn | geboortedatum | verblijfsadres | land_verblijf | nationaliteit |
| 999993653 | 1985-05-15 | Amsterdam | NEDERLAND | NEDERLANDS |
And de volgende RvIG relaties gegevens:
| bsn | partnerschap_type | partner_bsn |
| 999993653 | GEEN | null |
And de volgende BELASTINGDIENST box1 gegevens:
| bsn | loon_uit_dienstbetrekking | uitkeringen_en_pensioenen | winst_uit_onderneming | resultaat_overige_werkzaamheden | eigen_woning |
| 999993653 | 4800000 | 0 | 1200000 | 500000 | -120000 |
And de volgende BELASTINGDIENST box2 gegevens:
| bsn | reguliere_voordelen | vervreemdingsvoordelen |
| 999993653 | 300000 | 200000 |
And de volgende BELASTINGDIENST box3 gegevens:
| bsn | spaargeld | beleggingen | onroerend_goed | schulden |
| 999993653 | 10000000 | 5000000 | 15000000 | 4000000 |
And de volgende BELASTINGDIENST aftrekposten gegevens:
| bsn | persoonsgebonden_aftrek |
| 999993653 | 350000 |
When de wet_inkomstenbelasting wordt uitgevoerd door BELASTINGDIENST
Then is voldaan aan de voorwaarden
And is het box1_income "6380000" eurocent
And is het box2_income "500000" eurocent
And is het box3_income "1213626" eurocent
And is het taxable_income "7743626" eurocent
And is het total_tax_due "2309416" eurocent

Scenario: Berekening inkomstenbelasting voor gepensioneerde met AOW
Given de volgende RvIG personen gegevens:
| bsn | geboortedatum | verblijfsadres | land_verblijf | nationaliteit |
| 999993653 | 1955-05-15 | Amsterdam | NEDERLAND | NEDERLANDS |
And de volgende RvIG relaties gegevens:
| bsn | partnerschap_type | partner_bsn |
| 999993653 | GEEN | null |
And de volgende BELASTINGDIENST box1 gegevens:
| bsn | loon_uit_dienstbetrekking | uitkeringen_en_pensioenen | winst_uit_onderneming | resultaat_overige_werkzaamheden | eigen_woning |
| 999993653 | 0 | 2300000 | 0 | 0 | -50000 |
And de volgende BELASTINGDIENST box2 gegevens:
| bsn | reguliere_voordelen | vervreemdingsvoordelen |
| 999993653 | 0 | 0 |
And de volgende BELASTINGDIENST box3 gegevens:
| bsn | spaargeld | beleggingen | onroerend_goed | schulden |
| 999993653 | 8000000 | 2000000 | 0 | 0 |
When de wet_inkomstenbelasting wordt uitgevoerd door BELASTINGDIENST
Then is voldaan aan de voorwaarden
And is het box1_income "2250000" eurocent
And is het box2_income "0" eurocent
And is het box3_income "253626" eurocent
And is het total_tax_due "40075" eurocent

Scenario: Berekening inkomstenbelasting voor werkende ouder met heffingskortingen
Given de volgende RvIG personen gegevens:
| bsn | geboortedatum | verblijfsadres | land_verblijf | nationaliteit |
| 999993653 | 1998-05-15 | Amsterdam | NEDERLAND | NEDERLANDS |
And de volgende RvIG relaties gegevens:
| bsn | partnerschap_type | partner_bsn |
| 999993653 | GEEN | null |
And de volgende RvIG kinderen gegevens:
| bsn | geboortedatum |
| 111111111 | 2020-01-01 |
And de volgende BELASTINGDIENST box1 gegevens:
| bsn | loon_uit_dienstbetrekking | uitkeringen_en_pensioenen | winst_uit_onderneming | resultaat_overige_werkzaamheden | eigen_woning |
| 999993653 | 3000000 | 0 | 0 | 0 | -90000 |
And de volgende BELASTINGDIENST box2 gegevens:
| bsn | reguliere_voordelen | vervreemdingsvoordelen |
| 999993653 | 0 | 0 |
And de volgende BELASTINGDIENST box3 gegevens:
| bsn | spaargeld | beleggingen | onroerend_goed | schulden |
| 999993653 | 2000000 | 0 | 0 | 0 |
When de wet_inkomstenbelasting wordt uitgevoerd door BELASTINGDIENST
Then is voldaan aan de voorwaarden
And is het box1_income "2910000" eurocent
And is het box2_income "0" eurocent
And is het box3_income "0" eurocent
And is het total_tax_credits "727646" eurocent
And is het total_tax_due "347017" eurocent
14 changes: 12 additions & 2 deletions features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,22 @@ def step_impl(context, amount):

@then("ontbreken er verplichte gegevens")
def step_impl(context):

assertions.assertTrue(context.result.missing_required,
"Er zouden gegevens moeten ontbreken.")


@then("ontbreken er geen verplichte gegevens")
def step_impl(context):
assertions.assertFalse(context.result.missing_required,
"Er zouden geen gegevens moeten ontbreken.")
"Er zouden geen gegevens moeten ontbreken.")


@then('is het {field} "{amount}" eurocent')
def step_impl(context, field, amount):
actual_amount = context.result.output[field]
expected_amount = int(amount)
assertions.assertEqual(
actual_amount,
expected_amount,
f"Expected {field} to be {amount} eurocent, but was {actual_amount} eurocent",
)
2 changes: 1 addition & 1 deletion law/algemene_ouderdomswet/SVB-2024-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: 13dc8a31-91eb-4598-998c-012c9129b9ea
name: AOW-uitkering
law: algemene_ouderdomswet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: 47fa262a-b8f7-43bf-a5dd-5f9b2d2c1228
name: Bepalen AOW-leeftijd 2025
law: algemene_ouderdomswet/leeftijdsbepaling
Expand Down
2 changes: 1 addition & 1 deletion law/awb/beroep/JenV-2024-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: c4fda809-15f2-454a-9e9b-f645b905ca12
name: Algemene wet bestuursrecht - Beroepmogelijkheid en Termijnen
law: awb/beroep
Expand Down
2 changes: 1 addition & 1 deletion law/awb/bezwaar/JenV-2024-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: b6679cca-4555-44b4-9b8f-caa6886b74a0
name: Algemene wet bestuursrecht - Bezwaarmogelijkheid en Termijnen
law: awb/bezwaar
Expand Down
2 changes: 1 addition & 1 deletion law/handelsregisterwet/KVK-2024-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: 8b59ef92-03f8-4294-bce9-4eaac01ba0ed
name: Bepalen ondernemerschap
law: handelsregisterwet
Expand Down
2 changes: 1 addition & 1 deletion law/kieswet/KIESRAAD-2024-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: 96d926a0-b45f-4cf3-92af-01b167221a00
name: Kiesrecht Tweede Kamer
law: kieswet
Expand Down
2 changes: 1 addition & 1 deletion law/participatiewet/bijstand/SZW-2023-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: c00f6a8b-b387-45d0-ab15-6f5aa34b7287
name: Bepalen recht op bijstand landelijk
law: participatiewet/bijstand
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: b1d3a15b-45a2-44a3-b26a-d636785032c0
name: Bijstand Gemeente Amsterdam
law: participatiewet/bijstand
Expand Down
2 changes: 1 addition & 1 deletion law/penitentiaire_beginselenwet/DJI-2022-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: 292c11ff-8318-4b7a-bb11-3ea545b04c8e
name: Bepalen detentiestatus
law: penitentiaire_beginselenwet
Expand Down
2 changes: 1 addition & 1 deletion law/vreemdelingenwet/IND-2024-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: af0fed0d-ee11-48f3-b629-07becda4b7e9
name: Bepalen verblijfsstatus
law: vreemdelingenwet
Expand Down
48 changes: 47 additions & 1 deletion law/wet_brp/RvIG-2020-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: fcf09c18-1584-4565-9223-e8a86fbddc09
name: Bepalen persoonsgegevens BRP
law: wet_brp
Expand Down Expand Up @@ -185,6 +185,21 @@ properties:
description: "Huisnummer van het adres van de persoon"
type: "string"

- name: "CHILDREN_DATA"
description: "Gegevens over kinderen van de persoon"
type: "array"
temporal:
type: "point_in_time"
reference: "$calculation_date"
source_reference:
table: "relaties"
field: "kinderen"
select_on:
- name: "bsn"
description: "Burgerservicenummer van de persoon"
type: "string"
value: "$BSN"

output:
- name: "age"
description: "Leeftijd van de persoon in jaren"
Expand Down Expand Up @@ -297,6 +312,14 @@ properties:
type: "point_in_time"
reference: "$calculation_date"

# Nieuwe output voor de inkomstenbelastingwet
- name: "has_children_under_12"
description: "Heeft de persoon kinderen jonger dan 12 jaar"
type: "boolean"
temporal:
type: "point_in_time"
reference: "$calculation_date"

definitions:
DUTCH_NATIONALITIES:
- "NEDERLANDS"
Expand All @@ -308,6 +331,7 @@ properties:
- "WOONADRES"
POSTAL_ADDRESS_TYPES:
- "BRIEFADRES"
CHILD_MAX_AGE_COMBINATIEKORTING: 12

requirements:
- all:
Expand Down Expand Up @@ -452,3 +476,25 @@ actions:
- else:
value: null # Leeg resultaat
reference: "Wet BRP Art. 1.6"

# Nieuwe actie voor het bepalen of de persoon kinderen jonger dan 12 jaar heeft
- output: "has_children_under_12"
operation: IF
conditions:
- test:
subject: "$CHILDREN_DATA"
operation: NOT_NULL
then:
operation: EXISTS
subject: "$CHILDREN_DATA"
value:
operation: LESS_THAN
values:
- operation: SUBTRACT_DATE
unit: "years"
values:
- "$calculation_date"
- "$item.geboortedatum"
- "$CHILD_MAX_AGE_COMBINATIEKORTING"
- else: false
reference: "Wet BRP Art. 1.6"
2 changes: 1 addition & 1 deletion law/wet_forensische_zorg/DJI-2022-01-01.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.2/schema.json
$id: https://raw.githubusercontent.com/MinBZK/poc-machine-law/refs/heads/main/schema/v0.1.3/schema.json
uuid: c2124946-50d3-4aa8-b510-bccd04fc2cf9
name: Bepalen forensische zorg status
law: wet_forensische_zorg
Expand Down
Loading

0 comments on commit ef21d1d

Please sign in to comment.