From 67d1665afcbdfbe9fee39a6c66cf90cd94124609 Mon Sep 17 00:00:00 2001 From: Denis Merigoux Date: Wed, 22 Nov 2023 15:02:40 +0100 Subject: [PATCH] Progress --- french_law/python/cnaf_cross_tester/call_cnaf.py | 8 ++++---- french_law/python/cnaf_cross_tester/main.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/french_law/python/cnaf_cross_tester/call_cnaf.py b/french_law/python/cnaf_cross_tester/call_cnaf.py index 9bb0daab..83eb703f 100644 --- a/french_law/python/cnaf_cross_tester/call_cnaf.py +++ b/french_law/python/cnaf_cross_tester/call_cnaf.py @@ -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)) diff --git a/french_law/python/cnaf_cross_tester/main.py b/french_law/python/cnaf_cross_tester/main.py index 29db3851..5ac03d8d 100644 --- a/french_law/python/cnaf_cross_tester/main.py +++ b/french_law/python/cnaf_cross_tester/main.py @@ -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)