adCentsE16-server.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:AdCentsE16 作者: pooleja 项目源码 文件源码
def pay_user(to_user_name, to_address, amount):
    """
    Uses a BitTransferRequests to do an off chain payment.
    """
    headers = {BitTransferRequests.HTTP_BITCOIN_PRICE: amount,
               BitTransferRequests.HTTP_BITCOIN_ADDRESS: to_address,
               BitTransferRequests.HTTP_BITCOIN_USERNAME: to_user_name}
    response = MockRequest()
    setattr(response, 'headers', headers)
    setattr(response, 'url', 'http://10.244.119.122:11116')

    logger.debug("Making 402 payment request with headers: {}".format(response))
    req = requests.make_402_payment(response, amount)
    logger.debug("Have the payment: {}".format(req))
    transfer = BitTransfer(wallet, username=to_user_name)
    logger.debug("Have the transfer: {}".format(transfer))
    return transfer.redeem_payment(amount, req)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号