@POST('^/api/v1/complete_order')
    @authenticated
    def complete_order(self, request):
        def respond(success):
            if success is True:
                request.write(json.dumps({"success": True}))
                request.finish()
            else:
                request.write(json.dumps({"success": False, "reason": success}))
                request.finish()
        file_path = os.path.join(DATA_FOLDER, "purchases", "in progress", request.args["id"][0] + ".json")
        if not os.path.exists(file_path):
            file_path = os.path.join(DATA_FOLDER, "purchases", "trade receipts", request.args["id"][0] + ".json")
        with open(file_path, 'r') as filename:
            order = json.load(filename, object_pairs_hook=OrderedDict)
        c = Contract(self.db, contract=order, testnet=self.protocol.testnet)
        if "buyer_receipt" not in c.contract:
            c.add_receipt(True,
                          self.protocol.blockchain,
                          feedback=request.args["feedback"][0] if "feedback" in request.args else None,
                          quality=request.args["quality"][0] if "quality" in request.args else None,
                          description=request.args["description"][0] if "description" in request.args else None,
                          delivery_time=request.args["delivery_time"][0]
                          if request.args in "delivery_time" else None,
                          customer_service=request.args["customer_service"][0]
                          if "customer_service" in request.args else None,
                          review=request.args["review"][0].decode("utf8") if "review" in request.args else "",
                          anonymous=str_to_bool(request.args["anonymous"]) if "anonymous" in request.args else True)
        guid = c.contract["vendor_offer"]["listing"]["id"]["guid"]
        self.mserver.complete_order(guid, c).addCallback(respond)
        return server.NOT_DONE_YET
dataset/ETHPy150Open OpenBazaar/OpenBazaar-Server/api/restapi.py/OpenBazaarAPI.complete_order/swapped operands of `in`