diff --git a/Makefile b/Makefile index a29db284..ffaaf978 100644 --- a/Makefile +++ b/Makefile @@ -3,4 +3,4 @@ clean: find . -name '*.pyc' -exec rm \{\} \; test: - openfisca-run-test --country-package openfisca_aotearoa openfisca_aotearoa/tests + openfisca test --country-package openfisca_aotearoa openfisca_aotearoa/tests diff --git a/openfisca_aotearoa/entities.py b/openfisca_aotearoa/entities.py index 7cdd4363..e76e7aca 100644 --- a/openfisca_aotearoa/entities.py +++ b/openfisca_aotearoa/entities.py @@ -101,4 +101,34 @@ ] ) -entities = [Titled_Property, Person, Family] +Business = build_entity( + key="business", + plural="businesses", + label=u'business', + doc=''' + This term includes: + self-employed and sole traders + contractors + incorporated societies + registered charities + Non-government organisations (NGOs) + and post-settlement governance entities. + ''', + + roles=[ + { + 'key': 'business owner', + 'plural': 'business owners', + 'label': u'Business owner', + 'doc': u'The one or more persons who are owners of the business.' + }, + { + 'key': 'other', + 'plural': 'others', + 'label': u'Others', + 'doc': u'People who are not in any other role' + } + ] + ) + +entities = [Titled_Property, Person, Family, Business] diff --git a/openfisca_aotearoa/tests/social_security/covid_19_wage_subsidy.yaml b/openfisca_aotearoa/tests/social_security/covid_19_wage_subsidy.yaml new file mode 100644 index 00000000..d6ecb061 --- /dev/null +++ b/openfisca_aotearoa/tests/social_security/covid_19_wage_subsidy.yaml @@ -0,0 +1,27 @@ +- name: Sole trader, eligible for wage subsidy + period: 2020-6 + input: + sole_trader_operates_business: True + sole_trader_has_IRD_number: True + sole_trader_has_applicable_licenses: True + qualifications_or_registration_for_trade: True + registered_in_NZ: True + employees_legally_work_in_NZ: True + decline_in_business_revenue_due_to_covid_19: True + already_applied_for_wage_subsidy: False + output: + covid_19_wage_subsidy__eligibility: True +- name: Sole trader, does not have IRD number, not eligible for wage subsidy + period: 2020-6 + input: + sole_trader_operates_business: True + sole_trader_has_IRD_number: False + sole_trader_has_applicable_licenses: True + qualifications_or_registration_for_trade: True + registered_in_NZ: True + located_in_NZ: True + employees_legally_work_in_NZ: True + decline_in_business_revenue_due_to_covid_19: True + already_applied_for_wage_subsidy: False + output: + covid_19_wage_subsidy__eligibility: True diff --git a/openfisca_aotearoa/variables/acts/wage_subsidy_covid_19/eligibility.py b/openfisca_aotearoa/variables/acts/wage_subsidy_covid_19/eligibility.py new file mode 100644 index 00000000..524bec6b --- /dev/null +++ b/openfisca_aotearoa/variables/acts/wage_subsidy_covid_19/eligibility.py @@ -0,0 +1,102 @@ + +from openfisca_core.model_api import * +from openfisca_aotearoa.entities import Business + + +class registered_in_NZ(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Is the business registered with the New Zealand Companies Office?" + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + +class located_in_NZ(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Is the business physically located and operates in NZ?" + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + +class sole_trader_operates_business(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Is the person a sole trader?" + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + +class sole_trader_has_IRD_number(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Does the person have a personal IRD number used for paying income tax and GST?" + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + +class sole_trader_has_applicable_licenses(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Does the sole trader have applicable licenses and permits for their business needs?" + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + +class qualifications_or_registration_for_trade(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Does the sole trader have qualifications or registrations for their trade or profession?" + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + +class employees_legally_work_in_NZ(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Are all the named employees legally entitled to work in NZ?" + '''Legally working in New Zealand means a person is both working in New Zealand and is legally entitled to work in New Zealand. A person is legally entitled to work in New Zealand if they: + are a New Zealand or Australian citizen (including a person born in the Cook Islands, Niue or Tokelau), or + have a New Zealand residence class visa, or + have a New Zealand work visa or a condition on their New Zealand temporary visa that allows them to work in New Zealand.''' + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + +class decline_in_business_revenue_due_to_covid_19(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Has the business observed in actual or predicted (due to reduction in bookings, etc) revenue by more than 30% due to COVID-19?" + ''' The business must experience this decline between January 2020 and 9 June 2020.''' + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + +class already_applied_for_wage_subsidy(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Has the business already applied for a wage subsidy?" + + +class covid_19_wage_subsidy__eligibility(Variable): + value_type = bool + entity = Business + definition_period = MONTH + label = u"Conditions for checking eligibility for wage subsidy" + reference = "https://workandincome.govt.nz/products/a-z-benefits/covid-19-support.html" + + def formula(business, period, parameters): + conditions_for_sole_traders = business('sole_trader_has_IRD_number', period) \ + * business('sole_trader_has_applicable_licenses', period) \ + * business('qualifications_or_registration_for_trade', period) + + conditions_for_all_businesses = business('registered_in_NZ', period) \ + * business('located_in_NZ', period) \ + * business('employees_legally_work_in_NZ', period) \ + * business('decline_in_business_revenue_due_to_covid_19', period) \ + * not_(business('already_applied_for_wage_subsidy', period)) + + return conditions_for_all_businesses \ + * (business('sole_trader_operates_business', period) * conditions_for_sole_traders) \ + + (not_(business('sole_trader_operates_business', period)))