DHL Packstation PostCard Barcode
For a long time, in order to be able to pick up a parcel at the DHL Packstations, the PostNummer, which is embossed on a golden customer card, had to be typed in manually and, in a second step, an mTAN had to be entered. This procedure was to be simplified by a new yellow customer card with a barcode on the back. The customer scans his customer card and then enters his mTAN. Unfortunately, the new customer cards were not automatically sent to owners of the previous PostCard. Since I wanted to save myself the effort of applying for a new card at the time, I thought it would be a good idea to simply generate the said barcode myself. This doesn’t contain the actual PostNumber, but a long number which is calculated on the basis of the PostNummer.
The calculation of the number for the barcode is done as follows:
- Multiply the PostNummer by 631 (PostNummer * 631).
- Calculate the Luhn checksum for the number obtained in step 1.
- Assemble the number: “3000” + result from step 1 + Luhn checksum.
- An ITF barcode must be generated from this number combination.
function generateBarcode(postNummer) {
const step1Result = postNummer * 631;
const luhnChecksum = calculateLuhnChecksum(step1Result);
const barcodeNumber = "3000" + step1Result + luhnChecksum;
const itfBarcode = generateITFBarcode(barcodeNumber);
return itfBarcode;
}