def get_payment_constants(self): # Page 48 messages = self.send_command(CMD_GET_PERSONAL_MESSAGES) raw = messages[708:] methods = [] method_letter = 'ABCDEFGHIJKLMNOP' for i in range(16): method = raw[i * 18:i * 18 + 18] if method[2] == '\xff': continue name = decode_text(method[1:].strip(), self.coupon_printer_charset) methods.append((method_letter[i], name)) return methods
def _get_bound_receipt_constants(self): # Also page 48 messages = self.send_command(CMD_GET_PERSONAL_MESSAGES) raw = messages[372:708] constants = [] const_letter = 'ABCDEFGHIJKLMNOP' for i, char in enumerate(const_letter): const = raw[i * 21:i * 21 + 21] # Ignore constants that are not registered. if const[2] == '\xff': continue const = decode_text(const, self.coupon_printer_charset) constants.append((char, const.strip())) return constants
def get_payment_constants(self): constants = [('-2', u'Dinheiro')] for reg in range(16): try: retdict = self._send_command( 'LeMeioPagamento', CodMeioPagamentoProgram=reg) except DriverError as e: if e.code == 8014: # Meio de pagamento nao carregado continue raise code = retdict['CodMeioPagamentoProgram'] name = retdict['NomeMeioPagamento'] name = decode_text(name, self.coupon_printer_charset) constants.append((code, name)) return constants
def get_payment_constants(self): # Page 48 messages = self.send_command(CMD_GET_PERSONAL_MESSAGES) raw = messages[708:] methods = [] method_letter = 'ABCDEFGHIJKLMNOP' for i in range(16): method = raw[i * 18:i * 18 + 18] # XXX V = vinculavel. Why Only These???? #if method[0] == 'V': # methods.append((method_letter[i], method[1:].strip())) if method[2] == '\xff': continue name = decode_text(method[1:].strip(), self.coupon_printer_charset) methods.append((method_letter[i], name)) return methods