This commit is contained in:
Denis Merigoux 2023-11-22 15:02:40 +01:00
parent b25944a148
commit 67d1665afc
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3
2 changed files with 8 additions and 8 deletions

View File

@ -48,7 +48,7 @@ def get_simulation(bearer, payload_json):
response = requests.request("POST", url, headers=headers, data=payload)
response_json = response.json()
print(response_json)
# print(response_json)
if response_json['possedeDesDroits']:
return int(response_json['montantDroit'])
else:
@ -149,8 +149,8 @@ def format_payload(input: CnafSimulatorInput):
household_members.extend(children)
flgColocation = False
if isinstance(logement, AppartementOuMaison):
if logement.typ_v == AppartementOuMaisonType.Colocation:
if isinstance(input.logement, AppartementOuMaison):
if input.logement.typ_v == AppartementOuMaisonType.Colocation:
flgColocation = True
result = {
"rattachementLogementList": [
@ -173,6 +173,6 @@ def format_payload(input: CnafSimulatorInput):
def run_simulator(input: CnafSimulatorInput) -> int:
payload = format_payload(input)
print(payload)
# print(payload)
bearer = get_bearer()
return (get_simulation(bearer, payload))

View File

@ -5,17 +5,17 @@ from .cnaf_to_catala import run_catala_by_converting_cnaf_input
# input identical to the JS test of the housing benefits
sample_input = CnafSimulatorInput(
zone=Zone.Zone2,
zone=Zone.Zone1,
logement=AppartementOuMaison(
AppartementOuMaisonType.Location, meuble=False),
loyer=450,
AppartementOuMaisonType.Colocation, meuble=False),
loyer=1600,
seul_ou_couple=SeulOuCouple.EnCouple,
enfants=[Enfant(age=7, remuneration_derniere_annee=0),
Enfant(age=8, remuneration_derniere_annee=0)],
revenu_pris_en_compte=11_500
)
# Or a random input
sample_input = generate_random_input()
# sample_input = generate_random_input()
print("🏡 Description du ménage")
print(sample_input)
housing_benefits_catala = run_catala_by_converting_cnaf_input(sample_input)