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))
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)
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)
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)
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)
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) }
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) }
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 }