def parse_cvr(cvr_hex_string): report = [] for l in report_header('CVR : Card Verification Results', '='): report.append(l) report.append('raw hex %s' % cvr_hex_string) cvr_byte_list = hex_string_to_byte_list(cvr_hex_string) report.append(' hex %s' % '.'.join(['%02X' % x for x in cvr_byte_list])) report.append(' dec %s' % '.'.join(['%i' % x for x in cvr_byte_list])) for l in report_header('Bit Flags', '-'): report.append(l) cvr_flags = construct_cvr_bit_flags() for flag in cvr_flags: if (bit_flag_is_set_in_byte_list(cvr_byte_list, flag) == True): report.append(flag.description) for l in report_header('Composite Bit Flags', '-'): report.append(l) cvr_sub_bytes = construct_cvr_composite_bit_flags() for sub_byte in cvr_sub_bytes: for line in sub_byte.evaluate_on_byte_list_and_report(cvr_byte_list): report.append(line) for l in report_header('Nibbles', '-'): report.append(l) cvr_nibbles = construct_cvr_nibbles() for nibble in cvr_nibbles: for line in nibble.evaluate_on_byte_list_and_report(cvr_byte_list): report.append(line) for line in report: logging.info(line)
def parse_tsi(tsi_hex_string): report = [] for l in report_header('TSI : Transaction Status Information', '='): report.append(l) report.append('raw hex %s' % tsi_hex_string) tsi_byte_list = hex_string_to_byte_list(tsi_hex_string) report.append(' hex %s' % '.'.join(['%02X' % x for x in tsi_byte_list])) report.append(' dec %s' % '.'.join(['%i' % x for x in tsi_byte_list])) for l in report_header('Bit Flags', '-'): report.append(l) tsi_flags = construct_tsi_bit_flags() for flag in tsi_flags: if (bit_flag_is_set_in_byte_list(tsi_byte_list, flag) == True): report.append(flag.description) for line in report: logging.info(line)
def parse_tvr(tvr_hex_string): report = [] for l in report_header('TVR : Terminal Verification Results', '='): report.append(l) report.append('raw hex %s' % tvr_hex_string) tvr_byte_list = hex_string_to_byte_list(tvr_hex_string) report.append(' hex %s' % '.'.join(['%02X' % x for x in tvr_byte_list])) report.append(' dec %s' % '.'.join(['%i' % x for x in tvr_byte_list])) for l in report_header('Bit Flags', '-'): report.append(l) tvr_flags = construct_tvr_bit_flags() for flag in tvr_flags: if (bit_flag_is_set_in_byte_list(tvr_byte_list, flag) == True): report.append(flag.description) for line in report: logging.info(line)