133 #include "../ext/OTPayment.hpp"
134 #include "../core/crypto/OTEnvelope.hpp"
135 #include "../core/OTLedger.hpp"
136 #include "../core/OTPseudonym.hpp"
137 #include "../core/OTMessage.hpp"
138 #include "../core/OTString.hpp"
139 #include "../core/OTLog.hpp"
154 otErr << __FUNCTION__
155 <<
": nIndex is out of bounds (it's in the negative.)\n";
171 if (
nullptr == pTransaction) {
172 otErr << __FUNCTION__
173 <<
": good index but uncovered nullptr pointer: " << nIndex
201 if (
nullptr == pTransaction) {
202 otErr << __FUNCTION__
203 <<
": good index but uncovered nullptr "
204 "pointer after trying to load full version of receipt "
205 "(from abbreviated) at index: " << nIndex <<
"\n";
231 otOut << __FUNCTION__
232 <<
": Failure: Expected OTTransaction::instrumentNotice, "
233 "::payDividend or ::notice, "
234 "but found: OTTransaction::" << pTransaction->
GetTypeString()
246 otOut << __FUNCTION__
247 <<
": Failure: Expected OTTransaction::instrumentNotice to "
248 "contain an 'in reference to' string, but it was empty. "
249 "(Returning \"\".)\n";
253 std::unique_ptr<OTMessage> pMsg(
new OTMessage);
254 if (
nullptr == pMsg) {
255 otErr << __FUNCTION__ <<
": Null: Assert while allocating memory "
256 "for an OTMessage!\n";
261 otOut << __FUNCTION__
262 <<
": Failed trying to load OTMessage from string:\n\n"
285 otOut << __FUNCTION__
286 <<
": Failed trying to set ASCII-armored data for envelope:\n"
288 else if (!theEnvelope.
Open(theNym, strEnvelopeContents))
289 otOut << __FUNCTION__
290 <<
": Failed trying to decrypt the financial instrument "
291 "that was supposedly attached as a payload to this "
292 "payment message:\n" << strMsg <<
"\n\n";
293 else if (!strEnvelopeContents.
Exists())
294 otOut << __FUNCTION__
295 <<
": Failed: after decryption, cleartext is empty. From:\n"
298 std::unique_ptr<OTPayment> pPayment(
306 otOut << __FUNCTION__
307 <<
": Failed: after decryption, payment is invalid. "
308 "Contents:\n\n" << strEnvelopeContents <<
"\n\n";
311 return pPayment.release();
316 otErr << __FUNCTION__ <<
": This must be a notice (vs an "
317 "instrumentNotice or payDividend). "
318 "!!! Not yet supported !!!\n";
327 for (int32_t lOutpaymentsIndex = 0; lOutpaymentsIndex < lOutpaymentsCount;
328 ++lOutpaymentsIndex) {
331 if (
nullptr != pOutpaymentMsg) {
347 return static_cast<int32_t
>(lOutpaymentsIndex);
EXPORT void GetReferenceString(OTString &theStr) const
int32_t GetTransactionCount() const
EXPORT bool LoadBoxReceipt(const int64_t &lTransactionNum)
EXPORT bool HasTransactionNum(const int64_t &lInput) const
OTLOG_IMPORT OTLogStream otOut
EXPORT bool SetAsciiArmoredData(const OTASCIIArmor &theArmoredText, bool bLineBreaks=true)
EXPORT bool Open(const OTPseudonym &theRecipient, OTString &theOutput, const OTPasswordData *pPWData=nullptr)
EXPORT bool Exists() const
const char * GetTypeString() const
EXPORT int32_t GetOutpaymentsCount() const
return the number of payments items available for this Nym.
OTPayment * GetInstrument(const OTPseudonym &theNym, const int32_t &nIndex, OTLedger &ledger)
EXPORT OTTransaction * GetTransactionByIndex(int32_t nIndex) const
EXPORT bool SetTempValues()
transactionType GetType() const
OTLOG_IMPORT OTLogStream otErr
EXPORT int64_t GetTransactionNum() const
EXPORT bool IsValid() const
OTASCIIArmor m_ascPayload
bool IsAbbreviated() const
int32_t GetOutpaymentsIndexByTransNum(const OTPseudonym &nym, int64_t lTransNum)
EXPORT bool GetString(OTString &theData, bool bLineBreaks=true) const
EXPORT bool LoadContractFromString(const OTString &theStr)
EXPORT OTMessage * GetOutpaymentsByIndex(int32_t nIndex) const
EXPORT OTTransaction * GetTransaction(OTTransaction::transactionType theType)