georgesmith46 / bcbp Goto Github PK
View Code? Open in Web Editor NEWEncoding/decoding library for the IATA Bar Coded Boarding Pass
Home Page: https://npm.im/bcbp
License: MIT License
Encoding/decoding library for the IATA Bar Coded Boarding Pass
Home Page: https://npm.im/bcbp
License: MIT License
M2DESMARAIS/LUC YWR78H GRUVCPAD 2847 001Y015D0006 148>5182 M3364BAD 00000000000002A0000000000000 2 AD 0101010101 NYWR78H VCPSSAAD 2991 001Y007A0031 12C2A0000000000000 2 AD 0101010101 N
When I decode the above bcbp on https://jia.je/decode-bcbp , flightDate
returns "2024-01-01T00:00:00.000Z"
When I decode it on Linux (node script.js) as in the code below, flightDate
returns "2023-01-01T00:00:00.000Z"
import { decode } from "bcbp";
let output;
output = decode(
"M2DESMARAIS/LUC YWR78H GRUVCPAD 2847 001Y015D0006 148>5182 M3364BAD 00000000000002A0000000000000 2 AD 0101010101 NYWR78H VCPSSAAD 2991 001Y007A0031 12C2A0000000000000 2 AD 0101010101 N"
);
console.log(JSON.stringify(output, null, 2));
Could you please take a look at it ?
Hi
Fist of all thanks for creating the wonderful library and implementation for boarding card JS.
However, I am afraid that I found a bug in the implementation and it appears whenever I set the fast track flag to "Y", the generated boarding card string isn't a valid one. Could you please investigate? Thanks in advance
I am using the following version:
https://cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.js
Here's the code generated by the script:
"M1EEEEE BBB E234234 GOTARNSK 101 12 F011A0034 130>6002A Y"
Here's the part of the JS code generating the string:
let output = encode({
data: {
legs: [
{
operatingCarrierPNR: operatingCarrierPNR,
departureAirport: departureAirport,
arrivalAirport: arrivalAirport,
operatingCarrierDesignator: operatingCarrierDesignator,
flightNumber: flightNumber,
flightDate: new Date(${flightDate}T00:00:00.000Z
),
compartmentCode: compartmentCode,
seatNumber: seatNumber,
checkInSequenceNumber: checkInSequenceNumber,
passengerStatus: passengerStatus,
fastTrack: "Y"
},
],
passengerName: passengerName,
}
});
Hey @georgesmith46,
I also didn't found any other way to contact you...
Are there any plans for version 8 of BCBP Standard?
Thanks,
When you parse bcbp with previous year, it return flightDate
as 2020-19-10
instead of 2018-10-19
Test data:
M1CHERNYAVSKAYA/ALEXANEKC7TUE SINDPSSQ 0938 293Y055K0210 362>5180 8292BSQ 06184761750012A61824252801290 SQ N*30602027K0E
As you can see, flightDate should based on year from issuanceDate
How do airlines encode the boarding zone data? I can see the documentation for check-in sequence number but puzzled on zone number/value.
A quick question for the bcbp experienced fellows.
How would you check if the bcbp is valid or not ?
What kind of tests/conditions would you apply there for returning a true or false? : )
Either using the the raw string or the parsed JSON.
The Julian date is missing the leading zeroes for the day.
For example the 6th of January 2024 shall read as: 006
, whereas it now gets encoded as: 6
.
You can see it on issuance date as well as on flight date.
> const a = bcbp.decode('M1SURNAME/FIRSTNAME ABSHDJ FRAMUCLH 1234 006Y030B0137 149>5181W 4005BLH 00000000000002A0000000000000 0 NN')
'M1SURNAME/FIRSTNAME ABSHDJ FRAMUCLH 1234 006Y030B0137 149>5181W 4005BLH 00000000000002A0000000000000 0 NN'
> bcbp.encode(a)
'M1SURNAME/FIRSTNAME ABSHDJ FRAMUCLH 1234 6 Y030B0137 149>5181W 45 BLH 00000000000002A0000000000000 0 NN'
Hi,
first of all I wanted to say thanks for that great library, it is very useful in my recent project π
However I found an issue with parsing date scanned from the BP, below you can find an example boarding pass.
Boarding pass:
M1SMITH/JOHN MR XXXXXXD SCLPMCXX 1159 114Y030A0001 33D>30B1OO3115BLA 29045 0 0
When we're scanning this boarding pass on eg. GMT+2, we'll get:
flightDate: Mon Apr 24 2023 02:00:00 GMT+0200 (London Daylight Time)
and
issuanceDate: Tue Apr 25 2023 02:00:00 GMT+0200 (London Daylight Time)
If we then switch to eg. Chile timezone (Santiago) GMT-4, we'll get:
flightDate: Sun Apr 23 2023 20:00:00 GMT+0200 (Santiago Daylight Time)
and
issuanceDate: Mon Apr 24 2023 20:00:00 GMT+0200 (Santiago Daylight Time)
(the timezones reported in date objects are also incorrect)
Why the date parsing was introduced this way? In the boarding pass there's only year and the day of the year, so we can't be sure about time or timezone, am I right?
I guess that date manipulation/parsing that is done while decoding the boarding pass should not take into account time and local timezone at all.
A nice addition would be also an ability to enable/disable date parsing (eg. a flag that can be passed to decode function)
Hey @georgesmith46,
I didn't found another way to contact you Β―_(γ)_/Β―
I would like to know where you have found the BCBP Specifications.
You mentioned the Spec V5 but this spec doesn't contains no information on certain items.
Eg:
Thanks for your help π
For timezones with a negative offset from UTC, the dateToDayOfYear
function does not work correctly. The Date
object that is created to represent the beginning of the year has a timestamp of midnight in the local time zone, rather than midnight in UTC. For instance, when run in Mountain Standard Time in the US, the following code:
const date = new Date("2016-08-13T00:00:00.000Z")
const start = new Date(date.getFullYear(), 0, 0)
console.log(start)
produces output of Thu Dec 31 2015 00:00:00 GMT-0700
. This causes the Julian day number to be calculated as 225, instead of 226.
Hi,
I am upgrading my Bcbp dependency from v4.0.2
to latest v5.1.0
.
While testing my application I saw that for boarding passes that contains julian date for today (7th of July), it shows the month of June
in the field flightDate
for a decoded flight's leg.
EXAMPLE
Using julian date 188 -> 7th of July
For this boarding pass: M1DOE/JOHN EXYZ123 AMSHKGKL 1021 188F035A0001 100
Result is:
{
passengerName: 'DOE/JOHN',
legs: [
{
operatingCarrierPNR: 'XYZ123',
departureAirport: 'AMS',
arrivalAirport: 'HKG',
operatingCarrierDesignator: 'KL',
flightNumber: '1021',
flightDate: 2021-06-06T23:00:00.000Z,
compartmentCode: 'F',
seatNumber: '035A',
checkInSequenceNumber: '0001',
passengerStatus: '1',
airlineNumericCode: undefined,
serialNumber: undefined,
selecteeIndicator: undefined,
internationalDocumentationVerification: undefined,
marketingCarrierDesignator: undefined,
frequentFlyerAirlineDesignator: undefined,
frequentFlyerNumber: undefined,
idIndicator: undefined,
freeBaggageAllowance: undefined,
fastTrack: undefined,
airlineInfo: undefined
}
],
passengerDescription: undefined,
checkInSource: undefined,
boardingPassIssuanceSource: undefined,
issuanceDate: undefined,
documentType: undefined,
boardingPassIssuerDesignator: undefined,
baggageTagNumber: undefined,
firstBaggageTagNumber: undefined,
secondBaggageTagNumber: undefined,
securityDataType: undefined,
securityData: undefined
}
where legs[0].flightDate
references to the 6th of June
, instead of 7th of July
.
Code for this example is:
const {decode} = require('bcbp');
console.log(decode("M1DOE/JOHN EXYZ123 AMSHKGKL 1021 188F035A0001 100", 2021));
It seems to be one day and month off.
Maybe I am doing something wrong here. Let me know if I can provide more info.
And thanks for your work, keep it up!
master
branch failed. π¨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iβm sure you can resolve this πͺ.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those donβt help, or if this issue is reporting something you think isnβt right, you can always ask the humans behind semantic-release.
An npm token must be created and set in the NPM_TOKEN
environment variable on your CI environment.
Please make sure to create an npm token and to set it in the NPM_TOKEN
environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/
.
Good luck with your project β¨
Your semantic-release bot π¦π
Hi,
Is it possible for you to return the electronicTicketIndicator field when decoding the boarding pass?
I noticed it is on the meta field in decode.ts, and I require access that particular property for a project.
Your help would be much appreciated!
Without knowing moment very well seems an adjustment could be
estimatedDate = moment.utc(currentYear.substr(0, 1) + year + dayOfYear, "YYDDDD", true);
to include time object.
If you would like help I'd be more than happy to see if I can resolve the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.