本文整理汇总了C++中OT_ME::discard_incoming_payments方法的典型用法代码示例。如果您正苦于以下问题:C++ OT_ME::discard_incoming_payments方法的具体用法?C++ OT_ME::discard_incoming_payments怎么用?C++ OT_ME::discard_incoming_payments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OT_ME
的用法示例。
在下文中一共展示了OT_ME::discard_incoming_payments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DiscardIncoming
// ---------------------------------------
// For incoming, pending (not-yet-accepted) instruments.
//
bool MTRecord::DiscardIncoming()
{
if (!this->CanDiscardIncoming())
return false;
switch (this->GetRecordType())
{
case MTRecord::Instrument:
{
if (m_str_server_id.empty() || m_str_nym_id.empty())
{
OTLog::vError("%s: Error: missing server id (%s) or nym id (%s)\n",
__FUNCTION__, m_str_server_id.c_str(), m_str_nym_id.c_str());
return false;
}
// ------------------------------
if (0 == m_lTransactionNum)
{
OTLog::vError("%s: Error: Transaction number is 0, in payment inbox for server id (%s), nym id (%s)\n",
__FUNCTION__, m_str_server_id.c_str(), m_str_nym_id.c_str());
return false;
}
// ------------------------------
const OTIdentifier theServerID(m_str_server_id), theNymID(m_str_nym_id);
// Open the Nym's payments inbox.
OTLedger * pInbox = OTAPI_Wrap::OTAPI()->LoadPaymentInbox(theServerID, theNymID);
OTCleanup<OTLedger> theInboxAngel(pInbox);
// ------------------------------------------
if (NULL == pInbox)
{
OTLog::vError("%s: Error: Unable to load payment inbox for server id (%s), nym id (%s)\n",
__FUNCTION__, m_str_server_id.c_str(), m_str_nym_id.c_str());
return false;
}
// ------------------------------------------
// Find the payment therein that correlates to this MTRecord.
//
int nIndex = pInbox->GetTransactionIndex(m_lTransactionNum);
if ((-1) == nIndex)
{
OTLog::vError("%s: Error: Unable to find transaction %ld in payment inbox for server id (%s), nym id (%s)\n",
__FUNCTION__, m_lTransactionNum, m_str_server_id.c_str(), m_str_nym_id.c_str());
return false;
}
// ------------------------------------------
// Accept it.
//
OTString strIndices;
strIndices.Format("%d", nIndex);
const std::string str_indices(strIndices.Get());
OT_ME madeEasy;
return madeEasy.discard_incoming_payments(m_str_server_id, m_str_nym_id, str_indices);
} // case: instrument
break;
// --------------------------------------------
default:
OTLog::vError("%s: Unexpected type: %s\n",
__FUNCTION__, this->GetInstrumentType().c_str());
return false;
}
return true;
}