Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update maximum allowed de minimis aid (HL-1125) #2824

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DeMinimisAidSerializer(serializers.ModelSerializer):
in the Application.
"""

MAX_AID_AMOUNT = 200000
MAX_AID_AMOUNT = 300000
amount = serializers.DecimalField(
max_digits=DeMinimisAid.amount.field.max_digits,
decimal_places=DeMinimisAid.amount.field.decimal_places,
Expand Down
6 changes: 3 additions & 3 deletions backend/benefit/applications/tests/test_applications_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def test_application_post_invalid_data(
assert len(Application.objects.all()) == 0

del data["id"]
data["de_minimis_aid_set"][0]["amount"] = "300000.00" # value too high
data["de_minimis_aid_set"][0]["amount"] = "300001.00" # value too high
data["status"] = "foo" # invalid value
data["bases"] = ["something_completely_different"] # invalid value
data["applicant_language"] = None # non-null required
Expand Down Expand Up @@ -738,7 +738,7 @@ def test_application_put_read_only_fields(api_client, application):

def test_application_put_invalid_data(api_client, application):
data = ApplicantApplicationSerializer(application).data
data["de_minimis_aid_set"][0]["amount"] = "300000.00" # value too high
data["de_minimis_aid_set"][0]["amount"] = "300001.00" # value too high
data[
"status"
] = ApplicationStatus.ACCEPTED # invalid value when transitioning from draft
Expand Down Expand Up @@ -822,7 +822,7 @@ def test_application_edit_de_minimis_aid_too_high(api_client, application):

previous_aid = copy.deepcopy(data["de_minimis_aid_set"])
data["de_minimis_aid"] = True
data["de_minimis_aid_set"][0]["amount"] = "150000"
data["de_minimis_aid_set"][0]["amount"] = "250000"
data["de_minimis_aid_set"][1]["amount"] = "50001"

response = api_client.put(
Expand Down
3 changes: 2 additions & 1 deletion frontend/audit-ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"decode-uri-component", // testcafe
"@babel/traverse", // jest
"follow-redirects", // axios
"lodash.pick" // HDS
"lodash.pick", // HDS
"ip" // testcafe, lerna
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class DeMinimisAid {
fillTooBigAmounts: async (t: TestController): Promise<void> => {
const rows = [
{ granter: 'One', amount: '2', grantedAt: '1.1.2023' },
{ granter: 'Two', amount: '199999', grantedAt: '2.2.2023' },
{ granter: 'Two', amount: '299999', grantedAt: '2.2.2023' },
];
await this.actions.fillRows(t, rows);

Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/applicant/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"deMinimisAidMaxAmount": {
"label": "Maximum amount exceeded",
"content": "The maximum amount of de minimis aid has been exceeded. Under the EU Regulation, a company may receive a maximum EUR 200,000 of de minimis aid during the current year and the previous two tax years. All forms of de minimis aid granted by various authorities during this period will be taken into account in the maximum amount."
"content": "The maximum amount of de minimis aid has been exceeded. Under the EU Regulation, a company may receive a maximum EUR {{amount}} of de minimis aid during the current year and the previous two tax years. All forms of de minimis aid granted by various authorities during this period will be taken into account in the maximum amount."
},
"deMinimisUnfinished": {
"label": "Missing de minimis aid information",
Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/applicant/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"deMinimisAidMaxAmount": {
"label": "Enimmäismäärä ylitetty",
"content": "De minimis -tuen enimmäismäärä on ylitetty. Tuki voi olla enintään 200 000 euroa, joka myönnetään yritykselle kuluvan vuoden ja kahden edellisen verovuoden kuluessa. Enimmäismäärässä huomioidaan kaikkien eri viranomaisten kyseisenä ajanjaksona de minimis -tukena myöntämä rahoitus."
"content": "De minimis -tuen enimmäismäärä on ylitetty. Tuki voi olla enintään {{amount}} euroa, joka myönnetään yritykselle kuluvan vuoden ja kahden edellisen verovuoden kuluessa. Enimmäismäärässä huomioidaan kaikkien eri viranomaisten kyseisenä ajanjaksona de minimis -tukena myöntämä rahoitus."
},
"deMinimisUnfinished": {
"label": "Puuttuvia de minimis -tuen tietoja",
Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/applicant/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"deMinimisAidMaxAmount": {
"label": "Maximibeloppet har överskridits",
"content": "Maximibeloppet för de minimis-stöd har överskridits. Enligt EU:s förordning kan ett företag få de minimis-stöd till ett belopp om högst 200 000 euro under det innevarandet året och under de två föregående skatteåren. I maximibeloppet beaktas samtliga de minimis-stöd som olika myndigheter har beviljat under denna tidsperiod."
"content": "Maximibeloppet för de minimis-stöd har överskridits. Enligt EU:s förordning kan ett företag få de minimis-stöd till ett belopp om högst {{amount}} euro under det innevarandet året och under de två föregående skatteåren. I maximibeloppet beaktas samtliga de minimis-stöd som olika myndigheter har beviljat under denna tidsperiod."
},
"deMinimisUnfinished": {
"label": "Information saknar om de minimis stöd",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ import { useDeminimisAidsList } from './useDeminimisAidsList';
const unsavedAidRowKey = (): number => Math.floor(Math.random() * 1000);

const DeMinimisAidsList: React.FC = () => {
const { grants, t, translationsBase, handleRemove, deMinimisTotal } =
useDeminimisAidsList();
const {
grants,
t,
translationsBase,
handleRemove,
deMinimisTotal,
language,
} = useDeminimisAidsList();
const theme = useTheme();

return (
Expand Down Expand Up @@ -85,7 +91,10 @@ const DeMinimisAidsList: React.FC = () => {
type="error"
>
{t(
`${translationsBase}.notifications.deMinimisAidMaxAmount.content`
`${translationsBase}.notifications.deMinimisAidMaxAmount.content`,
{
amount: MAX_DEMINIMIS_AID_TOTAL_AMOUNT.toLocaleString(language),
}
)}
</$Notification>
</$GridCell>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import DeMinimisContext from 'benefit/applicant/context/DeMinimisContext';
import useLocale from 'benefit/applicant/hooks/useLocale';
import { useTranslation } from 'benefit/applicant/i18n';
import { DeMinimisAid } from 'benefit-shared/types/application';
import sumBy from 'lodash/sumBy';
import { TFunction } from 'next-i18next';
import React from 'react';
import { Language } from 'shared/i18n/i18n';
// import * as Yup from 'yup';

type ExtendedComponentProps = {
Expand All @@ -12,13 +14,15 @@ type ExtendedComponentProps = {
grants: DeMinimisAid[];
deMinimisTotal: () => number;
handleRemove: (index: number) => void;
language: Language;
};

const useDeminimisAidsList = (): ExtendedComponentProps => {
const { t } = useTranslation();
const translationsBase = 'common:applications.sections.company';
const { deMinimisAids, setDeMinimisAids } =
React.useContext(DeMinimisContext);
const language = useLocale();

const handleRemove = (index: number): void => {
// remove value
Expand All @@ -35,6 +39,7 @@ const useDeminimisAidsList = (): ExtendedComponentProps => {
handleRemove,
deMinimisTotal,
grants: deMinimisAids,
language,
};
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/applicant/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export enum ROUTES {
DECISIONS = '/decisions',
}

export const MAX_DEMINIMIS_AID_TOTAL_AMOUNT = 200_000;
export const MAX_DEMINIMIS_AID_TOTAL_AMOUNT = 300_000;

export enum SUPPORTED_LANGUAGES {
FI = 'fi',
Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/handler/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
},
"deMinimisAidMaxAmount": {
"label": "Enimmäismäärä ylitetty",
"content": "De minimis-tuen enimmäismäärä on ylitetty. Tuki voi olla enintään 200 000 euroa, joka myönnetään yritykselle kuluvan vuoden ja kahden edellisen verovuoden kuluessa. Enimmäismäärässä huomioidaan kaikkien eri viranomaisten kyseisenä ajanjaksona de minimis -tukena myöntämä rahoitus."
"content": "De minimis-tuen enimmäismäärä on ylitetty. Tuki voi olla enintään {{amount}} euroa, joka myönnetään yritykselle kuluvan vuoden ja kahden edellisen verovuoden kuluessa. Enimmäismäärässä huomioidaan kaikkien eri viranomaisten kyseisenä ajanjaksona de minimis -tukena myöntämä rahoitus."
},
"salaryBenefit": {
"label": "Palkkatuettu oppisopimus",
Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/handler/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
},
"deMinimisAidMaxAmount": {
"label": "Enimmäismäärä ylitetty",
"content": "De minimis-tuen enimmäismäärä on ylitetty. Tuki voi olla enintään 200 000 euroa, joka myönnetään yritykselle kuluvan vuoden ja kahden edellisen verovuoden kuluessa. Enimmäismäärässä huomioidaan kaikkien eri viranomaisten kyseisenä ajanjaksona de minimis -tukena myöntämä rahoitus."
"content": "De minimis-tuen enimmäismäärä on ylitetty. Tuki voi olla enintään {{amount}} euroa, joka myönnetään yritykselle kuluvan vuoden ja kahden edellisen verovuoden kuluessa. Enimmäismäärässä huomioidaan kaikkien eri viranomaisten kyseisenä ajanjaksona de minimis -tukena myöntämä rahoitus."
},
"salaryBenefit": {
"label": "Palkkatuettu oppisopimus",
Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/handler/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
},
"deMinimisAidMaxAmount": {
"label": "Enimmäismäärä ylitetty",
"content": "De minimis-tuen enimmäismäärä on ylitetty. Tuki voi olla enintään 200 000 euroa, joka myönnetään yritykselle kuluvan vuoden ja kahden edellisen verovuoden kuluessa. Enimmäismäärässä huomioidaan kaikkien eri viranomaisten kyseisenä ajanjaksona de minimis -tukena myöntämä rahoitus."
"content": "De minimis-tuen enimmäismäärä on ylitetty. Tuki voi olla enintään {{amount}} euroa, joka myönnetään yritykselle kuluvan vuoden ja kahden edellisen verovuoden kuluessa. Enimmäismäärässä huomioidaan kaikkien eri viranomaisten kyseisenä ajanjaksona de minimis -tukena myöntämä rahoitus."
},
"salaryBenefit": {
"label": "Palkkatuettu oppisopimus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { useTheme } from 'styled-components';
import { useDeminimisAidsList } from './useDeminimisAidsList';

const DeMinimisAidsList: React.FC = () => {
const { grants, t, translationsBase, handleRemove } = useDeminimisAidsList();
const { grants, t, translationsBase, handleRemove, language } =
useDeminimisAidsList();
const theme = useTheme();

return (
Expand Down Expand Up @@ -82,7 +83,10 @@ const DeMinimisAidsList: React.FC = () => {
type="error"
>
{t(
`${translationsBase}.notifications.deMinimisAidMaxAmount.content`
`${translationsBase}.notifications.deMinimisAidMaxAmount.content`,
{
amount: MAX_DEMINIMIS_AID_TOTAL_AMOUNT.toLocaleString(language),
}
)}
</$Notification>
</$GridCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ import DeMinimisContext from 'benefit/handler/context/DeMinimisContext';
import { DeMinimisAid } from 'benefit-shared/types/application';
import { TFunction, useTranslation } from 'next-i18next';
import { useContext } from 'react';
import useLocale from 'shared/hooks/useLocale';
import { Language } from 'shared/i18n/i18n';

type ExtendedComponentProps = {
t: TFunction;
translationsBase: string;
handleRemove: (index: number) => void;
grants: DeMinimisAid[];
language: Language;
};

const useDeminimisAidsList = (): ExtendedComponentProps => {
const { t } = useTranslation();
const translationsBase = 'common:applications.sections';
const { deMinimisAids, setDeMinimisAids } = useContext(DeMinimisContext);
const language = useLocale();

const handleRemove = (index: number): void => {
// remove value
Expand All @@ -27,6 +31,7 @@ const useDeminimisAidsList = (): ExtendedComponentProps => {
translationsBase,
handleRemove,
grants: deMinimisAids,
language,
};
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/handler/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const DE_MINIMIS_AID_GRANTED_AT_MAX_DATE = new Date();

export const APPLICATION_START_DATE = new Date(new Date().getFullYear(), 0, 1);

export const MAX_DEMINIMIS_AID_TOTAL_AMOUNT = 200_000;
export const MAX_DEMINIMIS_AID_TOTAL_AMOUNT = 300_000;

export const EMPLOYEE_MIN_WORKING_HOURS = 18;
export const EMPLOYEE_MAX_WORKING_HOURS = 168;
Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/shared/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export enum DE_MINIMIS_AID_KEYS {

export enum DE_MINIMIS_AID {
// eslint-disable-next-line unicorn/numeric-separators-style
MAX_AMOUNT = 200000,
MAX_AMOUNT = 300000,
}

export enum CALCULATION_EMPLOYMENT_KEYS {
Expand Down
Loading