Ejemplo n.º 1
0
def printcardinfo():
    '''    var5F25 = tlv.findtag('5F25')
    var5F24 = tlv.findtag('5F24')
    var50 = tlv.findtag('50')
    var5A = tlv.findtag('5A')
    var9F36 = tlv.findtag('9F36')
    var5F20 = tlv.findtag('5F20')
    var9F61 = tlv.findtag('9F61')
    var9F62 = tlv.findtag('9F62')
    var9F36 = tlv.findtag('9F36')
    var9F79 = tlv.findtag('9F79')'''
    print 'AID: ', pboccard['4F']
    print 'APP: ', to_ascii(a2b_hex(pboccard['50']), True)
    print 'PAN: ', pboccard['5A']
    print 'VALID: ', pboccard['5F25']
    print 'EXPIRE: ', pboccard['5F24']
    print 'ATC: ', pboccard['9F36']
    if pboccard.has_key('5F20') and pboccard['5F20'] is not None:
        cardholder = 'CARDHOLDER: %s'%to_ascii(a2b_hex(pboccard['5F20']), True)
    else:
        cardholder = 'CARDHOLDER: '
    if pboccard.has_key('9F0B') and pboccard['9F0B'] is not None:
        cardholder = cardholder + ' %s'%to_ascii(a2b_hex(pboccard['9F0B']), True)
    else:
        pass
    print cardholder
    
    if pboccard.has_key('9F61') and pboccard['9F61'] is not None:
        print 'ID: ', to_ascii(a2b_hex(pboccard['9F61']), True)
    else:
        print 'ID: '
    print 'IDTYPE: ', pboccard['9F62']
    print 'ECASH BALANCE: ', pboccard['9F79']
Ejemplo n.º 2
0
def parsetrans(data):
    trans = dict()
    trans['transdate'] = toHexString(data[:3]).replace(' ', '')
    trans['transtime'] = toHexString(data[3:6]).replace(' ', '')
    trans['amount'] = toHexString(data[6:12]).replace(' ', '')
    trans['merchant'] = to_ascii(a2b_hex(toHexString(data[22:42]).replace(' ', '')), True)
    trans['transtype'] = toHexString(data[42:43]).replace(' ', '')
    trans['transatc'] = toHexString(data[43:45]).replace(' ', '')
    return trans