bool OTAccount::GetOutboxHash(OTIdentifier & theOutput) { theOutput.Release(); if (!m_OutboxHash.IsEmpty()) { theOutput = m_OutboxHash; return true; } else if (!GetUserID().IsEmpty() && !GetRealAccountID().IsEmpty() && !GetRealServerID().IsEmpty() ) { OTLedger theOutbox(GetUserID(), GetRealAccountID(), GetRealServerID()); if (theOutbox.LoadOutbox() && theOutbox.CalculateOutboxHash(theOutput)) { SetOutboxHash(theOutput); return true; } } return false; }
bool OTPurse::GetNymID(OTIdentifier & theOutput) const { bool bSuccess = false; theOutput.Release(); // -------------------------------------- if (this->IsNymIDIncluded() && !m_UserID.IsEmpty()) { bSuccess = true; theOutput = m_UserID; } // -------------------------------------- else if (this->IsUsingATempNym() && (NULL != m_pTempNym)) { bSuccess = true; m_pTempNym->GetIdentifier(theOutput); } // -------------------------------------- else if (!m_UserID.IsEmpty()) { bSuccess = true; theOutput = m_UserID; } // -------------------------------------- return bSuccess; }
bool OTPayment::GetSenderAcctID(OTIdentifier & theOutput) const { theOutput.Release(); // ---------------------- if (!m_bAreTempValuesSet) return false; bool bSuccess = false; switch (m_Type) { case OTPayment::CHEQUE: case OTPayment::VOUCHER: case OTPayment::INVOICE: case OTPayment::PAYMENT_PLAN: theOutput = m_SenderAcctID; bSuccess = true; break; case OTPayment::SMART_CONTRACT: case OTPayment::PURSE: bSuccess = false; break; default: OTLog::Error("OTPayment::GetSenderAcctID: Bad payment type!\n"); break; } return bSuccess; }
bool OTPayment::GetRecipientAcctID(OTIdentifier & theOutput) const { // NOTE: // A cheque HAS NO "Recipient Asset Acct ID", since the recipient's account (where he deposits // the cheque) is not known UNTIL the time of the deposit. It's certain not known at the time // that the cheque is written... theOutput.Release(); // ---------------------- if (!m_bAreTempValuesSet) return false; bool bSuccess = false; switch (m_Type) { case OTPayment::PAYMENT_PLAN: if (m_bHasRecipient) { theOutput = m_RecipientAcctID; bSuccess = true; } else bSuccess = false; break; case OTPayment::CHEQUE: case OTPayment::VOUCHER: case OTPayment::INVOICE: case OTPayment::SMART_CONTRACT: case OTPayment::PURSE: // A purse might have a recipient USER, but never a recipient ACCOUNT. bSuccess = false; break; default: OTLog::Error("OTPayment::GetRecipientAcctID: Bad payment type!\n"); break; } return bSuccess; }
// With a voucher (cashier's cheque) the "bank" is the "sender", // whereas the actual Nym who purchased it is the "remitter." // bool OTPayment::GetRemitterUserID(OTIdentifier & theOutput) const { theOutput.Release(); // ---------------------- if (!m_bAreTempValuesSet) return false; bool bSuccess = false; switch (m_Type) { case OTPayment::VOUCHER: theOutput = m_RemitterUserID; bSuccess = true; break; default: OTLog::Error("OTPayment::GetRemitterUserID: Bad payment type! Expected a voucher cheque.\n"); break; } return bSuccess; }