当前位置: 首页>>代码示例>>Python>>正文


Python Contract.add_receipt方法代码示例

本文整理汇总了Python中market.contracts.Contract.add_receipt方法的典型用法代码示例。如果您正苦于以下问题:Python Contract.add_receipt方法的具体用法?Python Contract.add_receipt怎么用?Python Contract.add_receipt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在market.contracts.Contract的用法示例。


在下文中一共展示了Contract.add_receipt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: complete_order

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import add_receipt [as 别名]
 def complete_order(self, request):
     def respond(success):
         if success:
             request.write(json.dumps({"success": True}))
             request.finish()
         else:
             request.write(json.dumps({"success": False, "reason": "Failed to send receipt to vendor"}))
             request.finish()
     file_path = DATA_FOLDER + "purchases/in progress/" + 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)
     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 "delivery_time" in request.args else None,
                   customer_service=request.args["customer_service"][0]
                   if "customer_service" in request.args else None,
                   review=request.args["review"][0] if "review" in request.args else "")
     guid = c.contract["vendor_offer"]["listing"]["id"]["guid"]
     self.mserver.complete_order(guid, c).addCallback(respond)
     return server.NOT_DONE_YET
开发者ID:syntox,项目名称:OpenBazaar-Server,代码行数:27,代码来源:restapi.py


注:本文中的market.contracts.Contract.add_receipt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。