Skip to content

Commit

Permalink
ajout du types codespostaux et gestion d'un dispositif de strasbourg
Browse files Browse the repository at this point in the history
  • Loading branch information
jenovateurs committed Jan 13, 2025
1 parent 3c1a421 commit 12e3996
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
10 changes: 10 additions & 0 deletions contribuer/public/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ fields:
name: values
widget: list
hint: Pour saisir plusieurs communes, séparez les codes INSEE des communes par une virgule.
field_codespostaux: &field_codespostaux
label: Condition géographique codes postaux
name: codespostaux
widget: object
fields:
- label: Code postaux des communes
name: values
widget: list
hint: Pour saisir plusieurs codes postaux, séparez les codes des communes par une virgule.
field_boursier: &field_boursier
<<: *field_empty
label: Boursier
Expand Down Expand Up @@ -822,6 +831,7 @@ fields:
- *field_epcis
- *field_excluded_epcis
- *field_communes
- *field_codespostaux
- *field_regime_securite_sociale
- *field_quotient_familial
- *field_formation_sanitaire_social
Expand Down
13 changes: 13 additions & 0 deletions data/benefits/javascript/ville-strasbourg-accompagnement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
label: rendez-vous téléphonique d’accompagnement personnalisé
institution: ville_montpellier
description: Vous avez besoin d’aide pour comprendre votre résultat de simulation et effectuer vos démarches ? Prenez un rendez-vous pour être rappelé au téléphone par un agent chargé d’accès aux droits du Centre Communal d’Action Sociale de Montpellier.
prefix: le
conditions_generales:
- type: codespostaux
values:
- "67100"
type: bool
periodicite: autre
teleservice: https://mon.strasbourg.eu/bienvenue
link: https://mon.strasbourg.eu/bienvenue
top: -1
4 changes: 4 additions & 0 deletions lib/benefits/compute-javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const COMMUNE_PARAMETERS = {
departements: "_departement",
communes: "depcom",
epcis: "_epci",
codespostaux: "_codePostal",
}

export function testGeographicalEligibility(
Expand Down Expand Up @@ -196,6 +197,9 @@ export const CONDITION_STRATEGY: Conditions = {
regions: {
test: testGeographicalEligibility,
},
codespostaux: {
test: testGeographicalEligibility,
},
departements: {
test: testGeographicalEligibility,
},
Expand Down
1 change: 1 addition & 0 deletions tests/integration/benefits-description.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ describe("benefit descriptions", function () {
condition.type === "departements" ||
condition.type === "communes" ||
condition.type === "epcis" ||
condition.type === "codespostaux" ||
condition.type === "attached_to_institution"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import fs from "fs"

import { validateFile, getCollectionSchema } from "@root/data/schemas.js"
const benefitSchema = getCollectionSchema("benefits_javascript")

const dataDir = path.join(new URL(".", import.meta.url).pathname, "../../data")
const benefitFiles = fs
.readdirSync(`${dataDir}/benefits/javascript`)
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/compute-javascript-benefits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,19 @@ describe("computeAides", function () {
).toBe(true)
})

it("verify the result when a codespostaux is in benefit's EPCI", function () {
situation.menage._codePostal = "67100"
expect(
testGeographicalEligibility(
{
type: "codespostaux",
values: ["67100"],
},
{ situation }
)
).toBe(true)
})

it("adds the benefit amount when eligible", function () {
const openfiscaRequest = buildOpenFiscaRequest(situation)
computeJavascriptBenefits(benefits, situation, openfiscaRequest)
Expand Down

0 comments on commit 12e3996

Please sign in to comment.