本文整理汇总了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())
//.........这里部分代码省略.........