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


C++ OT_ME::retrieve_account方法代码示例

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


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

示例1: sendCashierCheque


//.........这里部分代码省略.........
    std::string strAttempt  = "withdraw_voucher";
    std::string strResponse;
    {
        MTOverrideCursor theSpinner;

        strResponse = madeEasy.withdraw_voucher(str_serverId, str_fromNymId, str_fromAcctId,
                                                str_toNymId, note.toStdString(), SignedAmount);
    }

    int32_t nInterpretReply = madeEasy.InterpretTransactionMsgReply(str_serverId, str_fromNymId, str_fromAcctId,
                                                                    strAttempt, strResponse);

    if (1 != nInterpretReply) // Failure
    {
        qDebug() << QString("Failure withdrawing voucher.");
        return false;
    }
    // ---------------------------------------------------------
    //else Success!
    std::string strLedger = OTAPI_Wrap::Message_GetLedger(strResponse);

    if (strLedger.empty())
    {
        qDebug() << QString("Failed withdrawing voucher: strLedger is empty.");
        return false;
    }
    // ---------------------------------------------------------
    std::string strTransReply = OTAPI_Wrap::Ledger_GetTransactionByIndex(str_serverId, str_fromNymId, str_fromAcctId, strLedger, 0); // index 0.

    if (strTransReply.empty())
    {
        qDebug() << QString("Error in withdraw_voucher: strTransReply is unexpectedly null, "
                            "returned by Ledger_GetTransactionByIndex, argument passed, index 0 and ledger:\n\n%s1\n").
                    arg(strLedger.c_str());
        return false;
    }
    // ---------------------------------------------------------
    std::string strVoucher = OTAPI_Wrap::Transaction_GetVoucher(str_serverId, str_fromNymId, str_fromAcctId, strTransReply);

    if (strVoucher.empty())
    {
        qDebug() << QString("Error in withdraw_voucher: Voucher is unexpectedly empty, returned by Transaction_GetVoucher "
                            "with strTransReply set to:\n\n%1\n").arg(strTransReply.c_str());
        return false;
    }
    else
    {
        // Save a copy in my own outpayments box. I don't want to lose this voucher since it uses
        // one of my own transaction numbers. (If I later send the voucher to someone, OT is smart
        // enough to remove the first copy from outpayments, when adding the second copy.)
        //
        // Notice how I can send an instrument to myself. This doesn't actually send anything --
        // it just puts a copy into my outpayments box for safe-keeping.
        //
        OT_ME sendToSelf;
        sendToSelf.send_user_payment(str_serverId, str_fromNymId, str_fromNymId, strVoucher);
    }
    // ---------------------------------------------------------
    // Download all the intermediary files (account balance, inbox, outbox, etc)
    // since they have probably changed from this operation.
    //
    OT_ME retrieveAcct;
    bool bRetrieved = false;
    {
        MTOverrideCursor theSpinner;

        bRetrieved = retrieveAcct.retrieve_account(str_serverId, str_fromNymId, str_fromAcctId, true); //bForceDownload defaults to false.
    }
    qDebug() << QString("%1 retrieving intermediary files for account %2. (After withdraw voucher.)").
                arg(bRetrieved ? QString("Success") : QString("Failed")).arg(str_fromAcctId.c_str());
    // ---------------------------------------------------------
    // We try to send it, even if the retrieve_account failed.
    // That way we insure that a copy of the voucher is stored
    // in the outpayment box. (Even if it fails to send.)
    // That way the user can later cancel or re-send it.
    //

    //OTLog::vOutput(0, "Sending payment to NymID: %s\n", str_toNymId.c_str());

    OT_ME sendPayment;

    std::string  strSendResponse;
    {
        MTOverrideCursor theSpinner;

        strSendResponse = sendPayment.send_user_payment(str_serverId, str_fromNymId, str_toNymId, strVoucher);
    }

    int32_t nReturnVal = sendPayment.VerifyMessageSuccess(strSendResponse);

    if (1 != nReturnVal)
        qDebug() << QString("send %1: Failed.").arg(nsChequeType);
    else
    {
        qDebug() << QString("Success in send %1!").arg(nsChequeType);
        return true;
    }

    return false;
}
开发者ID:kazcw,项目名称:Moneychanger,代码行数:101,代码来源:senddlg.cpp


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