Skip to content
Snippets Groups Projects
Unverified Commit 642f7bcb authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

NASA: switch to mgate

parent 464b6b15
No related branches found
No related tags found
No related merge requests found
......@@ -72,10 +72,25 @@ my %hafas_instance = (
},
},
NASA => {
url => 'https://reiseauskunft.insa.de/bin/stboard.exe',
mgate => 'https://reiseauskunft.insa.de/bin/mgate.exe',
stopfinder => 'https://reiseauskunft.insa.de/bin/ajax-getstop.exe',
name => 'Nahverkehrsservice Sachsen-Anhalt',
productbits => [qw[ice ice regio regio regio tram bus ondemand]],
request => {
client => {
id => 'NASA',
v => '4000200',
type => 'IPH',
name => 'nasaPROD',
os => 'iPhone OS 13.1.2',
},
ver => '1.18',
auth => {
type => 'AID',
aid => 'nasa-' . 'apps',
},
lang => 'deu',
},
},
NVV => {
url => 'https://auskunft.nvv.de/auskunft/bin/jp/stboard.exe',
......@@ -402,12 +417,14 @@ sub check_input_error {
sub check_mgate {
my ($self) = @_;
if ( $self->{raw_json}{err} ) {
$self->{errstr} = 'error code is ' . $self->{raw_json}{err};
if ( $self->{raw_json}{err} and $self->{raw_json}{err} ne 'OK' ) {
$self->{errstr} = $self->{raw_json}{errTxt}
// 'error code is ' . $self->{raw_json}{err};
$self->{errcode} = $self->{raw_json}{err};
}
elsif ( defined $self->{raw_json}{cInfo}{code}
and $self->{raw_json}{cInfo}{code} ne 'OK' )
and $self->{raw_json}{cInfo}{code} ne 'OK'
and $self->{raw_json}{cInfo}{code} ne 'VH' )
{
$self->{errstr} = 'cInfo code is ' . $self->{raw_json}{cInfo}{code};
$self->{errcode} = $self->{raw_json}{cInfo}{code};
......@@ -614,9 +631,11 @@ sub parse_mgate {
my $train_type = $product->{prodCtx}{catOutS};
my $line_no = $product->{prodCtx}{line};
my $operator = $opL[ $product->{oprX} ];
if ($operator) {
$operator = $operator->{name};
my $operator;
if ( defined $product->{oprX} ) {
if ( my $opref = $opL[ $product->{oprX} ] ) {
$operator = $opref->{name};
}
}
push(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment