Beispiel #1
0
 def test_exitosa(self):
     params = dict()
     params["msisdn"] = ""
     params["iccid"] = ""
     soap = Soap()
     js = soap.reactivacion(params)
     self.assertTrue(js == 0)
Beispiel #2
0
def extract_body(xml, method):
    soap = Soap()
    namespaces = {
        'soapenv': 'http://www.w3.org/2003/05/soap-envelope'
    }
    node = xml.findall("./soapenv:Body", namespaces)
    code = 0
    for child in node[0].getchildren():
        data = dict()
        for ele in child.getchildren():
            if "arg0" in ele.tag or "in0" in ele.tag:
                data["msisdn"] = ele.text
            elif "arg1" in ele.tag or "in1" in ele.tag:
                data["iccid"] = ele.text
            elif "arg2" in ele.tag or "in2" in ele.tag:
                data["cveplan"] = ele.text
            elif "arg3" in ele.tag or "in3" in ele.tag:
                data["cvetpoinst"] = ele.text
        logger.info("New transaction", extra={'props': {"method": child.tag, "app": config["name"], "data": data}})
        if method == "POST":
            if "alta_aprov_telcel" in child.tag:
                code = soap.alta(data)
            elif "suspender_aprov_telcel" in child.tag:
                code = soap.suspension(data)
            elif "reactivar_aprov_telcel" in child.tag:
                code = soap.reactivacion(data)
            elif "cancelar_aprov_telcel" in child.tag:
                code = soap.cancelacion(data)
            elif "modificar_aprov_telcel" in child.tag:
                data["cveplan"] = data["iccid"]
                code = soap.update_plan(data)
            elif "com6_aprov_telcel" in child.tag:
                logger.info("Request COM_6 processing", extra={'props': {"raw": data, "app": config["name"], "label": config["name"]}})
                code = soap.com_6(data)
    return code