154 : m_pForParty(nullptr)
155 , m_pAccount(nullptr)
156 , m_lClosingTransNo(0)
166 OTAccount& theAccount, int64_t lClosingTransNo)
167 : m_pForParty(nullptr)
169 m_pAccount(&theAccount)
170 , m_lClosingTransNo(lClosingTransNo)
171 , m_strName(str_account_name.c_str())
172 , m_strAcctID(theAccount.GetRealAccountID())
173 , m_strAssetTypeID(theAccount.GetAssetTypeID())
174 , m_strAgentName(strAgentName)
182 int64_t lClosingTransNo)
183 : m_pForParty(nullptr)
186 , m_lClosingTransNo(lClosingTransNo)
188 , m_strAcctID(strAcctID)
189 , m_strAssetTypeID(strAssetTypeID)
190 , m_strAgentName(strAgentName)
202 if (!m_strAgentName.
Exists()) {
203 otErr <<
"OTPartyAccount::GetAuthorizedAgent: Error: Authorized agent "
204 "name (for this account) is blank!\n";
208 const std::string str_agent_name = m_strAgentName.
Get();
219 m_pForParty = &theOwnerParty;
226 m_pForParty =
nullptr;
227 m_pAccount =
nullptr;
232 if (!m_strAcctID.
Exists()) {
236 if (!m_strAssetTypeID.
Exists()) {
241 if (!(theAcctID == theMemberAcctID)) {
243 otLog4 <<
"OTPartyAccount::IsAccountByID: Account IDs don't match: "
244 << m_strAcctID <<
" / " << strRHS <<
" \n";
257 if (!m_strAcctID.
Exists()) {
258 otErr <<
"OTPartyAccount::IsAccount: Error: Empty m_strAcctID.\n";
262 if (!m_strAssetTypeID.
Exists()) {
263 otErr <<
"OTPartyAccount::IsAccount: Error: Empty m_strAssetTypeID.\n";
270 otLog4 <<
"OTPartyAccount::IsAccount: Account IDs don't match: "
271 << m_strAcctID <<
" / " << strRHS
280 otOut <<
"OTPartyAccount::IsAccount: Asset Type IDs don't match ( "
281 << m_strAssetTypeID <<
" / " << strRHS
282 <<
" ) for Acct ID: " << m_strAcctID <<
" \n";
286 m_pAccount = &theAccount;
294 if (
nullptr == m_pForParty) {
295 otErr <<
"OTPartyAccount::VerifyOwnership: Error: nullptr pointer to "
299 if (
nullptr == m_pAccount) {
300 otErr <<
"OTPartyAccount::VerifyOwnership: Error: nullptr pointer to "
301 "account. (This function expects account to already be "
307 otOut <<
"OTPartyAccount::VerifyOwnership: Party %s doesn't verify as "
308 "the ACTUAL owner of account: " << m_strName <<
" \n";
319 if (
nullptr == m_pAccount) {
320 otErr <<
"OTPartyAccount::VerifyAgency: Error: nullptr pointer to "
321 "account. (This function expects account to already be "
328 if (
nullptr == pAgent) {
330 <<
"OTPartyAccount::VerifyAgency: Unable to find authorized agent ("
337 <<
" doesn't verify as ACTUALLY having rights over account "
347 OTSmartContract& theSmartContract,
const int64_t& lNewTransactionNumber,
351 const char* szFunc =
"OTPartyAccount::DropFinalReceiptToInbox";
353 if (
nullptr == m_pForParty) {
354 otErr << szFunc <<
": nullptr m_pForParty.\n";
357 else if (!m_strAcctID.
Exists()) {
358 otErr << szFunc <<
": Empty Acct ID.\n";
361 else if (!m_strAgentName.
Exists()) {
362 otErr << szFunc <<
": No agent named for this account.\n";
369 const std::string str_agent_name(m_strAgentName.
Get());
373 if (
nullptr == pAgent)
374 otErr << szFunc <<
": named agent wasn't found on party.\n";
378 return pAgent->DropFinalReceiptToInbox(
379 pNymMap, strServerID, theServerNym, theSmartContract,
381 lNewTransactionNumber, m_lClosingTransNo,
382 strOrigCronItem, pstrNote, pstrAttachment);
397 if (!m_strAcctID.
Exists()) {
398 otOut <<
"OTPartyAccount::LoadAccount: Bad: Acct ID is blank for "
399 "account: " << m_strName <<
" \n";
403 const OTIdentifier theAcctID(m_strAcctID), theServerID(strServerID);
408 if (
nullptr == pAccount) {
409 otOut <<
"OTPartyAccount::LoadAccount: Failed trying to load account: "
410 << m_strName <<
", with AcctID: " << m_strAcctID <<
" \n";
417 <<
"OTPartyAccount::LoadAccount: Failed trying to verify account: "
418 << m_strName <<
", with AcctID: " << m_strAcctID <<
" \n";
443 bool bSpecifyAssetID)
const
446 "<assetAccount\n name=\"%s\"\n"
448 " assetTypeID=\"%s\"\n"
449 " agentName=\"%s\"\n"
450 " closingTransNo=\"%lld\" />\n\n",
451 m_strName.
Get(), bCalculatingID ?
"" : m_strAcctID.
Get(),
452 (bCalculatingID && !bSpecifyAssetID) ?
"" : m_strAssetTypeID.
Get(),
453 bCalculatingID ?
"" : m_strAgentName.
Get(),
454 bCalculatingID ? 0 : m_lClosingTransNo);
459 const std::string str_acct_name = m_strName.
Get();
467 otOut <<
"OTPartyAccount::Compare: Names don't match: " <<
GetName()
468 <<
" / " << rhs.
GetName() <<
" \n";
474 otOut <<
"OTPartyAccount::Compare: Closing transaction numbers don't "
475 "match: " <<
GetName() <<
" \n";
481 otOut <<
"OTPartyAccount::Compare: Asset account numbers don't match "
489 otOut <<
"OTPartyAccount::Compare: Agent names don't match for party "
497 otOut <<
"OTPartyAccount::Compare: Asset Type IDs don't exist, or "
OTLOG_IMPORT OTLogStream otLog4
void Serialize(OTString &strAppend, bool bCalculatingID=false, bool bSpecifyAssetID=false) const
EXPORT OTAgent * GetAgent(const std::string &str_agent_name) const
EXPORT const OTIdentifier & GetAssetTypeID() const
EXPORT const OTString & GetName() const
OTLOG_IMPORT OTLogStream otOut
std::map< std::string, OTPseudonym * > mapOfNyms
bool VerifyOwnershipOfAccount(const OTAccount &theAccount) const
EXPORT void Concatenate(const char *arg,...)
EXPORT OTAgent * GetAuthorizedAgent()
EXPORT bool Exists() const
const OTIdentifier & GetRealAccountID() const
EXPORT bool Compare(const char *compare) const
void AddAccount(std::string str_acct_name, OTPartyAccount &theAcct)
bool Compare(const OTPartyAccount &rhs) const
const OTString & GetAgentName() const
EXPORT const char * Get() const
OTLOG_IMPORT OTLogStream otErr
virtual bool VerifyAccount(const OTPseudonym &theNym)
const OTString & GetAcctID() const
EXPORT void RegisterForExecution(OTScript &theScript)
bool VerifyAgencyOfAccount(const OTAccount &theAccount) const
bool DropFinalReceiptToInbox(mapOfNyms *pNymMap, const OTString &strServerID, OTPseudonym &theServerNym, OTSmartContract &theSmartContract, const int64_t &lNewTransactionNumber, const OTString &strOrigCronItem, OTString *pstrNote=nullptr, OTString *pstrAttachment=nullptr)
const OTString & GetAssetTypeID() const
bool IsAccountByID(const OTIdentifier &theAcctID) const
bool VerifyOwnership() const
EXPORT bool Exists(std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
int64_t GetClosingTransNo() const
bool IsAccount(OTAccount &theAccount)
virtual ~OTPartyAccount()
void SetParty(OTParty &theOwnerParty)
OTAccount * LoadAccount(OTPseudonym &theSignerNym, const OTString &strServerID)
static EXPORT OTAccount * LoadExistingAccount(const OTIdentifier &accountId, const OTIdentifier &serverId)