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


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

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


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

示例1: CancelOutgoing

// ---------------------------------------
// For outgoing, pending (not-yet-accepted) instruments.
//
bool MTRecord::CancelOutgoing(const std::string str_via_acct) // This can be blank if it's a cheque.
{
    if (!this->CanCancelOutgoing())
        return false;

    switch (this->GetRecordType())
    {
        case MTRecord::Instrument:
        {
            if (m_str_nym_id.empty())
            {
                OTLog::vError("%s: Error: missing nym id (%s)\n",
                              __FUNCTION__, m_str_nym_id.c_str());
                return false;
            }

            const OTIdentifier theNymID(m_str_nym_id);
            // ------------------------------
            std::string str_using_acct;

            if (this->IsCheque())
            {
                str_using_acct = m_str_account_id;
            }
            else
            {
                str_using_acct = str_via_acct;
            }
            // ---------------------------------------
            if (str_using_acct.empty())
            {
                OTLog::vError("%s: Error: Missing account ID (FAILURE)\n", __FUNCTION__);
                return false;
            }
            // ------------------------------
            if (0 == m_lTransactionNum)
            {
                if (IsCash())
                {
                    // Maybe it's cash...
                    std::string strOutpayment(OTAPI_Wrap::GetNym_OutpaymentsContentsByIndex(m_str_nym_id, GetBoxIndex()));

                    if (strOutpayment.empty())
                    {
                        long lIndex = static_cast<long>(GetBoxIndex());
                        OTLog::vError("%s: Error: Blank outpayment at index %ld\n", __FUNCTION__, lIndex);
                        return false;
                    }
                    // ------------------------
                    OTString  strPayment(strOutpayment);
                    OTPayment thePayment(strPayment);

                    if (!thePayment.IsValid() || !thePayment.SetTempValues())
                    {
                        long lIndex = static_cast<long>(GetBoxIndex());
                        OTLog::vError("%s: Error: Invalid outpayment at index %ld\n", __FUNCTION__, lIndex);
                        return false;
                    }
                    // ------------------------
                    long lTransNum = 0;
                    thePayment.GetOpeningNum(lTransNum, theNymID);
                    // ------------------------
                    if (0 == lTransNum) // Found it.
                    {
                        long lIndex = static_cast<long>(GetBoxIndex());
                        OTString strIndices;
                        strIndices.Format("%ld", lIndex);
                        const std::string str_indices(strIndices.Get());
                        // ---------------------------------
                        OT_ME madeEasy;

                        return madeEasy.cancel_outgoing_payments(m_str_nym_id, str_using_acct, str_indices);
                    }
                    else
                    {
                        OTLog::vError("%s: Error: Transaction number is non-zero (%ld), for cash outgoing payment for nym id (%s)\n",
                                      __FUNCTION__, lTransNum, m_str_nym_id.c_str());
                        return false;
                    }
                } // IsCash()
                else
                {
                    OTLog::vError("%s: Error: Transaction number is 0, for non-cash outgoing payment for nym id (%s)\n",
                                  __FUNCTION__, m_str_nym_id.c_str());
                    return false;
                }
            }
            // ---------------------------------------
            // Find the payment in the Nym's outpayments box that correlates to this MTRecord.
            //
            int32_t nCount = OTAPI_Wrap::GetNym_OutpaymentsCount(m_str_nym_id);

            for (int32_t nIndex = 0; nIndex < nCount; ++nIndex)
            {
                std::string strOutpayment(OTAPI_Wrap::GetNym_OutpaymentsContentsByIndex(m_str_nym_id, nIndex));

                if (strOutpayment.empty())
//.........这里部分代码省略.........
开发者ID:kazcw,项目名称:Moneychanger,代码行数:101,代码来源:MTRecord.cpp


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