passgen: add fast track field; make security data optional
This commit is contained in:
parent
09610ee555
commit
789e31e2d9
1 changed files with 29 additions and 17 deletions
|
@ -351,6 +351,7 @@ impl BoardingPass {
|
||||||
boarding_pass.legs.push(leg);
|
boarding_pass.legs.push(leg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if data.len() > p {
|
||||||
// What's left is the security data.
|
// What's left is the security data.
|
||||||
if data[p] != b'^' {
|
if data[p] != b'^' {
|
||||||
return Err(anyhow!(
|
return Err(anyhow!(
|
||||||
|
@ -369,6 +370,7 @@ impl BoardingPass {
|
||||||
security_data_size
|
security_data_size
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(boarding_pass)
|
Ok(boarding_pass)
|
||||||
}
|
}
|
||||||
|
@ -397,6 +399,7 @@ pub struct BoardingPassLeg {
|
||||||
pub frequent_flyer_number: Option<String>,
|
pub frequent_flyer_number: Option<String>,
|
||||||
pub id_ad_indicator: Option<char>,
|
pub id_ad_indicator: Option<char>,
|
||||||
pub free_baggage_allowance: Option<String>,
|
pub free_baggage_allowance: Option<String>,
|
||||||
|
pub fast_track: Option<char>,
|
||||||
pub airline_data: Option<Vec<u8>>,
|
pub airline_data: Option<Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,6 +447,7 @@ impl BoardingPassLeg {
|
||||||
frequent_flyer_number: None,
|
frequent_flyer_number: None,
|
||||||
id_ad_indicator: None,
|
id_ad_indicator: None,
|
||||||
free_baggage_allowance: None,
|
free_baggage_allowance: None,
|
||||||
|
fast_track: None,
|
||||||
airline_data: None,
|
airline_data: None,
|
||||||
},
|
},
|
||||||
35,
|
35,
|
||||||
|
@ -537,6 +541,14 @@ impl BoardingPassLeg {
|
||||||
};
|
};
|
||||||
structured_data = &structured_data[3..];
|
structured_data = &structured_data[3..];
|
||||||
}
|
}
|
||||||
|
if !structured_data.is_empty() {
|
||||||
|
self.fast_track = if structured_data[0] == b' ' {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(structured_data[0] as char)
|
||||||
|
};
|
||||||
|
structured_data = &structured_data[1..];
|
||||||
|
}
|
||||||
if !structured_data.is_empty() {
|
if !structured_data.is_empty() {
|
||||||
return Err(anyhow!(
|
return Err(anyhow!(
|
||||||
"trailing data in structured data section ({} bytes)",
|
"trailing data in structured data section ({} bytes)",
|
||||||
|
|
Loading…
Reference in a new issue