Today's WTF software engineering…

The application I work on has a feature where the train conductor can inspect tickets using their verification code. The application supports the code generated by the old sales system but it should now start supporting also the verification codes from the new sales system. Now, you have the right to ask are the codes from these 2 systems specified in the same way. The answer is, obviously, no.

The old verification code is, as per specification, the RFC4648 Base32-encoded version of the ticket ID (which is an integer). The new one, while being a Base32-encoded version of the booking ID (which is connected to the ticket ID), has some extra characters (in this case, a dash) sprinkled here and there to make it easier to read. Furthermore, the old system's ticket inspection API requires the ticket ID to be used while new system's API requires that we pass the verification code as is to the API.

At the moment the application does the conversion from the Base32-encoded code to the ticket ID, but I thought it would be easier to just pass the code to the server where the server decides to which system the (possibly converted) information should be forwarded. Sounds easy, doesn't it? Well, except that all those Base32-libraries for NodeJS I tested do not seem to convert the code correctly (from the ID to the code nor vice versa). Or, more likely, the Base32-library I use on the application does not comply with RFC4648 as it claims it would.

If the customer would not be anal about alcohol in their premises, I would have started drinking well before 10AM today…