37 OfxTransactionContainer::OfxTransactionContainer(
LibofxContext *p_libofx_context,
OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier):
42 memset(&data, 0,
sizeof(data));
45 while (tmp_parentcontainer != NULL && tmp_parentcontainer->
type !=
"STATEMENT")
47 tmp_parentcontainer = tmp_parentcontainer->parentcontainer;
49 if (tmp_parentcontainer != NULL)
55 parent_statement = NULL;
56 message_out(
ERROR,
"Unable to find the enclosing statement container this transaction");
58 if (parent_statement != NULL && parent_statement->data.account_id_valid ==
true)
63 OfxTransactionContainer::~OfxTransactionContainer()
70 if (data.unique_id_valid ==
true && MainContainer != NULL)
72 data.security_data_ptr = MainContainer->find_security(data.
unique_id);
73 if (data.security_data_ptr != NULL)
78 libofx_context->transactionCallback(data);
85 if (MainContainer != NULL)
87 return MainContainer->add_container(
this);
99 if (identifier ==
"DTPOSTED")
103 else if (identifier ==
"DTUSER")
107 else if (identifier ==
"DTAVAIL")
111 else if (identifier ==
"FITID")
115 else if (identifier ==
"CORRECTFITID")
119 else if (identifier ==
"CORRECTACTION")
121 data.fi_id_correction_action_valid =
true;
122 if (value ==
"REPLACE")
126 else if (value ==
"DELETE")
132 data.fi_id_correction_action_valid =
false;
135 else if ((identifier ==
"SRVRTID") || (identifier ==
"SRVRTID2"))
139 else if (identifier ==
"MEMO" || identifier ==
"MEMO2")
143 else if (identifier ==
"CURRENCY")
147 else if (identifier ==
"ORIGCURRENCY")
158 void OfxTransactionContainer::add_account(
OfxAccountData * account_data)
160 if (account_data->account_id_valid ==
true)
171 OfxBankTransactionContainer::OfxBankTransactionContainer(
LibofxContext *p_libofx_context,
OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier):
178 if ( identifier ==
"TRNTYPE")
181 if (value ==
"CREDIT")
185 else if (value ==
"DEBIT")
189 else if (value ==
"INT")
191 data.transactiontype =
OFX_INT;
193 else if (value ==
"DIV")
195 data.transactiontype =
OFX_DIV;
197 else if (value ==
"FEE")
199 data.transactiontype =
OFX_FEE;
201 else if (value ==
"SRVCHG")
205 else if (value ==
"DEP")
207 data.transactiontype =
OFX_DEP;
209 else if (value ==
"ATM")
211 data.transactiontype =
OFX_ATM;
213 else if (value ==
"POS")
215 data.transactiontype =
OFX_POS;
217 else if (value ==
"XFER")
221 else if (value ==
"CHECK")
225 else if (value ==
"PAYMENT")
229 else if (value ==
"CASH")
233 else if (value ==
"DIRECTDEP")
237 else if (value ==
"DIRECTDEBIT")
241 else if (value ==
"REPEATPMT")
245 else if (value ==
"OTHER")
254 else if (identifier ==
"TRNAMT")
260 else if (identifier ==
"CHECKNUM")
264 else if (identifier ==
"REFNUM")
268 else if (identifier ==
"SIC")
272 else if ((identifier ==
"PAYEEID") || (identifier ==
"PAYEEID2"))
276 else if (identifier ==
"NAME")
292 OfxInvestmentTransactionContainer::OfxInvestmentTransactionContainer(
LibofxContext *p_libofx_context,
OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier):
298 data.invtransactiontype_valid =
true;
299 if (para_tag_identifier ==
"BUYDEBT")
303 else if (para_tag_identifier ==
"BUYMF")
307 else if (para_tag_identifier ==
"BUYOPT")
311 else if (para_tag_identifier ==
"BUYOTHER")
315 else if (para_tag_identifier ==
"BUYSTOCK")
319 else if (para_tag_identifier ==
"CLOSUREOPT")
323 else if (para_tag_identifier ==
"INCOME")
327 else if (para_tag_identifier ==
"INVEXPENSE")
331 else if (para_tag_identifier ==
"JRNLFUND")
335 else if (para_tag_identifier ==
"JRNLSEC")
339 else if (para_tag_identifier ==
"MARGININTEREST")
343 else if (para_tag_identifier ==
"REINVEST")
347 else if (para_tag_identifier ==
"RETOFCAP")
351 else if (para_tag_identifier ==
"SELLDEBT")
355 else if (para_tag_identifier ==
"SELLMF")
359 else if (para_tag_identifier ==
"SELLOPT")
363 else if (para_tag_identifier ==
"SELLOTHER")
367 else if (para_tag_identifier ==
"SELLSTOCK")
371 else if (para_tag_identifier ==
"SPLIT")
375 else if (para_tag_identifier ==
"TRANSFER")
379 else if (para_tag_identifier ==
"INVBANKTRAN")
385 message_out(
ERROR,
"This should not happen, " + para_tag_identifier +
" is an unknown investment transaction type");
386 data.invtransactiontype_valid =
false;
392 if (identifier ==
"UNIQUEID")
396 else if (identifier ==
"UNIQUEIDTYPE")
400 else if (identifier ==
"UNITS")
404 else if (identifier ==
"UNITPRICE")
408 else if (identifier ==
"MKTVAL")
412 else if (identifier ==
"TOTAL")
416 else if (identifier ==
"CURRATE")
420 else if (identifier ==
"CURSYM")
424 else if (identifier ==
"DTSETTLE")
428 else if (identifier ==
"DTTRADE")
432 else if (identifier ==
"COMMISSION")
436 else if (identifier ==
"FEES")
440 else if (identifier ==
"OLDUNITS")
444 else if (identifier ==
"NEWUNITS")
448 else if (identifier ==
"ACCRDINT")
452 else if (identifier ==
"AVGCOSTBASIS")
456 else if (identifier ==
"BUYTYPE" || identifier ==
"OPTBUYTYPE")
460 ASSIGN(data.buy_type, data.OFX_BUY_TYPE_BUY);
462 else if (value ==
"BUYTOCOVER")
464 ASSIGN(data.buy_type, data.OFX_BUY_TYPE_BUYTOCOVER);
466 else if (value ==
"BUYTOOPEN")
468 ASSIGN(data.buy_type, data.OFX_BUY_TYPE_BUYTOOPEN);
470 else if (value ==
"BUYTOCLOSE")
472 ASSIGN(data.buy_type, data.OFX_BUY_TYPE_BUYTOCLOSE);
475 else if (identifier ==
"DENOMINATOR")
479 else if (identifier ==
"DTPAYROLL")
483 else if (identifier ==
"DTPURCHASE")
487 else if (identifier ==
"GAIN")
491 else if (identifier ==
"FRACCASH")
495 else if (identifier ==
"INCOMETYPE")
497 if (value ==
"CGLONG")
501 else if (value ==
"CGSHORT")
505 else if (value ==
"DIV")
509 else if (value ==
"INTEREST")
513 else if (value ==
"MISC")
518 else if (identifier ==
"INV401KSOURCE")
520 if (value ==
"PRETAX")
522 ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_PRETAX);
524 else if (value ==
"AFTERTAX")
526 ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_AFTERTAX);
528 else if (value ==
"MATCH")
530 ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_MATCH);
532 else if (value ==
"PROFITSHARING")
534 ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_PROFITSHARING);
536 else if (value ==
"ROLLOVER")
538 ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_ROLLOVER);
540 else if (value ==
"OTHERVEST")
542 ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_OTHERVEST);
544 else if (value ==
"OTHERNONVEST")
546 ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_OTHERNONVEST);
549 else if (identifier ==
"LOAD")
553 else if (identifier ==
"LOANID")
557 else if (identifier ==
"LOANINTEREST")
561 else if (identifier ==
"LOANPRINCIPAL")
565 else if (identifier ==
"MARKDOWN")
569 else if (identifier ==
"MARKUP")
573 else if (identifier ==
"NUMERATOR")
577 else if (identifier ==
"OPTACTION")
579 if (value ==
"EXERCISE")
581 ASSIGN(data.opt_action, data.OFX_OPTACTION_EXERCISE);
583 else if (value ==
"ASSIGN")
585 ASSIGN(data.opt_action, data.OFX_OPTACTION_ASSIGN);
587 else if (value ==
"EXPIRE")
589 ASSIGN(data.opt_action, data.OFX_OPTACTION_EXPIRE);
592 else if (identifier ==
"PENALTY")
596 else if (identifier ==
"POSTYPE")
600 ASSIGN(data.pos_type, data.OFX_POSTYPE_LONG);
602 else if (value ==
"SHORT")
604 ASSIGN(data.pos_type, data.OFX_POSTYPE_SHORT);
607 else if (identifier ==
"PRIORYEARCONTRIB")
613 else if (value ==
"N")
618 else if (identifier ==
"RELFITID")
622 else if (identifier ==
"RELTYPE")
624 if (value ==
"SPREAD")
626 ASSIGN(data.related_type, data.OFX_RELTYPE_SPREAD);
628 else if (value ==
"STRADDLE")
630 ASSIGN(data.related_type, data.OFX_RELTYPE_STRADDLE);
632 else if (value ==
"NONE")
634 ASSIGN(data.related_type, data.OFX_RELTYPE_NONE);
636 else if (value ==
"OTHER")
638 ASSIGN(data.related_type, data.OFX_RELTYPE_OTHER);
641 else if (identifier ==
"SECURED")
643 if (value ==
"NAKED")
645 ASSIGN(data.option_secured, data.OFX_SECURED_NAKED);
647 else if (value ==
"COVERED")
649 ASSIGN(data.option_secured, data.OFX_SECURED_COVERED);
652 else if (identifier ==
"SELLREASON")
658 else if (value ==
"SELL")
662 else if (value ==
"MATURITY")
667 else if (identifier ==
"SELLTYPE" || identifier ==
"OPTSELLTYPE")
671 ASSIGN(data.sell_type, data.OFX_SELL_TYPE_SELL);
673 else if (value ==
"SELLSHORT")
675 ASSIGN(data.sell_type, data.OFX_SELL_TYPE_SELLSHORT);
677 else if (value ==
"SELLTOOPEN")
679 ASSIGN(data.sell_type, data.OFX_SELL_TYPE_SELLTOOPEN);
681 else if (value ==
"SELLTOCLOSE")
683 ASSIGN(data.sell_type, data.OFX_SELL_TYPE_SELLTOCLOSE);
686 else if (identifier ==
"SHPERCTRCT")
690 else if (identifier ==
"STATEWITHHOLDING")
694 else if (identifier ==
"SUBACCTFROM")
698 ASSIGN(data.subacct_from, data.OFX_SUBACCT_CASH);
700 else if (value ==
"MARGIN")
702 ASSIGN(data.subacct_from, data.OFX_SUBACCT_MARGIN);
704 else if (value ==
"SHORT")
706 ASSIGN(data.subacct_from, data.OFX_SUBACCT_SHORT);
708 else if (value ==
"OTHER")
710 ASSIGN(data.subacct_from, data.OFX_SUBACCT_OTHER);
713 else if (identifier ==
"SUBACCTFUND")
717 ASSIGN(data.subacct_funding, data.OFX_SUBACCT_CASH);
719 else if (value ==
"MARGIN")
721 ASSIGN(data.subacct_funding, data.OFX_SUBACCT_MARGIN);
723 else if (value ==
"SHORT")
725 ASSIGN(data.subacct_funding, data.OFX_SUBACCT_SHORT);
727 else if (value ==
"OTHER")
729 ASSIGN(data.subacct_funding, data.OFX_SUBACCT_OTHER);
732 else if (identifier ==
"SUBACCTSEC")
736 ASSIGN(data.subacct_security, data.OFX_SUBACCT_CASH);
738 else if (value ==
"MARGIN")
740 ASSIGN(data.subacct_security, data.OFX_SUBACCT_MARGIN);
742 else if (value ==
"SHORT")
744 ASSIGN(data.subacct_security, data.OFX_SUBACCT_SHORT);
746 else if (value ==
"OTHER")
748 ASSIGN(data.subacct_security, data.OFX_SUBACCT_OTHER);
751 else if (identifier ==
"SUBACCTTO")
755 ASSIGN(data.subacct_to, data.OFX_SUBACCT_CASH);
757 else if (value ==
"MARGIN")
759 ASSIGN(data.subacct_to, data.OFX_SUBACCT_MARGIN);
761 else if (value ==
"SHORT")
763 ASSIGN(data.subacct_to, data.OFX_SUBACCT_SHORT);
765 else if (value ==
"OTHER")
767 ASSIGN(data.subacct_to, data.OFX_SUBACCT_OTHER);
770 else if (identifier ==
"TAXES")
774 else if (identifier ==
"TAXEXEMPT")
780 else if (value ==
"N")
785 else if (identifier ==
"TFERACTION")
789 ASSIGN(data.transfer_action, data.OFX_TFERACTION_IN);
791 else if (value ==
"OUT")
793 ASSIGN(data.transfer_action, data.OFX_TFERACTION_OUT);
796 else if (identifier ==
"UNITTYPE")
798 if (value ==
"SHARES")
800 ASSIGN(data.unit_type, data.OFX_UNITTYPE_SHARES);
802 else if (value ==
"CURRENCY")
804 ASSIGN(data.unit_type, data.OFX_UNITTYPE_CURRENCY);
807 else if (identifier ==
"WITHHOLDING")
812 else if ( identifier ==
"TRNTYPE")
815 if (value ==
"CREDIT")
819 else if (value ==
"DEBIT")
823 else if (value ==
"INT")
825 data.transactiontype =
OFX_INT;
827 else if (value ==
"DIV")
829 data.transactiontype =
OFX_DIV;
831 else if (value ==
"FEE")
833 data.transactiontype =
OFX_FEE;
835 else if (value ==
"SRVCHG")
839 else if (value ==
"DEP")
841 data.transactiontype =
OFX_DEP;
843 else if (value ==
"ATM")
845 data.transactiontype =
OFX_ATM;
847 else if (value ==
"POS")
849 data.transactiontype =
OFX_POS;
851 else if (value ==
"XFER")
855 else if (value ==
"CHECK")
859 else if (value ==
"PAYMENT")
863 else if (value ==
"CASH")
867 else if (value ==
"DIRECTDEP")
871 else if (value ==
"DIRECTDEBIT")
875 else if (value ==
"REPEATPMT")
879 else if (value ==
"OTHER")
888 else if (identifier ==
"TRNAMT")
894 else if (identifier ==
"CHECKNUM")
898 else if (identifier ==
"REFNUM")
902 else if (identifier ==
"SIC")
906 else if ((identifier ==
"PAYEEID") || (identifier ==
"PAYEEID2"))
910 else if (identifier ==
"NAME")