def cancelacion(self, params): code = self.validate(params) if code == 0: db = Database(dbhost=Utils.get_secret("pg_host"), dbuser=Utils.get_secret("soapdbuser"), dbpass=Utils.get_secret("soapdbpass")) rows = db.find_msisdn(params["msisdn"]) if len(rows) < 1: code = 503 else: values = rows[0] if values["estado"] != "ALTA": code = 503 else: values["estado"] = "CANCELAR" code = db.update_telcel_trans(values) db.insert_telcel_hist(values) return code
def com_6(self, params): logger.info("Request COM_6 processing", extra={'props': {"raw": params, "app": config["name"], "label": config["name"]}}) code = self.validate(params) if code == 0: db = Database(dbhost=Utils.get_secret("pg_host"), dbuser=Utils.get_secret("soapdbuser"), dbpass=Utils.get_secret("soapdbpass")) rows = db.find_msisdn(params["msisdn"]) logger.info("Finding rows:"+str(len(rows)), extra={'props': {"raw": params, "app": config["name"], "label": config["name"]}}) if len(rows) < 1: code = 406 else: value = rows[0] code = value["msisdn"]+"|"+value["iccid"]+"|"+value["cveplan"]+"|"+value["cvetpoinst"]+"|"+value["estado"] if value["estado"] == "SUSPENDIDA": code = code + "|"+str(700) elif value["estado"] == "CANCELAR": code = code + "|" + str(800) return code