Ognyan
Ognyan

Reputation: 13600

List of tags that might be requested in PDOL per kernel type?

I can't find information about the potential tags that might get included in a PDOL (per kernel type, i.e. Visa, Mastercard, etc.). I've already looked in all the Book A-D, Book 1-4 pdfs to no avail (exception is C-1). I am particularly interested in lists for C-2 and C-3.

My problem is that currently I construct the PDOL related data based on a switch statement like this:

    switch (item.getTag()) {
        case AMOUNT_AUTHORISED_NUMERIC:
            out.write(ByteUtils.leftPad(ByteUtils.intToUnpackedBcd(txData.getAmountAuthorized()), 6));
            break;
        case AMOUNT_OTHER_NUMERIC:
            out.write(ByteUtils.leftPad(ByteUtils.intToUnpackedBcd(txData.getAmountOther()), 6));
            break;
        case TERMINAL_COUNTRY_CODE:
            out.write(ByteUtils.intToUnpackedBcd(terminalConfiguration.getCountryCode().getNumeric()));
            break;
        case TRANSACTION_CURRENCY_CODE:
            out.write(ByteUtils.leftPad(ByteUtils.intToUnpackedBcd(txData.getCurrency().getISOCodeNumeric()), 2));
            break;
      ...

For this approach I must know what tags can be requested in PDOL in order to add a case.

The alternative approach is to fill a Map with all the tags and their respective values that I have information for and just look in it when constructing the PDOL related data. I think that is kind of messy and redundant I am trying to avoid it.

Upvotes: 1

Views: 276

Answers (2)

jjlei
jjlei

Reputation: 109

Filling a map with the tags isn't messy at all. It's more flexible and convenience where you have the tag as key and the value as value. We do that for our EMV sdk. Often time you don't know what tags or how many tags you will get back or what kind of tags you will get back.

Having them in a hash map is good for many reason, if you need to pass them to an API to run a transaction, you can easily throw the the hash map in which contains all your tag and values already. If you need to display them out, displaying the keys and values from hash map is pretty easy as well.

Upvotes: 0

Michal Gluchowski
Michal Gluchowski

Reputation: 1237

This approach is not leading in the right direction. You should think of more generic DOL building code that handles requested tag lengths including trimming and padding depending on the object type as specified in EMV book 3 chapter 5.4.

Upvotes: 1

Related Questions