Open-Transactions  0.93.0-ge03d287
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
opentxs::OTCheque Class Reference

#include <OTCheque.hpp>

Inheritance diagram for opentxs::OTCheque:
Collaboration diagram for opentxs::OTCheque:

Public Member Functions

void SetAsVoucher (const OTIdentifier &remitterUserID, const OTIdentifier &remitterAcctID)
 
const OTStringGetMemo () const
 
const int64_t & GetAmount () const
 
const OTIdentifierGetRecipientUserID () const
 
bool HasRecipient () const
 
const OTIdentifierGetRemitterUserID () const
 
const OTIdentifierGetRemitterAcctID () const
 
bool HasRemitter () const
 
EXPORT bool IssueCheque (const int64_t &lAmount, const int64_t &lTransactionNum, const time64_t &VALID_FROM, const time64_t &VALID_TO, const OTIdentifier &SENDER_ACCT_ID, const OTIdentifier &SENDER_USER_ID, const OTString &strMemo, const OTIdentifier *pRECIPIENT_USER_ID=nullptr)
 
EXPORT void CancelCheque ()
 
EXPORT OTCheque ()
 
EXPORT OTCheque (const OTIdentifier &SERVER_ID, const OTIdentifier &ASSET_ID)
 
virtual EXPORT ~OTCheque ()
 
void InitCheque ()
 
virtual void Release ()
 
void Release_Cheque ()
 
virtual void UpdateContents ()
 
virtual bool SaveContractWallet (std::ofstream &ofs) const
 
- Public Member Functions inherited from opentxs::OTTrackable
 OTTrackable ()
 
 OTTrackable (const OTIdentifier &SERVER_ID, const OTIdentifier &ASSET_ID)
 
 OTTrackable (const OTIdentifier &SERVER_ID, const OTIdentifier &ASSET_ID, const OTIdentifier &ACCT_ID, const OTIdentifier &USER_ID)
 
virtual ~OTTrackable ()
 
void InitTrackable ()
 
void Release_Trackable ()
 
virtual bool HasTransactionNum (const int64_t &lInput) const
 
virtual void GetAllTransactionNumbers (OTNumList &numlistOutput) const
 
int64_t GetTransactionNum () const
 
void SetTransactionNum (int64_t lTransactionNum)
 
const OTIdentifierGetSenderAcctID () const
 
const OTIdentifierGetSenderUserID () const
 
- Public Member Functions inherited from opentxs::OTInstrument
EXPORT OTInstrument ()
 
EXPORT OTInstrument (const OTIdentifier &SERVER_ID, const OTIdentifier &ASSET_ID)
 
virtual EXPORT ~OTInstrument ()
 
void Release_Instrument ()
 
EXPORT bool VerifyCurrentDate ()
 
EXPORT bool IsExpired ()
 
time64_t GetValidFrom () const
 
time64_t GetValidTo () const
 
const OTIdentifierGetAssetID () const
 
const OTIdentifierGetServerID () const
 
void InitInstrument ()
 
- Public Member Functions inherited from opentxs::OTScriptable
virtual EXPORT void SetDisplayLabel (const std::string *pstrLabel=nullptr)
 
int32_t GetPartyCount () const
 
int32_t GetBylawCount () const
 
virtual EXPORT bool AddParty (OTParty &theParty)
 
virtual EXPORT bool AddBylaw (OTBylaw &theBylaw)
 
virtual EXPORT bool ConfirmParty (OTParty &theParty)
 
EXPORT OTPartyGetParty (std::string str_party_name) const
 
EXPORT OTBylawGetBylaw (std::string str_bylaw_name) const
 
EXPORT OTClauseGetClause (std::string str_clause_name) const
 
EXPORT OTPartyGetPartyByIndex (int32_t nIndex) const
 
EXPORT OTBylawGetBylawByIndex (int32_t nIndex) const
 
EXPORT OTPartyFindPartyBasedOnNymAsAgent (OTPseudonym &theNym, OTAgent **ppAgent=nullptr) const
 
EXPORT OTPartyFindPartyBasedOnNymAsAuthAgent (OTPseudonym &theNym, OTAgent **ppAgent=nullptr) const
 
OTPartyFindPartyBasedOnAccount (OTAccount &theAccount, OTPartyAccount **ppPartyAccount=nullptr) const
 
OTPartyFindPartyBasedOnNymIDAsAgent (const OTIdentifier &theNymID, OTAgent **ppAgent=nullptr) const
 
OTPartyFindPartyBasedOnNymIDAsAuthAgent (const OTIdentifier &theNymID, OTAgent **ppAgent=nullptr) const
 
OTPartyFindPartyBasedOnAccountID (const OTIdentifier &theAcctID, OTPartyAccount **ppPartyAccount=nullptr) const
 
OTAgentGetAgent (std::string str_agent_name) const
 
OTPartyAccountGetPartyAccount (std::string str_acct_name) const
 
OTPartyAccountGetPartyAccountByID (const OTIdentifier &theAcctID) const
 
EXPORT int32_t GetCountTransNumsNeededForAgent (std::string str_agent_name) const
 
virtual EXPORT bool VerifyNymAsAgent (OTPseudonym &theNym, OTPseudonym &theSignerNym, mapOfNyms *pmap_ALREADY_LOADED=nullptr) const
 
virtual EXPORT bool VerifyNymAsAgentForAccount (OTPseudonym &theNym, OTAccount &theAccount) const
 
bool VerifyPartyAuthorization (OTParty &theParty, OTPseudonym &theSignerNym, const OTString &strServerID, mapOfNyms *pmap_ALREADY_LOADED=nullptr, mapOfNyms *pmap_NEWLY_LOADED=nullptr, bool bBurnTransNo=false)
 
bool VerifyPartyAcctAuthorization (OTPartyAccount &thePartyAcct, OTPseudonym &theSignerNym, const OTString &strServerID, bool bBurnTransNo=false)
 
EXPORT bool VerifyThisAgainstAllPartiesSignedCopies ()
 
EXPORT bool AllPartiesHaveSupposedlyConfirmed ()
 
void RetrieveNymPointers (mapOfNyms &map_Nyms_Already_Loaded)
 
void ClearTemporaryPointers ()
 
bool GetHooks (std::string str_HookName, mapOfClauses &theResults)
 
OTClauseGetCallback (std::string str_CallbackName)
 
OTVariableGetVariable (std::string str_VarName)
 
bool IsDirty () const
 
bool IsDirtyImportant () const
 
void SetAsClean ()
 
EXPORT bool SendNoticeToAllParties (bool bSuccessMsg, OTPseudonym &theServerNym, const OTIdentifier &theServerID, const int64_t &lNewTransactionNumber, const OTString &strReference, OTString *pstrNote=nullptr, OTString *pstrAttachment=nullptr, OTPseudonym *pActualNym=nullptr) const
 
EXPORT bool CanExecuteClause (std::string str_party_name, std::string str_clause_name)
 
bool ExecuteCallback (OTClause &theCallbackClause, mapOfVariables &theParameters, OTVariable &varReturnVal)
 
virtual EXPORT void RegisterOTNativeCallsWithScript (OTScript &theScript)
 
virtual EXPORT bool Compare (OTScriptable &rhs) const
 
 OTScriptable ()
 
virtual ~OTScriptable ()
 
void UpdateContentsToString (OTString &strAppend, bool bCalculatingID) const
 
virtual EXPORT void CalculateContractID (OTIdentifier &newID) const
 
void Release_Scriptable ()
 
- Public Member Functions inherited from opentxs::OTContract
const char * GetHashType () const
 
void SetIdentifier (const OTIdentifier &theID)
 
EXPORT OTContract ()
 
EXPORT OTContract (const OTString &name, const OTString &foldername, const OTString &filename, const OTString &strID)
 
EXPORT OTContract (const OTString &strID)
 
EXPORT OTContract (const OTIdentifier &theID)
 
void Initialize ()
 
virtual EXPORT ~OTContract ()
 
EXPORT void Release_Contract ()
 
EXPORT void ReleaseSignatures ()
 
virtual EXPORT bool CreateContract (const OTString &strContract, const OTPseudonym &theSigner)
 
EXPORT bool InsertNym (const OTString &strKeyName, const OTString &strKeyValue)
 
EXPORT void GetName (OTString &strName) const
 
EXPORT void SetName (const OTString &strName)
 
virtual EXPORT bool VerifyContract ()
 
virtual EXPORT void GetIdentifier (OTIdentifier &theIdentifier) const
 
virtual EXPORT void GetIdentifier (OTString &theIdentifier) const
 
EXPORT void GetFilename (OTString &strFilename) const
 
EXPORT void GetFoldername (OTString &strFoldername) const
 
virtual EXPORT bool LoadContract ()
 
EXPORT bool LoadContract (const char *szFoldername, const char *szFilename)
 
EXPORT bool LoadContractFromString (const OTString &theStr)
 
bool LoadContractRawFile ()
 
EXPORT bool ParseRawFile ()
 
EXPORT bool SaveToContractFolder ()
 
EXPORT bool SaveContractRaw (OTString &strOutput) const
 
EXPORT bool RewriteContract (OTString &strOutput) const
 
EXPORT bool SaveContract ()
 
EXPORT bool SaveContract (const char *szFoldername, const char *szFilename)
 
virtual EXPORT void CreateContents ()
 
EXPORT void CreateInnerContents ()
 
virtual EXPORT bool SaveContents (std::ofstream &ofs) const
 
virtual EXPORT bool SaveContractWallet (OTString &strContents) const
 
virtual EXPORT bool DisplayStatistics (OTString &strContents) const
 
virtual EXPORT bool SaveContents (OTString &strContents) const
 
virtual EXPORT bool SignContract (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContractAuthent (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignWithKey (const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const OTPseudonym &theNym, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContractAuthent (const OTPseudonym &theNym, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const OTAsymmetricKey &theKey, OTSignature &theSignature, const OTString &strHashType, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const char *szFoldername, const char *szFilename, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
virtual EXPORT bool VerifyContractID () const
 
virtual EXPORT bool VerifySignature (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
 
virtual EXPORT bool VerifySigAuthent (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifyWithKey (const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const OTPseudonym &theNym, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySigAuthent (const OTPseudonym &theNym, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const OTAsymmetricKey &theKey, const OTSignature &theSignature, const OTString &strHashType, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const char *szFoldername, const char *szFilename, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT const OTAsymmetricKeyGetContractPublicKey () const
 
EXPORT const OTPseudonymGetContractPublicNym () const
 

Protected Member Functions

virtual int32_t ProcessXMLNode (irr::io::IrrXMLReader *&xml)
 
- Protected Member Functions inherited from opentxs::OTTrackable
void SetSenderAcctID (const OTIdentifier &ACCT_ID)
 
void SetSenderUserID (const OTIdentifier &USER_ID)
 
- Protected Member Functions inherited from opentxs::OTInstrument
void SetValidFrom (time64_t TIME_FROM)
 
void SetValidTo (time64_t TIME_TO)
 
void SetAssetID (const OTIdentifier &ASSET_ID)
 
void SetServerID (const OTIdentifier &SERVER_ID)
 
- Protected Member Functions inherited from opentxs::OTContract
bool LoadContractXML ()
 

Protected Attributes

int64_t m_lAmount
 
OTString m_strMemo
 
OTIdentifier m_RECIPIENT_USER_ID
 
bool m_bHasRecipient
 
OTIdentifier m_REMITTER_USER_ID
 
OTIdentifier m_REMITTER_ACCT_ID
 
bool m_bHasRemitter
 
- Protected Attributes inherited from opentxs::OTTrackable
int64_t m_lTransactionNum
 
OTIdentifier m_SENDER_ACCT_ID
 
OTIdentifier m_SENDER_USER_ID
 
- Protected Attributes inherited from opentxs::OTInstrument
OTIdentifier m_AssetTypeID
 
OTIdentifier m_ServerID
 
time64_t m_VALID_FROM
 
time64_t m_VALID_TO
 
- Protected Attributes inherited from opentxs::OTScriptable
mapOfParties m_mapParties
 
mapOfBylaws m_mapBylaws
 
bool m_bCalculatingID
 
bool m_bSpecifyAssetID
 
bool m_bSpecifyParties
 
OTString m_strLabel
 
- Protected Attributes inherited from opentxs::OTContract
OTString m_strName
 
OTString m_strFoldername
 
OTString m_strFilename
 
OTIdentifier m_ID
 
OTStringXML m_xmlUnsigned
 
OTString m_strRawFile
 
OTString m_strSigHashType
 
OTString m_strContractType
 
mapOfNyms m_mapNyms
 
listOfSignatures m_listSignatures
 
OTString m_strVersion
 
OTString m_strEntityShortName
 
OTString m_strEntityLongName
 
OTString m_strEntityEmail
 
OTString::Map m_mapConditions
 

Additional Inherited Members

- Static Public Member Functions inherited from opentxs::OTScriptable
static EXPORT OTScriptableInstantiateScriptable (const OTString &strInput)
 
static bool ValidateName (std::string str_name)
 
static std::string GetTime ()
 
- Static Public Member Functions inherited from opentxs::OTContract
static EXPORT bool DearmorAndTrim (const OTString &strInput, OTString &strOutput, OTString &strFirstLine)
 
static bool AddBookendsAroundContent (OTString &strOutput, const OTString &strContents, const OTString &strContractType, const OTString &strHashType, const listOfSignatures &listSignatures)
 
static EXPORT bool LoadEncodedTextField (irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput)
 
static EXPORT bool LoadEncodedTextField (irr::io::IrrXMLReader *&xml, OTString &strOutput)
 
static bool LoadEncodedTextFieldByName (irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)
 
static bool LoadEncodedTextFieldByName (irr::io::IrrXMLReader *&xml, OTString &strOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)
 
static bool SkipToElement (irr::io::IrrXMLReader *&xml)
 
static bool SkipToTextField (irr::io::IrrXMLReader *&xml)
 
static bool SkipAfterLoadingField (irr::io::IrrXMLReader *&xml)
 
static EXPORT bool SignFlatText (OTString &strFlatText, const OTString &strContractType, const OTPseudonym &theSigner, OTString &strOutput)
 

Detailed Description

Definition at line 141 of file OTCheque.hpp.

Constructor & Destructor Documentation

opentxs::OTCheque::OTCheque ( )

Definition at line 373 of file OTCheque.cpp.

374  : ot_super()
375  , m_lAmount(0)
376  , m_bHasRecipient(false)
377  , m_bHasRemitter(false)
378 {
379  InitCheque();
380 }
opentxs::OTCheque::OTCheque ( const OTIdentifier SERVER_ID,
const OTIdentifier ASSET_ID 
)

Definition at line 382 of file OTCheque.cpp.

383  : ot_super(SERVER_ID, ASSET_ID)
384  , m_lAmount(0)
385  , m_bHasRecipient(false)
386  , m_bHasRemitter(false)
387 {
388  InitCheque();
389 
390  // m_ServerID and m_AssetTypeID are now in a grandparent class
391  // (OTInstrument)
392  // So they are initialized there now.
393 }
opentxs::OTCheque::~OTCheque ( )
virtual

Definition at line 416 of file OTCheque.cpp.

417 {
418  Release_Cheque();
419 }
void Release_Cheque()
Definition: OTCheque.cpp:395

Member Function Documentation

void opentxs::OTCheque::CancelCheque ( )

Definition at line 295 of file OTCheque.cpp.

296 {
297  m_lAmount = 0;
298 
299  // When cancelling a cheque, it is basically just deposited back into the
300  // account it was originally drawn from. The purpose of this is to "beat the
301  // original recipient to the punch" by invalidating the cheque before he can
302  // redeem it. Therefore when we do this "deposit" we don't actually intend
303  // to
304  // change the account balance -- so we set the cheque amount to 0.
305  //
306  // So why deposit the cheque, with a 0 balance? Because we just want to
307  // invalidate the transaction number that was used on the cheque. We're
308  // still
309  // going to use a balance agreement, which the server will still verify, but
310  // it
311  // will be for a zero balance, and the transaction number will still be
312  // marked
313  // off via a cheque receipt.
314  //
315  // Since this is really just about marking off transaction numbers, not
316  // changing any balances, we set the cheque amount to 0 and re-sign it.
317 }
const int64_t& opentxs::OTCheque::GetAmount ( ) const
inline

Definition at line 172 of file OTCheque.hpp.

173  {
174  return m_lAmount;
175  }
const OTString& opentxs::OTCheque::GetMemo ( ) const
inline

Definition at line 168 of file OTCheque.hpp.

169  {
170  return m_strMemo;
171  }
OTString m_strMemo
Definition: OTCheque.hpp:150
const OTIdentifier& opentxs::OTCheque::GetRecipientUserID ( ) const
inline

Definition at line 176 of file OTCheque.hpp.

177  {
178  return m_RECIPIENT_USER_ID;
179  }
OTIdentifier m_RECIPIENT_USER_ID
Definition: OTCheque.hpp:151
const OTIdentifier& opentxs::OTCheque::GetRemitterAcctID ( ) const
inline

Definition at line 188 of file OTCheque.hpp.

189  {
190  return m_REMITTER_ACCT_ID;
191  }
OTIdentifier m_REMITTER_ACCT_ID
Definition: OTCheque.hpp:156
const OTIdentifier& opentxs::OTCheque::GetRemitterUserID ( ) const
inline

Definition at line 184 of file OTCheque.hpp.

185  {
186  return m_REMITTER_USER_ID;
187  }
OTIdentifier m_REMITTER_USER_ID
Definition: OTCheque.hpp:154
bool opentxs::OTCheque::HasRecipient ( ) const
inline

Definition at line 180 of file OTCheque.hpp.

181  {
182  return m_bHasRecipient;
183  }
bool opentxs::OTCheque::HasRemitter ( ) const
inline

Definition at line 192 of file OTCheque.hpp.

193  {
194  return m_bHasRemitter;
195  }
void opentxs::OTCheque::InitCheque ( )

Definition at line 364 of file OTCheque.cpp.

365 {
366  m_strContractType.Set("CHEQUE");
367 
368  m_lAmount = 0;
369  m_bHasRecipient = false;
370  m_bHasRemitter = false;
371 }
EXPORT void Set(const char *data, uint32_t enforcedMaxLength=0)
Definition: OTString.cpp:1055
OTString m_strContractType
Definition: OTContract.hpp:178
bool opentxs::OTCheque::IssueCheque ( const int64_t &  lAmount,
const int64_t &  lTransactionNum,
const time64_t VALID_FROM,
const time64_t VALID_TO,
const OTIdentifier SENDER_ACCT_ID,
const OTIdentifier SENDER_USER_ID,
const OTString strMemo,
const OTIdentifier pRECIPIENT_USER_ID = nullptr 
)

Definition at line 322 of file OTCheque.cpp.

336 {
337  m_lAmount = lAmount;
338  m_strMemo = strMemo;
339 
340  SetValidFrom(VALID_FROM);
341  SetValidTo(VALID_TO);
342 
343  SetTransactionNum(lTransactionNum);
344 
345  SetSenderAcctID(SENDER_ACCT_ID);
346  SetSenderUserID(SENDER_USER_ID);
347 
348  if (nullptr == pRECIPIENT_USER_ID) {
349  m_bHasRecipient = false;
351  }
352  else {
353  m_bHasRecipient = true;
354  m_RECIPIENT_USER_ID = *pRECIPIENT_USER_ID;
355  }
356 
357  m_bHasRemitter = false; // OTCheque::SetAsVoucher() will set this to true.
358 
359  if (m_lAmount < 0) m_strContractType.Set("INVOICE");
360 
361  return true;
362 }
OTString m_strMemo
Definition: OTCheque.hpp:150
void SetValidFrom(time64_t TIME_FROM)
void SetValidTo(time64_t TIME_TO)
EXPORT void Set(const char *data, uint32_t enforcedMaxLength=0)
Definition: OTString.cpp:1055
void SetTransactionNum(int64_t lTransactionNum)
OTString m_strContractType
Definition: OTContract.hpp:178
void SetSenderAcctID(const OTIdentifier &ACCT_ID)
OTIdentifier m_RECIPIENT_USER_ID
Definition: OTCheque.hpp:151
void SetSenderUserID(const OTIdentifier &USER_ID)
virtual EXPORT void Release()
Definition: OTData.cpp:257
int32_t opentxs::OTCheque::ProcessXMLNode ( irr::io::IrrXMLReader *&  xml)
protectedvirtual

Reimplemented from opentxs::OTInstrument.

Definition at line 197 of file OTCheque.cpp.

198 {
199  int32_t nReturnVal = 0;
200 
201  // Here we call the parent class first.
202  // If the node is found there, or there is some error,
203  // then we just return either way. But if it comes back
204  // as '0', then nothing happened, and we'll continue executing.
205  //
206  // -- Note you can choose not to call the parent if
207  // you don't want to use any of those xml tags.
208  // As I do below, in the case of OTAccount.
209  // if (nReturnVal = OTContract::ProcessXMLNode(xml))
210  // return nReturnVal;
211 
212  if (!strcmp("cheque", xml->getNodeName())) {
213  OTString strHasRecipient = xml->getAttributeValue("hasRecipient");
214  m_bHasRecipient = strHasRecipient.Compare("true");
215 
216  OTString strHasRemitter = xml->getAttributeValue("hasRemitter");
217  m_bHasRemitter = strHasRemitter.Compare("true");
218 
219  m_strVersion = xml->getAttributeValue("version");
220  m_lAmount = atol(xml->getAttributeValue("amount"));
221 
222  SetTransactionNum(atol(xml->getAttributeValue("transactionNum")));
223 
224  const OTString str_valid_from = xml->getAttributeValue("validFrom");
225  const OTString str_valid_to = xml->getAttributeValue("validTo");
226 
227  SetValidFrom(OTTimeGetTimeFromSeconds(str_valid_from.ToLong()));
228  SetValidTo(OTTimeGetTimeFromSeconds(str_valid_to.ToLong()));
229 
230  OTString strAssetTypeID(xml->getAttributeValue("assetTypeID")),
231  strServerID(xml->getAttributeValue("serverID")),
232  strSenderAcctID(xml->getAttributeValue("senderAcctID")),
233  strSenderUserID(xml->getAttributeValue("senderUserID")),
234  strRecipientUserID(xml->getAttributeValue("recipientUserID")),
235  strRemitterUserID(xml->getAttributeValue("remitterUserID")),
236  strRemitterAcctID(xml->getAttributeValue("remitterAcctID"));
237 
238  OTIdentifier ASSET_ID(strAssetTypeID), SERVER_ID(strServerID),
239  SENDER_ACCT_ID(strSenderAcctID), SENDER_USER_ID(strSenderUserID);
240 
241  SetAssetID(ASSET_ID);
242  SetServerID(SERVER_ID);
243  SetSenderAcctID(SENDER_ACCT_ID);
244  SetSenderUserID(SENDER_USER_ID);
245 
246  // Recipient ID
247  if (m_bHasRecipient)
248  m_RECIPIENT_USER_ID.SetString(strRecipientUserID);
249  else
251 
252  // Remitter ID (for vouchers)
253  if (m_bHasRemitter) {
254  m_REMITTER_USER_ID.SetString(strRemitterUserID);
255  m_REMITTER_ACCT_ID.SetString(strRemitterAcctID);
256  }
257  else {
260  }
261 
262  otInfo << "\n\nCheque Amount: " << m_lAmount
263  << ". Transaction Number: " << m_lTransactionNum
264  << "\n Valid From: " << str_valid_from.ToLong()
265  << "\n Valid To: " << str_valid_to.ToLong()
266  << "\n AssetTypeID: " << strAssetTypeID
267  << "\n ServerID: " << strServerID
268  << "\n"
269  " senderAcctID: " << strSenderAcctID
270  << "\n senderUserID: " << strSenderUserID << "\n "
271  " Has Recipient? "
272  << (m_bHasRecipient ? "Yes" : "No")
273  << ". If yes, UserID of Recipient: " << strRecipientUserID
274  << "\n"
275  " Has Remitter? " << (m_bHasRemitter ? "Yes" : "No")
276  << ". If yes, UserID/Acct of Remitter: " << strRemitterUserID
277  << " / " << strRemitterAcctID << "\n";
278 
279  nReturnVal = 1;
280  }
281  else if (!strcmp("memo", xml->getNodeName())) {
283  otErr << "Error in OTCheque::ProcessXMLNode: memo field without "
284  "value.\n";
285  return (-1); // error condition
286  }
287 
288  return 1;
289  }
290 
291  return nReturnVal;
292 }
OTString m_strMemo
Definition: OTCheque.hpp:150
void SetValidFrom(time64_t TIME_FROM)
OTIdentifier m_REMITTER_ACCT_ID
Definition: OTCheque.hpp:156
void SetValidTo(time64_t TIME_TO)
time64_t OTTimeGetTimeFromSeconds(int64_t seconds)
Definition: Common.hpp:215
void SetAssetID(const OTIdentifier &ASSET_ID)
EXPORT void SetString(const char *szString)
OTIdentifier m_REMITTER_USER_ID
Definition: OTCheque.hpp:154
static EXPORT bool LoadEncodedTextField(irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput)
void SetTransactionNum(int64_t lTransactionNum)
OTLOG_IMPORT OTLogStream otInfo
void SetSenderAcctID(const OTIdentifier &ACCT_ID)
void SetServerID(const OTIdentifier &SERVER_ID)
OTLOG_IMPORT OTLogStream otErr
OTIdentifier m_RECIPIENT_USER_ID
Definition: OTCheque.hpp:151
void SetSenderUserID(const OTIdentifier &USER_ID)
virtual EXPORT void Release()
Definition: OTData.cpp:257
void opentxs::OTCheque::Release ( )
virtual

Reimplemented from opentxs::OTTrackable.

Definition at line 411 of file OTCheque.cpp.

412 {
413  Release_Cheque();
414 }
void Release_Cheque()
Definition: OTCheque.cpp:395
void opentxs::OTCheque::Release_Cheque ( )

Definition at line 395 of file OTCheque.cpp.

396 {
397  // If there were any dynamically allocated objects, clean them up here.
398  m_strMemo.Release();
399 
400  // m_SENDER_ACCT_ID.Release(); // in parent class now.
401  // m_SENDER_USER_ID.Release(); // in parent class now.
403 
404  ot_super::Release(); // since I've overridden the base class, I call it
405  // now...
406 
407  // Then I call this to re-initialize everything
408  InitCheque();
409 }
OTString m_strMemo
Definition: OTCheque.hpp:150
OTIdentifier m_RECIPIENT_USER_ID
Definition: OTCheque.hpp:151
virtual EXPORT void Release()
Definition: OTData.cpp:257
virtual EXPORT void Release()
Definition: OTString.cpp:765
virtual void Release()
bool opentxs::OTCheque::SaveContractWallet ( std::ofstream &  ofs) const
virtual

Reimplemented from opentxs::OTInstrument.

Definition at line 421 of file OTCheque.cpp.

422 {
423 
424  return true;
425 }
void opentxs::OTCheque::SetAsVoucher ( const OTIdentifier remitterUserID,
const OTIdentifier remitterAcctID 
)
inline

Definition at line 160 of file OTCheque.hpp.

162  {
163  m_REMITTER_USER_ID = remitterUserID;
164  m_REMITTER_ACCT_ID = remitterAcctID;
165  m_bHasRemitter = true;
166  m_strContractType = "VOUCHER";
167  }
OTIdentifier m_REMITTER_ACCT_ID
Definition: OTCheque.hpp:156
OTIdentifier m_REMITTER_USER_ID
Definition: OTCheque.hpp:154
OTString m_strContractType
Definition: OTContract.hpp:178
void opentxs::OTCheque::UpdateContents ( )
virtual

Reimplemented from opentxs::OTTrackable.

Definition at line 148 of file OTCheque.cpp.

149 {
150  OTString ASSET_TYPE_ID(GetAssetID()), SERVER_ID(GetServerID()),
151  SENDER_ACCT_ID(GetSenderAcctID()), SENDER_USER_ID(GetSenderUserID()),
152  RECIPIENT_USER_ID(GetRecipientUserID()),
153  REMITTER_USER_ID(GetRemitterUserID()),
154  REMITTER_ACCT_ID(GetRemitterAcctID());
155 
156  int64_t lFrom = OTTimeGetSecondsFromTime(GetValidFrom());
157  int64_t lTo = OTTimeGetSecondsFromTime(GetValidTo());
158 
159  // I release this because I'm about to repopulate it.
161 
162  m_xmlUnsigned.Concatenate("<?xml version=\"%s\"?>\n\n", "1.0");
163 
165  "<cheque\n version=\"%s\"\n"
166  " amount=\"%lld\"\n"
167  " assetTypeID=\"%s\"\n"
168  " transactionNum=\"%lld\"\n"
169  " serverID=\"%s\"\n"
170  " senderAcctID=\"%s\"\n"
171  " senderUserID=\"%s\"\n"
172  " hasRecipient=\"%s\"\n"
173  " recipientUserID=\"%s\"\n"
174  " hasRemitter=\"%s\"\n"
175  " remitterUserID=\"%s\"\n"
176  " remitterAcctID=\"%s\"\n"
177  " validFrom=\"%" PRId64 "\"\n"
178  " validTo=\"%" PRId64 "\""
179  " >\n\n",
180  m_strVersion.Get(), m_lAmount, ASSET_TYPE_ID.Get(), GetTransactionNum(),
181  SERVER_ID.Get(), SENDER_ACCT_ID.Get(), SENDER_USER_ID.Get(),
182  (m_bHasRecipient ? "true" : "false"),
183  (m_bHasRecipient ? RECIPIENT_USER_ID.Get() : ""),
184  (m_bHasRemitter ? "true" : "false"),
185  (m_bHasRemitter ? REMITTER_USER_ID.Get() : ""),
186  (m_bHasRemitter ? REMITTER_ACCT_ID.Get() : ""), lFrom, lTo);
187 
188  if (m_strMemo.Exists() && m_strMemo.GetLength() > 2) {
189  OTASCIIArmor ascMemo(m_strMemo);
190  m_xmlUnsigned.Concatenate("<memo>\n%s</memo>\n\n", ascMemo.Get());
191  }
192 
193  m_xmlUnsigned.Concatenate("</cheque>\n");
194 }
const OTIdentifier & GetSenderUserID() const
OTString m_strMemo
Definition: OTCheque.hpp:150
time64_t GetValidTo() const
int64_t GetTransactionNum() const
const OTIdentifier & GetAssetID() const
const OTIdentifier & GetRemitterAcctID() const
Definition: OTCheque.hpp:188
EXPORT uint32_t GetLength() const
Definition: OTString.cpp:1040
EXPORT void Concatenate(const char *arg,...)
Definition: OTString.cpp:1334
EXPORT bool Exists() const
Definition: OTString.cpp:1035
const OTIdentifier & GetServerID() const
time64_t GetValidFrom() const
const OTIdentifier & GetRemitterUserID() const
Definition: OTCheque.hpp:184
OTStringXML m_xmlUnsigned
Definition: OTContract.hpp:174
EXPORT const char * Get() const
Definition: OTString.cpp:1045
const OTIdentifier & GetSenderAcctID() const
int64_t OTTimeGetSecondsFromTime(time64_t time)
Definition: Common.hpp:230
const OTIdentifier & GetRecipientUserID() const
Definition: OTCheque.hpp:176
virtual EXPORT void Release()
Definition: OTString.cpp:765

Member Data Documentation

bool opentxs::OTCheque::m_bHasRecipient
protected

Definition at line 153 of file OTCheque.hpp.

bool opentxs::OTCheque::m_bHasRemitter
protected

Definition at line 157 of file OTCheque.hpp.

int64_t opentxs::OTCheque::m_lAmount
protected

Definition at line 149 of file OTCheque.hpp.

OTIdentifier opentxs::OTCheque::m_RECIPIENT_USER_ID
protected

Definition at line 151 of file OTCheque.hpp.

OTIdentifier opentxs::OTCheque::m_REMITTER_ACCT_ID
protected

Definition at line 156 of file OTCheque.hpp.

OTIdentifier opentxs::OTCheque::m_REMITTER_USER_ID
protected

Definition at line 154 of file OTCheque.hpp.

OTString opentxs::OTCheque::m_strMemo
protected

Definition at line 150 of file OTCheque.hpp.


The documentation for this class was generated from the following files: