def get_auth_msg(self): auth_dict = OrderedDict() auth_factor = OrderedDict() auth_dict[SGREQ] = {} auth_factor["B2"] = zip auth_factor["B1"] = phone auth_dict[SGREQ]["A1"] = pos_id auth_dict[SGREQ]["A2"] = auth_code auth_dict[SGREQ]["A4"] = auth_factor auth_dict[SGREQ]["A10"] = "1" try: auth_xml = pu.dict_to_xml(auth_dict) except Exception as e: raise e return auth_xml
def parse_dict_to_payment(self, payment_dict, gen_key): print('parsing payment dict to tsys payment msg') print(str(payment_dict)) #pos_data_codes = payment_dict['payment']['f22'] msg_unparsed = OrderedDict() msg_unparsed[SGREQ] = {} msg_unparsed[SGREQ]['A1'] = pos_id msg_unparsed[SGREQ]['A3'] = gen_key msg_unparsed[SGREQ]['A10'] = '10' msg_unparsed[SGREQ]['A12'] = payment_dict['payment']['paymentCode'] msg_unparsed[SGREQ]['A15'] = payment_dict['payment']['amount'] msg_unparsed[SGREQ]['A17'] = payment_dict['payment']['transactionCounter'] msg_unparsed[SGREQ]['A21'] = {} msg_unparsed[SGREQ]['A21']['B1'] = '0' msg_unparsed[SGREQ]['A21']['B2'] = '1' msg_unparsed[SGREQ]['A21']['B3'] = 'C' msg_unparsed[SGREQ]['A21']['B4'] = '1' msg_unparsed[SGREQ]['A21']['B5'] = '1' msg_unparsed[SGREQ]['A21']['B6'] = '5' msg_unparsed[SGREQ]['A21']['B9'] = '1' msg_unparsed[SGREQ]['A21']['B13'] = '0' msg_unparsed[SGREQ]['A24'] = payment_dict['payment']['track2Data'] msg_unparsed[SGREQ]['A41'] = developer_id msg_unparsed[SGREQ]['A42'] = version_id xml_msg = pu.dict_to_xml(msg_unparsed) print('xml_msg: ' + xml_msg) tsys_payment = self.construct_msg(xml_msg) print('tsys payment: ' + tsys_payment) return tsys_payment