Пример #1
0
Файл: scan.py Проект: 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)
Пример #2
0
 def POST(self,reader,password,sn = None,answer={},**kw):
  card = reader.scan(sn)
  answer['sn'] = card.sn.sn7()
  transport_card.validate(card)
  answer['aspp'] = str(card.aspp)

  answer['staff'] = staff.read(card)
  answer['personal'] = staff.read_personal_info(card)

  from u2py import config
  if config.password != password: raise WrongPasswordError()

  config.cash_card_sn = card.sn.sn8()
  config.cash_card_aspp = str(card.aspp)