From 464b6b1583c0a5fa3bf38a9711bce9f200a22378 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 2 Oct 2022 21:52:29 +0200 Subject: NAHSH: Switch to mgate --- lib/Travel/Status/DE/HAFAS.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm index 56a79b3..3a90353 100644 --- a/lib/Travel/Status/DE/HAFAS.pm +++ b/lib/Travel/Status/DE/HAFAS.pm @@ -53,10 +53,23 @@ my %hafas_instance = ( }, }, NAHSH => { - url => 'https://nah.sh.hafas.de/bin/stboard.exe', + mgate => 'https://nah.sh.hafas.de/bin/mgate.exe', stopfinder => 'https://nah.sh.hafas.de/bin/ajax-getstop.exe', name => 'Nahverkehrsverbund Schleswig-Holstein', productbits => [qw[ice ice ice regio s bus ferry u tram ondemand]], + request => { + client => { + id => 'NAHSH', + v => '3000700', + type => 'IPH', + name => 'NAHSHPROD', + }, + ver => '1.16', + auth => { + type => 'AID', + aid => 'r0Ot9FLF' . 'NAFxijLW' + }, + }, }, NASA => { url => 'https://reiseauskunft.insa.de/bin/stboard.exe', @@ -393,7 +406,9 @@ sub check_mgate { $self->{errstr} = 'error code is ' . $self->{raw_json}{err}; $self->{errcode} = $self->{raw_json}{err}; } - elsif ( $self->{raw_json}{cInfo}{code} ne 'OK' ) { + elsif ( defined $self->{raw_json}{cInfo}{code} + and $self->{raw_json}{cInfo}{code} ne 'OK' ) + { $self->{errstr} = 'cInfo code is ' . $self->{raw_json}{cInfo}{code}; $self->{errcode} = $self->{raw_json}{cInfo}{code}; } -- cgit v1.2.3