146 #include <irrxml/irrXML.hpp>
180 otErr << __FUNCTION__ <<
": Error verifying account ID.\n";
186 otErr << __FUNCTION__ <<
": Error verifying signature on parent ledger "
187 "for abbreviated transaction receipt.\n";
191 otErr << __FUNCTION__ <<
": Error verifying signature.\n";
195 otLog4 <<
"\nWe now know that...\n"
196 "1) The expected Account ID matches the ID that was found on the "
198 "2) The SIGNATURE VERIFIED on the object.\n\n";
304 bool bHarvestingForRetry,
306 bool bReplyWasSuccess,
307 bool bReplyWasFailure,
308 bool bTransactionWasSuccess,
309 bool bTransactionWasFailure)
311 bool bSuccess =
false;
352 if (bReplyWasFailure)
363 else if (bReplyWasSuccess) {
382 if (bReplyWasFailure) {
393 else if (bReplyWasSuccess) {
394 if (bTransactionWasSuccess) {
404 else if (bTransactionWasFailure) {
427 if (bReplyWasFailure) {
438 else if (bReplyWasSuccess) {
439 if (bTransactionWasSuccess) {
449 else if (bTransactionWasFailure) {
472 if (bReplyWasFailure) {
482 else if (bReplyWasSuccess) {
618 if (bReplyWasFailure && !bHarvestingForRetry) {
630 else if (bReplyWasSuccess) {
631 if (bTransactionWasSuccess) {
642 else if (bTransactionWasFailure) {
676 class _getRecipientOpeningNum
683 if (
nullptr != pItem) {
691 if (strPaymentPlan.
Exists() &&
695 otErr <<
"OTTransaction::HarvestOpeningNumber: "
696 "Error: Unable to load "
697 "paymentPlan object from paymentPlan "
698 "transaction item.\n";
701 otErr <<
"OTTransaction::HarvestOpeningNumber: "
702 "Error: Unable to find "
703 "paymentPlan item in paymentPlan "
714 if (bReplyWasFailure && !bHarvestingForRetry) {
715 _getRecipientOpeningNum getRecipientOpeningNum;
716 const int64_t lRecipientOpeningNum =
717 getRecipientOpeningNum.Run(*
this);
719 if (lRecipientOpeningNum > 0)
722 lRecipientOpeningNum);
738 else if (bReplyWasSuccess) {
739 if (bTransactionWasSuccess)
754 else if (bTransactionWasFailure && !bHarvestingForRetry) {
763 _getRecipientOpeningNum getRecipientOpeningNum;
764 const int64_t lRecipientOpeningNum =
765 getRecipientOpeningNum.Run(*
this);
767 if (lRecipientOpeningNum > 0)
770 lRecipientOpeningNum);
813 if (
nullptr == pItem) {
814 otErr <<
"OTTransaction::HarvestOpeningNumber: Error: Unable "
816 "smartContract item in smartContract transaction.\n";
825 if (!strSmartContract.
Exists() ||
828 strSmartContract))) {
829 otErr <<
"OTTransaction::HarvestOpeningNumber: Error: "
831 "smartContract object from smartContract "
832 "transaction item.\n";
842 if (bReplyWasFailure && !bHarvestingForRetry) {
858 else if (bReplyWasSuccess) {
859 if (bTransactionWasSuccess) {
870 else if (bTransactionWasFailure) {
900 bool bHarvestingForRetry,
901 bool bReplyWasSuccess,
902 bool bReplyWasFailure,
903 bool bTransactionWasSuccess,
904 bool bTransactionWasFailure)
906 bool bSuccess =
false;
933 if (
nullptr == pItem) {
934 otErr <<
"OTTransaction::HarvestClosingNumbers: Error: Unable "
936 "marketOffer item in marketOffer transaction.\n";
945 const bool bLoadContractFromString =
950 if (!bLoadContractFromString) {
951 otErr <<
"OTTransaction::HarvestClosingNumbers: ERROR: "
952 "Failed loading trade from string:\n\n" << strTrade
963 if (bReplyWasFailure)
998 else if (bReplyWasSuccess) {
999 if (bTransactionWasSuccess) {
1014 else if (bTransactionWasFailure) {
1044 if (
nullptr == pItem) {
1045 otErr <<
"OTTransaction::HarvestClosingNumbers: Error: Unable "
1047 "paymentPlan item in paymentPlan transaction.\n";
1056 const bool bLoadContractFromString =
1057 (strPaymentPlan.
Exists() &&
1061 if (!bLoadContractFromString) {
1062 otErr <<
"OTTransaction::HarvestClosingNumbers: ERROR: "
1063 "Failed loading payment plan from string:\n\n"
1064 << strPaymentPlan <<
"\n\n";
1073 if (bReplyWasFailure &&
1074 !bHarvestingForRetry)
1101 else if (bReplyWasSuccess) {
1102 if (bTransactionWasSuccess) {
1112 else if (bTransactionWasFailure &&
1113 !bHarvestingForRetry)
1149 if (
nullptr == pItem) {
1150 otErr <<
"OTTransaction::HarvestClosingNumbers: Error: Unable "
1152 "smartContract item in smartContract transaction.\n";
1161 if (!strSmartContract.
Exists() ||
1164 strSmartContract))) {
1165 otErr <<
"OTTransaction::HarvestClosingNumbers: Error: "
1167 "smartContract object from smartContract "
1168 "transaction item.\n";
1178 if (bReplyWasFailure &&
1179 !bHarvestingForRetry)
1203 else if (bReplyWasSuccess) {
1204 if (bTransactionWasSuccess) {
1215 else if (bTransactionWasFailure &&
1216 !bHarvestingForRetry)
1464 otErr <<
"OTTransaction::VerifyBalanceReceipt: Error: This is an "
1465 "abbreviated receipt. (Load the box receipt first.)\n";
1469 OTIdentifier USER_ID(THE_NYM), SERVER_USER_ID(SERVER_NYM);
1484 strFilename.
Format(
"%s.success", strReceiptID.
Get());
1487 const char* szFolder2name = strServerID.Get();
1488 const char* szFilename =
1491 if (!
OTDB::Exists(szFolder1name, szFolder2name, szFilename)) {
1492 otWarn <<
"Receipt file doesn't exist in "
1493 "OTTransaction::VerifyBalanceReceipt:\n " << szFilename
1498 std::string strFileContents(
1502 if (strFileContents.length() < 2) {
1503 otErr <<
"OTTransaction::VerifyBalanceReceipt: Error reading "
1504 "transaction statement:\n " << szFolder1name
1510 OTString strTransaction(strFileContents.c_str());
1513 std::unique_ptr<OTTransactionType> pContents(
1516 if (
nullptr == pContents) {
1517 otErr <<
"OTTransaction::VerifyBalanceReceipt: Unable to load "
1518 "transaction statement:\n " << szFolder1name
1523 else if (!pContents->VerifySignature(SERVER_NYM)) {
1524 otErr <<
"OTTransaction::VerifyBalanceReceipt: Unable to verify "
1525 "signature on transaction statement:\n " << szFolder1name
1535 if (
nullptr == pTrans) {
1536 otErr <<
"OTTransaction::VerifyBalanceReceipt: Was expecting an "
1537 "OTTransaction to be stored in the transaction statement "
1561 OTItem* pItemWithIssuedList =
1566 OTItem* pTransactionItem =
nullptr;
1574 OTItem* pResponseTransactionItem =
1577 if (
nullptr == pResponseTransactionItem) {
1579 otOut <<
"No atTransactionStatement item found on receipt "
1584 pResponseTransactionItem->
GetStatus()) {
1586 otOut <<
"Error: atTransactionStatement found on receipt, but not "
1587 "a successful one.\n";
1591 otOut <<
"Unable to verify signature on atTransactionStatement "
1592 "item in OTTransaction::VerifyBalanceReceipt.\n";
1602 if (!strBalanceItem.
Exists()) {
1604 otOut <<
"No transactionStatement item found as 'in ref to' string "
1605 "on a receipt containing atTransactionStatement item.\n";
1613 if (
nullptr == pTransactionItem) {
1614 otOut <<
"Unable to load transactionStatement item from string "
1615 "(from a receipt containing an atTransactionStatement "
1619 else if (pTransactionItem->
GetType() !=
1621 otOut <<
"Wrong type on pTransactionItem (expected "
1622 "OTItem::transactionStatement)\n";
1626 otOut <<
"Unable to verify signature on transactionStatement item "
1627 "in OTTransaction::VerifyBalanceReceipt.\n";
1631 pItemWithIssuedList = pTransactionItem;
1640 otOut <<
"Failed loading or verifying account for THE_NYM in "
1641 "OTTransaction::VerifyBalanceReceipt.\n";
1650 otOut <<
"Account, inbox or outbox server ID fails to match receipt "
1659 otOut <<
"Account ID fails to match receipt account ID.\n";
1665 std::unique_ptr<OTLedger> pInbox(THE_ACCOUNT.
LoadInbox(
1667 std::unique_ptr<OTLedger> pOutbox(THE_ACCOUNT.
LoadOutbox(
1670 if ((
nullptr == pInbox) || (
nullptr == pOutbox)) {
1672 otOut <<
"Inbox or outbox was nullptr after THE_ACCOUNT.Load in "
1673 "OTTransaction::VerifyBalanceReceipt.\n";
1681 if (
nullptr == pResponseBalanceItem) {
1683 otOut <<
"No atBalanceStatement item found on receipt (strange.)\n";
1688 otOut <<
"Error: atBalanceStatement found on receipt, but not a "
1689 "successful one.\n";
1693 otOut <<
"Unable to verify signature on atBalanceStatement item in "
1694 "OTTransaction::VerifyBalanceReceipt.\n";
1700 OTItem* pBalanceItem =
nullptr;
1705 if (!strBalanceItem.
Exists()) {
1707 otOut <<
"No balanceStatement item found as 'in ref to' string on a "
1708 "receipt containing atBalanceStatement item.\n";
1716 if (
nullptr == pBalanceItem) {
1717 otOut <<
"Unable to load balanceStatement item from string (from a "
1718 "receipt containing an atBalanceStatement item.)\n";
1722 otOut <<
"Wrong type on pBalanceItem (expected "
1723 "OTItem::balanceStatement)\n";
1727 otOut <<
"Unable to verify signature on balanceStatement item in "
1728 "OTTransaction::VerifyBalanceReceipt.\n";
1739 if ((
nullptr != pTransactionItem) &&
1744 pItemWithIssuedList =
1748 pItemWithIssuedList =
1755 if (!strMessageNym.
Exists() ||
1757 otOut <<
"Unable to load message nym in "
1758 "OTTransaction::VerifyBalanceReceipt.\n";
1833 otOut <<
"Unable to verify issued numbers on last signed receipt with "
1834 "numbers on THE_NYM in OTTransaction::VerifyBalanceReceipt.\n";
1841 int32_t nInboxItemCount = 0, nOutboxItemCount = 0;
1846 const char* szInbox =
"Inbox";
1847 const char* szOutbox =
"Outbox";
1848 const char* pszLedgerType =
nullptr;
1849 int64_t lReceiptBalanceChange =
1855 otWarn <<
"Number of inbox/outbox items on the balance statement: "
1867 for (int32_t i = 0; i < pBalanceItem->
GetItemCount(); i++) {
1870 int64_t lReceiptAmountMultiplier = 1;
1878 switch (pSubItem->
GetType()) {
1887 lReceiptBalanceChange += pSubItem->
GetAmount();
1902 pLedger = pInbox.get();
1903 pszLedgerType = szInbox;
1914 <<
"OTTransaction::VerifyBalanceReceipt: Ignoring "
1917 "in balance statement while verifying it against inbox.\n";
1922 switch (pSubItem->
GetType()) {
1927 lReceiptAmountMultiplier =
1935 pLedger = pOutbox.get();
1936 pszLedgerType = szOutbox;
1939 lReceiptAmountMultiplier =
1942 pLedger = pInbox.get();
1943 pszLedgerType = szInbox;
1961 lReceiptAmountMultiplier = 1;
1970 int64_t lTempTransactionNum = 0;
1971 int64_t lTempReferenceToNum = 0;
1972 int64_t lTempNumberOfOrigin = 0;
1981 if ((pOutbox.get() ==
1997 otLog3 <<
"OTTransaction::VerifyBalanceReceipt: (This iteration, "
1998 "I'm handling an item listed as '1' in the outbox.)\n";
2010 if (
nullptr != pTransaction) {
2015 bool bSwitchedBoxes =
false;
2038 if ((
nullptr == pTransaction) && (pOutbox.get() == pLedger)) {
2039 otLog4 <<
"OTTransaction::" << __FUNCTION__
2040 <<
": Outbox pending found as inbox transferReceipt. "
2051 if (
nullptr != pTransaction) {
2102 lReceiptAmountMultiplier = 1;
2111 pLedger = pInbox.get();
2112 pszLedgerType = szInbox;
2140 if (
nullptr == pTransaction) {
2141 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": Expected "
2142 << pszLedgerType <<
" transaction (" << lTempTransactionNum
2143 <<
") not found. (Amount " << pSubItem->
GetAmount() <<
".)\n";
2150 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2151 <<
" transaction (" << lTempTransactionNum
2152 <<
") mismatch Reference Num: "
2154 << lTempReferenceToNum <<
"\n";
2159 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2160 <<
" transaction (" << lTempTransactionNum
2161 <<
") mismatch Number of Origin: "
2163 << lTempNumberOfOrigin <<
"\n";
2168 lTransactionAmount *= lReceiptAmountMultiplier;
2170 if (pSubItem->
GetAmount() != lTransactionAmount) {
2171 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2172 <<
" transaction (" << lTempTransactionNum
2174 "amounts don't match: Report says "
2175 << pSubItem->
GetAmount() <<
", but expected "
2176 << lTransactionAmount
2178 <<
", (pBalanceItem->GetAmount() == "
2184 (((bSwitchedBoxes ==
true) &&
2186 ((pLedger == pOutbox.get()) &&
2188 ((pLedger == pInbox.get()) &&
2191 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2192 <<
" transaction (" << lTempTransactionNum
2193 <<
") wrong type. (pending block)\n";
2199 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2200 <<
" transaction (" << lTempTransactionNum
2201 <<
") wrong type. (chequeReceipt block)\n";
2207 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2208 <<
" transaction (" << lTempTransactionNum
2209 <<
") wrong type. (voucherReceipt block)\n";
2215 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2216 <<
" transaction (" << lTempTransactionNum
2217 <<
") wrong type. (marketReceipt block)\n";
2223 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2224 <<
" transaction (" << lTempTransactionNum
2225 <<
") wrong type. (paymentReceipt block)\n";
2231 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2232 <<
" transaction (" << lTempTransactionNum
2233 <<
") wrong type. (transferReceipt block)\n";
2240 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2241 <<
" transaction (" << lTempTransactionNum
2242 <<
") wrong type or closing num ("
2244 "(basketReceipt block)\n";
2251 otOut <<
"OTTransaction::" << __FUNCTION__ <<
": " << pszLedgerType
2252 <<
" transaction (" << lTempTransactionNum
2253 <<
") wrong type or closing num ("
2255 "(finalReceipt block)\n";
2272 if (nOutboxItemCount != pOutbox->GetTransactionCount()) {
2273 otOut <<
"OTTransaction::" << __FUNCTION__
2274 <<
": Outbox mismatch in expected transaction count.\n"
2275 " --- THE_INBOX count: " << pInbox->GetTransactionCount()
2276 <<
" --- THE_OUTBOX count: " << pOutbox->GetTransactionCount()
2278 "--- nInboxItemCount: " << nInboxItemCount
2279 <<
" --- nOutboxItemCount: " << nOutboxItemCount <<
"\n\n";
2290 int64_t lInboxBalanceChange = 0;
2293 int64_t lInboxSupposedDifference = 0;
2297 for (int32_t i = 0; i < pInbox->GetTransactionCount(); i++) {
2298 OTTransaction* pTransaction = pInbox->GetTransactionByIndex(i);
2302 switch (pTransaction->
GetType()) {
2308 lInboxBalanceChange +=
2330 otLog4 <<
"OTTransaction::" << __FUNCTION__ <<
": Ignoring "
2332 <<
" item in inbox while verifying it against balance "
2356 if (
nullptr == pSubItem) {
2357 OTItem* pFinalReceiptItem =
nullptr;
2358 switch (pTransaction->
GetType()) {
2392 if (
nullptr != pFinalReceiptItem) {
2393 otOut <<
"OTTransaction::" << __FUNCTION__
2394 <<
": Malicious server? A new cronReceipt has "
2396 "even though its corresponding \nfinalReceipt was "
2397 "already present in the LAST SIGNED RECEIPT. "
2410 lInboxSupposedDifference +=
2447 otOut <<
"OTTransaction::" << __FUNCTION__
2448 <<
": Inbox transaction ("
2450 <<
") mismatch Reference Num: "
2458 otOut <<
"OTTransaction::" << __FUNCTION__
2459 <<
": Inbox transaction ("
2461 <<
") mismatch Reference Num: "
2471 otOut <<
"OTTransaction::" << __FUNCTION__
2472 <<
": Inbox transaction ("
2475 "amounts don't match: " << pSubItem->
GetAmount()
2477 <<
". (pBalanceItem->GetAmount() == "
2484 otOut <<
"OTTransaction::" << __FUNCTION__
2485 <<
": Inbox transaction ("
2487 <<
") wrong type. (pending block)\n";
2493 otOut <<
"OTTransaction::" << __FUNCTION__
2494 <<
": Inbox transaction ("
2497 "(chequeReceipt block)\n";
2503 otOut <<
"OTTransaction:" << __FUNCTION__
2504 <<
": Inbox transaction ("
2507 "(voucherReceipt block)\n";
2513 otOut <<
"OTTransaction::" << __FUNCTION__
2514 <<
": Inbox transaction ("
2517 "(marketReceipt block)\n";
2523 otOut <<
"OTTransaction::" << __FUNCTION__
2524 <<
": Inbox transaction ("
2527 "(paymentReceipt block)\n";
2533 otOut <<
"OTTransaction::" << __FUNCTION__
2534 <<
": Inbox transaction ("
2537 "(transferReceipt block)\n";
2545 otOut <<
"OTTransaction::" << __FUNCTION__
2546 <<
": Inbox transaction ("
2549 "or mismatched closing num. (basketReceipt block)\n";
2557 otOut <<
"OTTransaction::" << __FUNCTION__
2558 <<
": Inbox transaction ("
2561 "or mismatched closing num. (finalReceipt block)\n";
2573 int64_t lIssuedNum = 0;
2578 switch (pTransaction->
GetType()) {
2608 pFinalReceiptTransaction =
2611 if (
nullptr != pFinalReceiptTransaction)
2665 otErr <<
"OTTransaction::" << __FUNCTION__
2666 <<
": Error verifying if transaction num in inbox ("
2668 <<
") was actually signed out (" << lIssuedNum <<
")\n";
2756 const int64_t lAbsoluteDifference =
2757 std::abs(lInboxBalanceChange - lReceiptBalanceChange);
2758 const int64_t lNegativeDifference = (lAbsoluteDifference * (-1));
2762 const bool bNewInboxWasBigger =
2763 ((lInboxBalanceChange > lReceiptBalanceChange) ?
true :
false);
2764 const bool bNewInboxWasSmaller =
2765 ((lInboxBalanceChange < lReceiptBalanceChange) ?
true :
false);
2767 int64_t lActualDifference;
2769 if (bNewInboxWasBigger)
2770 lActualDifference = lAbsoluteDifference;
2771 else if (bNewInboxWasSmaller)
2772 lActualDifference = lNegativeDifference;
2774 lActualDifference = 0;
2856 if (lActualDifference != lInboxSupposedDifference) {
2857 otErr <<
"OTTransaction::" << __FUNCTION__ <<
": lActualDifference ("
2858 << lActualDifference
2859 <<
") is not equal to lInboxSupposedDifference ("
2860 << lInboxSupposedDifference
2862 "FYI, Inbox balance on old receipt: " << lReceiptBalanceChange
2863 <<
" Inbox balance on current inbox: " << lInboxBalanceChange
2910 (THE_ACCOUNT.
GetBalance() + (lActualDifference * (-1)))) {
2916 otErr <<
"OTTransaction::" << __FUNCTION__
2917 <<
": lActualDifference in receipts (" << lActualDifference
2919 "plus current acct balance (" << THE_ACCOUNT.
GetBalance()
2920 <<
") is NOT equal to last signed balance ("
2937 OTString strFolder1name, strFolder2name, strFolder3name, strFilename;
2940 theLedger, *
this,
"OTTransaction::DeleteBoxReceipt", strFolder1name,
2941 strFolder2name, strFolder3name, strFilename))
2947 strFolder3name.
Get(), strFilename.
Get())) {
2950 <<
": Box receipt already doesn't exist, thus no need to delete: "
2965 otErr << __FUNCTION__
2966 <<
": Error deleting (writing over) box receipt (failed "
2967 "writing armored string):\n" << strFolder1name
2984 strOutput.
Format(
"%s\n\n%s\n", strFinal.
Get(),
2985 "MARKED_FOR_DELETION");
2987 strOutput.
Format(
"%s\n\n%s\n",
2988 "(Transaction was already empty -- strange.)",
2989 "MARKED_FOR_DELETION");
2992 strOutput.
Get(), strFolder1name.
Get(), strFolder2name.
Get(),
2993 strFolder3name.
Get(), strFilename.
Get());
2995 otErr << __FUNCTION__
2996 <<
": Error deleting (writing over) file: " << strFolder1name
3009 otOut << __FUNCTION__ <<
": Unable to save box receipt "
3012 "This transaction is the abbreviated version (box receipt is "
3014 "consist of the full version, so we can't save THIS as the "
3019 OTString strFolder1name, strFolder2name, strFolder3name, strFilename;
3022 lLedgerType, *
this,
"OTTransaction::SaveBoxReceipt", strFolder1name,
3023 strFolder2name, strFolder3name, strFilename))
3029 strFolder3name.
Get(), strFilename.
Get())) {
3030 otOut << __FUNCTION__
3031 <<
": Warning -- Box receipt already exists! (Overwriting)"
3045 otErr << __FUNCTION__
3046 <<
": Error saving box receipt (failed writing armored string):\n"
3054 strFinal.
Get(), strFolder1name.
Get(), strFolder2name.
Get(),
3055 strFolder3name.
Get(), strFilename.
Get());
3058 otErr << __FUNCTION__ <<
": Error writing file: " << strFolder1name
3072 int64_t lLedgerType = 0;
3074 switch (theLedger.
GetType()) {
3095 otErr <<
"OTTransaction::SaveBoxReceipt: Error: unknown box type. "
3096 "(This should never happen.)\n";
3105 otErr <<
"OTTransaction::" << __FUNCTION__
3106 <<
": Failure: This transaction "
3107 "isn't abbreviated (val: "
3109 <<
"), or the purported full version erroneously is (val: "
3112 "Either way, you can't use it in this way, for trans num: "
3126 if (
m_Hash != idFullVersion) {
3127 otErr <<
"OTTransaction::" << __FUNCTION__
3128 <<
": Failure: The purported 'full version' of the transaction, "
3129 "passed in for verification fails to match the stored hash "
3138 otErr <<
"OTTransaction::" << __FUNCTION__
3139 <<
": Failure: The purported 'full version' of the transaction "
3141 <<
") fails to match the actual transaction number: "
3148 otErr <<
"OTTransaction::" << __FUNCTION__
3149 <<
": Failure: The purported 'full version' of the transaction "
3150 "passed, GetReferenceNumForDisplay() ("
3152 <<
") fails to match the GetAbbrevInRefDisplay ("
3171 otErr <<
"Wrong owner passed to OTTransaction::VerifyItems\n";
3192 if (NYM_ID != pItem->
GetUserID())
return false;
3222 , m_pParent(nullptr)
3223 , m_bIsAbbreviated(false)
3224 , m_lAbbrevAmount(0)
3225 , m_lDisplayAmount(0)
3226 , m_lInRefDisplay(0)
3229 , m_lClosingTransactionNo(0)
3230 , m_lRequestNumber(0)
3231 , m_bReplyTransSuccess(false)
3232 , m_bCancelled(false)
3246 theOwner.GetPurportedServerID())
3247 , m_pParent(&theOwner)
3248 , m_bIsAbbreviated(false)
3249 , m_lAbbrevAmount(0)
3250 , m_lDisplayAmount(0)
3251 , m_lInRefDisplay(0)
3254 , m_lClosingTransactionNo(0)
3255 , m_lRequestNumber(0)
3256 , m_bReplyTransSuccess(false)
3257 , m_bCancelled(false)
3276 , m_pParent(nullptr)
3277 , m_bIsAbbreviated(false)
3278 , m_lAbbrevAmount(0)
3279 , m_lDisplayAmount(0)
3280 , m_lInRefDisplay(0)
3283 , m_lClosingTransactionNo(0)
3284 , m_lRequestNumber(0)
3285 , m_bReplyTransSuccess(false)
3286 , m_bCancelled(false)
3299 int64_t lTransactionNum)
3301 , m_pParent(nullptr)
3302 , m_bIsAbbreviated(false)
3303 , m_lAbbrevAmount(0)
3304 , m_lDisplayAmount(0)
3305 , m_lInRefDisplay(0)
3308 , m_lClosingTransactionNo(0)
3309 , m_lRequestNumber(0)
3310 , m_bReplyTransSuccess(false)
3311 , m_bCancelled(false)
3345 const OTIdentifier& theServerID,
const int64_t& lNumberOfOrigin,
3346 const int64_t& lTransactionNum,
const int64_t& lInRefTo,
3347 const int64_t& lInRefDisplay,
time64_t the_DATE_SIGNED,
3349 const int64_t& lAdjustment,
const int64_t& lDisplayValue,
3350 const int64_t& lClosingNum,
const int64_t& lRequestNum,
3351 bool bReplyTransSuccess,
OTNumList* pNumList)
3353 , m_pParent(nullptr)
3354 , m_bIsAbbreviated(true)
3355 , m_lAbbrevAmount(lAdjustment)
3356 , m_lDisplayAmount(lDisplayValue)
3357 , m_lInRefDisplay(lInRefDisplay)
3359 , m_DATE_SIGNED(the_DATE_SIGNED)
3361 , m_lClosingTransactionNo(lClosingNum)
3362 , m_lRequestNumber(lRequestNum)
3363 , m_bReplyTransSuccess(bReplyTransSuccess)
3364 , m_bCancelled(false)
3435 if (
nullptr != pNumList)
m_Numlist = *pNumList;
3454 int64_t lTransactionNum)
3459 if (
nullptr != pTransaction) pTransaction->
SetParent(theOwner);
3461 return pTransaction;
3468 int64_t lTransactionNum)
3471 theUserID, theAccountID, theServerID, lTransactionNum);
3474 pTransaction->
m_Type = theType;
3484 return pTransaction;
3528 if (pItem->
GetType() == theType)
return pItem;
3540 OT_FAIL_MSG(
"CAN'T USE GetItemInRefTo! (There are multiple items in "
3541 "reference to the same number...) SWITCH to using "
3644 bool bFoundAnActionItem =
false, bFoundABalanceAgreement =
false;
3690 bFoundABalanceAgreement =
true;
3774 bFoundAnActionItem =
true;
3784 otErr <<
"Wrong transaction type passed to "
3785 "OTTransaction::GetSuccess() "
3786 "for processNymbox or processInbox transaction.\n";
3791 return (bFoundABalanceAgreement && bFoundAnActionItem);
3845 bFoundABalanceAgreement =
true;
3947 bFoundAnActionItem =
true;
3956 otErr <<
"Wrong transaction type passed to "
3957 "OTTransaction::GetSuccess()\n";
3962 return (bFoundABalanceAgreement && bFoundAnActionItem);
3978 else if (strType.
Compare(
"message"))
3980 else if (strType.
Compare(
"notice"))
3982 else if (strType.
Compare(
"replyNotice"))
3984 else if (strType.
Compare(
"successNotice"))
3987 else if (strType.
Compare(
"pending"))
3990 else if (strType.
Compare(
"transferReceipt"))
3992 else if (strType.
Compare(
"voucherReceipt"))
3994 else if (strType.
Compare(
"chequeReceipt"))
3996 else if (strType.
Compare(
"marketReceipt"))
3998 else if (strType.
Compare(
"paymentReceipt"))
4000 else if (strType.
Compare(
"finalReceipt"))
4002 else if (strType.
Compare(
"basketReceipt"))
4005 else if (strType.
Compare(
"instrumentNotice"))
4007 else if (strType.
Compare(
"instrumentRejection"))
4010 else if (strType.
Compare(
"processNymbox"))
4012 else if (strType.
Compare(
"atProcessNymbox"))
4014 else if (strType.
Compare(
"processInbox"))
4016 else if (strType.
Compare(
"atProcessInbox"))
4018 else if (strType.
Compare(
"transfer"))
4020 else if (strType.
Compare(
"atTransfer"))
4022 else if (strType.
Compare(
"deposit"))
4024 else if (strType.
Compare(
"atDeposit"))
4026 else if (strType.
Compare(
"withdrawal"))
4028 else if (strType.
Compare(
"atWithdrawal"))
4030 else if (strType.
Compare(
"marketOffer"))
4032 else if (strType.
Compare(
"atMarketOffer"))
4034 else if (strType.
Compare(
"paymentPlan"))
4036 else if (strType.
Compare(
"atPaymentPlan"))
4038 else if (strType.
Compare(
"smartContract"))
4040 else if (strType.
Compare(
"atSmartContract"))
4042 else if (strType.
Compare(
"cancelCronItem"))
4044 else if (strType.
Compare(
"atCancelCronItem"))
4046 else if (strType.
Compare(
"exchangeBasket"))
4048 else if (strType.
Compare(
"atExchangeBasket"))
4050 else if (strType.
Compare(
"payDividend"))
4052 else if (strType.
Compare(
"atPayDividend"))
4063 const OTString strNodeName = xml->getNodeName();
4066 if (strNodeName.
Compare(
"nymboxRecord")) {
4070 if (strNodeName.
Compare(
"nymboxRecord") ||
4071 strNodeName.
Compare(
"inboxRecord") ||
4072 strNodeName.
Compare(
"outboxRecord") ||
4073 strNodeName.
Compare(
"paymentInboxRecord") ||
4074 strNodeName.
Compare(
"recordBoxRecord") ||
4075 strNodeName.
Compare(
"expiredBoxRecord")) {
4076 int64_t lNumberOfOrigin = 0;
4077 int64_t lTransactionNum = 0;
4078 int64_t lInRefTo = 0;
4079 int64_t lInRefDisplay = 0;
4085 int64_t lAdjustment = 0;
4086 int64_t lDisplayValue = 0;
4087 int64_t lClosingNum = 0;
4088 int64_t lRequestNumber = 0;
4089 bool bReplyTransSuccess =
false;
4092 xml, lNumberOfOrigin, lTransactionNum, lInRefTo, lInRefDisplay,
4093 the_DATE_SIGNED, theType, strHash, lAdjustment, lDisplayValue,
4094 lClosingNum, lRequestNumber, bReplyTransSuccess, pNumList);
4096 if ((-1) == nAbbrevRetVal)
4118 otErr <<
"OTTransaction::ProcessXMLNode: Missing receiptHash on "
4119 "abbreviated record.\n";
4125 else if (strNodeName.
Compare(
"transaction"))
4135 const OTString strType = xml->getAttributeValue(
"type");
4140 otOut <<
"OTTransaction::ProcessXMLNode: Failure: unknown "
4141 "transaction type: " << strType <<
" \n";
4145 OTString strCancelled = xml->getAttributeValue(
"cancelled");
4151 OTString strDateSigned = xml->getAttributeValue(
"dateSigned");
4152 const int64_t lDateSigned =
4153 strDateSigned.
Exists() ? atol(strDateSigned.
Get()) : 0;
4156 const OTString strAcctID = xml->getAttributeValue(
"accountID");
4157 const OTString strServerID = xml->getAttributeValue(
"serverID");
4158 const OTString strUserID = xml->getAttributeValue(
"userID");
4163 <<
"OTTransaction::ProcessXMLNode: Failure: missing strAcctID ("
4164 << strAcctID <<
") or strServerID (" << strServerID
4165 <<
") or strUserID (" << strUserID <<
"). \n";
4169 const OTString strOrigin = xml->getAttributeValue(
"numberOfOrigin");
4170 const OTString strTransNum = xml->getAttributeValue(
"transactionNum");
4171 const OTString strInRefTo = xml->getAttributeValue(
"inReferenceTo");
4174 otOut <<
"OTTransaction::ProcessXMLNode: Failure: missing "
4175 "strTransNum (" << strTransNum <<
") or strInRefTo ("
4176 << strInRefTo <<
"). \n";
4187 xml->getAttributeValue(
"requestNumber");
4189 if (strRequestNum.
Exists())
4193 xml->getAttributeValue(
"transSuccess");
4201 xml->getAttributeValue(
"totalListOfNumbers");
4204 if (strTotalList.
Exists())
4209 OTIdentifier ACCOUNT_ID(strAcctID), SERVER_ID(strServerID),
4253 <<
" type: " << strType <<
"\n";
4257 else if (!strcmp(
"closingTransactionNumber", xml->getNodeName())) {
4258 OTString strClosingNumber = xml->getAttributeValue(
"value");
4260 if (strClosingNumber.
Exists() &&
4266 otErr <<
"Error in OTTransaction::ProcessXMLNode: "
4267 "closingTransactionNumber field without value, or in "
4268 "wrong transaction type.\n";
4274 else if (!strcmp(
"cancelRequest", xml->getNodeName())) {
4277 otErr <<
"Error in OTTransaction::ProcessXMLNode: cancelRequest "
4278 "field without value.\n";
4284 else if (!strcmp(
"inReferenceTo", xml->getNodeName())) {
4287 otErr <<
"Error in OTTransaction::ProcessXMLNode: inReferenceTo "
4288 "field without value.\n";
4294 else if (!strcmp(
"item", xml->getNodeName())) {
4299 otErr <<
"Error in OTTransaction::ProcessXMLNode: transaction item "
4300 "field without value.\n";
4313 otErr <<
"ERROR: OTTransaction failed loading item from "
4315 << (strData.
Exists() ? strData.
Get() :
"") <<
"\n\n";
4321 otErr <<
"ERROR: Failed verifying transaction Item in "
4322 "OTTransaction::ProcessXMLNode: \n\n" << strData
4360 strCancelled.
Format(
" cancelled=\"%s\"\n",
"true");
4371 strRequestNum.
Format(
" requestNumber=\"%lld\"\n transSuccess=\"%s\"\n",
4386 strListOfBlanks.
Format(
" totalListOfNumbers=\"%s\"\n",
4389 strListOfBlanks.
Set(
"");
4397 const OTString strType((
nullptr != pTypeStr) ? pTypeStr :
"error_state"),
4409 " dateSigned=\"%lld\"\n"
4410 " accountID=\"%s\"\n"
4412 " serverID=\"%s\"\n%s"
4413 " numberOfOrigin=\"%lld\"\n"
4414 " transactionNum=\"%lld\"\n%s"
4415 " inReferenceTo=\"%lld\" >\n\n",
4416 strType.Get(), strCancelled.
Get(), lDateSigned,
4417 strAcctID.Get(), strUserID.
Get(),
4418 strServerID.Get(), strRequestNum.
Get(),
4446 otErr <<
"OTTransaction::" << __FUNCTION__
4447 <<
": Unexpected message ledger type in 'abbreviated' "
4448 "block. (Error.) \n";
4451 otErr <<
"OTTransaction::" << __FUNCTION__
4452 <<
": Unexpected ledger type in 'abbreviated' block. "
4458 otErr <<
"OTTransaction::" << __FUNCTION__
4459 <<
": Error: Unable to save abbreviated receipt here, since "
4460 "m_pParent is nullptr.\n";
4468 "<closingTransactionNumber value=\"%lld\"/>\n\n",
4571 int64_t lDisplayValue = 0;
4585 otErr <<
"OTTransaction::" << __FUNCTION__ <<
": Unexpected "
4587 "in payment inbox while making abbreviated "
4588 "payment inbox record.\n";
4590 OT_FAIL_MSG(
"ASSERT: OTTransaction::SaveAbbrevPaymentInboxRecord: "
4591 "Unexpected transaction type.");
4603 strType.
Set((
nullptr != pTypeStr) ? pTypeStr :
"error_state");
4628 strOutput.
Concatenate(
"<paymentInboxRecord type=\"%s\"\n"
4629 " dateSigned=\"%lld\"\n"
4630 " receiptHash=\"%s\"\n"
4631 " displayValue=\"%lld\"\n"
4632 " transactionNum=\"%lld\"\n"
4633 " inRefDisplay=\"%lld\"\n"
4634 " inReferenceTo=\"%lld\" />\n\n",
4635 strType.
Get(), lDateSigned, strHash.
Get(),
4642 int64_t lDisplayValue = 0;
4668 <<
"OTTransaction::" << __FUNCTION__ <<
": Unexpected "
4671 "in expired box while making abbreviated expired-box record.\n";
4673 OT_FAIL_MSG(
"ASSERT: OTTransaction::SaveAbbrevExpiredBoxRecord: "
4674 "Unexpected transaction type.");
4686 strType.
Set((
nullptr != pTypeStr) ? pTypeStr :
"error_state");
4711 strOutput.
Concatenate(
"<expiredBoxRecord type=\"%s\"\n"
4712 " dateSigned=\"%lld\"\n"
4713 " receiptHash=\"%s\"\n"
4714 " displayValue=\"%lld\"\n"
4715 " transactionNum=\"%lld\"\n"
4716 " inRefDisplay=\"%lld\"\n"
4717 " inReferenceTo=\"%lld\" />\n\n",
4718 strType.
Get(), lDateSigned, strHash.
Get(),
4770 int64_t lAdjustment = 0, lDisplayValue = 0;
4826 lDisplayValue = lAdjustment;
4879 otErr <<
"OTTransaction::SaveAbbrevRecordBoxRecord: Unexpected "
4882 "in record box while making abbreviated record-box record.\n";
4895 strType.
Set((
nullptr != pTypeStr) ? pTypeStr :
"error_state");
4924 "<recordBoxRecord type=\"%s\"\n"
4925 " dateSigned=\"%lld\"\n"
4926 " receiptHash=\"%s\"\n"
4927 " adjustment=\"%lld\"\n"
4928 " displayValue=\"%lld\"\n"
4929 " numberOfOrigin=\"%lld\"\n"
4930 " transactionNum=\"%lld\"\n"
4931 " closingNum=\"%lld\"\n"
4932 " inRefDisplay=\"%lld\"\n"
4933 " inReferenceTo=\"%lld\" />\n\n",
4934 strType.
Get(), lDateSigned, strHash.
Get(), lAdjustment,
4938 strOutput.
Concatenate(
"<recordBoxRecord type=\"%s\"\n"
4939 " dateSigned=\"%lld\"\n"
4940 " receiptHash=\"%s\"\n"
4941 " adjustment=\"%lld\"\n"
4942 " displayValue=\"%lld\"\n"
4943 " numberOfOrigin=\"%lld\"\n"
4944 " transactionNum=\"%lld\"\n"
4945 " inRefDisplay=\"%lld\"\n"
4946 " inReferenceTo=\"%lld\" />\n\n",
4947 strType.
Get(), lDateSigned, strHash.
Get(),
4948 lAdjustment, lDisplayValue,
4962 int64_t lDisplayValue = 0;
4985 strListOfBlanks.
Format(
" totalListOfNumbers=\"%s\"\n",
4988 strListOfBlanks.
Set(
"");
4996 strRequestNum.
Format(
" requestNumber=\"%lld\"\n transSuccess=\"%s\"\n",
5018 strDisplayValue.
Format(
" displayValue=\"%lld\"\n", lDisplayValue);
5029 <<
" transaction in nymbox while making abbreviated nymbox "
5031 OT_FAIL_MSG(
"ASSERT: OTTransaction::SaveAbbreviatedNymboxRecord: "
5032 "Unexpected transaction in this Nymbox.");
5044 strType.
Set((
nullptr != pTypeStr) ? pTypeStr :
"error_state");
5077 strOutput.
Concatenate(
"<nymboxRecord type=\"%s\"\n"
5078 " dateSigned=\"%lld\"\n"
5079 " receiptHash=\"%s\"\n"
5080 " transactionNum=\"%lld\"\n"
5081 " closingNum=\"%lld\"\n"
5082 " inRefDisplay=\"%lld\"\n"
5083 " inReferenceTo=\"%lld\" />\n\n",
5084 strType.
Get(), lDateSigned, strHash.
Get(),
5090 "<nymboxRecord type=\"%s\"\n"
5091 " dateSigned=\"%lld\"\n%s"
5092 " receiptHash=\"%s\"\n%s"
5094 " transactionNum=\"%lld\"\n%s"
5097 " inRefDisplay=\"%lld\"\n"
5098 " inReferenceTo=\"%lld\" />\n\n",
5099 strType.
Get(), lDateSigned, strRequestNum.
Get(), strHash.
Get(),
5106 int64_t lAdjustment = 0, lDisplayValue = 0;
5126 otErr <<
"OTTransaction::SaveAbbreviatedOutboxRecord: Unexpected "
5129 "in outbox while making abbreviated outbox record.\n";
5131 OT_FAIL_MSG(
"ASSERT: OTTransaction::SaveAbbreviatedOutboxRecord: "
5132 "unexpected transaction type.");
5144 strType.
Set((
nullptr != pTypeStr) ? pTypeStr :
"error_state");
5169 strOutput.
Concatenate(
"<outboxRecord type=\"%s\"\n"
5170 " dateSigned=\"%lld\"\n"
5171 " receiptHash=\"%s\"\n"
5172 " adjustment=\"%lld\"\n"
5173 " displayValue=\"%lld\"\n"
5174 " numberOfOrigin=\"%lld\"\n"
5175 " transactionNum=\"%lld\"\n"
5176 " inRefDisplay=\"%lld\"\n"
5177 " inReferenceTo=\"%lld\" />\n\n",
5178 strType.
Get(), lDateSigned, strHash.
Get(),
5207 int64_t lAdjustment = 0, lDisplayValue = 0;
5262 lDisplayValue = lAdjustment;
5279 otErr <<
"OTTransaction::" << __FUNCTION__ <<
": Unexpected "
5282 "in inbox while making abbreviated inbox record.\n";
5284 OT_FAIL_MSG(
"ASSERT: OTTransaction::SaveAbbreviatedInboxRecord: "
5285 "unexpected transaction type.");
5298 strType.
Set((
nullptr != pTypeStr) ? pTypeStr :
"error_state");
5327 "<inboxRecord type=\"%s\"\n"
5328 " dateSigned=\"%lld\"\n"
5329 " receiptHash=\"%s\"\n"
5330 " adjustment=\"%lld\"\n"
5331 " displayValue=\"%lld\"\n"
5332 " numberOfOrigin=\"%lld\"\n"
5333 " transactionNum=\"%lld\"\n"
5334 " closingNum=\"%lld\"\n"
5335 " inRefDisplay=\"%lld\"\n"
5336 " inReferenceTo=\"%lld\" />\n\n",
5337 strType.
Get(), lDateSigned, strHash.
Get(), lAdjustment,
5341 strOutput.
Concatenate(
"<inboxRecord type=\"%s\"\n"
5342 " dateSigned=\"%lld\"\n"
5343 " receiptHash=\"%s\"\n"
5344 " adjustment=\"%lld\"\n"
5345 " displayValue=\"%lld\"\n"
5346 " numberOfOrigin=\"%lld\"\n"
5347 " transactionNum=\"%lld\"\n"
5348 " inRefDisplay=\"%lld\"\n"
5349 " inReferenceTo=\"%lld\" />\n\n",
5350 strType.
Get(), lDateSigned, strHash.
Get(),
5351 lAdjustment, lDisplayValue,
5368 otLog3 <<
"Producing statement report item for inbox item type: "
5408 otLog3 <<
"OTTransaction::ProduceInboxReportItem: Ignoring "
5411 "in inbox while making balance statement.\n";
5511 <<
"ProduceOutboxReportItem: Error, wrong item type. Returning.\n";
5530 const int64_t lAmount =
5565 int64_t lAdjustment = 0;
5567 OTItem* pOriginalItem =
nullptr;
5568 std::unique_ptr<OTItem> theItemAngel;
5603 if (
nullptr != pOriginalItem) theItemAngel.reset(pOriginalItem);
5612 if (
nullptr == pOriginalItem) {
5613 otErr <<
"OTTransaction::" << __FUNCTION__
5614 <<
": Unable to find original item. Should never happen.\n";
5629 otErr << __FUNCTION__ <<
": Wrong item type attached to "
5633 <<
". (expected depositCheque)\n";
5639 bool bLoadContractFromString =
5642 if (!bLoadContractFromString) {
5645 otErr <<
"ERROR loading cheque from string in OTTransaction::"
5646 << __FUNCTION__ <<
":\n" << strCheque <<
"\n";
5671 otErr <<
"Wrong item type attached to transferReceipt\n";
5697 lAdjustment = (pOriginalItem->
GetAmount() * (-1));
5703 otErr <<
"Wrong item type attached to pending transfer\n";
5711 lAdjustment = pOriginalItem->
GetAmount();
5717 otErr <<
"Wrong item type attached to marketReceipt\n";
5720 lAdjustment = pOriginalItem->
GetAmount();
5729 otErr <<
"Wrong item type attached to paymentReceipt\n";
5732 lAdjustment = pOriginalItem->
GetAmount();
5740 otErr <<
"Wrong item type attached to basketReceipt\n";
5743 lAdjustment = pOriginalItem->
GetAmount();
5772 otErr << __FUNCTION__ <<
": In this case, you can't calculate the "
5773 "origin number, you must set it "
5778 OT_FAIL_MSG(
"In this case, you can't calculate the origin number, "
5779 "you must set it explicitly.");
5831 otErr << __FUNCTION__ <<
": In this case, you can't calculate the "
5832 "origin number, you must set it explicitly.\n";
5835 OT_FAIL_MSG(
"In this case, you can't calculate the origin number, you "
5836 "must set it explicitly.");
5860 otErr << __FUNCTION__ <<
": ERROR: Wrong item type attached to "
5864 "(expected OTItem::depositCheque)\n";
5949 int64_t lReferenceNum = 0;
5983 return lReferenceNum;
6032 bool bSuccess =
false;
6034 OTItem* pOriginalItem =
nullptr;
6035 std::unique_ptr<OTItem> theItemAngel;
6040 if (strReference.
GetLength() < 2)
return false;
6050 if (
nullptr != pItem)
6053 otErr <<
"OTTransaction::" << __FUNCTION__
6054 <<
": Failed trying to get paymentReceipt item from "
6055 "paymentReceipt transaction.\n";
6057 std::unique_ptr<OTCronItem> pCronItem(
6063 if (
nullptr != pSmart)
6070 else if (
nullptr != pCronItem)
6073 theReturnID = pCronItem->GetSenderUserID();
6077 otErr <<
"OTTransaction::" << __FUNCTION__
6078 <<
": Unable to load Cron Item. Should never happen. "
6119 if (strReference.
Exists() &&
6145 if (
nullptr != pOriginalItem) theItemAngel.reset(pOriginalItem);
6154 if (
nullptr == pOriginalItem) {
6155 otErr <<
"OTTransaction::GetSenderUserIDForDisplay: original item not "
6156 "found. Should never happen.\n";
6171 otErr << __FUNCTION__ <<
": Wrong item type attached to "
6175 <<
" (expected depositCheque)\n";
6181 bool bLoadContractFromString =
6184 if (!bLoadContractFromString) {
6187 otErr <<
"ERROR loading cheque or voucher from string in "
6188 "OTTransaction::" << __FUNCTION__ <<
":\n" << strCheque
6205 otErr <<
"Wrong item type attached to pending transfer\n";
6208 theReturnID = pOriginalItem->
GetUserID();
6223 bool bSuccess =
false;
6225 OTItem* pOriginalItem =
nullptr;
6226 std::unique_ptr<OTItem> theItemAngel;
6238 if (
nullptr != pItem)
6241 otErr <<
"OTTransaction::" << __FUNCTION__
6242 <<
": Failed trying to get paymentReceipt item from "
6243 "paymentReceipt transaction.\n";
6245 std::unique_ptr<OTCronItem> pCronItem(
6253 if (
nullptr != pSmart)
6267 otErr <<
"OTTransaction::" << __FUNCTION__
6268 <<
": Unable to load Cron Item. Should never happen. "
6308 if (strReference.
Exists() &&
6334 if (
nullptr != pOriginalItem) theItemAngel.reset(pOriginalItem);
6342 if (
nullptr == pOriginalItem)
6352 otErr <<
"Wrong item type attached to transferReceipt\n";
6356 theReturnID = pOriginalItem->
GetUserID();
6371 otErr << __FUNCTION__ <<
": Wrong item type attached to "
6375 <<
" (expected depositCheque)\n";
6381 bool bLoadContractFromString =
6384 if (!bLoadContractFromString) {
6387 otErr <<
"ERROR loading cheque or voucher from string in "
6388 "OTTransaction::" << __FUNCTION__ <<
":\n" << strCheque
6417 bool bSuccess =
false;
6419 OTItem* pOriginalItem =
nullptr;
6420 std::unique_ptr<OTItem> theItemAngel;
6425 if (strReference.
GetLength() < 2)
return false;
6432 if (
nullptr != pItem)
6435 otErr <<
"OTTransaction::" << __FUNCTION__
6436 <<
": Failed trying to get paymentReceipt item from "
6437 "paymentReceipt transaction.\n";
6439 std::unique_ptr<OTCronItem> pCronItem(
6445 if (
nullptr != pSmart)
6455 theReturnID = pCronItem->GetSenderAcctID();
6460 <<
"OTTransaction::" << __FUNCTION__
6461 <<
": Unable to load Cron Item. Should never happen. Receipt: "
6477 if (
nullptr != pOriginalItem) theItemAngel.reset(pOriginalItem);
6485 if (
nullptr == pOriginalItem) {
6486 otErr <<
"OTTransaction::" << __FUNCTION__
6487 <<
": couldn't load original item, should never happen. \n";
6502 otErr << __FUNCTION__ <<
": Wrong item type attached to "
6506 <<
" (expected depositCheque)\n";
6512 bool bLoadContractFromString =
6515 if (!bLoadContractFromString) {
6518 otErr <<
"ERROR loading cheque from string in OTTransaction::"
6519 << __FUNCTION__ <<
":\n" << strCheque <<
"\n";
6535 otErr <<
"Wrong item type attached to pending transfer\n";
6554 bool bSuccess =
false;
6556 OTItem* pOriginalItem =
nullptr;
6557 std::unique_ptr<OTItem> theItemAngel;
6567 if (
nullptr != pItem)
6570 otErr <<
"OTTransaction::" << __FUNCTION__
6571 <<
": Failed trying to get paymentReceipt item from "
6572 "paymentReceipt transaction.\n";
6574 std::unique_ptr<OTCronItem> pCronItem(
6581 if (
nullptr != pSmart)
6588 else if (
nullptr != pPlan)
6596 <<
"OTTransaction::" << __FUNCTION__
6597 <<
": Unable to load Cron Item. Should never happen. Receipt: "
6612 if (
nullptr != pOriginalItem) theItemAngel.reset(pOriginalItem);
6620 if (
nullptr == pOriginalItem)
6630 otErr <<
"Wrong item type attached to transferReceipt\n";
6642 otErr << __FUNCTION__ <<
": Wrong item type attached to "
6645 :
"voucherReceipt") <<
" (expected depositCheque)\n";
6665 otErr <<
"Wrong item type attached to pending transfer\n";
6684 bool bSuccess =
false;
6686 OTItem* pOriginalItem =
nullptr;
6687 std::unique_ptr<OTItem> theItemAngel;
6697 if (
nullptr != pItem)
6700 otErr <<
"OTTransaction::" << __FUNCTION__
6701 <<
": Failed trying to get paymentReceipt item from "
6702 "paymentReceipt transaction.\n";
6704 std::unique_ptr<OTCronItem> pCronItem(
6711 if (
nullptr != pSmart)
6717 else if (
nullptr != pPlan)
6727 <<
"OTTransaction::" << __FUNCTION__
6728 <<
": Unable to load Cron Item. Should never happen. Receipt: "
6743 if (
nullptr != pOriginalItem) theItemAngel.reset(pOriginalItem);
6751 if (
nullptr == pOriginalItem)
6761 otErr << __FUNCTION__
6762 <<
": Wrong item type attached to transferReceipt\n";
6766 pOriginalItem->
GetNote(strMemo);
6767 bSuccess = strMemo.
Exists();
6774 otErr << __FUNCTION__ <<
": Wrong item type attached to "
6777 :
"voucherReceipt") <<
" (expected depositCheque)\n";
6787 otErr << __FUNCTION__
6788 <<
": Error loading cheque or voucher from string:\n"
6789 << strCheque <<
"\n";
6794 strMemo = theCheque.
GetMemo();
6795 bSuccess = strMemo.
Exists();
6802 otErr << __FUNCTION__
6803 <<
": Wrong item type attached to pending transfer\n";
6806 pOriginalItem->
GetNote(strMemo);
6807 bSuccess = strMemo.
Exists();
virtual void UpdateContents()
void AddItem(OTItem &theItem)
EXPORT bool StorePlainString(std::string strContents, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
EXPORT void GetReferenceString(OTString &theStr) const
const OTString & GetLastRecipientUserID() const
OTLOG_IMPORT OTLogStream otLog4
virtual EXPORT bool LoadContract()
void SetAmount(int64_t lAmount)
virtual EXPORT ~OTTransaction()
int32_t LoadAbbreviatedRecord(irr::io::IrrXMLReader *&xml, int64_t &lNumberOfOrigin, int64_t &lTransactionNum, int64_t &lInRefTo, int64_t &lInRefDisplay, time64_t &the_DATE_SIGNED, int &theType, OTString &strHash, int64_t &lAdjustment, int64_t &lDisplayValue, int64_t &lClosingNum, int64_t &lRequestNum, bool &bReplyTransSuccess, OTNumList *pNumList=nullptr)
EXPORT bool GetSenderAcctIDForDisplay(OTIdentifier &theReturnID)
static EXPORT OTTransaction * GenerateTransaction(const OTIdentifier &theUserID, const OTIdentifier &theAccountID, const OTIdentifier &theServerID, transactionType theType, int64_t lTransactionNum=0)
void SaveAbbrevExpiredBoxRecord(OTString &strOutput)
static EXPORT OTItem * CreateItemFromString(const OTString &strItem, const OTIdentifier &theServerID, int64_t lTransactionNumber)
EXPORT void SetNumberOfOrigin(int64_t lTransactionNum)
const OTString & GetLastSenderAcctID() const
EXPORT bool AddNumbersToTransaction(const OTNumList &theAddition)
const OTIdentifier & GetSenderUserID() const
OTItem * GetItem(int32_t nIndex)
void SaveAbbrevRecordBoxRecord(OTString &strOutput)
EXPORT bool ClawbackTransactionNumber(const OTIdentifier &theServerID, const int64_t &lTransClawback, bool bSave=false, OTPseudonym *pSIGNER_NYM=nullptr)
EXPORT bool LoadFromString(const OTString &strNym, OTString::Map *pMapCredentials=nullptr, OTString *pstrReason=nullptr, const OTPassword *pImportPassword=nullptr)
void SaveAbbreviatedInboxRecord(OTString &strOutput)
EXPORT void GetAttachment(OTString &theStr) const
bool HarvestClosingNumbers(OTPseudonym &theNym, bool bHarvestingForRetry, bool bReplyWasSuccess, bool bReplyWasFailure, bool bTransactionWasSuccess, bool bTransactionWasFailure)
virtual EXPORT int64_t GetNumberOfOrigin()
virtual void HarvestClosingNumbers(OTPseudonym &theNym)
void SetTransactionNum(int64_t lTransactionNum)
const OTLedger * m_pParent
static EXPORT OTTransactionType * TransactionFactory(OTString strInput)
EXPORT int64_t GetBalance() const
const int64_t & GetAmount() const
EXPORT bool DeleteBoxReceipt(OTLedger &theLedger)
const OTString & GetLastRecipientAcctID() const
EXPORT bool VerifyIssuedNum(const OTString &strServerID, const int64_t &lTransNum) const
EXPORT bool GetRecipientAcctIDForDisplay(OTIdentifier &theReturnID)
int64_t GetAbbrevAdjustment() const
static EXPORT const char * PathSeparator()
virtual void HarvestOpeningNumber(OTPseudonym &theNym)
EXPORT OTLedger * LoadOutbox(OTPseudonym &nym) const
virtual bool VerifyAccount(const OTPseudonym &theNym)
int64_t GetNewOutboxTransNum() const
void SaveAbbreviatedNymboxRecord(OTString &strOutput)
EXPORT OTItem * GetItemInRefTo(int64_t lReference)
bool m_bReplyTransSuccess
void SaveAbbrevPaymentInboxRecord(OTString &strOutput)
OTLOG_IMPORT OTLogStream otOut
void SetRealAccountID(const OTIdentifier &theID)
EXPORT void GetNote(OTString &theStr) const
OTLOG_IMPORT OTLogStream otLog3
EXPORT bool GetSenderUserIDForDisplay(OTIdentifier &theReturnID)
EXPORT bool SaveContractRaw(OTString &strOutput) const
const OTIdentifier & GetRemitterAcctID() const
EXPORT uint32_t GetLength() const
time64_t OTTimeGetTimeFromSeconds(int64_t seconds)
int64_t m_lTransactionNum
bool HasRecipient() const
EXPORT void Concatenate(const char *arg,...)
void SetRealServerID(const OTIdentifier &theID)
EXPORT bool WriteArmoredString(OTString &strOutput, const std::string str_type, bool bEscaped=false) const
OTItem * GetFinalReceiptItemByReferenceNum(int64_t lReferenceNumber)
EXPORT int64_t GetRecipientOpeningNum() const
const OTString & GetMemo() const
static EXPORT OTItem * CreateItemFromTransaction(const OTTransaction &theOwner, OTItem::itemType theType, const OTIdentifier *pDestinationAcctID=nullptr)
OTItem * GetItemByTransactionNum(int64_t lTransactionNumber)
EXPORT bool Exists() const
EXPORT bool SetString(const OTString &theData, bool bLineBreaks=true)
EXPORT void SetString(const char *szString)
const char * GetTypeString() const
int64_t GetClosingNum() const
EXPORT void Format(const char *fmt,...)
int32_t GetItemCountInRefTo(int64_t lReference)
const OTIdentifier & GetRealAccountID() const
EXPORT bool Compare(const char *compare) const
EXPORT bool GetMemo(OTString &strMemo)
EXPORT OTItem * GetItem(OTItem::itemType theType)
const OTIdentifier & GetPurportedServerID() const
EXPORT void Set(const char *data, uint32_t enforcedMaxLength=0)
virtual int32_t ProcessXMLNode(irr::io::IrrXMLReader *&xml)
time64_t OTTimeGetCurrentTime()
EXPORT bool VerifyTransactionStatementNumbersOnNym(OTPseudonym &THE_NYM)
EXPORT void SetClosingNum(int64_t lClosingNum)
const OTString & GetLastSenderUserID() const
EXPORT std::string QueryPlainString(std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
OTASCIIArmor m_ascCancellationRequest
void SetClosingNum(int64_t lClosingNum)
static EXPORT bool LoadEncodedTextField(irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput)
int64_t GetAmount() const
EXPORT bool Output(std::set< int64_t > &theOutput) const
EXPORT int64_t GetClosingNum() const
EXPORT OTLedger * LoadInbox(OTPseudonym &nym) const
bool HarvestOpeningNumber(OTPseudonym &theNym, bool bHarvestingForRetry, bool bReplyWasSuccess, bool bReplyWasFailure, bool bTransactionWasSuccess, bool bTransactionWasFailure)
static EXPORT const OTString & Receipt()
bool VerifyBoxReceipt(OTTransaction &theFullVersion)
OTString m_strContractType
const OTIdentifier & GetDestinationAcctID() const
OTLOG_IMPORT OTLogStream otInfo
ledgerType GetType() const
const OTString & GetConsideration() const
EXPORT bool VerifyBalanceReceipt(OTPseudonym &SERVER_NYM, OTPseudonym &THE_NYM)
EXPORT int32_t Count() const
static transactionType GetTypeFromString(const OTString &strType)
const OTIdentifier & GetRemitterUserID() const
void SetReplyTransSuccess(bool bVal)
bool SetupBoxReceiptFilename(int64_t lLedgerType, OTTransaction &theTransaction, const char *szCaller, OTString &strFolder1name, OTString &strFolder2name, OTString &strFolder3name, OTString &strFilename)
OTStringXML m_xmlUnsigned
time64_t GetDateSigned() const
EXPORT int64_t GetReferenceToNum() const
EXPORT bool SaveBoxReceipt(int64_t lLedgerType)
OTLOG_IMPORT OTLogStream otWarn
EXPORT int64_t GetReferenceNumForDisplay()
int64_t GetAbbrevDisplayAmount() const
EXPORT const char * Get() const
void SetUserID(const OTIdentifier &theID)
void SaveAbbreviatedOutboxRecord(OTString &strOutput)
transactionType GetType() const
void ProduceInboxReportItem(OTItem &theBalanceItem)
OTLOG_IMPORT OTLogStream otErr
OTItem::itemStatus GetStatus() const
const OTIdentifier & GetPurportedAccountID() const
EXPORT int64_t GetReceiptAmount()
virtual bool VerifyAccount(const OTPseudonym &theNym)
EXPORT int64_t GetTransactionNum() const
virtual void HarvestClosingNumbers(OTPseudonym &theNym)
EXPORT void SetReferenceToNum(int64_t lTransactionNum)
bool IsAbbreviated() const
virtual EXPORT void HarvestClosingNumbers(OTPseudonym &theNym)
void SetRequestNum(const int64_t &lNum)
void SetPurportedServerID(const OTIdentifier &theID)
EXPORT void GetString(OTString &theStr) const
virtual EXPORT bool VerifySignature(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
const OTIdentifier & GetRecipientUserID() const
const OTIdentifier & GetSenderAcctID() const
virtual EXPORT bool VerifyContractID() const
EXPORT bool Exists(std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
int32_t GetItemCount() const
int64_t m_lNumberOfOrigin
const OTIdentifier & GetRecipientAcctID() const
OTItem::itemType GetType() const
const OTIdentifier & GetUserID() const
int64_t OTTimeGetSecondsFromTime(time64_t time)
EXPORT bool LoadContractFromString(const OTString &theStr)
void ProduceOutboxReportItem(OTItem &theBalanceItem)
void GetTypeString(OTString &strType) const
virtual EXPORT void CalculateContractID(OTIdentifier &newID) const
const OTIdentifier & GetRecipientUserID() const
listOfItems & GetItemList()
virtual EXPORT int64_t GetNumberOfOrigin()
void SetPurportedAccountID(const OTIdentifier &theID)
virtual EXPORT void Release()
OTASCIIArmor m_ascInReferenceTo
const OTIdentifier & GetRealServerID() const
EXPORT bool VerifyItems(OTPseudonym &theNym)
static EXPORT OTCronItem * NewCronItem(const OTString &strCronItem)
int64_t m_lClosingTransactionNo
EXPORT void AddItem(OTItem &theItem)
virtual bool SaveContractWallet(std::ofstream &ofs) const
int64_t GetAbbrevInRefDisplay() const
void SetParent(const OTLedger &theParent)
EXPORT OTTransaction * GetTransaction(OTTransaction::transactionType theType)
EXPORT int64_t GetRawNumberOfOrigin() const
EXPORT bool GetRecipientUserIDForDisplay(OTIdentifier &theReturnID)
virtual EXPORT void CalculateNumberOfOrigin()