@@ -94,3 +94,8 @@ class db():
cur.executemany("insert into productos_pedido(id_pedido,id_producto,cantidad) values (%s, %s, %s)", lista_productos)
self.conn.commit()
return 0
+
+ def confirm(self, _hash, _id):
+ c = self.client(_hash)
+ cur = self.conn.cursor()
+ cur.execute("UPDATE pedidos set estado = 'CONFIRMADO' where id = %s and cliente = %s and estado = 'CREADO'", (_id,c["id"]))
@@ -49,6 +49,10 @@ def pedido():
return "{}"
+@app.route(BASE_PATH + '/confirm/<_hash>/<pedidoid>', methods=["POST"])
+def confirm(_hash, pedidoid):
+ d.confirm(_hash, pedidoid)
+ return "{}"
if __name__ == '__main__':
app.run(host="0.0.0.0",port=PORT, debug=True)