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