1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
// Copyright (C) 2018 Martin Mroz // // This software may be modified and distributed under the terms // of the MIT license. See the LICENSE file for details. #[derive(Clone,Eq,PartialEq,Hash,Debug,Default)] pub struct Leg { pub(crate) operating_carrier_pnr_code: String, pub(crate) from_city_airport_code: String, pub(crate) to_city_airport_code: String, pub(crate) operating_carrier_designator: String, pub(crate) flight_number: String, pub(crate) date_of_flight: String, pub(crate) compartment_code: char, pub(crate) seat_number: String, pub(crate) check_in_sequence_number: String, pub(crate) passenger_status: char, pub(crate) airline_numeric_code: Option<String>, pub(crate) document_form_serial_number: Option<String>, pub(crate) selectee_indicator: Option<char>, pub(crate) international_document_verification: Option<char>, pub(crate) marketing_carrier_designator: Option<String>, pub(crate) frequent_flyer_airline_designator: Option<String>, pub(crate) frequent_flyer_number: Option<String>, pub(crate) id_ad_indicator: Option<char>, pub(crate) free_baggage_allowance: Option<String>, pub(crate) fast_track: Option<char>, pub(crate) airline_individual_use: Option<String>, } impl Leg { /// An alphanumeric string of up to 6 characters, left-aligned, space-padded. /// This is the Passenger Name Record used to identify the booking /// in the reservation system of the operating carrier. pub fn operating_carrier_pnr_code(&self) -> &str { &self.operating_carrier_pnr_code } /// Three-letter or four-letter IATA code of the origin airport. /// Spaces indicate the field is not set. /// Any other values are invalid. pub fn from_city_airport_code(&self) -> &str { &self.from_city_airport_code } /// Three-letter or four-letter IATA code of the destination airport. /// Spaces indicate the field is not set. /// Any other values are invalid. pub fn to_city_airport_code(&self) -> &str { &self.to_city_airport_code } /// Airline code of the marketing carrier, which can be the same as the operating carrier. /// Two-character and three-letter IATA carrier designators /// are permitted and the string is left-justified and space padded. /// Spaces indicate the field is not set. /// Any other values are invalid. pub fn marketing_carrier_designator(&self) -> Option<&str> { self.marketing_carrier_designator.as_ref().map(|x| &**x) } /// Airline code associated with the frequent flyer number. /// Two-character and three-letter IATA carrier designators /// are permitted and the string is left-justified and space padded. /// Spaces indicate the field is not set. /// Any other values are invalid. pub fn frequent_flyer_airline_designator(&self) -> Option<&str> { self.frequent_flyer_airline_designator.as_ref().map(|x| &**x) } /// 2 character or 3 letter airline designator followed by up to 13 numerics or /// alphanumerics, or 16 numerics if the FFN is 16 digits. /// Spaces indicate the field is not set. /// Any other values are invalid. pub fn frequent_flyer_number(&self) -> Option<&str> { self.frequent_flyer_number.as_ref().map(|x| &**x) } /// Values are defined in Resolution 792. /// Spaces indicate the field is not set. /// Any other values are invalid. pub fn id_ad_indicator(&self) -> Option<char> { self.id_ad_indicator } /// Airline code of the operating carrier, which can be the same as the marketing carrier. /// Two-character and three-letter IATA carrier designators /// are permitted and the string is left-justified and space padded. /// Spaces indicate the field is not set. /// Any other values are invalid. pub fn operating_carrier_designator(&self) -> &str { &self.operating_carrier_designator } /// A flight number comprised of four numeric characters followed by an optional /// alphabetic suffix. This refers to the operating carrier. /// Spaces indicate the field is not set. pub fn flight_number(&self) -> &str { &self.flight_number } /// The Julian date code for the flight. The 3-digit number reflects the /// day of the year beginning with '0'. The year is to be inferred. /// Spaces indicate the field is not set. pub fn date_of_flight(&self) -> &str { &self.date_of_flight } /// IATA compartment code indiciating the class of service. /// Values are defined in Resolution 792. /// A space indicates the field is not set. /// Any other values are invalid. pub fn compartment_code(&self) -> char { self.compartment_code } /// Seat number of the passenger. /// Usually 3 numerics followed by a single alphabetic. /// In the case of infants, can be any 4 ASCII characters, often 'INF '. /// Spaces indicate the field is not set. pub fn seat_number(&self) -> &str { &self.seat_number } /// Check-in sequence number. /// Usually 4 numerics followed by an optional alpha or blank, however in the case of /// infants, the format is defined by the host system and can be any 5 ASCII characters. pub fn check_in_sequence_number(&self) -> &str { &self.check_in_sequence_number } /// The status of the passenger. /// Field values are defined in Resolution 792. /// A space indicates the field is not set. pub fn passenger_status(&self) -> char { self.passenger_status } /// The three-digit airline numeric code. /// This is also the first three digits of the eTicket number. /// Spaces indicate the field is not set. pub fn airline_numeric_code(&self) -> Option<&str> { self.airline_numeric_code.as_ref().map(|x| &**x) } /// The ten-digit DSN. /// This is also the last ten digits of the eTicket number. /// Spaces indicate the field is not set. pub fn document_form_serial_number(&self) -> Option<&str> { self.document_form_serial_number.as_ref().map(|x| &**x) } /// This field is used by certain agencies to demarcate individuals requiring extra screening. /// Although a conditional field, it is now required as of Resolotion 792 Version 6 when /// travel involves the United States. Values '0', '1', or '3' determine the type /// of screening the passenger will receive at US airports. /// A space indicates the field is not set. pub fn selectee_indicator(&self) -> Option<char> { self.selectee_indicator } /// This field is used by carriers to identify passengers requiring document verification. /// Connected to the display of the 'DOCS OK' string on international boarding passes. pub fn international_document_verification(&self) -> Option<char> { self.international_document_verification } /// Indicates if the passenger is eligible for fast track. /// If 'Y', the passenger is eligible, 'N' if not, ' ' if not set. /// Any other values are invalid. pub fn fast_track(&self) -> Option<char> { self.fast_track } /// Three characters, unstructured, left-aligned and space padded, /// indicating how much baggage passengers are able to take with them free of charge. /// Spaces indicate the field is not set. pub fn free_baggage_allowance(&self) -> Option<&str> { self.free_baggage_allowance.as_ref().map(|x| &**x) } /// Optional unstructured data for airline individual use. /// Content frequently includes frequent flyer tier, passenger preferences, etc. pub fn airline_individual_use(&self) -> Option<&str> { self.airline_individual_use.as_ref().map(|x| &**x) } } #[derive(Clone,Eq,PartialEq,Hash,Debug,Default)] pub struct SecurityData { pub(crate) type_of_security_data: Option<char>, pub(crate) security_data: Option<String>, } impl SecurityData { /// Vendor specific flag indicating the type of the security data which follows. pub fn type_of_security_data(&self) -> Option<char> { self.type_of_security_data } /// Security data used to verify the boarding pass was not tampered with. pub fn security_data(&self) -> Option<&str> { self.security_data.as_ref().map(|x| &**x) } } #[derive(Clone,Eq,PartialEq,Hash,Debug,Default)] pub struct Bcbp { pub(crate) passenger_name: String, pub(crate) electronic_ticket_indicator: char, pub(crate) passenger_description: Option<char>, pub(crate) source_of_check_in: Option<char>, pub(crate) source_of_boarding_pass_issuance: Option<char>, pub(crate) date_of_issue_of_boarding_pass: Option<String>, pub(crate) document_type: Option<char>, pub(crate) airline_designator_of_boarding_pass_issuer: Option<String>, pub(crate) baggage_tag_license_plate_numbers: Option<String>, pub(crate) first_non_consecutive_baggage_tag_license_plate_numbers: Option<String>, pub(crate) second_non_consecutive_baggage_tag_license_plate_numbers: Option<String>, pub(crate) legs: Vec<Leg>, pub(crate) security_data: SecurityData, } impl Bcbp { /// All legs encoded into the boarding pass. /// At least one needs to be present to form a valid boarding pass. pub fn legs(&self) -> &[Leg] { &self.legs } /// A reference to the optional security data used to verify a boarding pass was not tamptered with. pub fn security_data(&self) -> &SecurityData { &self.security_data } /// Used to differentiate between an electronic ticket ('E') and another type of travel document. /// Values are defined in Resolution 792. /// A space indicates the field is not set. pub fn electronic_ticket_indicator(&self) -> char { self.electronic_ticket_indicator } /// This describes the passenger. /// Values are defined in Resolution 792. /// Spaces indicate the field is not set. pub fn passenger_description(&self) -> Option<char> { self.passenger_description } /// The name of the passenger. Up to 20 characters, left-aligned, space padded. /// The format is `LAST_NAME/FIRST_NAME[TITLE]`. There is no separator between /// the first name and the title, and no indication a title is present. /// Certain names have characters which cannot be translated and /// special handling may be required. /// Spaces indicate the field is not set. pub fn passenger_name(&self) -> &str { &self.passenger_name } /// This field reflects channel in which the customer initiated check-in. /// Values are defined in Resolution 792 Attachment C. /// Spaces indicate the field is not set. pub fn source_of_check_in(&self) -> Option<char> { self.source_of_check_in } /// This field reflects channel which issued the boarding pass. /// Values are defined in Resolution 792. /// Spaces indicate the field is not set. pub fn source_of_boarding_pass_issuance(&self) -> Option<char> { self.source_of_boarding_pass_issuance } /// Optionally the 4-digit Julian date representing when the boarding pass /// was issued. The first digit is the last digit of the year and the next three /// represent the number of days elapsed. /// For example: /// "6001" represnts January 1, 2016. /// "6366" represaents December 31, 2016 (a leap year). /// Spaces indicate the field is not set. pub fn date_of_issue_of_boarding_pass(&self) -> Option<&str> { self.date_of_issue_of_boarding_pass.as_ref().map(|x| &**x) } /// The type of the document, 'B' indicating a boarding pass. /// Spaces indicate the field is not set. pub fn document_type(&self) -> Option<char> { self.document_type } /// Airline code of the boarding pass issuer. /// Two-character and three-letter IATA carrier designators /// are permitted and the string is left-justified and space padded. /// Spaces indicate the field is not set. pub fn airline_designator_of_boarding_pass_issuer(&self) -> Option<&str> { self.airline_designator_of_boarding_pass_issuer.as_ref().map(|x| &**x) } /// This field allows carriers to populate baggage tag numbers and the number /// of consecutive bags. This 13-character fiels is divided into: /// 0: '0' for interline tag, '1' for fall-back tag, '2' for interline rush tag. /// 2... 4: carrier numeric code. /// 5...10: carrier initial tag number with leading zeroes. /// 11...13: number of consecutive bags (up to 999). /// Spaces indicate the field is not set. pub fn baggage_tag_license_plate_numbers(&self) -> Option<&str> { self.baggage_tag_license_plate_numbers.as_ref().map(|x| &**x) } /// This field allows carriers who handle non-sequential bags to include a second set of them /// in the boarding pass data in in the same format as `baggage_tag_license_plate_numbers`. /// Spaces indicate the field is not set. pub fn first_non_consecutive_baggage_tag_license_plate_numbers(&self) -> Option<&str> { self.first_non_consecutive_baggage_tag_license_plate_numbers.as_ref().map(|x| &**x) } /// This field allows carriers who handle non-sequential bags to include a third set of them /// in the boarding pass data in in the same format as `baggage_tag_license_plate_numbers`. /// Spaces indicate the field is not set. pub fn second_non_consecutive_baggage_tag_license_plate_numbers(&self) -> Option<&str> { self.second_non_consecutive_baggage_tag_license_plate_numbers.as_ref().map(|x| &**x) } }