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


Python Contract.get_order_id方法代码示例

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


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

示例1: rpc_order_confirmation

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import get_order_id [as 别名]
 def rpc_order_confirmation(self, sender, pubkey, encrypted):
     try:
         box = Box(self.signing_key.to_curve25519_private_key(), PublicKey(pubkey))
         order = box.decrypt(encrypted)
         c = Contract(self.db, contract=json.loads(order, object_pairs_hook=OrderedDict),
                      testnet=self.multiplexer.testnet)
         valid = c.accept_order_confirmation(self.get_notification_listener())
         if valid is True:
             self.router.addContact(sender)
             self.log.info("received confirmation for order %s" % c.get_order_id())
             return ["True"]
         else:
             self.log.warning("received invalid order confirmation from %s" % sender)
             return [valid]
     except Exception, e:
         self.log.error("unable to decrypt order confirmation from %s" % sender)
         return [str(e.message)]
开发者ID:inertia186,项目名称:OpenBazaar-Server,代码行数:19,代码来源:protocol.py

示例2: rpc_complete_order

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import get_order_id [as 别名]
    def rpc_complete_order(self, sender, pubkey, encrypted):
        try:
            box = Box(self.signing_key.to_curve25519_private_key(), PublicKey(pubkey))
            order = box.decrypt(encrypted)
            json.loads(order, object_pairs_hook=OrderedDict)
            temp = Contract(self.db, contract=json.loads(order, object_pairs_hook=OrderedDict),
                            testnet=self.multiplexer.testnet)
            c = Contract(self.db, hash_value=unhexlify(temp.get_order_id()),
                         testnet=self.multiplexer.testnet)

            contract_id = c.accept_receipt(self.get_notification_listener(),
                                           self.multiplexer.blockchain,
                                           receipt_json=json.dumps(temp.contract["buyer_receipt"], indent=4))
            self.router.addContact(sender)
            self.log.info("received receipt for order %s" % contract_id)
            return ["True"]
        except Exception, e:
            self.log.error("unable to parse receipt from %s" % sender)
            return [e.message]
开发者ID:inertia186,项目名称:OpenBazaar-Server,代码行数:21,代码来源:protocol.py


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