Repository: PolicyEngine/policyengine-canada (language: python)

Issue:
Manitoba Pension income amount
[Reference](https://www.canada.ca/en/revenue-agency/services/forms-publications/tax-packages-years/general-income-tax-benefit-package/manitoba/5007-pc/information-residents-manitoba.html#P70_5092)


Discussion / hints:

Fix patch:
diff --git a/changelog_entry.yaml b/changelog_entry.yaml
index e69de29bb..4e68d7251 100644
--- a/changelog_entry.yaml
+++ b/changelog_entry.yaml
@@ -0,0 +1,4 @@
+- bump: minor
+  changes:
+    added:
+    - Manitoba Pension amount credit.
diff --git a/policyengine_canada/parameters/gov/provinces/mb/tax/income/credits/pension_amount/max_amount.yaml b/policyengine_canada/parameters/gov/provinces/mb/tax/income/credits/pension_amount/max_amount.yaml
new file mode 100644
index 000000000..8d0dc589d
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/mb/tax/income/credits/pension_amount/max_amount.yaml
@@ -0,0 +1,9 @@
+description: Manitoba provides this maximum amount under the Pension amount credit. 
+values:
+  2022-01-01: 1_000
+metadata:
+  unit: currency-CAD
+  label: Manitoba pension amount credit max amount
+  reference:
+    - title: Government of Canada - Manitoba Information Guide
+      href: https://www.canada.ca/en/revenue-agency/services/forms-publications/tax-packages-years/general-income-tax-benefit-package/manitoba/5007-pc/information-residents-manitoba.html#P70_5092
diff --git a/policyengine_canada/variables/gov/provinces/mb/tax/income/credits/pension_amount/mb_pension_amount_credit.py b/policyengine_canada/variables/gov/provinces/mb/tax/income/credits/pension_amount/mb_pension_amount_credit.py
new file mode 100644
index 000000000..4501be59a
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/mb/tax/income/credits/pension_amount/mb_pension_amount_credit.py
@@ -0,0 +1,19 @@
+from policyengine_canada.model_api import *
+
+
+class mb_pension_amount_credit(Variable):
+    value_type = float
+    entity = Person
+    label = "Manitoba pension amount credit"
+    unit = CAD
+    definition_period = YEAR
+    defined_for = ProvinceCode.MB
+
+    def formula(person, period, parameters):
+        pension_and_savings_income = person(
+            "pension_and_savings_plan_income", period
+        )
+        max_amount = parameters(
+            period
+        ).gov.provinces.mb.tax.income.credits.pension_amount.max_amount
+        return min_(pension_and_savings_income, max_amount)
diff --git a/policyengine_canada/variables/household/income/individual/pension_and_savings_plan_income.py b/policyengine_canada/variables/household/income/individual/pension_and_savings_plan_income.py
index c5b505575..61ef732b5 100644
--- a/policyengine_canada/variables/household/income/individual/pension_and_savings_plan_income.py
+++ b/policyengine_canada/variables/household/income/individual/pension_and_savings_plan_income.py
@@ -8,4 +8,3 @@ class pension_and_savings_plan_income(Variable):
     unit = CAD
     documentation = "Income from pensions and savings plans"
     definition_period = YEAR
-    reference = "https://www.canada.ca/en/financial-consumer-agency/services/financial-toolkit/taxes/taxes-2/4.html"


Test patch:
diff --git a/policyengine_canada/tests/gov/provinces/mb/tax/income/credits/pension_amount/mb_pension_amount_credit.yaml b/policyengine_canada/tests/gov/provinces/mb/tax/income/credits/pension_amount/mb_pension_amount_credit.yaml
new file mode 100644
index 000000000..8c909ddea
--- /dev/null
+++ b/policyengine_canada/tests/gov/provinces/mb/tax/income/credits/pension_amount/mb_pension_amount_credit.yaml
@@ -0,0 +1,23 @@
+- name: No pension income
+  period: 2022
+  input:
+    province_code: MB
+    pension_and_savings_plan_income: 0
+  output:
+    mb_pension_amount_credit: 0
+
+- name: Pension income of $2_000 - capped at 1_000
+  period: 2022
+  input:
+    province_code: MB
+    pension_and_savings_plan_income: 2_000
+  output:
+    mb_pension_amount_credit: 1_000
+
+- name: Pension income of $500 - capped at 1_000
+  period: 2022
+  input:
+    province_code: MB
+    pension_and_savings_plan_income: 500
+  output:
+    mb_pension_amount_credit: 500