Esempio n. 1
0
File: card.py Progetto: stdk/u2py
 def POST(self, reader, amount, sn = None, answer={}, **kw):
   card = reader.scan(sn)
   answer['sn'] = card.sn.sn7()
   transport_card.validate(card)
   answer['aspp'] = str(card.aspp)

   purse.change_value(card, int(amount))
Esempio n. 2
0
 def POST(self,reader,amount,sn = None,answer={},**kw):
  card = reader.scan(sn)
  answer['sn'] = card.sn.sn7()
  transport_card.validate(card)
  answer['aspp'] = str(card.aspp)

  transport_card.set_deposit(card)
Esempio n. 3
0
File: scan.py Progetto: 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)
Esempio n. 4
0
 def POST(self, reader, sn = None, answer={}, **kw):
  card = reader.scan(sn)
  answer['sn'] = card.sn.sn7()

  transport_card.validate(card)
  answer['aspp'] = str(card.aspp)

  answer['events'] = read_card_events(card)
Esempio n. 5
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)
Esempio n. 6
0
File: term.py Progetto: stdk/u2py
 def handle_standard(self,card,answer,amount=0,fast=False):
  transport_card.validate(card)
  answer['aspp'] = str(card.aspp)

  if not fast:
   answer['before'] = {
     'purse_value' : purse.get_value(card),
     'term'        : term.read(card)
   }

  answer['amount_used'] = term.refill(card,amount)

  if not fast:
   answer['after'] = {
    'purse_value' : purse.get_value(card),
    'term'        : term.read(card)
   }
Esempio n. 7
0
File: journey.py Progetto: stdk/u2py
 def POST(self, reader, amount, sn = None, fast=False, answer={}, **kw):
   card = reader.scan(sn)
   answer['sn'] = card.sn.sn7()
   transport_card.validate(card)
   answer['aspp'] = str(card.aspp)

   if not fast:
    answer['before'] = {
     'purse_value': purse.get_value(card),
     'journey': journey.read(card)
    }

   answer['amount_used'] = journey.refill(card,amount)

   if not fast:
    answer['after'] = {
     'purse_value': purse.get_value(card),
     'journey': journey.read(card)
    }
Esempio n. 8
0
File: term.py Progetto: stdk/u2py
 def handle_standard(self,card,answer):
   transport_card.validate(card)
   answer['aspp'] = str(card.aspp)

   sector,static = term.read_static(card)

   cost,(begin,end) = term.available_refill(static.aid,static.pix)

   # try to refill with current available parameters to let card check itself.
   # This operation is harmless to card without corresponding write.
   static.refill(begin,end)

   begin,end,limit = static.validity()
   answer['available'] = {
    'validity_begin_date': begin,
    'validity_end_date': end,
    'validity_limit_date': limit,
    'cost': cost
   }