Generating flight vouchers with LaTex

Learning LaTex was on my todo list for many years. Like most people of my generation, I learned wysiwyg text programs in school, and used them for a long time for most stuff that ended up on paper. Actually, to be exact, the first text processing program I learned in school didn’t fall into the wysiwyg category, but was DOS based. I think it’s name was “Farsight”, but I can’t find any information about it on the internet. Since I am no friend of proprietary lock-in systems, I switched from MS Word to OpenOffice a long time ago, and more recently to LibreOffice. But even though their file format is open, it’s still binary. I know, I know, Word and ODF offer textual formats. I think they are mostly XML based. But the last time, I looked at one of them, I could not believe how overloaded with useless trash they were. The most annoying limitation of binary formats, is when you want to store the documents in a version control system, and compare different revisions. I used html for a while for documentation purposes. Although it is very good for these textual diffs between revisions, I’m not artistic enough to make it good looking. Hence, I thought for a long time that LaTex would be worth learning.

Also, for a long time I wanted to automate the vouchers for our tandem flights at paraeasy.ch. Even-though I knew that this was a perfect match, I had too many other things to do. As I’m currently reading a book about LaTex, I have my perfect hands on exercise. Hence, I prepared a template tex file for the vouchers and one for the invoices. Then I wrapped a python script around, that handles the rest.

The traditional way to keep track of which vouchers are active, and which ones were redeemed, is to keep a list. But after reading all the buzz about smart property, I figured that BitCoin is actually a perfect solution in itself. I generate a unique BitCoin address for each voucher, and load it with some coins. That way I can easily check, if the voucher is still valid. In fact, even other pilots that fly for us, can easily verify the validity of our vouchers. Now the perfect solution would be to load it with the full value, but since the BitCoin price is still quite volatile, the risk would be too high. After all, I need to be able to pay other pilots in case of a BitCoin crash. So I decided to load the voucher addresses with half the value. That way I can better tackle the risk.

As an opensource believer, I pushed my scripts to github, hoping they might be useful for somebody. I didn’t go to full lengths, in making it a configurable drop in solution. So, if you want to use it, leave me a message, and I will help you set it all up, and make it more configurable along the way.

Now, what happens if somebody orders a flight voucher on paraeasy.ch?  After the customer fills in all the required fields, and presses submit, I receive an email with a html table containing all the information. I then save the mail with evolution to a folder as an mbox file. Next, I start the python script which performs the following:

  • Generates a new unique number for the voucher.
  • Parses the information from the mbox email file.
  • Generates a BitCoin address that contains the initials of the passenger.
  • Replaces the placeholders in the tex files with the actual information.
  • Generates a qr code with the relevant information, and a gpg signature thereof.
  • Generate pdf files for the voucher and invoice.
  • Add the new entry to the list of active vouchers.
  • Add the pdf files, the updated list as well as the encrypted private key for the BitCoin address to my private git repository.

The system is not finished yet, but it already looks like a big relief. In the future, it might also generate the email to send the pdf file back to the customer.