Exemplo n.º 1
0
Arquivo: term.py Projeto: stdk/u2py
 def handle_ultralight(self,card,answer,amount=0,fast=False):
  answer['before'] = { 'term' : ultralight.read(card) }
  answer['aspp'] = str(card.aspp)

  ultralight.activate(card,amount)

  answer['after'] = { 'term' : ultralight.read(card) }
Exemplo n.º 2
0
Arquivo: scan.py Projeto: stdk/u2py
 def POST(self, reader, sn = None, answer={}, fast=False, **kw):
  card = reader.scan(sn)

  answer['sn'] = card.sn.sn7()
  answer['ultralight'] = card.type == ULTRALIGHT
  if fast: return

  if card.type == ULTRALIGHT:
   answer['term']         = ultralight.read(card)
   answer['aspp']         = str(card.aspp)
   answer['contracts']    = card.contract_list
   return

  transport_card.validate(card)
  answer['aspp']         = str(card.aspp)
  answer['end_date']     = card.end_date
  answer['deposit']      = card.deposit
  answer['pay_unit']     = card.pay_unit
  answer['resource']     = card.resource
  answer['status']       = card.status
  answer['contracts']    = card.contract_list
  answer['purse_value']  = purse.get_value(card)

  if 0xD01100 in card.contract_list:
   answer['journey'] = journey.read(card)

  if 0xD010FF in card.contract_list:
   answer['staff'] = staff.read(card)
   answer['personal'] = staff.read_personal_info(card)

  for aidpix in card.contract_list:
   if aidpix & 0xF00 == 0x300:
    answer['term'] = term.read(card)