183 OTItem* pBalanceItem =
nullptr;
184 OTItem* pResponseItem =
nullptr;
185 OTItem* pResponseBalanceItem =
nullptr;
195 const OTIdentifier SERVER_ID(server_->m_strServerID), USER_ID(theNym),
196 ACCOUNT_ID(theFromAccount),
199 OTString strUserID(USER_ID), strAccountID(ACCOUNT_ID);
200 pResponseBalanceItem =
203 tranOut.
AddItem(*pResponseBalanceItem);
209 tranOut.
AddItem(*pResponseItem);
214 OTLog::vOutput(0,
"Notary::NotarizeTransfer: User %s cannot do this "
215 "transaction (All acct-to-acct transfers are "
216 "disallowed in server.cfg)\n",
223 "OTItem::balanceStatement in trans# %ld: \n\n%s\n\n",
227 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
235 "OTItem::transfer in trans# %ld: \n\n%s\n\n",
239 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
244 0,
"Notary::NotarizeTransfer: Failed attempt by user %s in "
245 "trans# %ld, to transfer money \"To the From Acct\": \n\n%s\n\n",
248 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
290 std::unique_ptr<OTAccount> pDestinationAcct(
296 OTLog::Output(0,
"Notary::NotarizeTransfer: Failure: Attempt to "
297 "transfer negative balance.\n");
305 "account ID on the transaction does not match "
306 "'from' account ID on the transaction item.\n");
309 else if (
nullptr == pDestinationAcct) {
310 OTLog::Output(0,
"Notary::NotarizeTransfer: ERROR verifying "
311 "existence of the 'to' account.\n");
319 else if (pDestinationAcct->IsInternalServerAcct()) {
320 OTLog::Output(0,
"Notary::NotarizeTransfer: Failure: Destination "
321 "account is used internally by the server, and is "
322 "not a valid recipient for this transaction.\n");
326 pDestinationAcct->GetAssetTypeID())) {
328 strDestinationAssetID(pDestinationAcct->GetAssetTypeID());
330 0,
"ERROR - user attempted to transfer between accounts of 2 "
332 "asset types in Notary::NotarizeTransfer:\n%s\n%s\n",
333 strFromAssetID.Get(), strDestinationAssetID.Get());
338 else if (!pDestinationAcct->VerifySignature(server_->m_nymServer)) {
339 OTLog::Output(0,
"ERROR verifying signature on, the 'to' account "
340 "in Notary::NotarizeTransfer\n");
358 OTLedger theFromOutbox(USER_ID, IDFromAccount, SERVER_ID),
361 bool bSuccessLoadingInbox = theToInbox.
LoadInbox();
362 bool bSuccessLoadingOutbox = theFromOutbox.LoadOutbox();
387 if (
true == bSuccessLoadingInbox)
388 bSuccessLoadingInbox =
389 theToInbox.VerifyAccount(server_->m_nymServer);
392 "Notary::NotarizeTransfer: Error loading 'to' inbox.\n");
394 if (
true == bSuccessLoadingOutbox)
395 bSuccessLoadingOutbox =
396 theFromOutbox.VerifyAccount(server_->m_nymServer);
398 OTLog::Error(
"Notary::NotarizeTransfer: Error loading 'from' "
401 std::unique_ptr<OTLedger> pInbox(
402 theFromAccount.
LoadInbox(server_->m_nymServer));
403 std::unique_ptr<OTLedger> pOutbox(
404 theFromAccount.
LoadOutbox(server_->m_nymServer));
406 if (
nullptr == pInbox) {
409 else if (
nullptr == pOutbox) {
412 else if (!bSuccessLoadingInbox ||
413 false == bSuccessLoadingOutbox) {
415 "ERROR generating ledger in Notary::NotarizeTransfer.\n");
420 int64_t lNewTransactionNumber = 0;
423 server_->m_nymServer, lNewTransactionNumber,
435 lNewTransactionNumber);
439 lNewTransactionNumber);
444 lNewTransactionNumber);
484 pTEMPOutboxTransaction->
SignContract(server_->m_nymServer);
490 pOutbox->AddTransaction(
491 *pTEMPOutboxTransaction);
526 theNym, *pInbox, *pOutbox, theFromAccount, tranIn,
527 lNewTransactionNumber))) {
529 "performing transfer. Acct ID:\n%s\n",
537 lNewTransactionNumber);
549 if (theFromAccount.
Debit(
555 theFromOutbox.AddTransaction(*pOutboxTransaction);
556 theToInbox.AddTransaction(*pInboxTransaction);
562 theFromOutbox.ReleaseSignatures();
563 theToInbox.ReleaseSignatures();
566 theFromOutbox.SignContract(server_->m_nymServer);
567 theToInbox.SignContract(server_->m_nymServer);
570 theFromOutbox.SaveContract();
571 theToInbox.SaveContract();
575 pDestinationAcct->SaveInbox(theToInbox);
582 pDestinationAcct->ReleaseSignatures();
583 pDestinationAcct->SignContract(server_->m_nymServer);
584 pDestinationAcct->SaveContract();
585 pDestinationAcct->SaveAccount();
622 delete pOutboxTransaction;
623 pOutboxTransaction =
nullptr;
624 delete pInboxTransaction;
625 pInboxTransaction =
nullptr;
627 "the amount of: %ld\n",
628 __FUNCTION__, strAccountID.Get(),
645 pResponseBalanceItem->
SignContract(server_->m_nymServer);
670 OTItem* pItemCash =
nullptr;
671 OTItem* pItemVoucher =
nullptr;
672 OTItem* pBalanceItem =
nullptr;
673 OTItem* pResponseItem =
nullptr;
674 OTItem* pResponseBalanceItem =
nullptr;
684 const OTIdentifier SERVER_ID(server_->m_strServerID), USER_ID(theNym),
685 ACCOUNT_ID(theAccount), SERVER_USER_ID(server_->m_nymServer),
688 const OTString strUserID(USER_ID), strAccountID(ACCOUNT_ID),
689 strAssetTypeID(ASSET_TYPE_ID);
698 if (
nullptr == pItemVoucher) {
704 pItem = pItemVoucher;
710 tranOut.
AddItem(*pResponseItem);
713 pResponseBalanceItem =
716 tranOut.
AddItem(*pResponseBalanceItem);
719 if (
nullptr == pItem) {
722 0,
"Notary::NotarizeWithdrawal: Expected OTItem::withdrawal or "
723 "OTItem::withdrawVoucher in trans# %ld: \n\n%s\n\n",
726 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
735 OTLog::vOutput(0,
"Notary::NotarizeWithdrawal: User %s cannot do "
736 "this transaction (All withdrawals are disallowed in "
741 else if ((
nullptr != pItemVoucher) &&
745 OTLog::vOutput(0,
"Notary::NotarizeWithdrawal: User %s cannot do "
746 "this transaction (withdrawVoucher is disallowed in "
751 else if ((
nullptr != pItemCash) &&
755 OTLog::vOutput(0,
"Notary::NotarizeWithdrawal: User %s cannot do "
756 "this transaction (withdraw cash is disallowed in "
766 "OTItem::balanceStatement, but not found in trans # "
771 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
803 std::shared_ptr<OTAccount> pVoucherReserveAcct;
804 std::unique_ptr<OTLedger> pInbox(
805 theAccount.
LoadInbox(server_->m_nymServer));
806 std::unique_ptr<OTLedger> pOutbox(
817 OTLog::Output(0,
"Error: Account ID does not match account ID on "
818 "the withdrawal item.\n");
820 else if (
nullptr == pInbox) {
823 else if (
nullptr == pOutbox) {
837 pVoucherReserveAcct->VerifyAccount(
838 server_->m_nymServer))
844 OTString strVoucherRequest, strItemNote;
848 OTAccount& theVoucherReserveAcct = (*pVoucherReserveAcct);
851 OTCheque theVoucher(SERVER_ID, ASSET_TYPE_ID),
852 theVoucherRequest(SERVER_ID, ASSET_TYPE_ID);
854 bool bLoadContractFromString =
857 if (!bLoadContractFromString) {
859 "from string:\n%s\n",
860 __FUNCTION__, strVoucherRequest.
Get());
865 "Notary::%s: Failed verifying transaction number on the "
866 "voucher (%ld) in withdrawal request %ld for Nym: %s\n",
870 else if (ASSET_TYPE_ID != theVoucherRequest.
GetAssetID()) {
873 "Notary::%s: Failed verifying asset type ID (%s) on the "
874 "withdraw voucher request (found: %s) "
875 "for transaction %ld, voucher %ld. User: %s\n",
876 __FUNCTION__, strAssetTypeID.Get(), strFoundAssetID.Get(),
885 *pInbox, *pOutbox, theAccount, tranIn))) {
887 "issuing voucher. Acct ID:\n%s\n",
896 strChequeMemo.
Format(
"%s%s", strItemNote.
Get(),
920 const int64_t lAmount =
931 bool bIssueVoucher = theVoucher.IssueCheque(
958 if (bIssueVoucher && (lAmount > 0) &&
961 pVoucherReserveAcct->Credit(
964 "crediting voucher reserve account.\n");
969 "(voucher): Failed crediting user "
974 theVoucher.SetAsVoucher(
975 USER_ID, ACCOUNT_ID);
980 theVoucher.SignContract(server_->m_nymServer);
981 theVoucher.SaveContract();
982 theVoucher.SaveContractRaw(strVoucher);
1007 pVoucherReserveAcct->ReleaseSignatures();
1008 pVoucherReserveAcct->SignContract(server_->m_nymServer);
1009 pVoucherReserveAcct->SaveContract();
1010 pVoucherReserveAcct->SaveAccount();
1019 "transactor_.getVoucherAccount() failed in NotarizeWithdrawal. "
1020 "Asset Type:\n%s\n",
1021 strAssetTypeID.Get());
1059 std::unique_ptr<OTLedger> pInbox(
1060 theAccount.
LoadInbox(server_->m_nymServer));
1061 std::unique_ptr<OTLedger> pOutbox(
1062 theAccount.
LoadOutbox(server_->m_nymServer));
1064 Mint* pMint =
nullptr;
1065 OTAccount* pMintCashReserveAcct =
nullptr;
1068 OTLog::Output(0,
"Attempt to withdraw a negative amount.\n");
1074 OTLog::Output(0,
"Error: 'From' account ID on the transaction does "
1075 "not match 'from' account ID on the withdrawal "
1078 else if (
nullptr == pInbox) {
1081 else if (
nullptr == pOutbox) {
1127 Purse thePurse(SERVER_ID, ASSET_TYPE_ID);
1128 Purse theOutputPurse(SERVER_ID, ASSET_TYPE_ID);
1129 Token* pToken =
nullptr;
1132 bool bSuccess =
false;
1133 bool bLoadContractFromString =
1136 if (!bLoadContractFromString) {
1138 "Notary::NotarizeWithdrawal:\n%s\n",
1145 theNym, *pInbox, *pOutbox, theAccount, tranIn))) {
1147 "withdrawing cash. Acct ID: %s\n",
1148 strAccountID.Get());
1158 while ((pToken = thePurse.
Pop(server_->m_nymServer)) !=
1162 theDeque.push_front(pToken);
1164 pMint = server_->transactor_.
getMint(ASSET_TYPE_ID,
1167 if (
nullptr == pMint) {
1169 "find Mint (series %d): %s\n",
1171 strAssetTypeID.Get());
1176 (pMintCashReserveAcct =
1177 pMint->GetCashReserveAccount())) {
1179 "Notary::NotarizeWithdrawal: Unable to find cash "
1180 "reserve account for Mint (series %d): %s\n",
1181 pToken->
GetSeries(), strAssetTypeID.Get());
1194 else if (pMint->Expired()) {
1196 "Notary::NotarizeWithdrawal: User attempting "
1197 "withdrawal with an expired mint (series %d): %s\n",
1198 pToken->
GetSeries(), strAssetTypeID.Get());
1207 str2(ASSET_TYPE_ID);
1210 "Expected asset ID %s but found %s "
1211 "instead. (Failure.)\n",
1212 __FUNCTION__, str2.Get(), str1.
Get());
1221 else if (!(pMint->SignToken(server_->m_nymServer,
1222 *pToken, theStringReturnVal,
1228 "%s: Failure in call: "
1229 "pMint->SignToken(server_->m_nymServer, "
1230 "*pToken, theStringReturnVal, 0). "
1255 if (theAccount.
Debit(
1283 if (!pMintCashReserveAcct->
Credit(
1286 "reserve account...\n");
1294 "user account back.\n",
1304 "%s in the amount of: %ld\n",
1305 __FUNCTION__, strAccountID.Get(),
1315 while (!theDeque.empty()) {
1316 pToken = theDeque.front();
1317 theDeque.pop_front();
1319 theOutputPurse.
Push(theNym, *pToken);
1363 pMintCashReserveAcct->
SignContract(server_->m_nymServer);
1383 while (!theDeque.empty()) {
1384 pToken = theDeque.front();
1385 theDeque.pop_front();
1404 pResponseBalanceItem->
SignContract(server_->m_nymServer);
1410 0,
"Notary::NotarizeWithdrawal: Expected OTItem::withdrawal or "
1411 "OTItem::withdrawVoucher in trans# %ld: \n\n%s\n\n",
1414 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
1426 pResponseBalanceItem->
SignContract(server_->m_nymServer);
1465 const char* szFunc =
"Notary::NotarizePayDividend";
1474 OTItem* pItemPayDividend =
1477 OTItem* pBalanceItem =
nullptr;
1479 OTItem* pResponseItem =
nullptr;
1480 OTItem* pResponseBalanceItem =
1493 const OTIdentifier SERVER_ID(server_->m_strServerID), USER_ID(theNym),
1494 SOURCE_ACCT_ID(theSourceAccount), SERVER_USER_ID(server_->m_nymServer),
1500 const OTString strUserID(USER_ID), strAccountID(SOURCE_ACCT_ID),
1501 strAssetTypeID(PAYOUT_ASSET_ID);
1508 if (
nullptr != pItemPayDividend)
1510 pItem = pItemPayDividend;
1519 tranOut.
AddItem(*pResponseItem);
1522 pResponseBalanceItem =
1525 tranOut.
AddItem(*pResponseBalanceItem);
1528 if (
nullptr == pItem) {
1531 0,
"%s: Expected OTItem::payDividend in trans# %ld: \n\n%s\n\n",
1535 :
" (ERROR SERIALIZING TRANSACTION INTO A STRING) ");
1546 0,
"%s: User %s cannot do this transaction (All withdrawals are "
1547 "disallowed in server.cfg, even for paying dividends with.)\n",
1548 szFunc, strUserID.Get());
1552 else if ((
nullptr != pItemPayDividend) &&
1557 "(payDividend is disallowed in server.cfg)\n",
1558 szFunc, strUserID.Get());
1565 OTLog::vOutput(0,
"%s: Expected OTItem::balanceStatement, but not "
1566 "found in trans # %ld: \n\n%s\n\n",
1570 :
" (ERROR SERIALIZING TRANSACTION INTO A STRING) ");
1603 const int64_t lTotalCostOfDividend = pItem->
GetAmount();
1614 const bool bLoadContractFromString =
1617 if (!bLoadContractFromString) {
1618 OTLog::vError(
"%s: ERROR loading dividend payout's voucher request "
1619 "from string:\n%s\n",
1620 szFunc, strVoucherRequest.
Get());
1622 else if (theVoucherRequest.
GetAmount() <= 0) {
1623 OTLog::vError(
"%s: ERROR expected >0 'payout per share' as "
1624 "'amount' on request voucher:\n%s\n",
1625 szFunc, strVoucherRequest.
Get());
1634 const int64_t lAmountPerShare =
1639 const OTString strSharesIssuerAcct(SHARES_ISSUER_ACCT_ID);
1648 OTAccount* pSharesIssuerAccount =
nullptr;
1649 std::unique_ptr<OTAccount> theAcctAngel;
1651 if (
nullptr != pSharesContract) {
1653 SHARES_ISSUER_ACCT_ID, SERVER_ID);
1654 theAcctAngel.reset(pSharesIssuerAccount);
1657 if (
nullptr == pSharesContract) {
1658 const OTString strSharesType(SHARES_ASSET_ID);
1659 OTLog::vError(
"%s: ERROR unable to find shares contract based "
1660 "on asset type ID: %s\n",
1661 szFunc, strSharesType.
Get());
1663 else if (!pSharesContract->
IsShares()) {
1664 const OTString strSharesType(SHARES_ASSET_ID);
1666 "shares-based. Asset type ID: %s\n",
1667 szFunc, strSharesType.
Get());
1670 const OTString strSharesType(SHARES_ASSET_ID);
1671 OTLog::vError(
"%s: ERROR unable to verify signature for Nym "
1672 "(%s) on shares contract "
1673 "with asset ID: %s\n",
1674 szFunc, strUserID.Get(), strSharesType.
Get());
1676 else if (
nullptr == pSharesIssuerAccount) {
1678 "%s: ERROR unable to find issuer account for shares: %s\n",
1679 szFunc, strSharesIssuerAcct.
Get());
1681 else if (PAYOUT_ASSET_ID ==
1684 const OTString strSharesType(PAYOUT_ASSET_ID);
1686 "shares asset type as payout type also. "
1687 "(It's logically impossible for it to payout to "
1689 "ITSELF as the asset type for the payout): %s\n",
1690 szFunc, strSharesType.
Get());
1694 server_->m_nymServer)) {
1695 const OTString strIssuerAcctID(SHARES_ISSUER_ACCT_ID);
1697 "%s: ERROR failed trying to verify issuer account: %s\n",
1698 szFunc, strIssuerAcctID.
Get());
1700 else if (!pSharesIssuerAccount->
VerifyOwner(theNym)) {
1701 const OTString strIssuerAcctID(SHARES_ISSUER_ACCT_ID);
1703 0,
"%s: ERROR verifying signer's ownership of shares "
1704 "issuer account (%s), "
1705 "while trying to pay dividend from source account: %s\n",
1706 szFunc, strIssuerAcctID.
Get(), strAccountID.Get());
1715 else if ((pSharesIssuerAccount->
GetBalance() * (-1) *
1716 lAmountPerShare) != lTotalCostOfDividend) {
1717 const OTString strIssuerAcctID(SHARES_ISSUER_ACCT_ID);
1719 "calculated (%ld) doesn't match client's "
1720 "request (%ld) for source acct: %s\n",
1721 szFunc, (pSharesIssuerAccount->
GetBalance() *
1722 (-1) * lAmountPerShare),
1723 lTotalCostOfDividend, strAccountID.Get());
1725 else if (theSourceAccount.
GetBalance() < lTotalCostOfDividend) {
1726 const OTString strIssuerAcctID(SHARES_ISSUER_ACCT_ID);
1728 "cover total dividend payout (%ld) for "
1729 "source acct: %s\n",
1731 lTotalCostOfDividend, strAccountID.Get());
1746 std::unique_ptr<OTLedger> pInbox(
1747 theSourceAccount.
LoadInbox(server_->m_nymServer));
1748 std::unique_ptr<OTLedger> pOutbox(
1749 theSourceAccount.
LoadOutbox(server_->m_nymServer));
1752 std::shared_ptr<OTAccount> pVoucherReserveAcct;
1759 if (SOURCE_ACCT_ID !=
1770 "account ID on the 'pay dividend' "
1774 else if (
nullptr == pInbox) {
1778 else if (
nullptr == pOutbox) {
1790 else if ((pVoucherReserveAcct =
1792 PAYOUT_ASSET_ID)) &&
1795 pVoucherReserveAcct->VerifyAccount(
1796 server_->m_nymServer))
1801 OTAccount& theVoucherReserveAcct = (*pVoucherReserveAcct);
1803 theVoucherReserveAcct);
1824 lTotalCostOfDividend * (-1),
1827 theNym, *pInbox, *pOutbox, theSourceAccount,
1830 "statement while trying to pay "
1831 "dividend. Source Acct ID: %s\n",
1832 szFunc, strAccountID.Get());
1848 if ((lTotalCostOfDividend > 0) &&
1849 theSourceAccount.
Debit(
1850 lTotalCostOfDividend)
1857 const OTString strVoucherAcctID(VOUCHER_ACCOUNT_ID);
1860 pVoucherReserveAcct->Credit(
1861 lTotalCostOfDividend))
1864 "to voucher reserve account: "
1866 szFunc, lTotalCostOfDividend,
1867 strVoucherAcctID.
Get());
1876 lTotalCostOfDividend))
1878 "%s: Failed crediting back the user "
1879 "account, after taking his funds "
1880 "and failing to credit them to the "
1881 "voucher reserve account.\n",
1914 server_->m_nymServer);
1928 pVoucherReserveAcct->ReleaseSignatures();
1929 pVoucherReserveAcct->SignContract(
1930 server_->m_nymServer);
1931 pVoucherReserveAcct->SaveContract();
1932 pVoucherReserveAcct->SaveAccount();
1947 std::pair<std::string, OTAccount*>(
1948 strAccountID.Get(), &theSourceAccount));
1950 std::pair<std::string, OTAccount*>(
1951 strSharesIssuerAcct.
Get(),
1952 pSharesIssuerAccount));
1954 std::pair<std::string, OTAccount*>(
1955 strVoucherAcctID.
Get(),
1956 &theVoucherReserveAcct));
1959 SERVER_ID, USER_ID, PAYOUT_ASSET_ID,
1964 *server_, lAmountPerShare, &theAccounts);
1974 const bool bForEachAcct =
2021 "%s: ERROR: After moving funds for "
2022 "dividend payment, there was some "
2023 "error when sending out the vouchers "
2024 "to the payout recipients.\n",
2030 const int64_t lLeftovers =
2031 lTotalCostOfDividend -
2034 if (lLeftovers > 0) {
2044 0,
"%s: After dividend payout, with "
2045 "%ld units removed initially, "
2046 "there were %ld units remaining. "
2047 "(Returning them to sender...)\n",
2048 szFunc, lTotalCostOfDividend,
2070 int64_t lNewTransactionNumber = 0;
2071 const bool bGotNextTransNum =
2072 server_->transactor_
2074 server_->m_nymServer,
2075 lNewTransactionNumber);
2088 if (bGotNextTransNum) {
2090 server_->m_nymServer);
2091 const bool bIssueVoucher =
2095 lNewTransactionNumber,
2143 if (bIssueVoucher) {
2146 VOUCHER_ACCOUNT_ID);
2154 server_->m_nymServer);
2169 server_->SendInstrumentToNym(
2175 nullptr, &thePayment,
2186 strSenderUserID(USER_ID);
2188 "%s: ERROR failed issuing "
2189 "voucher (to return leftovers "
2191 "the dividend payout "
2192 "initiator.) WAS TRYING TO PAY "
2193 "%ld of asset type %s to Nym "
2196 strPayoutAssetID.Get(),
2197 strSenderUserID.
Get());
2204 strRecipientUserID(USER_ID);
2206 "%s: ERROR!! Failed issuing next "
2208 "number while trying to send a "
2209 "voucher (while returning leftover "
2210 "funds, after paying dividends.) "
2211 "WAS TRYING TO PAY %ld of asset "
2212 "type %s to Nym %s.\n",
2214 strPayoutAssetID.Get(),
2215 strRecipientUserID.
Get());
2227 "%s: server_->transactor_.getVoucherAccount() failed. "
2228 "Asset Type:\n%s\n",
2229 szFunc, strAssetTypeID.Get());
2237 0,
"%s: Expected OTItem::payDividend in trans# %ld: \n\n%s\n\n",
2240 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
2251 pResponseBalanceItem->
SignContract(server_->m_nymServer);
2265 OTItem* pItemCheque =
nullptr;
2266 OTItem* pItemCash =
nullptr;
2267 OTItem* pBalanceItem =
nullptr;
2268 OTItem* pResponseItem =
nullptr;
2269 OTItem* pResponseBalanceItem =
nullptr;
2279 const OTIdentifier SERVER_ID(server_->m_strServerID), USER_ID(theNym),
2280 ACCOUNT_ID(theAccount), SERVER_USER_ID(server_->m_nymServer),
2283 const OTString strUserID(USER_ID), strAccountID(ACCOUNT_ID);
2285 Mint* pMint =
nullptr;
2294 if (
nullptr == pItemCheque) {
2300 pItem = pItemCheque;
2306 tranOut.
AddItem(*pResponseItem);
2309 pResponseBalanceItem =
2312 tranOut.
AddItem(*pResponseBalanceItem);
2315 if (
nullptr == pItem) {
2317 OTLog::vOutput(0,
"Notary::NotarizeDeposit: Expected OTItem::deposit "
2318 "or OTItem::depositCheque in trans# %ld: \n\n%s\n\n",
2322 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
2332 OTLog::vOutput(0,
"Notary::NotarizeDeposit: User %s cannot do this "
2333 "transaction (All deposits are disallowed in "
2338 else if ((
nullptr != pItemCheque) &&
2342 OTLog::vOutput(0,
"Notary::NotarizeDeposit: User %s cannot do this "
2343 "transaction (depositCheque is disallowed in "
2348 else if ((
nullptr != pItemCash) &&
2352 OTLog::vOutput(0,
"Notary::NotarizeDeposit: User %s cannot do this "
2353 "transaction (deposit cash is disallowed in "
2363 0,
"Notary::NotarizeDeposit: Expected OTItem::balanceStatement, "
2364 "but not found in trans # %ld: \n\n%s\n\n",
2367 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
2399 std::unique_ptr<OTLedger> pInbox(
2400 theAccount.
LoadInbox(server_->m_nymServer));
2401 std::unique_ptr<OTLedger> pOutbox(
2402 theAccount.
LoadOutbox(server_->m_nymServer));
2408 OTLog::Error(
"Notary::NotarizeDeposit: Error loading or "
2409 "verifying inbox for depositor account.\n");
2415 OTLog::Error(
"Notary::NotarizeDeposit: Error loading or "
2416 "verifying outbox for depositor account.\n");
2430 OTLog::Output(0,
"Notary::NotarizeDeposit: Error: account ID "
2431 "does not match account ID on the deposit "
2440 bool bLoadContractFromString =
2443 if (!bLoadContractFromString) {
2444 OTLog::vError(
"%s: ERROR loading cheque from string:\n%s\n",
2445 __FUNCTION__, strCheque.
Get());
2456 "Incorrect Server ID on cheque. Sender User "
2457 "ID: %s\nRecipient User ID is: %s\n",
2459 strSenderUserID.Get(), strRecipientUserID.Get());
2468 "Not within valid date range. Sender User "
2469 "ID: %s\nRecipient User ID: %s\n",
2471 strSenderUserID.Get(), strRecipientUserID.Get());
2490 else if (ACCOUNT_ID ==
2506 "%s: Failure verifying cheque: Strange: while the "
2507 "depositing account has the "
2508 "same ID as the cheque sender acct, somehow the user "
2509 "IDs do not match. (Should never happen.)\n"
2510 "Cheque Sender User ID: %s\n Depositor User ID: %s\n",
2511 __FUNCTION__, strSenderUserID.Get(), strUserID.Get());
2515 0,
"%s: Failure verifying cheque: While attempting to "
2516 "perform cancellation, "
2517 "the cheque has a non-zero amount.\n"
2518 "Sender User ID: %s\nRecipient User ID: %s\n",
2519 __FUNCTION__, strSenderUserID.Get(),
2520 strRecipientUserID.Get());
2529 0,
"%s: Failure verifying cheque: Bad transaction "
2531 "Sender User ID: %s\nRecipient User ID: %s\n",
2532 __FUNCTION__, strSenderUserID.Get(),
2533 strRecipientUserID.Get());
2539 "%s: Failure verifying cheque signature for "
2540 "sender ID: %s\nRecipient User ID: %s\n "
2541 "Cheque:\n\n%s\n\n",
2542 __FUNCTION__, strSenderUserID.Get(),
2543 strRecipientUserID.Get(), strCheque.
Get());
2549 theNym, *pInbox, *pOutbox, theAccount,
2552 "while cancelling cheque %ld. Acct "
2555 strAccountID.Get());
2576 "number as in use. (Should never "
2584 int64_t lNewTransactionNumber = 0;
2587 server_->m_nymServer, lNewTransactionNumber,
2593 lNewTransactionNumber);
2613 pInbox->AddTransaction(*pInboxTransaction);
2620 pInbox->ReleaseSignatures();
2621 pInbox->SignContract(server_->m_nymServer);
2622 pInbox->SaveContract();
2624 theAccount.SaveInbox(*pInbox);
2645 theAccount.ReleaseSignatures();
2646 theAccount.SignContract(server_->m_nymServer);
2647 theAccount.SaveContract();
2648 theAccount.SaveAccount();
2671 0,
"%s: SUCCESS cancelling cheque %ld, which had "
2672 "been drawn from account: %s\n",
2674 strAccountID.Get());
2712 const bool bHasRemitter = theCheque.
HasRemitter();
2713 const bool bRemitterCancelling =
2722 bRemitterCancelling ? USER_ID
2728 const OTString strSenderUserID(SENDER_USER_ID),
2729 strSourceAcctID(SOURCE_ACCT_ID),
2730 strRecipientUserID(RECIPIENT_USER_ID),
2731 strRemitterUserID(REMITTER_USER_ID),
2732 strRemitterAcctID(REMITTER_ACCT_ID);
2733 OTLedger theSenderInbox(SENDER_USER_ID, SOURCE_ACCT_ID,
2736 REMITTER_USER_ID, REMITTER_ACCT_ID,
2738 OTLedger* pSenderInbox = &theSenderInbox;
2739 OTLedger* pRemitterInbox = &theRemitterInbox;
2742 std::unique_ptr<OTAccount> theRemitterAcctGuardian;
2747 std::unique_ptr<OTAccount> theSourceAcctGuardian;
2818 bool bDepositorIsServer = (USER_ID == SERVER_USER_ID);
2819 bool bDepositorIsSender = (USER_ID == SENDER_USER_ID);
2820 bool bDepositorIsRemitter = (USER_ID == REMITTER_USER_ID);
2821 bool bDepositAcctIsRemitter = (ACCOUNT_ID == REMITTER_ACCT_ID);
2822 bool bSourceAcctIsRemitter =
2823 (SOURCE_ACCT_ID == REMITTER_ACCT_ID);
2824 bool bSenderIsServer = (SENDER_USER_ID == SERVER_USER_ID);
2825 bool bRemitterIsServer = (REMITTER_USER_ID == SERVER_USER_ID);
2826 bool bSenderUserAlreadyLoaded =
false;
2827 bool bSourceAcctAlreadyLoaded =
false;
2828 bool bRemitterUserAlreadyLoaded =
false;
2829 bool bRemitterAcctAlreadyLoaded =
false;
2837 if (bDepositorIsServer) {
2850 if (bDepositorIsSender) {
2851 pSenderNym = &theNym;
2852 bSenderUserAlreadyLoaded =
true;
2856 if (bSenderIsServer) {
2857 pSenderNym = &server_->m_nymServer;
2858 bSenderUserAlreadyLoaded =
true;
2860 bool bSuccessLoadSenderInbox =
false;
2861 bool bSuccessLoadRemitterInbox =
false;
2864 pSenderInbox =
nullptr;
2868 if (bDepositorIsRemitter) {
2869 pRemitterNym = &theNym;
2870 bRemitterUserAlreadyLoaded =
true;
2874 if (bRemitterIsServer) {
2875 pRemitterNym = &server_->m_nymServer;
2876 bRemitterUserAlreadyLoaded =
true;
2880 if (bDepositAcctIsRemitter) {
2881 pRemitterAcct = &theAccount;
2882 pRemitterInbox = pInbox.get();
2884 bRemitterAcctAlreadyLoaded =
true;
2885 bSuccessLoadRemitterInbox =
true;
2891 if (bSourceAcctIsRemitter) {
2892 pSourceAcct = pRemitterAcct;
2893 pSenderInbox = pRemitterInbox;
2895 bSourceAcctAlreadyLoaded =
true;
2896 bSuccessLoadSenderInbox =
true;
2906 bSuccessLoadSenderInbox = pSenderInbox->
LoadInbox();
2909 if (bSuccessLoadSenderInbox)
2910 bSuccessLoadSenderInbox =
2914 "for %s source account.\n",
2916 (bHasRemitter) ?
"cheque" :
"voucher");
2949 if (bHasRemitter && !bSenderIsServer) {
2951 "'sender' who is not the server: %s\n",
2952 __FUNCTION__, strSenderUserID.Get());
2962 else if (!bSenderUserAlreadyLoaded &&
2977 0,
"Notary::%s: Error loading public key for %s "
2979 "deposit: %s\nRecipient User ID: %s\n",
2980 __FUNCTION__, (bHasRemitter) ?
"cheque" :
"voucher",
2981 strSenderUserID.Get(), strRecipientUserID.Get());
2988 0,
"Notary::%s: Failure verifying %s: "
2989 "Bad Sender User ID (fails hash check of pubkey)"
2990 ": %s\nRecipient User ID: %s\n",
2991 __FUNCTION__, (bHasRemitter) ?
"cheque" :
"voucher",
2992 strSenderUserID.Get(), strRecipientUserID.Get());
3001 else if (!bSenderUserAlreadyLoaded &&
3004 server_->m_nymServer))) {
3006 0,
"Notary::%s: Error loading nymfile for %s signer "
3007 "during deposit, user ID: %s\n"
3008 "Recipient User ID: %s\n",
3009 __FUNCTION__, (bHasRemitter) ?
"cheque" :
"voucher",
3010 strSenderUserID.Get(), strRecipientUserID.Get());
3018 else if (bHasRemitter && !bRemitterUserAlreadyLoaded &&
3034 0,
"Notary::%s: Error loading public key for "
3036 "voucher deposit: %s\nRecipient User ID: %s\n",
3037 __FUNCTION__, strRemitterUserID.Get(),
3038 strRecipientUserID.Get());
3045 0,
"Notary::%s: Failure verifying voucher: "
3046 "Bad Remitter User ID (fails hash check of pubkey)"
3047 ": %s\nRecipient User ID: %s\n",
3048 __FUNCTION__, strRemitterUserID.Get(),
3049 strRecipientUserID.Get());
3058 else if (bHasRemitter && !bRemitterUserAlreadyLoaded &&
3061 server_->m_nymServer))) {
3063 "remitter during voucher deposit: %s\n"
3064 "Recipient User ID: %s\n",
3065 __FUNCTION__, strRemitterUserID.Get(),
3066 strRecipientUserID.Get());
3072 *(bHasRemitter ? pRemitterNym : pSenderNym),
3075 "transaction number.\n"
3076 "Recipient User ID: %s\n",
3078 (bHasRemitter) ?
"cheque" :
"voucher",
3079 strRecipientUserID.Get());
3089 0,
"Notary::%s: Failure verifying %s signature for "
3090 "sender ID: %s Recipient User ID: %s",
3091 __FUNCTION__, (bHasRemitter) ?
"cheque" :
"voucher",
3092 strSenderUserID.Get(), strRecipientUserID.Get());
3095 strRemitterUserID.Get());
3104 !(USER_ID == RECIPIENT_USER_ID)) {
3106 "depositor. Depositor User ID: %s "
3107 "Recipient User ID: %s\n",
3109 (bHasRemitter) ?
"cheque" :
"voucher",
3110 strUserID.Get(), strRecipientUserID.Get());
3116 else if (!bSourceAcctAlreadyLoaded &&
3119 SOURCE_ACCT_ID, SERVER_ID))) ||
3120 (theSourceAcctGuardian.reset(pSourceAcct),
3127 0,
"%s: %s deposit failure, "
3128 "trying to load source acct, ID: %s Recipient User "
3130 __FUNCTION__, (bHasRemitter) ?
"Cheque" :
"Voucher",
3131 strSourceAcctID.Get(), strRecipientUserID.Get());
3134 strRemitterUserID.Get());
3146 else if (!bSuccessLoadSenderInbox &&
3148 OTLog::vError(
"%s: ERROR verifying inbox ledger for source "
3150 __FUNCTION__, strSourceAcctID.Get());
3165 0,
"%s: ERROR verifying signature on source account "
3166 "while depositing %s. Acct ID: %s\n",
3167 __FUNCTION__, (bHasRemitter) ?
"cheque" :
"voucher",
3168 strAccountID.Get());
3172 else if (!pSourceAcct->
VerifyOwner(*pSenderNym)) {
3174 "ownership of source account while "
3175 "depositing %s. Source Acct ID: %s\n",
3177 (bHasRemitter) ?
"cheque" :
"voucher",
3178 strAccountID.Get());
3181 if (bSourceAcctIsRemitter) {
3182 pRemitterAcct = pSourceAcct;
3183 bRemitterAcctAlreadyLoaded =
true;
3185 pRemitterInbox = pSenderInbox;
3187 if (
nullptr != pRemitterInbox)
3191 bSuccessLoadRemitterInbox =
3202 if (bHasRemitter && !bRemitterAcctAlreadyLoaded &&
3205 REMITTER_ACCT_ID, SERVER_ID))) ||
3206 (theRemitterAcctGuardian.reset(pRemitterAcct),
3213 0,
"%s: Voucher deposit, failure "
3214 "trying to load remitter acct, ID: %s Recipient "
3215 "User ID: %s Remitter User ID: %s\n",
3216 __FUNCTION__, strRemitterAcctID.Get(),
3217 strRecipientUserID.Get(), strRemitterUserID.Get());
3225 else if (bHasRemitter &&
3227 server_->m_nymServer)) {
3229 "remitter account while depositing "
3231 "Remitter Acct ID: %s\n",
3232 __FUNCTION__, strRemitterAcctID.Get());
3236 else if (bHasRemitter &&
3239 0,
"Notary::%s: ERROR verifying remitter's "
3240 "ownership of remitter account while "
3241 "depositing voucher. Remitter Acct ID: %s\n",
3242 __FUNCTION__, strRemitterAcctID.Get());
3244 else if (bHasRemitter &&
3247 !bSourceAcctIsRemitter &&
3252 !bSuccessLoadRemitterInbox &&
3260 server_->m_nymServer)))
3264 "ledger for remitter acct ID: %s\n",
3265 __FUNCTION__, strRemitterAcctID.Get());
3280 0,
"Notary::%s: ERROR - user attempted to "
3281 "deposit cheque between accounts of different "
3282 "asset types. Source Acct: %s\nType: "
3283 "%s\nRecipient Acct: %s\nType: %s\n",
3284 __FUNCTION__, strSourceAcctID.Get(),
3285 strSourceAssetID.Get(), strAccountID.Get(),
3286 strRecipientAssetID.Get());
3292 strRemitterAcctID.Get(),
3293 strRemitterAssetID.Get());
3334 *pOutbox, theAccount, tranIn))) {
3336 "balance statement while depositing "
3337 "cheque. Acct ID:\n%s\n",
3338 __FUNCTION__, strAccountID.Get());
3358 "source account.\n",
3362 theAccount.Credit(theCheque.
GetAmount())) {
3364 "destination account.\n",
3370 "back source account.\n",
3389 *(bHasRemitter ? pRemitterNym : pSenderNym),
3394 "transaction number from sender or "
3395 "remitter, even though "
3396 "it verified just earlier...\n",
3401 "crediting-back source "
3406 theAccount.Debit(theCheque.
GetAmount()))
3408 "debiting-back destination "
3418 OTAccount* pAcctWhereReceiptGoes =
nullptr;
3419 OTLedger* pInboxWhereReceiptGoes =
nullptr;
3422 pAcctWhereReceiptGoes = pRemitterAcct;
3423 pInboxWhereReceiptGoes = pRemitterInbox;
3427 pAcctWhereReceiptGoes = pSourceAcct;
3428 pInboxWhereReceiptGoes = pSenderInbox;
3441 if (pAcctWhereReceiptGoes
3442 ->IsInternalServerAcct())
3457 if (!bHasRemitter || !bRemitterIsServer)
3459 "%s: Error: Apparently this is a "
3460 "voucher remitted directly by the "
3461 "server (such as a dividend payment) "
3462 "but one of these values is false: "
3464 "bRemitterIsServer()\n",
3466 bHasRemitter ?
"true" :
"false",
3467 bRemitterIsServer ?
"true" :
"false");
3502 if (!server_->transactor_
3508 "%s: Strange: Failed removing "
3509 "issued number from remitter (the "
3510 "server nym, in this case), "
3511 "even though the number verified "
3512 "just earlier...\n",
3524 int64_t lNewTransactionNumber = 0;
3527 server_->m_nymServer, lNewTransactionNumber,
3532 *pInboxWhereReceiptGoes,
3536 lNewTransactionNumber);
3550 if (bRemitterCancelling)
3558 server_->m_nymServer);
3565 *pInboxTransaction);
3574 server_->m_nymServer);
3578 *pInboxWhereReceiptGoes);
3599 server_->m_nymServer);
3616 *pInboxWhereReceiptGoes);
3628 theAccount.ReleaseSignatures();
3631 theAccount.SignContract(server_->m_nymServer);
3634 theAccount.SaveContract();
3637 theAccount.SaveAccount();
3663 if (bRemitterCancelling) {
3666 "crediting remitter account "
3673 "crediting account from "
3674 "cheque deposit.\n",
3740 "account ID on the transaction does not match "
3741 "'from' account ID on the deposit item.\n");
3744 std::unique_ptr<OTLedger> pInbox(
3745 theAccount.
LoadInbox(server_->m_nymServer));
3746 std::unique_ptr<OTLedger> pOutbox(
3747 theAccount.
LoadOutbox(server_->m_nymServer));
3749 if (
nullptr == pInbox) {
3750 OTLog::Error(
"Notary::NotarizeDeposit: Error loading or "
3751 "verifying inbox.\n");
3754 else if (
nullptr == pOutbox) {
3755 OTLog::Error(
"Notary::NotarizeDeposit: Error loading or "
3756 "verifying outbox.\n");
3762 Purse thePurse(SERVER_ID, ASSET_TYPE_ID);
3764 bool bLoadContractFromString =
3767 if (!bLoadContractFromString) {
3768 OTLog::vError(
"Notary::NotarizeDeposit: ERROR loading purse "
3769 "from string:\n%s\n",
3774 theAccount, tranIn))) {
3776 "balance statement while depositing cash. "
3778 strAccountID.Get());
3789 bool bSuccess =
false;
3794 std::unique_ptr<Token> pToken(
3795 thePurse.
Pop(server_->m_nymServer));
3800 pMint = server_->transactor_.
getMint(ASSET_TYPE_ID,
3801 pToken->GetSeries());
3803 if (
nullptr == pMint) {
3808 else if ((pMintCashReserveAcct =
3812 bool bToken = pToken->GetSpendableString(
3813 server_->m_nymServer, strSpendableToken);
3820 "ERROR verifying token: Failure "
3821 "retrieving token data. \n");
3824 else if (!(pToken->GetAssetID() ==
3830 "ERROR verifying token: Wrong "
3834 else if (!(pToken->GetServerID() ==
3840 "ERROR verifying token: Wrong "
3856 server_->m_nymServer, strSpendableToken,
3857 pToken->GetDenomination()))) {
3860 "ERROR verifying token: Token "
3861 "verification failed. \n");
3867 else if (pToken->IsTokenAlreadySpent(
3868 strSpendableToken)) {
3881 "ERROR verifying token: Token "
3882 "was already spent. \n");
3887 "SUCCESS verifying token... "
3900 pMintCashReserveAcct->
Debit(
3901 pToken->GetDenomination())) {
3903 "debiting the mint cash reserve "
3905 "SHOULD NEVER HAPPEN...\n");
3912 pToken->GetDenomination())) {
3914 "crediting the user's asset "
3918 pMintCashReserveAcct->
Credit(
3919 pToken->GetDenomination()))
3921 "Failure crediting-back "
3922 "mint's cash reserve account "
3923 "while depositing cash.\n");
3931 pToken->RecordTokenAsSpent(
3932 strSpendableToken)) {
3934 "Failed recording token as "
3938 pMintCashReserveAcct->
Credit(
3939 pToken->GetDenomination()))
3941 "Failure crediting-back "
3942 "mint's cash reserve account "
3943 "while depositing cash.\n");
3946 theAccount.Debit(pToken->GetDenomination()))
3948 "Failure debiting-back user's "
3949 "asset account while "
3950 "depositing cash.\n");
3958 "SUCCESS crediting account "
3959 "with cash token...\n");
3969 "cash reserve account for Mint.\n");
3978 theAccount.ReleaseSignatures();
3981 theAccount.SignContract(server_->m_nymServer);
3984 theAccount.SaveContract();
3987 theAccount.SaveAccount();
3998 pMintCashReserveAcct->
SignContract(server_->m_nymServer);
4007 "-- crediting account from cash "
4025 "OTItem::depositCheque on trans# %ld: \n\n%s\n\n",
4029 :
" (ERROR CREATING STRING FROM TRANSACTION.) ");
4041 pResponseBalanceItem->
SignContract(server_->m_nymServer);
4075 OTItem* pBalanceItem =
nullptr;
4076 OTItem* pResponseItem =
nullptr;
4077 OTItem* pResponseBalanceItem =
nullptr;
4088 DEPOSITOR_USER_ID(theNym), SERVER_USER_ID(server_->m_nymServer),
4089 DEPOSITOR_ACCT_ID(theDepositorAccount), USER_ID(theNym);
4097 tranOut.
AddItem(*pResponseItem);
4102 tranOut.
AddItem(*pResponseBalanceItem);
4105 if ((
nullptr != pItem) &&
4108 OTLog::vOutput(0,
"%s: User %s cannot do this transaction (All payment "
4109 "plans are disallowed in server.cfg)\n",
4110 __FUNCTION__, strUserID.
Get());
4115 else if ((
nullptr == pItem) || (
nullptr == pBalanceItem)) {
4116 OTLog::vError(
"%s: Error, expected OTItem::paymentPlan and "
4117 "OTItem::transactionStatement.\n",
4122 OTLog::vOutput(0,
"%s: Error: Source account ID on the transaction "
4123 "does not match sender's account ID on the "
4124 "transaction item.\n",
4131 OTLog::vOutput(0,
"%s: Failed verifying transaction statement.\n",
4174 "%s: ERROR loading payment plan from string:\n%s\n",
4175 __FUNCTION__, strPaymentPlan.
Get());
4186 "payment plan. Expected: %s\n",
4187 __FUNCTION__, strAssetID1.Get(),
4201 const bool bCancelling =
4204 const int64_t lExpectedNum =
4213 const int64_t lFoundOpeningNum =
4215 const int64_t lFoundClosingNum =
4217 if (lFoundNum != lExpectedNum) {
4219 "while %s payment plan (%ld). Expected "
4220 "based on transaction: %ld\n",
4222 bCancelling ?
"cancelling" :
"activating",
4223 lFoundNum, lExpectedNum);
4227 0,
"%s: ERROR bad transaction number while %s payment "
4228 "plan (%ld). Expected based on transaction: %ld\n",
4229 __FUNCTION__, bCancelling ?
"cancelling" :
"activating",
4232 else if (FOUND_USER_ID != DEPOSITOR_USER_ID) {
4233 const OTString strIDExpected(FOUND_USER_ID),
4234 strIDDepositor(DEPOSITOR_USER_ID);
4236 0,
"%s: ERROR wrong user ID while %s payment plan. "
4237 "Depositor: %s Found on plan: %s\n",
4238 __FUNCTION__, bCancelling ?
"cancelling" :
"activating",
4239 strIDDepositor.
Get(), strIDExpected.Get());
4241 else if (bCancelling &&
4242 (DEPOSITOR_USER_ID != theCancelerNymID)) {
4243 const OTString strIDExpected(DEPOSITOR_USER_ID),
4244 strIDDepositor(theCancelerNymID);
4246 "canceling payment plan. Depositor: %s "
4248 __FUNCTION__, strIDExpected.Get(),
4249 strIDDepositor.
Get());
4251 else if (FOUND_ACCT_ID != DEPOSITOR_ACCT_ID) {
4252 const OTString strAcctID1(FOUND_ACCT_ID),
4253 strAcctID2(DEPOSITOR_ACCT_ID);
4255 "payment plan. Expected: %s\n",
4256 __FUNCTION__, strAcctID1.Get(),
4257 bCancelling ?
"cancelling" :
"activating",
4264 else if (!bCancelling &&
4268 theNym, lFoundClosingNum)))
4275 "wasn't available for use while "
4276 "activating a payment plan.\n",
4277 __FUNCTION__, lFoundClosingNum);
4279 else if (bCancelling &&
4282 theNym, lFoundClosingNum))) {
4284 "available for use while cancelling a "
4296 bool bRecipientNymIsServerNym =
4297 ((RECIPIENT_USER_ID == SERVER_USER_ID) ?
true :
false);
4298 bool bUsersAreSameNym =
4299 ((DEPOSITOR_USER_ID == RECIPIENT_USER_ID) ?
true
4313 bool bFoundRecipientNym =
false;
4316 if (bRecipientNymIsServerNym) {
4319 pRecipientNym = &server_->m_nymServer;
4320 bFoundRecipientNym =
true;
4325 else if (bUsersAreSameNym)
4329 pRecipientNym = &theNym;
4330 bFoundRecipientNym =
true;
4357 OTString strNymID(RECIPIENT_USER_ID);
4360 __FUNCTION__, strNymID.
Get());
4361 bFoundRecipientNym =
false;
4365 server_->m_nymServer)) {
4366 OTString strNymID(RECIPIENT_USER_ID);
4368 "Recipient Nym public key: %s\n",
4369 __FUNCTION__, strNymID.
Get());
4370 bFoundRecipientNym =
false;
4373 pRecipientNym = &theRecipientNym;
4374 bFoundRecipientNym =
true;
4381 if (!bFoundRecipientNym || (
nullptr == pRecipientNym)) {
4396 else if (!bCancelling && (DEPOSITOR_ACCT_ID ==
4400 0,
"%s: Error: Source account ID matches Recipient "
4402 "on attempted Payment Plan notarization.\n",
4406 else if (bCancelling && (DEPOSITOR_ACCT_ID !=
4410 0,
"%s: Error: Source account ID doesn't match "
4411 "Recipient account ID "
4412 "on attempted Payment Plan cancellation.\n",
4415 else if (!bCancelling &&
4420 0,
"%s: ERROR verifying Sender and Recipient on "
4422 "(against merchant and customer copies.)\n",
4430 else if (bCancelling &&
4433 "signature on Payment Plan.\n");
4451 "Opening and Closing number on a "
4453 "(he should have two numbers, "
4454 "but he doesn't.)\n",
4457 else if (!bCancelling &&
4458 !server_->transactor_
4463 "opening transaction number on a "
4467 else if (!bCancelling &&
4468 !server_->transactor_
4473 "Closing transaction number on a "
4481 std::unique_ptr<OTAccount> theRecipientAcctGuardian;
4485 RECIPIENT_ACCT_ID, SERVER_ID);
4486 theRecipientAcctGuardian.reset(pRecipientAcct);
4490 pRecipientAcct = &theDepositorAccount;
4493 if (
nullptr == pRecipientAcct) {
4495 0,
"%s: ERROR loading Recipient account.\n",
4501 "ownership of the recipient "
4508 "%s: Failed: recipient account is an "
4510 "server account (currently prohibited.)\n",
4522 0,
"%s: ERROR - user attempted to %s a "
4523 "payment plan between dissimilar "
4524 "asset types:\n%s\n%s\n",
4526 bCancelling ?
"cancel" :
"activate",
4527 strSourceAssetID.Get(),
4528 strRecipAssetID.Get());
4535 server_->m_nymServer)) {
4537 "signature on the Recipient "
4551 "ID (%s) on Recipient Acct. "
4552 "Expected per Plan: %s\n",
4553 __FUNCTION__, strAssetID2.Get(),
4584 *pPlan, &theNym,
true,
4601 "payment plan to Cron "
4611 std::set<int64_t>& theIDSet =
4634 server_->transactor_
4645 std::set<int64_t>& theIDSet2 =
4663 server_->transactor_
4668 server_->transactor_
4680 int64_t lOtherNewTransNumber = 0;
4681 server_->transactor_
4683 server_->m_nymServer,
4684 lOtherNewTransNumber,
4690 server_->m_nymServer, SERVER_ID,
4691 lOtherNewTransNumber,
4694 strPaymentPlan,
nullptr,
nullptr,
4697 0,
"%s: Failed notifying parties "
4698 "while trying to activate "
4699 "payment plan: %ld.\n",
4709 0,
"%s: Canceling a payment plan "
4710 "before it was ever activated. "
4711 "(At user's request.)\n",
4716 0,
"%s: Unable to add payment plan "
4717 "to Cron. (Failed activating "
4729 int64_t lOtherNewTransNumber = 0;
4730 server_->transactor_
4732 server_->m_nymServer,
4733 lOtherNewTransNumber,
4738 false, server_->m_nymServer,
4739 SERVER_ID, lOtherNewTransNumber,
4742 strPaymentPlan,
nullptr,
nullptr,
4784 if ((
nullptr != pPlan) &&
4801 pResponseBalanceItem->
SignContract(server_->m_nymServer);
4815 OTItem* pBalanceItem =
nullptr;
4816 OTItem* pResponseItem =
nullptr;
4817 OTItem* pResponseBalanceItem =
nullptr;
4828 ACTIVATOR_USER_ID(theNym), SERVER_USER_ID(server_->m_nymServer),
4829 ACTIVATOR_ACCT_ID(theActivatingAccount), USER_ID(theNym);
4836 tranOut.
AddItem(*pResponseItem);
4841 tranOut.
AddItem(*pResponseBalanceItem);
4844 if ((
nullptr != pItem) &&
4847 OTLog::vOutput(0,
"%s: User %s cannot do this transaction (All smart "
4848 "contracts are disallowed in server.cfg)\n",
4849 __FUNCTION__, strUserID.
Get());
4854 else if ((
nullptr == pItem) || (
nullptr == pBalanceItem)) {
4855 OTLog::vError(
"%s: Error, expected OTItem::smartContract and "
4856 "OTItem::transactionStatement.\n",
4861 OTLog::vOutput(0,
"%s: Error: Source account ID on the transaction "
4862 "does not match activator's account ID on the "
4863 "transaction item.\n",
4868 OTLog::vOutput(0,
"%s: Failed verifying transaction statement.\n",
4911 "%s: ERROR loading smart contract from string:\n\n%s\n\n",
4912 __FUNCTION__, strContract.
Get());
4917 "contract. Expected %s\n",
4918 __FUNCTION__, strWrongID.Get(),
4919 server_->m_strServerID.
Get());
4925 const bool bCancelling =
4930 int64_t lFoundOpeningNum = 0;
4931 int64_t lFoundClosingNum = 0;
4939 0,
"Attempting to activate smart contract...\n");
4950 "Attempting to cancel smart contract...\n");
4959 if (lFoundOpeningNum > 0) FOUND_USER_ID = theCancelerNymID;
4960 if (lFoundClosingNum > 0) FOUND_ACCT_ID = ACTIVATOR_ACCT_ID;
4963 if (lFoundNum != lExpectedNum) {
4965 0,
"%s: ERROR bad main opening transaction number on "
4966 "smart contract. Found: %ld Expected: %ld\n"
4967 "FYI, pItem->GetTransactionNum() is %ld.\n",
4968 __FUNCTION__, lFoundNum, lExpectedNum,
4971 else if (lFoundOpeningNum != lExpectedNum) {
4973 0,
"%s: ERROR bad opening transaction number on smart "
4974 "contract. Found: %ld Expected: %ld\n",
4975 __FUNCTION__, lFoundOpeningNum, lExpectedNum);
4977 else if (FOUND_USER_ID != ACTIVATOR_USER_ID) {
4978 const OTString strWrongID(ACTIVATOR_USER_ID);
4979 const OTString strRightID(FOUND_USER_ID);
4981 "%s smart contract. Expected from "
4983 __FUNCTION__, strWrongID.
Get(),
4984 bCancelling ?
"canceling" :
"activating",
4987 else if (FOUND_ACCT_ID != ACTIVATOR_ACCT_ID) {
4988 const OTString strSenderAcctID(FOUND_ACCT_ID),
4989 strActivatorAcctID(ACTIVATOR_ACCT_ID);
4991 "to %s smart contract. Expected from "
4993 __FUNCTION__, strActivatorAcctID.
Get(),
4994 bCancelling ?
"cancel" :
"activate",
4995 strSenderAcctID.Get());
5004 theNym, lFoundClosingNum))
5010 "wasn't available for use while %s a "
5011 "smart contract.\n",
5012 __FUNCTION__, lFoundClosingNum,
5013 bCancelling ?
"canceling" :
"activating");
5027 server_->m_nymServer))) {
5030 "%s: ** SORRY ** but the server itself is NOT ALLOWED "
5032 "to any smart contracts. (Pending security review.)\n",
5093 "while canceling smart contract.\n",
5105 theNym, theActivatingAccount, server_->m_nymServer,
5113 "before it was ever even activated "
5114 "(at user's request.)\n",
5120 "%s: This smart contract has FAILED to verify.\n",
5399 int64_t lNewTransactionNumber = 0;
5401 server_->m_nymServer, lNewTransactionNumber,
false);
5405 false, server_->m_nymServer, SERVER_ID,
5406 lNewTransactionNumber,
5409 strContract,
nullptr,
nullptr, &theNym)) {
5439 int64_t lNewTransactionNumber = 0;
5441 server_->m_nymServer, lNewTransactionNumber,
false);
5445 true, server_->m_nymServer, SERVER_ID,
5446 lNewTransactionNumber,
5449 strContract,
nullptr,
nullptr, &theNym)) {
5451 0,
"%s: Failed notifying parties while trying to "
5452 "activate smart contract: %ld.\n",
5457 *pContract, &theNym,
true,
5481 "contract to Cron object.\n",
5495 if ((
nullptr != pContract) &&
5498 pContract =
nullptr;
5512 pResponseBalanceItem->
SignContract(server_->m_nymServer);
5546 OTItem* pBalanceItem =
nullptr;
5547 OTItem* pResponseItem =
nullptr;
5548 OTItem* pResponseBalanceItem =
nullptr;
5558 const OTIdentifier SERVER_ID(server_->m_strServerID), USER_ID(theNym);
5566 tranOut.
AddItem(*pResponseItem);
5572 tranOut.
AddItem(*pResponseBalanceItem);
5578 0,
"%s: User %s cannot do this transaction "
5579 "(CancelCronItem messages are disallowed in server.cfg)\n",
5580 __FUNCTION__, strUserID.
Get());
5582 else if (
nullptr == pBalanceItem) {
5585 0,
"%s: Expected transaction statement in trans# %ld: \n\n%s\n\n",
5588 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
5628 "NotarizeCancelCronItem.\n");
5642 OTLog::Output(0,
"Error: Asset account ID on the transaction "
5643 "does not match asset account "
5644 "ID on the transaction item.\n");
5654 bool bSuccess =
false;
5656 if ((
nullptr != pCronItem) &&
5684 "Cron object, based on ID: %ld\n",
5685 (
nullptr != pCronItem)
5695 "Notary::NotarizeCancelCronItem\n");
5703 0,
"Error, expected OTItem::cancelCronItem "
5704 "in Notary::NotarizeCancelCronItem for trans# %ld:\n\n%s\n\n",
5707 :
" (ERROR LOADING TRANSACTION FROM STRING) ");
5718 pResponseBalanceItem->
SignContract(server_->m_nymServer);
5734 OTItem* pResponseItem =
nullptr;
5735 OTItem* pResponseBalanceItem =
nullptr;
5743 const OTIdentifier USER_ID(theNym), SERVER_ID(server_->m_strServerID),
5744 BASKET_CONTRACT_ID(theAccount.
GetAssetTypeID()), ACCOUNT_ID(theAccount);
5748 std::unique_ptr<OTLedger> pInbox(
5749 theAccount.
LoadInbox(server_->m_nymServer));
5750 std::unique_ptr<OTLedger> pOutbox(
5751 theAccount.
LoadOutbox(server_->m_nymServer));
5756 tranOut.
AddItem(*pResponseItem);
5759 pResponseBalanceItem =
5762 tranOut.
AddItem(*pResponseBalanceItem);
5765 bool bSuccess =
false;
5769 OTLog::vOutput(0,
"Notary::NotarizeExchangeBasket: User %s cannot do "
5770 "this transaction (All basket exchanges are "
5771 "disallowed in server.cfg)\n",
5774 else if (
nullptr == pItem) {
5775 OTLog::Output(0,
"Notary::NotarizeExchangeBasket: No exchangeBasket "
5776 "item found on this transaction.\n");
5778 else if (
nullptr == pBalanceItem) {
5779 OTLog::Output(0,
"Notary::NotarizeExchangeBasket: No Balance "
5780 "Agreement item found on this transaction.\n");
5782 else if ((
nullptr == pInbox)) {
5785 else if ((
nullptr == pOutbox)) {
5792 pResponseItem->SetReferenceString(strInReferenceTo);
5797 pResponseItem->SetReferenceToNum(
5815 *pOutbox, theAccount, tranIn)) {
5817 "verifying balance statement.\n");
5828 std::list<OTLedger*> listInboxes;
5832 Basket theBasket, theRequestBasket;
5836 int64_t lTransferAmount = 0;
5844 std::unique_ptr<OTAccount> theBasketAcctGuardian;
5848 BASKET_CONTRACT_ID, BASKET_ACCOUNT_ID);
5850 OTLog::Error(
"Notary::NotarizeExchangeBasket: Asset type is "
5851 "not a basket currency.\n");
5853 else if (!strBasket.
Exists() ||
5856 OTLog::Error(
"Notary::NotarizeExchangeBasket: Expected "
5857 "verifiable basket object to be attached to "
5858 "exchangeBasket item.\n");
5862 OTLog::Error(
"Notary::NotarizeExchangeBasket: User's main "
5863 "account ID according to request basket doesn't "
5864 "match theAccount.\n");
5869 OTLog::Error(
"Notary::NotarizeExchangeBasket: Closing number "
5870 "used for User's main account receipt was not "
5871 "available for use...\n");
5880 theBasketAcctGuardian.reset(pBasketAcct);
5882 if (
nullptr == pBasketAcct) {
5884 "Notary::NotarizeExchangeBasket\n");
5890 OTLog::Error(
"ERROR verifying signature on the basket "
5892 "Notary::NotarizeExchangeBasket\n");
5898 BASKET_CONTRACT_ID);
5906 theBasket.
Count() == theRequestBasket.
Count() &&
5912 std::set<OTIdentifier> setOfAccounts;
5913 setOfAccounts.insert(
5916 bool bFoundSameAcctTwice =
false;
5918 for (int32_t i = 0; i < theRequestBasket.
Count(); i++) {
5921 std::set<OTIdentifier>::iterator it_account =
5924 if (setOfAccounts.end() !=
5929 "found TWICE on same basket "
5930 "exchange request: %s\n",
5931 __FUNCTION__, strSubID.
Get());
5932 bFoundSameAcctTwice =
true;
5937 if (!bFoundSameAcctTwice)
5941 for (int32_t i = 0; i < theBasket.
Count(); i++) {
5944 theRequestBasket.
At(i);
5954 "NotarizeExchangeBasket\n");
5968 "these account ID's match. "
5970 "NotarizeExchangeBasket.\n");
5975 server_->transactor_
5981 "Error: Basket sub-currency closing "
5982 "number didn't verify . "
5983 "Notary::NotarizeExchangeBasket.\n");
5998 if (
nullptr == pUserAcct) {
6002 "NotarizeExchangeBasket"
6012 if (
nullptr == pServerAcct) {
6016 "NotarizeExchangeBasket"
6025 server_->m_nymServer);
6027 if (
nullptr == pSubInbox) {
6029 "verifying sub-inbox in "
6031 "NotarizeExchangeBasket."
6044 listUserAccounts.push_back(pUserAcct);
6045 listServerAccounts.push_back(pServerAcct);
6046 listInboxes.push_back(pSubInbox);
6055 "ERROR verifying asset type on a "
6056 "user's account in "
6058 "NotarizeExchangeBasket\n");
6063 server_->m_nymServer)) {
6065 "ERROR verifying signature on a "
6066 "user's asset account in "
6068 "NotarizeExchangeBasket\n");
6073 server_->m_nymServer)) {
6075 "ERROR verifying signature on a "
6076 "basket sub-account in "
6078 "NotarizeExchangeBasket\n");
6095 if (theRequestBasket
6096 .GetExchangingIn()) {
6097 if (pUserAcct->
Debit(
6106 "NotarizeExchangeBasket"
6107 ": Failure crediting "
6118 "NotarizeExchangeBa"
6130 "NotarizeExchangeBasket:"
6131 " Unable to Debit user "
6139 if (pServerAcct->
Debit(
6148 "NotarizeExchangeBasket"
6149 ": Failure crediting "
6160 "NotarizeExchangeBa"
6172 "NotarizeExchangeBasket:"
6174 "server account.\n");
6197 int64_t lNewTransactionNumber = 0;
6199 server_->transactor_
6201 server_->m_nymServer,
6202 lNewTransactionNumber,
6211 lNewTransactionNumber);
6229 ? lTransferAmount * (-1)
6233 server_->m_nymServer);
6267 ->lClosingTransactionNo);
6275 server_->m_nymServer);
6282 *pInboxTransaction);
6301 if ((
true == bSuccess) &&
6302 (
nullptr != pBasketAcct)) {
6311 if (pBasketAcct->
Debit(lTransferAmount)) {
6312 if (theAccount.
Credit(lTransferAmount))
6316 "NotarizeExchangeBaske"
6317 "t: Failed crediting "
6326 "NotarizeExchangeBasket: "
6327 "Failed crediting back "
6328 "basket issuer account.\n");
6336 0,
"Unable to Debit basket issuer "
6339 "NotarizeExchangeBasket\n");
6344 if (theAccount.
Debit(lTransferAmount)) {
6350 "NotarizeExchangeBaske"
6351 "t: Failed crediting "
6360 "NotarizeExchangeBasket: "
6361 "Failed crediting back "
6362 "user basket account.\n");
6370 "basket account in "
6372 "NotarizeExchangeBaske"
6394 int64_t lNewTransactionNumber = 0;
6396 server_->transactor_
6398 server_->m_nymServer,
6399 lNewTransactionNumber,
6406 lNewTransactionNumber);
6424 : lTransferAmount * (-1));
6427 server_->m_nymServer);
6464 server_->m_nymServer);
6470 pInbox->AddTransaction(*pInboxTransaction);
6476 "user's main basket account in "
6478 "NotarizeExchangeBasket\n");
6490 while (!listUserAccounts.empty()) {
6491 pAccount = listUserAccounts.front();
6492 if (
nullptr == pAccount)
OT_FAIL;
6493 listUserAccounts.pop_front();
6495 if (
true == bSuccess) {
6498 server_->m_nymServer);
6508 while (!listServerAccounts.empty()) {
6509 pAccount = listServerAccounts.front();
6510 if (
nullptr == pAccount)
OT_FAIL;
6512 listServerAccounts.pop_front();
6514 if (
true == bSuccess) {
6517 server_->m_nymServer);
6527 while (!listInboxes.empty()) {
6528 OTLedger* pTempInbox = listInboxes.front();
6529 if (
nullptr == pTempInbox)
OT_FAIL;
6530 listInboxes.pop_front();
6532 if (
true == bSuccess) {
6535 server_->m_nymServer);
6541 pTempInbox =
nullptr;
6543 if (
true == bSuccess) {
6545 pInbox->SignContract(server_->m_nymServer);
6546 pInbox->SaveContract();
6564 i < theRequestBasket.
Count(); i++) {
6566 theRequestBasket.
At(i);
6575 server_->transactor_
6584 pResponseItem->SetStatus(
6596 "Error finding asset contract for basket, or "
6597 "loading the basket from it, or verifying\n"
6598 "the signature on that basket, or the request "
6599 "basket didn't match actual basket.\n");
6608 pResponseItem->SignContract(server_->m_nymServer);
6609 pResponseItem->SaveContract();
6611 pResponseBalanceItem->
SignContract(server_->m_nymServer);
6628 OTItem* pBalanceItem =
nullptr;
6629 OTItem* pResponseItem =
nullptr;
6630 OTItem* pResponseBalanceItem =
nullptr;
6640 const OTIdentifier SERVER_ID(server_->m_strServerID), USER_ID(theNym);
6648 tranOut.
AddItem(*pResponseItem);
6654 tranOut.
AddItem(*pResponseBalanceItem);
6661 "Notary::NotarizeMarketOffer: User %s cannot do this transaction "
6662 "(All market offers are disallowed in server.cfg)\n",
6665 else if (
nullptr == pBalanceItem) {
6667 OTLog::vOutput(0,
"Notary::NotarizeMarketOffer: Expected transaction "
6668 "statement in trans # %ld: \n\n%s\n\n",
6672 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
6674 else if (
nullptr == pItem) {
6677 "OTItem::marketOffer in trans# %ld:\n\n%s\n\n",
6681 :
" (ERROR LOADING TRANSACTION INTO STRING) ");
6723 "NotarizeMarketOffer.\n");
6731 std::unique_ptr<OTAccount> pCurrencyAcct(
6747 bool bLoadContractFromString =
6751 if (!bLoadContractFromString) {
6753 "Notary::NotarizeMarketOffer:\n%s\n",
6761 OTLog::Output(0,
"Error: Asset account ID on the transaction "
6762 "does not match asset account ID on the "
6763 "transaction item.\n");
6766 else if (
nullptr == pCurrencyAcct) {
6767 OTLog::Output(0,
"ERROR verifying existence of the currency "
6768 "account in Notary::NotarizeMarketOffer\n");
6770 else if (!pCurrencyAcct->VerifyContractID()) {
6771 OTLog::Output(0,
"ERROR verifying Contract ID on the currency "
6772 "account in Notary::NotarizeMarketOffer\n");
6774 else if (!pCurrencyAcct->VerifyOwner(theNym)) {
6775 OTLog::Output(0,
"ERROR verifying ownership of the currency "
6776 "account in Notary::NotarizeMarketOffer\n");
6780 pCurrencyAcct->GetAssetTypeID()) {
6782 strCurrencyTypeID(pCurrencyAcct->GetAssetTypeID());
6784 0,
"ERROR - user attempted to trade between identical "
6785 "asset types in Notary::NotarizeMarketOffer:\n%s\n%s\n",
6786 strAssetTypeID.Get(), strCurrencyTypeID.Get());
6791 else if (!pCurrencyAcct->VerifySignature(server_->m_nymServer)) {
6792 OTLog::Output(0,
"ERROR verifying signature on the Currency "
6793 "account in Notary::NotarizeMarketOffer\n");
6796 OTLog::Output(0,
"ERROR verifying signature on the Trade in "
6797 "Notary::NotarizeMarketOffer\n");
6801 OTLog::Output(0,
"ERROR bad transaction number on trade in "
6802 "Notary::NotarizeMarketOffer\n");
6814 OTLog::Output(0,
"ERROR needed 2 valid closing transaction "
6815 "numbers in Notary::NotarizeMarketOffer\n");
6820 "Server ID (%s) on trade. Expected: %s\n",
6821 strID1.
Get(), strID2.Get());
6827 "Nym ID (%s) on trade. Expected: %s\n",
6828 strID1.
Get(), strID2.Get());
6835 "Asset Type ID (%s) on trade. Expected: %s\n",
6836 strAssetID1.Get(), strAssetID2.Get());
6840 strAcctID2(ASSET_ACCT_ID);
6842 "asset Acct ID (%s) on trade. Expected: %s\n",
6843 strAcctID1.
Get(), strAcctID2.Get());
6846 pCurrencyAcct->GetAssetTypeID()) {
6848 strID2(pCurrencyAcct->GetAssetTypeID());
6850 "Currency Type ID (%s) on trade. Expected: "
6852 strID1.Get(), strID2.Get());
6856 strID2(CURRENCY_ACCT_ID);
6858 "Currency Acct ID (%s) on trade. Expected: "
6860 strID1.
Get(), strID2.Get());
6867 "Notary::NotarizeMarketOffer:\n%s\n",
6872 "Notary::NotarizeMarketOffer:\n%s\n",
6879 "Notary::NotarizeMarketOffer.\n");
6883 "Notary::NotarizeMarketOffer\n");
6888 "verifying Offer, SCALE: %ld. (Minimum is "
6893 else if (static_cast<int64_t>(
6904 OTLog::Output(0,
"Notary::NotarizeMarketOffer: FAILED adding "
6906 "NYM HAS TOO MANY ACTIVE OFFERS ALREADY. See "
6907 "'max_items_per_nym' setting in the config "
6936 *pTrade, &theNym,
true,
6950 "Successfully added Trade to Cron object.\n");
6983 server_->m_nymServer);
6987 "Notary::NotarizeMarketOffer\n");
6996 if ((
nullptr != pTrade) &&
7013 pResponseBalanceItem->
SignContract(server_->m_nymServer);
7036 if (!theFromAccount.LoadContract()) {
7038 OTLog::vOutput(0,
"%s: Error loading asset account: %s\n", __FUNCTION__,
7042 else if (theFromAccount.IsMarkedForDeletion()) {
7044 OTLog::vOutput(0,
"%s: Failed attempt to use an Asset account that was "
7045 "marked for deletion: %s\n",
7046 __FUNCTION__, strIDAcct.Get());
7050 else if (!theFromAccount.VerifyContractID()) {
7055 OTLog::vError(
"%s: Error verifying account ID: %s\n", __FUNCTION__,
7063 else if (!theFromAccount.VerifyOwner(theNym)) {
7067 0,
"%s: Error verifying account ownership... Nym: %s Acct: %s\n",
7068 __FUNCTION__, strIDNym.
Get(), strIDAcct.
Get());
7071 else if (!theFromAccount.VerifySignature(server_->m_nymServer)) {
7075 "%s: Error verifying server signature on account: %s for Nym: %s\n",
7076 __FUNCTION__, strIDAcct.
Get(), strIDNym.
Get());
7081 theNym, lTransactionNumber)) {
7086 OTLog::vOutput(0,
"%s: Error verifying transaction number %ld on user "
7087 "Nym: %s Account: %s\n",
7088 __FUNCTION__, lTransactionNumber, strIDNym.
Get(),
7103 OTLog::vOutput(0,
"%s: Error verifying transaction items. Trans: %ld "
7104 "Nym: %s Account: %s\n",
7105 __FUNCTION__, lTransactionNumber, strIDNym.
Get(),
7122 theNym, lTransactionNumber,
true))
7124 OTLog::Error(
"Error removing transaction number (as available) "
7125 "from user nym in Notary::NotarizeTransaction\n");
7147 OTLog::Output(0,
"NotarizeTransaction type: Process Inbox\n");
7167 if (
nullptr != pItemCash) {
7170 0,
"NotarizeTransaction type: Withdrawal (cash)\n");
7172 else if (
nullptr != pItemVoucher) {
7175 0,
"NotarizeTransaction type: Withdrawal (voucher)\n");
7201 OTLog::Output(0,
"NotarizeTransaction type: Pay Dividend\n");
7214 OTLog::Output(0,
"NotarizeTransaction type: Market Offer\n");
7226 OTLog::Output(0,
"NotarizeTransaction type: Payment Plan\n");
7239 OTLog::Output(0,
"NotarizeTransaction type: Smart Contract\n");
7247 theIDSet.insert(lTransactionNumber);
7258 OTLog::Output(0,
"NotarizeTransaction type: cancelCronItem\n");
7271 OTLog::Output(0,
"NotarizeTransaction type: Exchange Basket\n");
7278 OTLog::vError(
"%s: Error, unexpected type: %s\n", __FUNCTION__,
7286 bool bIsCronItem =
false;
7312 if ((
nullptr != pItem)) {
7318 std::set<int64_t>& theIDSet =
7320 std::set<int64_t>::iterator theSetIT =
7321 theIDSet.find(lTransactionNumber);
7322 if (theSetIT != theIDSet.end())
7323 theIDSet.erase(lTransactionNumber);
7326 theNym, lTransactionNumber,
7331 "number %ld from user nym: %s\n",
7332 __FUNCTION__, lTransactionNumber,
7350 theNym, lTransactionNumber,
true))
7355 __FUNCTION__, lTransactionNumber,
7360 OTLog::vError(
"%s: Error, unexpected type: %s\n", __FUNCTION__,
7410 OTItem* pResponseItem =
nullptr;
7411 OTItem* pResponseBalanceItem =
nullptr;
7415 const OTIdentifier SERVER_ID(server_->m_strServerID), USER_ID(theNym);
7418 OTLedger theNymbox(USER_ID, USER_ID, SERVER_ID);
7421 bool bSuccessLoadingNymbox = theNymbox.
LoadNymbox();
7423 if (
true == bSuccessLoadingNymbox)
7425 server_->m_nymServer);
7429 tranOut.
AddItem(*pResponseBalanceItem);
7432 bool bNymboxHashRegenerated =
false;
7435 if (!bSuccessLoadingNymbox) {
7437 0,
"Notary::%s: Failed loading or verifying Nymbox for user:\n%s\n",
7438 __FUNCTION__, strNymID.
Get());
7440 else if (
nullptr == pBalanceItem) {
7441 const OTString strTransaction(tranIn);
7442 OTLog::vOutput(0,
"Notary::%s: No Transaction Agreement item found "
7443 "on this transaction %ld (required):\n\n%s\n\n",
7445 strTransaction.
Get());
7483 bool bSuccessFindingAllTransactions =
true;
7488 "Pointer should not have been nullptr.");
7494 if ((
nullptr != pTransaction) &&
7500 bSuccessFindingAllTransactions =
true;
7502 OTNumList listNumbersNymbox, listNumbersUserItem;
7511 if (!listNumbersNymbox.
Verify(listNumbersUserItem))
7513 "Notary::NotarizeProcessNymbox: Failed "
7514 "verifying: The numbers on the actual blank "
7515 "transaction in the nymbox do not match the list "
7516 "of numbers sent over by the user.\n");
7522 std::set<int64_t> theNumbers;
7523 listNumbersNymbox.
Output(theNumbers);
7529 for (
auto& it : theNumbers) {
7530 const int64_t lTransactionNumber = it;
7535 lTransactionNumber)) {
7537 lTransactionNumber);
7539 server_->m_strServerID,
7540 lTransactionNumber);
7547 " tried to add an issued trans# "
7548 "(%ld) to a nym who "
7549 "ALREADY had that number...\n",
7550 lTransactionNumber);
7555 bSuccessFindingAllTransactions =
false;
7577 if (!bSuccessFindingAllTransactions) {
7578 OTLog::vOutput(0,
"%s: transactions in processNymbox message do "
7579 "not match actual nymbox.\n",
7596 theNym, tranIn,
false))
7599 OTLog::vOutput(0,
"%s: ERROR verifying transaction statement.\n",
7638 "Pointer should not have been nullptr.");
7694 tranOut, theReplyItemType);
7710 tranOut.
AddItem(*pResponseItem);
7721 pServerTransaction->
GetType()) ||
7726 pServerTransaction->
GetType()) ||
7730 pServerTransaction->
GetType()) ||
7733 pServerTransaction->
GetType()) ||
7741 pServerTransaction->
GetType()) ||
7746 pServerTransaction->
GetType()) ||
7750 pServerTransaction->
GetType())
7784 pServerTransaction->
GetType())) {
7809 pServerTransaction->
GetType()) ||
7811 pServerTransaction->
GetType()) ||
7813 pServerTransaction->
GetType()) ||
7815 pServerTransaction->
GetType()))) {
7851 pServerTransaction->
GetType())) {
7858 int64_t lSuccessNoticeTransNum = 0;
7859 bool bGotNextTransNum =
7861 server_->m_nymServer,
7862 lSuccessNoticeTransNum,
7865 if (!bGotNextTransNum) {
7866 lSuccessNoticeTransNum = 0;
7869 "Notary::NotarizeProcessNymbox "
7870 "for OTTransaction::blank (for "
7871 "the successNotice)\n");
7879 lSuccessNoticeTransNum);
7893 ->GetTransactionNum());
7921 server_->m_nymServer);
7952 bNymboxHashRegenerated =
true;
7970 pServerTransaction->
GetType())) {
7987 bNymboxHashRegenerated =
true;
7997 "transaction that client is trying to "
8012 const int32_t nStatus = pItem->
GetStatus();
8018 "Notary::NotarizeProcessNymbox\n",
8019 strItemType.
Get(), nStatus);
8026 pResponseBalanceItem->
SignContract(server_->m_nymServer);
8032 if (bNymboxHashRegenerated) {
8035 server_->m_nymServer);
8057 if ((
nullptr != pResponseBalanceItem) &&
8069 strPath.
Format((
char*)
"%s.success", strNymID.
Get());
8072 strPath.
Format((
char*)
"%s.fail", strNymID.
Get());
8098 OTItem* pResponseItem =
nullptr;
8099 OTItem* pResponseBalanceItem =
nullptr;
8110 ACCOUNT_ID(theAccount), USER_ID(theNym);
8115 std::unique_ptr<OTLedger> pInbox(
8116 theAccount.
LoadInbox(server_->m_nymServer));
8117 std::unique_ptr<OTLedger> pOutbox(
8118 theAccount.
LoadOutbox(server_->m_nymServer));
8120 pResponseBalanceItem =
8123 tranOut.
AddItem(*pResponseBalanceItem);
8129 0,
"%s: User %s cannot do this transaction (All \"process inbox\" "
8130 "transactions are disallowed in server.cfg)\n",
8131 __FUNCTION__, strUserID.
Get());
8133 else if (
nullptr == pBalanceItem) {
8135 0,
"%s: No Balance Agreement item found on this transaction.\n",
8138 else if (
nullptr == pInbox) {
8139 OTLog::vError(
"%s: Error loading or verifying inbox.\n", __FUNCTION__);
8141 else if (
nullptr == pOutbox) {
8142 OTLog::vError(
"%s: Error loading or verifying outbox.\n", __FUNCTION__);
8147 pResponseBalanceItem->SetReferenceString(
8150 pResponseBalanceItem->SetReferenceToNum(
8154 pResponseBalanceItem->SetNumberOfOrigin(*pBalanceItem);
8177 std::list<int64_t> theListOfInboxReceiptsBeingRemoved;
8183 bool bSuccessFindingAllTransactions =
true;
8184 int64_t lTotalBeingAccepted = 0;
8189 "Pointer should not have been nullptr.");
8194 pServerTransaction =
nullptr;
8203 pServerTransaction =
8214 pServerTransaction =
8221 int32_t nItemType = pItem->
GetType();
8223 pServerTransaction =
nullptr;
8224 bSuccessFindingAllTransactions =
false;
8226 OTLog::vError(
"%s: Wrong item type: %s (%d).\n", __FUNCTION__,
8227 strItemType.
Exists() ? strItemType.
Get() :
"",
8232 if (
nullptr == pServerTransaction) {
8233 const OTString strAccountID(ACCOUNT_ID);
8234 OTLog::vError(
"%s: Unable to find or process inbox transaction "
8235 "being accepted by user: %s for account: %s\n",
8236 __FUNCTION__, strUserID.
Get(),
8237 strAccountID.
Get());
8238 bSuccessFindingAllTransactions =
false;
8244 "%s: Receipt amounts don't match: %ld and %ld. Nym: %s\n",
8247 bSuccessFindingAllTransactions =
false;
8256 bSuccessFindingAllTransactions =
true;
8259 bSuccessFindingAllTransactions =
true;
8297 std::set<int64_t> setOfRefNumbers;
8305 OTItem* pItemPointer = it;
8307 "Pointer should not have been nullptr.");
8312 if ((
nullptr != pTransPointer) &&
8315 setOfRefNumbers.insert(
8320 if (pInbox->GetTransactionCountInRefTo(
8322 static_cast<int32_t>(setOfRefNumbers.size())) {
8324 0,
"%s: User tried to close a finalReceipt, "
8325 "without also closing all related receipts. "
8326 "(Those that share the IN REF TO number.)\n",
8328 bSuccessFindingAllTransactions =
false;
8341 std::set<int64_t>::iterator theSetIT =
8349 if (theIDSet.end() != theSetIT)
8351 server_->m_strServerID,
8361 1,
"%s: expected to find "
8362 "pServerTransaction->GetClosingNum() (%ld) on "
8364 "list of open cron items. (Maybe he didn't see "
8365 "the notice in his Nymbox yet.)\n",
8382 server_->m_strServerID,
8385 bSuccessFindingAllTransactions =
false;
8388 "'remove' an issued "
8389 "number (%ld) that already wasn't on Nym's "
8390 "issued list. (So what is this in the inbox, "
8402 bSuccessFindingAllTransactions =
true;
8405 bSuccessFindingAllTransactions =
true;
8425 std::unique_ptr<OTItem> pOriginalItem(
8427 strOriginalItem, SERVER_ID,
8430 if (
nullptr != pOriginalItem) {
8458 pOriginalItem->GetType())
8468 pOriginalItem->GetAttachment(strCheque);
8477 __FUNCTION__, strCheque.
Get());
8478 bSuccessFindingAllTransactions =
false;
8491 server_->m_strServerID,
8494 server_->m_strServerID,
8497 bSuccessFindingAllTransactions =
false;
8500 "%s: cheque receipt, trying to "
8501 "'remove' an issued "
8502 "number (%ld) that already wasn't on "
8503 "Nym's issued list. (So what is this "
8515 pOriginalItem->GetType())
8526 server_->m_strServerID,
8527 pOriginalItem->GetNumberOfOrigin()))
8529 server_->m_strServerID,
8530 pOriginalItem->GetNumberOfOrigin());
8532 bSuccessFindingAllTransactions =
false;
8535 "%s: transfer receipt, trying to 'remove' "
8537 "number (%ld) that already wasn't on Nym's "
8538 "issued list. (So what is this in the "
8542 pOriginalItem->GetReferenceToNum());
8547 pOriginalItem->GetTypeString(strOriginalItemType);
8549 "while accepting item receipt:\n%s\n",
8551 strOriginalItemType.
Get());
8552 bSuccessFindingAllTransactions =
false;
8557 "string while accepting item "
8559 __FUNCTION__, strOriginalItem.
Get());
8560 bSuccessFindingAllTransactions =
false;
8567 "Notary::NotarizeProcessInbox. (2nd notice.)\n");
8568 bSuccessFindingAllTransactions =
false;
8580 if (bSuccessFindingAllTransactions) {
8591 theListOfInboxReceiptsBeingRemoved.push_back(
8599 if (!bSuccessFindingAllTransactions) {
8600 OTLog::vOutput(0,
"%s: transactions in processInbox message do not "
8601 "match actual inbox.\n",
8608 while (!theListOfInboxReceiptsBeingRemoved.empty()) {
8609 int64_t lTemp = theListOfInboxReceiptsBeingRemoved.front();
8610 theListOfInboxReceiptsBeingRemoved.pop_front();
8618 pInbox->RemoveTransaction(lTemp))
8620 "%s: Failed removing receipt from Inbox copy: %ld \n"
8621 "Meaning the client probably has an old copy of his "
8623 "We don't even see the receipt that he still thinks he "
8625 __FUNCTION__, lTemp);
8643 const bool bVerifiedBalanceStatement =
8645 lTotalBeingAccepted,
8646 theNym, *pInbox, *pOutbox, theAccount, tranIn);
8659 if (!bVerifiedBalanceStatement) {
8661 "verifying balance statement for transaction "
8667 pResponseBalanceItem->SetStatus(
8678 for (
auto& it_bigloop_two : tranIn.
GetItemList()) {
8679 pItem = it_bigloop_two;
8681 "Pointer should not have been nullptr.");
8763 tranOut, theReplyItemType);
8774 tranOut.
AddItem(*pResponseItem);
8788 OTLedger theInbox(USER_ID, ACCOUNT_ID, SERVER_ID);
8794 "Error loading inbox during processInbox\n");
8798 server_->m_nymServer)) {
8800 "Error verifying inbox during processInbox\n");
8824 pServerTransaction->
GetType()) ||
8826 pServerTransaction->
GetType()))) {
8864 pServerTransaction->
GetType()))) {
8902 pServerTransaction->
GetType()))) {
8961 pServerTransaction->
GetType()) ||
8964 pServerTransaction->
GetType()) ||
8967 pServerTransaction->
GetType())
8996 std::unique_ptr<OTItem> pOriginalItem(
8998 strOriginalItem, SERVER_ID,
9001 if (
nullptr != pOriginalItem) {
9063 pServerTransaction->
GetType()) &&
9065 pOriginalItem->GetType())) ||
9067 pServerTransaction->
GetType()) ||
9069 pServerTransaction->
GetType())) &&
9071 pOriginalItem->GetType())))) {
9088 ->GetTransactionNum());
9095 server_->m_nymServer);
9120 pServerTransaction->
GetType()) &&
9122 pOriginalItem->GetType())) {
9128 pOriginalItem->GetPurportedAccountID());
9130 pOriginalItem->GetDestinationAcctID());
9138 if (!(ACCOUNT_ID == IDToAccount)) {
9140 "Error: Destination account ID on "
9141 "the transaction does not match "
9142 "account ID of client transaction "
9159 bool bSuccessLoadingInbox =
9161 bool bSuccessLoadingOutbox =
9162 theFromOutbox.LoadOutbox();
9169 if (
true == bSuccessLoadingInbox)
9170 bSuccessLoadingInbox =
9172 server_->m_nymServer);
9177 "NotarizeProcessInbox.\n");
9182 if (
true == bSuccessLoadingOutbox)
9183 bSuccessLoadingOutbox =
9184 theFromOutbox.VerifyAccount(
9185 server_->m_nymServer);
9192 "NotarizeProcessInbox.\n");
9193 if (!bSuccessLoadingInbox ||
9194 false == bSuccessLoadingOutbox) {
9196 "inbox or outbox in "
9198 "NotarizeProcessInbox.\n");
9204 int64_t lNewTransactionNumber = 0;
9205 server_->transactor_
9207 server_->m_nymServer,
9208 lNewTransactionNumber,
9218 lNewTransactionNumber);
9220 if (
nullptr == pInboxTransaction)
9234 ->GetTransactionNum());
9257 server_->m_nymServer);
9272 pOriginalItem->GetAmount())) {
9283 *pInboxTransaction);
9325 theFromOutbox.RemoveTransaction(
9327 ->GetTransactionNum());
9334 ->GetTransactionNum());
9352 theFromOutbox.ReleaseSignatures();
9355 server_->m_nymServer);
9356 theFromOutbox.SignContract(
9357 server_->m_nymServer);
9360 theFromOutbox.SaveContract();
9363 theFromOutbox.SaveOutbox();
9371 server_->m_nymServer);
9376 server_->m_nymServer);
9418 delete pInboxTransaction;
9419 pInboxTransaction =
nullptr;
9421 "Unable to credit account in "
9423 "NotarizeProcessInbox.\n");
9430 "inbox transaction.\n");
9435 "transfer that client is trying to "
9454 "OTItem::itemType: %s\n",
9455 __FUNCTION__, strItemType.
Get());
9466 pResponseBalanceItem->ReleaseSignatures();
9467 pResponseBalanceItem->SignContract(server_->m_nymServer);
9468 pResponseBalanceItem->SaveContract();
9488 const OTString strAcctID(ACCOUNT_ID);
9508 int64_t lTemp = theTempClosingNumNym.
GetIssuedNum(SERVER_ID, i);
9509 theIDSet.erase(lTemp);
9513 strPath.
Format((
char*)
"%s.success", strAcctID.
Get());
9516 strPath.
Format((
char*)
"%s.fail", strAcctID.
Get());
static EXPORT void vError(const char *szError,...)
EXPORT int32_t GetIssuedNumCount(const OTIdentifier &theServerID) const
EXPORT void GetReferenceString(OTString &theStr) const
EXPORT bool RemoveTransaction(int64_t lTransactionNum, bool bDeleteIt=true)
void SetAmount(int64_t lAmount)
std::deque< Token * > dequeOfTokenPtrs
static EXPORT OTTransaction * GenerateTransaction(const OTIdentifier &theUserID, const OTIdentifier &theAccountID, const OTIdentifier &theServerID, transactionType theType, int64_t lTransactionNum=0)
const OTIdentifier & GetRequestAccountID()
static EXPORT OTItem * CreateItemFromString(const OTString &strItem, const OTIdentifier &theServerID, int64_t lTransactionNumber)
static EXPORT void Output(int32_t nVerbosity, const char *szOutput)
EXPORT void SetNumberOfOrigin(int64_t lTransactionNum)
std::list< OTAccount * > listOfAccounts
EXPORT bool IsCanceled() const
EXPORT bool AddNumbersToTransaction(const OTNumList &theAddition)
EXPORT int32_t GetRecipientCountClosingNumbers() const
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
const OTIdentifier & GetSenderUserID() const
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
static bool __transact_withdraw_cash
EXPORT void GetAttachment(OTString &theStr) const
EXPORT bool VerifySmartContract(OTPseudonym &theNym, OTAccount &theAcct, OTPseudonym &theServerNym, bool bBurnTransNo=false)
virtual EXPORT bool VerifyAccount(const OTPseudonym &theNym)
bool lookupBasketAccountIDByContractID(const OTIdentifier &basketContractId, OTIdentifier &basketAccountId)
EXPORT bool VerifyTransactionStatement(OTPseudonym &THE_NYM, OTTransaction &TARGET_TRANSACTION, bool bIsRealTransaction=true)
EXPORT const OTIdentifier & GetAssetTypeID() const
int64_t GetTransactionNum() const
EXPORT bool Push(OTNym_or_SymmetricKey theOwner, const Token &theToken)
const int64_t & GetScale() const
EXPORT bool SaveOutbox(OTLedger &box, OTIdentifier *nash=nullptr)
bool issueNextTransactionNumber(OTPseudonym &nym, int64_t &txNumber, bool storeNumber=true)
EXPORT int64_t GetBalance() const
const int64_t & GetAmount() const
EXPORT bool DeleteBoxReceipt(OTLedger &theLedger)
EXPORT bool SaveContract()
EXPORT bool VerifyIssuedNum(const OTString &strServerID, const int64_t &lTransNum) const
time64_t OTTimeAddTimeInterval(time64_t lhs, int64_t rhs)
int64_t GetMinimumTransfer() const
EXPORT bool VerifyBalanceStatement(int64_t lActualAdjustment, OTPseudonym &THE_NYM, OTLedger &THE_INBOX, OTLedger &THE_OUTBOX, const OTAccount &THE_ACCOUNT, OTTransaction &TARGET_TRANSACTION, int64_t lOutboxTrnsNum=0)
#define NYM_IS_ALLOWED(SZ_NYM_ID, BOOL_VAR_NAME)
bool verifyTransactionNumber(OTPseudonym &nym, const int64_t &transactionNumber)
EXPORT bool AddCronItem(OTCronItem &theItem, OTPseudonym *pActivator, bool bSaveReceipt, time64_t tDateAdded)
EXPORT OTLedger * LoadOutbox(OTPseudonym &nym) const
int32_t GetSeries() const
const OTIdentifier & GetAssetID() const
void NotarizeDeposit(OTPseudonym &nym, OTAccount &account, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
for depositing a cheque or cash.
EXPORT bool AddTransaction(OTTransaction &theTransaction)
int64_t lClosingTransactionNo
virtual bool CanRemoveItemFromCron(OTPseudonym &theNym)
EXPORT void GetNumList(OTNumList &theOutput)
EXPORT void GetNote(OTString &theStr) const
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
virtual EXPORT bool VerifyToken(OTPseudonym &theNotary, OTString &theCleartextToken, int64_t lDenomination)=0
static bool __transact_market_offer
void NotarizeWithdrawal(OTPseudonym &nym, OTAccount &account, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
EXPORT void SetAttachment(const OTString &theStr)
EXPORT bool IsInternalServerAcct() const
const OTIdentifier & GetCurrencyAcctID() const
EXPORT bool SaveContractRaw(OTString &strOutput) const
const OTIdentifier & GetRemitterAcctID() const
EXPORT uint32_t GetLength() const
static bool __transact_withdrawal
EXPORT bool LoadSignedNymfile(OTPseudonym &SIGNER_NYM)
static int32_t GetCronMaxItemsPerNym()
EXPORT OTCronItem * GetItemByValidOpeningNum(int64_t lOpeningNum)
static bool __transact_cancel_cron_item
bool HasRecipient() const
virtual int64_t GetClosingNumber(const OTIdentifier &theAcctID) const
void NotarizeMarketOffer(OTPseudonym &nym, OTAccount &assetAccount, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
EXPORT bool VerifyCurrentDate()
EXPORT void SetNymboxHashServerSide(const OTIdentifier &theInput)
std::shared_ptr< OTAccount > getVoucherAccount(const OTIdentifier &assetTypeId)
bool removeTransactionNumber(OTPseudonym &nym, const int64_t &transactionNumber, bool save=false)
EXPORT int64_t GetRecipientOpeningNum() const
#define OT_TIME_SIX_MONTHS_IN_SECONDS
const OTString & GetMemo() const
int64_t GetClosingNum() const
EXPORT void HarvestIssuedNumbers(const OTIdentifier &theServerID, OTPseudonym &SIGNER_NYM, OTPseudonym &theOtherNym, bool bSave=false)
EXPORT bool VerifyPseudonym() const
static EXPORT OTItem * CreateItemFromTransaction(const OTTransaction &theOwner, OTItem::itemType theType, const OTIdentifier *pDestinationAcctID=nullptr)
void NotarizePayDividend(OTPseudonym &nym, OTAccount &account, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
EXPORT void ReleaseSignatures()
EXPORT bool Exists() const
EXPORT void SetIdentifier(const OTIdentifier &theIdentifier)
void NotarizeProcessNymbox(OTPseudonym &nym, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
static EXPORT void Error(const char *szError)
EXPORT bool VerifyOffer(OTOffer &offer) const
const char * GetTypeString() const
const OTIdentifier & GetServerID() const
int32_t GetTransferMultiple() const
EXPORT void Format(const char *fmt,...)
void SetStatus(const OTItem::itemStatus &theVal)
Mint * getMint(const OTIdentifier &assetTypeId, int32_t seriesCount)
Lookup the current mint for any given asset type ID and series.
EXPORT bool LoadPublicKey()
EXPORT void SetReferenceString(const OTString &theStr)
EXPORT int32_t GetCountClosingNumbers() const
EXPORT OTItem * GetItem(OTItem::itemType theType)
void NotarizeProcessInbox(OTPseudonym &nym, OTAccount &account, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
EXPORT bool VerifyOwner(const OTPseudonym &candidate) const
void SetNewOutboxTransNum(int64_t lTransNum)
time64_t OTTimeGetCurrentTime()
static bool __transact_transfer
EXPORT void SetSignature(const OTASCIIArmor &theSignature, int32_t nTokenIndex)
EXPORT void SetClosingNum(int64_t lClosingNum)
EXPORT bool GetCancelerID(OTIdentifier &theOutput) const
static int64_t GetMinMarketScale()
int64_t GetAmount() const
bool removeIssuedNumber(OTPseudonym &nym, const int64_t &transactionNumber, bool save=false)
EXPORT bool Output(std::set< int64_t > &theOutput) const
EXPORT int64_t GetClosingNum() const
EXPORT bool RemoveIssuedNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, const int64_t &lTransNum, bool bSave)
int64_t GetDenomination() const
int64_t GetTotalValue() const
EXPORT OTLedger * LoadInbox(OTPseudonym &nym) const
static bool __transact_deposit
static EXPORT const OTString & Receipt()
static bool __transact_smart_contract
#define OT_ASSERT_MSG(x, s)
const OTIdentifier & GetDestinationAcctID() const
std::map< std::string, OTAccount * > mapOfAccounts
EXPORT int64_t GetRecipientClosingNum() const
EXPORT BasketItem * At(uint32_t nIndex)
static bool __transact_process_inbox
const OTIdentifier & GetRemitterUserID() const
virtual bool VerifyAgreement(OTPseudonym &RECIPIENT_NYM, OTPseudonym &SENDER_NYM) const
void SetAsVoucher(const OTIdentifier &remitterUserID, const OTIdentifier &remitterAcctID)
EXPORT bool SaveNymbox(OTIdentifier *pNymboxHash=nullptr)
OTAssetContract * getAssetContract(const OTIdentifier &id)
static bool __transact_exchange_basket
const OTIdentifier & GetCurrencyID() const
EXPORT int64_t GetClosingNum() const
EXPORT int64_t GetOpeningNum() 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 int64_t GetReferenceToNum() const
EXPORT bool SaveBoxReceipt(int64_t lLedgerType)
EXPORT const char * Get() const
static bool __transact_withdraw_voucher
transactionType GetType() const
virtual EXPORT bool SignContract(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
EXPORT bool VisitAccountRecords(AccountVisitor &visitor) const
EXPORT bool SaveInbox(OTLedger &box, OTIdentifier *hash=nullptr)
void NotarizeExchangeBasket(OTPseudonym &nym, OTAccount &sourceAccount, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
OTItem::itemStatus GetStatus() const
virtual EXPORT int64_t GetOpeningNumber(const OTIdentifier &theNymID) const
const OTIdentifier & GetPurportedAccountID() const
EXPORT int64_t GetReceiptAmount()
virtual bool VerifyAccount(const OTPseudonym &theNym)
EXPORT int64_t GetTransactionNum() const
static bool __transact_deposit_cash
int64_t GetAmountReturned()
EXPORT void SetReferenceToNum(int64_t lTransactionNum)
EXPORT int64_t GetCurrencyAcctClosingNum() const
OTIdentifier SUB_ACCOUNT_ID
void NotarizePaymentPlan(OTPseudonym &nym, OTAccount &depositorAccount, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
EXPORT int64_t GetAssetAcctClosingNum() const
static bool __transact_deposit_cheque
EXPORT bool IsShares() const
EXPORT bool Verify(const int64_t &theValue) const
OTIdentifier SUB_CONTRACT_ID
virtual int64_t GetOpeningNumber(const OTIdentifier &theNymID) const
virtual EXPORT bool VerifySignature(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
const OTIdentifier & GetRecipientUserID() const
const OTIdentifier & GetSenderAcctID() const
EXPORT const OTString & GetBasketInfo() const
static bool __transact_payment_plan
std::set< int64_t > & GetSetOpenCronItems()
void NotarizeCancelCronItem(OTPseudonym &nym, OTAccount &assetAccount, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
EXPORT OTParty * FindPartyBasedOnNymAsAgent(OTPseudonym &theNym, OTAgent **ppAgent=nullptr) const
const OTIdentifier & GetRecipientAcctID() const
bool GetExchangingIn() const
OTItem::itemType GetType() const
bool GetOfferString(OTString &offer)
void NotarizeTransaction(OTPseudonym &nym, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
int64_t OTTimeGetSecondsFromTime(time64_t time)
EXPORT bool LoadContractFromString(const OTString &theStr)
EXPORT int64_t GetIssuedNum(const OTIdentifier &theServerID, int32_t nIndex) const
static bool __transact_pay_dividend
EXPORT bool SaveAccount()
int64_t GetAmountPaidOut()
void GetTypeString(OTString &strType) const
const OTIdentifier & GetRecipientUserID() const
EXPORT bool AddIssuedNum(const OTString &strServerID, const int64_t &lTransNum)
listOfItems & GetItemList()
OTAccount * GetCashReserveAccount() const
static EXPORT void vOutput(int32_t nVerbosity, const char *szOutput,...)
EXPORT bool Credit(const int64_t &amount)
static EXPORT OTAccount * LoadExistingAccount(const OTIdentifier &accountId, const OTIdentifier &serverId)
EXPORT bool Debit(const int64_t &amount)
virtual EXPORT void Release()
EXPORT void SetAsCancelled()
EXPORT bool VerifyItems(OTPseudonym &theNym)
virtual int64_t GetClosingNumber(const OTIdentifier &theAcctID) const
EXPORT void AddItem(OTItem &theItem)
EXPORT bool SaveSignedNymfile(OTPseudonym &SIGNER_NYM)
void SetType(transactionType theType)
void NotarizeSmartContract(OTPseudonym &nym, OTAccount &activatingAccount, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
EXPORT int32_t Count() const
EXPORT OTTransaction * GetTransaction(OTTransaction::transactionType theType)
EXPORT bool RemoveCronItem(int64_t lTransactionNum, OTPseudonym &theRemover)
int64_t lMinimumTransferAmount
EXPORT bool SaveInbox(OTIdentifier *pInboxHash=nullptr)
void NotarizeTransfer(OTPseudonym &nym, OTAccount &fromAccount, OTTransaction &tranIn, OTTransaction &tranOut, bool &outSuccess)
EXPORT Token * Pop(OTNym_or_SymmetricKey theOwner)