diff --git a/input/input_Bern_Belp.xml b/input/input_Bern_Belp.xml new file mode 100644 index 0000000..020cd25 --- /dev/null +++ b/input/input_Bern_Belp.xml @@ -0,0 +1,36 @@ + + + + + OJP SDK v1.0 + 2023-08-08T11:35:38.145Z + + 2023-08-08T11:35:38.145Z + + + 8507076 + + Belp + + + + + + + 8507000 + + Bern + + + + + 6 + false + false + false + true + + + + + \ No newline at end of file diff --git a/input/input_problematic_Europaplatz_4.xml b/input/input_problematic_Europaplatz_4.xml new file mode 100644 index 0000000..1350953 --- /dev/null +++ b/input/input_problematic_Europaplatz_4.xml @@ -0,0 +1,41 @@ + + + + + + + de + + 2025-07-22T12:51:35.026Z + OJP_DemoApp_Beta_OJP2.0 + + 2025-07-22T12:51:35.027Z + + + 8507076 + + Belp + + + + + + 8507000 + + Bern + + + + + true + 5 + true + false + true + true + explanatory + + + + + \ No newline at end of file diff --git a/input/input_test_europaplatz.xml b/input/input_test_europaplatz.xml new file mode 100644 index 0000000..a5059e3 --- /dev/null +++ b/input/input_test_europaplatz.xml @@ -0,0 +1,42 @@ + + + + + + de + + 2026-01-28T20:14:42.089Z + OJP_DemoApp_Beta_OJP2.0 + + 2026-01-28T20:14:42.090Z + + + 8507000 + + n/a + + + + + + + 8507099 + + n/a + + + + + + 5 + true + true + false + true + true + explanatory + + + + + \ No newline at end of file diff --git a/map_ojp2_to_ojp2.py b/map_ojp2_to_ojp2.py index 30886b1..471ef4b 100644 --- a/map_ojp2_to_ojp2.py +++ b/map_ojp2_to_ojp2.py @@ -72,8 +72,9 @@ def map_to_individual_ojpfarerequest(trip: TripStructure, now: XmlDateTime) -> O # ojprefinement_request=refinerequest))) def preprocess_stops_to_commercial_stops(delivery: OjptripDeliveryStructure) -> OjptripDeliveryStructure: - #prepocessing every StopPointRef is replaced with the highestmost parent for the processing in fares + #prepocessing every StopPointRef is replaced with the highest most parent for the processing in fares #parse context and create a dictionnary of the highest parent + #as this does not work if no context exists we will have to do the dictionnary also in sloid2didok parent = {} #TODO we do it once only, but in future we might to change it if not delivery.trip_response_context: diff --git a/support.py b/support.py index 6ffe96d..71661ce 100644 --- a/support.py +++ b/support.py @@ -56,6 +56,15 @@ def sloid2didok(sloid:str)->int: # TODO this is a hack for the timetable change 2024/2025 must be done correctly in map_ojp_to_ojp.py by replacing the stoppoints with the correct didoks #if a didok code, just return it my_dict: Dict[str,str] ={ + "8507082": "8504108", + "8503088": "8503000", + "8519342": "8504014", + "8014488": "8503467", + "8014482": "8503466", + "8014483": "8503465", + "8014484": "8503464", + "8014485": "853463", + "8014487": "8503462", } #dict from https://confluence.sbb.ch/pages/viewpage.action?pageId=2608861819 #"8507082": "8504108", diff --git a/test_configuration.py b/test_configuration.py index 97d1d60..6566259 100644 --- a/test_configuration.py +++ b/test_configuration.py @@ -1,18 +1,43 @@ READFILE = [] +READFILE.append("input/input_Bern_Belp.xml") +READFILE.append("input/input_oev_shart_plus_long.xml") +READFILE.append("input/input_Zuerich_Chur.xml") +READFILE.append("input/input_Visp_SaaS_Fee_problem_1_preis.xml") #1. class price problematic +READFILE.append("input/input_strange_price.xml") +READFILE.append("input/input_Zuerich_Bern.xml") +READFILE.append("input/input_Basel_Sargans.xml") +READFILE.append("input/input_Bern_Interlaken_Ost.xml") +READFILE.append("input/input_Bern_Interlaken_Gymnasium.xml") +READFILE.append("input/input_Bern_Guisanplatz_Interlaken_Gymnasium.xml") +READFILE.append("input/input_local.xml") +READFILE.append("input/input_oev_shart_plus_long.xml") +READFILE.append("input/input_bus_postauto.xml") +READFILE.append("input/input_sharing_intercity.xml") +READFILE.append("input/input_problematic_case_vasile.xml") +READFILE.append("input/input_Europaplatz.xml") +READFILE.append("input/input_Bodensee_1.xml") +READFILE.append("input/input_test_europaplatz.xml") + + +# Working OJP 2.0 example +#READFILE.append("input/input_ojp_1_test.xml") READFILE.append("input/input_ojp_2_test.xml") READFILE.append("input/input_problematic_Europaplatz_ojp1.xml") READFILE.append("input/input_problematic_Europaplatz_ojp2.xml") READFILE.append("input/input_Bodensee_2.xml") READFILE.append("input/input_problem_footpath.xml") +READFILE.append("input/input_problematic_Europaplatz_4.xml") ''' ---------------------------------------------------------------- Reservoir for tests # Working OJP 1.0 examples +READFILE.append("input/input_Bern_Belp.xml") + READFILE.append("input/input_oev_shart_plus_long.xml") READFILE.append("input/input_Zuerich_Chur.xml") READFILE.append("input/input_Visp_SaaS_Fee_problem_1_preis.xml") #1. class price problematic @@ -29,6 +54,7 @@ READFILE.append("input/input_problematic_case_vasile.xml") READFILE.append("input/input_Europaplatz.xml") READFILE.append("input/input_Bodensee_1.xml") +READFILE.append("input/input_test_europaplatz.xml") # Working OJP 2.0 example @@ -38,6 +64,7 @@ READFILE.append("input/input_problematic_Europaplatz_ojp2.xml") READFILE.append("input/input_Bodensee_2.xml") READFILE.append("input/input_problem_footpath.xml") +READFILE.append("input/input_problematic_Europaplatz_4.xml") diff --git a/test_nova_r_r.py b/test_nova_r_r.py index fe41266..59de3c1 100644 --- a/test_nova_r_r.py +++ b/test_nova_r_r.py @@ -73,7 +73,7 @@ def send_nova(url: str, headers: dict, xml_body: str) -> requests.Response: with open(READFILE, 'r', encoding='utf-8') as inputfile: nova_request = inputfile.read() # send it to NOVA - oauth_helper = OAuth2Helper(client_id=NOVA_CLIENT_ID, client_secret=NOVA_CLIENT_SECRET) + oauth_helper = OAuth2Helper(client_id=NOVA_CLIENT_ID, client_secret=NOVA_CLIENT_SECRET, scope=NOVA_SCOPE) access_token = oauth_helper.get_token() headers = {'Authorization': 'Bearer ' + access_token, 'SOAPAction': 'http://nova.voev.ch/services/v14/preisauskunft/erstellePreisAuskunft',