1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>LibOFX: ofx_request_statement.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<h1>ofx_request_statement.cpp</h1><a href="fx-0_88_82_2lib_2ofx__request__statement_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/***************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> ofx_request_statement.cpp </span>
<a name="l00003"></a>00003 <span class="comment"> -------------------</span>
<a name="l00004"></a>00004 <span class="comment"> copyright : (C) 2005 by Ace Jones</span>
<a name="l00005"></a>00005 <span class="comment"> email : acejones@users.sourceforge.net</span>
<a name="l00006"></a>00006 <span class="comment">***************************************************************************/</span>
<a name="l00011"></a>00011 <span class="comment">/***************************************************************************</span>
<a name="l00012"></a>00012 <span class="comment"> * *</span>
<a name="l00013"></a>00013 <span class="comment"> * This program is free software; you can redistribute it and/or modify *</span>
<a name="l00014"></a>00014 <span class="comment"> * it under the terms of the GNU General Public License as published by *</span>
<a name="l00015"></a>00015 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or *</span>
<a name="l00016"></a>00016 <span class="comment"> * (at your option) any later version. *</span>
<a name="l00017"></a>00017 <span class="comment"> * *</span>
<a name="l00018"></a>00018 <span class="comment"> ***************************************************************************/</span>
<a name="l00019"></a>00019
<a name="l00020"></a>00020 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
<a name="l00022"></a>00022 <span class="preprocessor">#endif</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include <string></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="libofx-0_89_80_2inc_2libofx_8h.html" title="Main header file containing the LibOfx API.">libofx.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="fx-0_88_82_2lib_2ofx__utilities_8hh.html" title="Various simple functions for type conversion &amp; al.">ofx_utilities.hh</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="fx-0_88_82_2lib_2ofx__request__statement_8hh.html" title="Declaration of libofx_request_statement to create an OFX file containing a request...">ofx_request_statement.hh</a>"</span>
<a name="l00028"></a>00028
<a name="l00029"></a>00029 <span class="keyword">using namespace </span>std;
<a name="l00030"></a>00030
<a name="l00031"></a><a class="code" href="fx-0_88_82_2lib_2ofx__request__statement_8cpp.html#fe5e9e2a83708f6d345a4f49268ec8b2">00031</a> <span class="keywordtype">char</span>* <a class="code" href="inc_2libofx_8h.html#8095d04a045a8f0bdfd5c32ea6f1638d" title="Creates an OFX statement request in string form.">libofx_request_statement</a>( <span class="keyword">const</span> <a class="code" href="structOfxFiLogin.html" title="Information sufficient to log into an financial institution.">OfxFiLogin</a>* login, <span class="keyword">const</span> <a class="code" href="structOfxAccountData.html" title="An abstraction of an account.">OfxAccountData</a>* account, time_t date_from )
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 <a class="code" href="classOfxStatementRequest.html" title="A statement request.">OfxStatementRequest</a> strq( *login, *account, date_from );
<a name="l00034"></a>00034 <span class="keywordtype">string</span> request = <a class="code" href="ofx__request_8cpp.html#38a94b99f351615ee7a342f409db8499">OfxHeader</a>() + strq.<a class="code" href="classOfxAggregate.html#b430ce663510ff8eea83bbe0e3bedf6d">Output</a>();
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="keywordtype">unsigned</span> size = request.size();
<a name="l00037"></a>00037 <span class="keywordtype">char</span>* result = (<span class="keywordtype">char</span>*)malloc(size + 1);
<a name="l00038"></a>00038 request.copy(result,size);
<a name="l00039"></a>00039 result[size] = 0;
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="keywordflow">return</span> result;
<a name="l00042"></a>00042 }
<a name="l00043"></a>00043
<a name="l00044"></a>00044 <a class="code" href="classOfxStatementRequest.html#26f2cb4111c3965436129c2bdfbf678b">OfxStatementRequest::OfxStatementRequest</a>( <span class="keyword">const</span> <a class="code" href="structOfxFiLogin.html" title="Information sufficient to log into an financial institution.">OfxFiLogin</a>& fi, <span class="keyword">const</span> <a class="code" href="structOfxAccountData.html" title="An abstraction of an account.">OfxAccountData</a>& account, time_t from ):
<a name="l00045"></a>00045 <a class="code" href="classOfxRequest.html" title="A generic request.">OfxRequest</a>(fi),
<a name="l00046"></a>00046 m_account(account),
<a name="l00047"></a>00047 m_date_from(from)
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049 Add( SignOnRequest() );
<a name="l00050"></a>00050
<a name="l00051"></a>00051 <span class="keywordflow">if</span> ( account.<a class="code" href="structOfxAccountData.html#86c1f1fc9d27be97de56b2ca1feef70f">account_type</a> == account.<a class="code" href="structOfxAccountData.html#3835390f3072fc32736780f44ab10284ef7a40d4a94b79cb30e36e9d2d767446">OFX_CREDITCARD</a> )
<a name="l00052"></a>00052 Add(CreditCardStatementRequest());
<a name="l00053"></a>00053 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( account.<a class="code" href="structOfxAccountData.html#86c1f1fc9d27be97de56b2ca1feef70f">account_type</a> == account.<a class="code" href="structOfxAccountData.html#3835390f3072fc32736780f44ab1028471412f0985b2443ef3cf35dc131c227a">OFX_INVESTMENT</a> )
<a name="l00054"></a>00054 Add(InvestmentStatementRequest());
<a name="l00055"></a>00055 <span class="keywordflow">else</span>
<a name="l00056"></a>00056 Add(BankStatementRequest());
<a name="l00057"></a>00057 }
<a name="l00058"></a>00058
<a name="l00059"></a>00059 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> <a class="code" href="classOfxStatementRequest.html#42f8752cca60b057325785563d67e92f">OfxStatementRequest::BankStatementRequest</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00060"></a>00060 <span class="keyword"></span>{
<a name="l00061"></a>00061 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> bankacctfromTag(<span class="stringliteral">"BANKACCTFROM"</span>);
<a name="l00062"></a>00062 bankacctfromTag.Add( <span class="stringliteral">"BANKID"</span>, m_account.<a class="code" href="structOfxAccountData.html#e7f1e1e41cb6c19ca9a4bdee2b6d3c3b">bank_id</a> );
<a name="l00063"></a>00063 bankacctfromTag.Add( <span class="stringliteral">"ACCTID"</span>, m_account.<a class="code" href="structOfxAccountData.html#b7a689ab5977bd72653046449534f7f7">account_number</a> );
<a name="l00064"></a>00064 <span class="keywordflow">if</span> ( m_account.<a class="code" href="structOfxAccountData.html#86c1f1fc9d27be97de56b2ca1feef70f">account_type</a> == m_account.<a class="code" href="structOfxAccountData.html#3835390f3072fc32736780f44ab1028432212e64e77d0f487d8ac7078204a56c">OFX_CHECKING</a> )
<a name="l00065"></a>00065 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"CHECKING"</span> );
<a name="l00066"></a>00066 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( m_account.<a class="code" href="structOfxAccountData.html#86c1f1fc9d27be97de56b2ca1feef70f">account_type</a> == m_account.<a class="code" href="structOfxAccountData.html#3835390f3072fc32736780f44ab1028420ea5732b04980ca296c6c25673bd324">OFX_SAVINGS</a> )
<a name="l00067"></a>00067 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"SAVINGS"</span> );
<a name="l00068"></a>00068 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( m_account.<a class="code" href="structOfxAccountData.html#86c1f1fc9d27be97de56b2ca1feef70f">account_type</a> == m_account.<a class="code" href="structOfxAccountData.html#3835390f3072fc32736780f44ab102847c19e4fda38aeb2ee1120be2a638d28d">OFX_MONEYMRKT</a> )
<a name="l00069"></a>00069 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"MONEYMRKT"</span> );
<a name="l00070"></a>00070 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( m_account.<a class="code" href="structOfxAccountData.html#86c1f1fc9d27be97de56b2ca1feef70f">account_type</a> == m_account.<a class="code" href="structOfxAccountData.html#3835390f3072fc32736780f44ab102849a7eac1e4fc43f03821fc6c42d468a71">OFX_CREDITLINE</a> )
<a name="l00071"></a>00071 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"CREDITLINE"</span> );
<a name="l00072"></a>00072 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( m_account.<a class="code" href="structOfxAccountData.html#86c1f1fc9d27be97de56b2ca1feef70f">account_type</a> == m_account.<a class="code" href="structOfxAccountData.html#3835390f3072fc32736780f44ab10284381147bb1b704c18f716cf7fa318f72d">OFX_CMA</a> )
<a name="l00073"></a>00073 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"CMA"</span> );
<a name="l00074"></a>00074
<a name="l00075"></a>00075 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> inctranTag(<span class="stringliteral">"INCTRAN"</span>);
<a name="l00076"></a>00076 inctranTag.Add( <span class="stringliteral">"DTSTART"</span>, <a class="code" href="ofx__request_8cpp.html#34e84f6346e9d35feba51592e3db190c">time_t_to_ofxdate</a>( m_date_from ) );
<a name="l00077"></a>00077 inctranTag.Add( <span class="stringliteral">"INCLUDE"</span>,<span class="stringliteral">"Y"</span> );
<a name="l00078"></a>00078
<a name="l00079"></a>00079 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> stmtrqTag(<span class="stringliteral">"STMTRQ"</span>);
<a name="l00080"></a>00080 stmtrqTag.Add( bankacctfromTag );
<a name="l00081"></a>00081 stmtrqTag.Add( inctranTag );
<a name="l00082"></a>00082
<a name="l00083"></a>00083 <span class="keywordflow">return</span> <a class="code" href="classOfxRequest.html#e56ceb8ef12b9431dcd4d63eec60a377">RequestMessage</a>(<span class="stringliteral">"BANK"</span>,<span class="stringliteral">"STMT"</span>, stmtrqTag);
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085
<a name="l00086"></a>00086 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> <a class="code" href="classOfxStatementRequest.html#721c88927e57c1bc189b3e4b9410690d">OfxStatementRequest::CreditCardStatementRequest</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00087"></a>00087 <span class="keyword"></span>{<span class="comment">/*</span>
<a name="l00088"></a>00088 <span class="comment"> QString dtstart_string = _dtstart.toString(Qt::ISODate).remove(QRegExp("[^0-9]"));</span>
<a name="l00089"></a>00089 <span class="comment"></span>
<a name="l00090"></a>00090 <span class="comment"> return message("CREDITCARD","CCSTMT",Tag("CCSTMTRQ")</span>
<a name="l00091"></a>00091 <span class="comment"> .subtag(Tag("CCACCTFROM").element("ACCTID",accountnum()))</span>
<a name="l00092"></a>00092 <span class="comment"> .subtag(Tag("INCTRAN").element("DTSTART",dtstart_string).element("INCLUDE","Y")));</span>
<a name="l00093"></a>00093 <span class="comment">}</span>
<a name="l00094"></a>00094 <span class="comment">*/</span>
<a name="l00095"></a>00095 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> ccacctfromTag(<span class="stringliteral">"CCACCTFROM"</span>);
<a name="l00096"></a>00096 ccacctfromTag.Add( <span class="stringliteral">"ACCTID"</span>, m_account.<a class="code" href="structOfxAccountData.html#b7a689ab5977bd72653046449534f7f7">account_number</a> );
<a name="l00097"></a>00097
<a name="l00098"></a>00098 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> inctranTag(<span class="stringliteral">"INCTRAN"</span>);
<a name="l00099"></a>00099 inctranTag.Add( <span class="stringliteral">"DTSTART"</span>, <a class="code" href="ofx__request_8cpp.html#34e84f6346e9d35feba51592e3db190c">time_t_to_ofxdate</a>( m_date_from ) );
<a name="l00100"></a>00100 inctranTag.Add( <span class="stringliteral">"INCLUDE"</span>,<span class="stringliteral">"Y"</span> );
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> ccstmtrqTag(<span class="stringliteral">"CCSTMTRQ"</span>);
<a name="l00103"></a>00103 ccstmtrqTag.Add( ccacctfromTag );
<a name="l00104"></a>00104 ccstmtrqTag.Add( inctranTag );
<a name="l00105"></a>00105
<a name="l00106"></a>00106 <span class="keywordflow">return</span> <a class="code" href="classOfxRequest.html#e56ceb8ef12b9431dcd4d63eec60a377">RequestMessage</a>(<span class="stringliteral">"CREDITCARD"</span>,<span class="stringliteral">"CCSTMT"</span>, ccstmtrqTag);
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108
<a name="l00109"></a>00109 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> <a class="code" href="classOfxStatementRequest.html#c3df87c5377e4d0d6f5944010527bea4">OfxStatementRequest::InvestmentStatementRequest</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00110"></a>00110 <span class="keyword"></span>{
<a name="l00111"></a>00111 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> invacctfromTag(<span class="stringliteral">"INVACCTFROM"</span>);
<a name="l00112"></a>00112
<a name="l00113"></a>00113 invacctfromTag.Add( <span class="stringliteral">"BROKERID"</span>, m_account.<a class="code" href="structOfxAccountData.html#51cd1ff5d5809de171bf9071517239e7">broker_id</a> );
<a name="l00114"></a>00114 invacctfromTag.Add( <span class="stringliteral">"ACCTID"</span>, m_account.<a class="code" href="structOfxAccountData.html#b7a689ab5977bd72653046449534f7f7">account_number</a> );
<a name="l00115"></a>00115
<a name="l00116"></a>00116 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> inctranTag(<span class="stringliteral">"INCTRAN"</span>);
<a name="l00117"></a>00117 inctranTag.Add( <span class="stringliteral">"DTSTART"</span>, <a class="code" href="ofx__request_8cpp.html#34e84f6346e9d35feba51592e3db190c">time_t_to_ofxdate</a>( m_date_from ) );
<a name="l00118"></a>00118 inctranTag.Add( <span class="stringliteral">"INCLUDE"</span>,<span class="stringliteral">"Y"</span> );
<a name="l00119"></a>00119
<a name="l00120"></a>00120 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> incposTag(<span class="stringliteral">"INCPOS"</span>);
<a name="l00121"></a>00121 incposTag.Add( <span class="stringliteral">"DTASOF"</span>, <a class="code" href="ofx__request_8cpp.html#2f86a163dc83453b02683f1d20d6b3d6">time_t_to_ofxdatetime</a>( time(NULL) ) );
<a name="l00122"></a>00122 incposTag.Add( <span class="stringliteral">"INCLUDE"</span>,<span class="stringliteral">"Y"</span> );
<a name="l00123"></a>00123
<a name="l00124"></a>00124 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> invstmtrqTag(<span class="stringliteral">"INVSTMTRQ"</span>);
<a name="l00125"></a>00125 invstmtrqTag.Add( invacctfromTag );
<a name="l00126"></a>00126 invstmtrqTag.Add( inctranTag );
<a name="l00127"></a>00127 invstmtrqTag.Add( <span class="stringliteral">"INCOO"</span>,<span class="stringliteral">"Y"</span> );
<a name="l00128"></a>00128 invstmtrqTag.Add( incposTag );
<a name="l00129"></a>00129 invstmtrqTag.Add( <span class="stringliteral">"INCBAL"</span>,<span class="stringliteral">"Y"</span> );
<a name="l00130"></a>00130
<a name="l00131"></a>00131 <span class="keywordflow">return</span> <a class="code" href="classOfxRequest.html#e56ceb8ef12b9431dcd4d63eec60a377">RequestMessage</a>(<span class="stringliteral">"INVSTMT"</span>,<span class="stringliteral">"INVSTMT"</span>, invstmtrqTag);
<a name="l00132"></a>00132 }
<a name="l00133"></a>00133
<a name="l00134"></a><a class="code" href="fx-0_88_82_2lib_2ofx__request__statement_8cpp.html#22a315696e3c04b47ab85ad7da3d3cab">00134</a> <span class="keywordtype">char</span>* libofx_request_payment( <span class="keyword">const</span> <a class="code" href="structOfxFiLogin.html" title="Information sufficient to log into an financial institution.">OfxFiLogin</a>* login, <span class="keyword">const</span> <a class="code" href="structOfxAccountData.html" title="An abstraction of an account.">OfxAccountData</a>* account, <span class="keyword">const</span> <a class="code" href="structOfxPayee.html">OfxPayee</a>* payee, <span class="keyword">const</span> <a class="code" href="structOfxPayment.html">OfxPayment</a>* payment )
<a name="l00135"></a>00135 {
<a name="l00136"></a>00136 <a class="code" href="classOfxPaymentRequest.html">OfxPaymentRequest</a> strq( *login, *account, *payee, *payment );
<a name="l00137"></a>00137 <span class="keywordtype">string</span> request = <a class="code" href="ofx__request_8cpp.html#38a94b99f351615ee7a342f409db8499">OfxHeader</a>() + strq.<a class="code" href="classOfxAggregate.html#b430ce663510ff8eea83bbe0e3bedf6d">Output</a>();
<a name="l00138"></a>00138
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> size = request.size();
<a name="l00140"></a>00140 <span class="keywordtype">char</span>* result = (<span class="keywordtype">char</span>*)malloc(size + 1);
<a name="l00141"></a>00141 request.copy(result,size);
<a name="l00142"></a>00142 result[size] = 0;
<a name="l00143"></a>00143
<a name="l00144"></a>00144 <span class="keywordflow">return</span> result;
<a name="l00145"></a>00145 }
<a name="l00146"></a>00146
<a name="l00147"></a>00147 <a class="code" href="classOfxPaymentRequest.html#ce1a35797c9b4d7a81f6cc43870bc909">OfxPaymentRequest::OfxPaymentRequest</a>( <span class="keyword">const</span> <a class="code" href="structOfxFiLogin.html" title="Information sufficient to log into an financial institution.">OfxFiLogin</a>& fi, <span class="keyword">const</span> <a class="code" href="structOfxAccountData.html" title="An abstraction of an account.">OfxAccountData</a>& account, <span class="keyword">const</span> <a class="code" href="structOfxPayee.html">OfxPayee</a>& payee, <span class="keyword">const</span> <a class="code" href="structOfxPayment.html">OfxPayment</a>& payment ):
<a name="l00148"></a>00148 <a class="code" href="classOfxRequest.html" title="A generic request.">OfxRequest</a>(fi),
<a name="l00149"></a>00149 m_account(account),
<a name="l00150"></a>00150 m_payee(payee),
<a name="l00151"></a>00151 m_payment(payment)
<a name="l00152"></a>00152 {
<a name="l00153"></a>00153 Add( SignOnRequest() );
<a name="l00154"></a>00154
<a name="l00155"></a>00155 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> bankacctfromTag(<span class="stringliteral">"BANKACCTFROM"</span>);
<a name="l00156"></a>00156 bankacctfromTag.Add( <span class="stringliteral">"BANKID"</span>, m_account.bank_id );
<a name="l00157"></a>00157 bankacctfromTag.Add( <span class="stringliteral">"ACCTID"</span>, m_account.account_number );
<a name="l00158"></a>00158 <span class="keywordflow">if</span> ( m_account.account_type == m_account.OFX_CHECKING)
<a name="l00159"></a>00159 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"CHECKING"</span> );
<a name="l00160"></a>00160 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( m_account.account_type == m_account.OFX_SAVINGS )
<a name="l00161"></a>00161 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"SAVINGS"</span> );
<a name="l00162"></a>00162 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( m_account.account_type == m_account.OFX_MONEYMRKT )
<a name="l00163"></a>00163 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"MONEYMRKT"</span> );
<a name="l00164"></a>00164 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( m_account.account_type == m_account.OFX_CREDITLINE )
<a name="l00165"></a>00165 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"CREDITLINE"</span> );
<a name="l00166"></a>00166 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( m_account.account_type == m_account.OFX_CMA )
<a name="l00167"></a>00167 bankacctfromTag.Add( <span class="stringliteral">"ACCTTYPE"</span>, <span class="stringliteral">"CMA"</span> );
<a name="l00168"></a>00168
<a name="l00169"></a>00169 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> payeeTag(<span class="stringliteral">"PAYEE"</span>);
<a name="l00170"></a>00170 payeeTag.Add( <span class="stringliteral">"NAME"</span>, m_payee.name );
<a name="l00171"></a>00171 payeeTag.Add( <span class="stringliteral">"ADDR1"</span>, m_payee.address1 );
<a name="l00172"></a>00172 payeeTag.Add( <span class="stringliteral">"CITY"</span>, m_payee.city );
<a name="l00173"></a>00173 payeeTag.Add( <span class="stringliteral">"STATE"</span>, m_payee.state );
<a name="l00174"></a>00174 payeeTag.Add( <span class="stringliteral">"POSTALCODE"</span>, m_payee.postalcode );
<a name="l00175"></a>00175 payeeTag.Add( <span class="stringliteral">"PHONE"</span>, m_payee.phone );
<a name="l00176"></a>00176
<a name="l00177"></a>00177 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> pmtinfoTag(<span class="stringliteral">"PMTINFO"</span>);
<a name="l00178"></a>00178 pmtinfoTag.Add( bankacctfromTag );
<a name="l00179"></a>00179 pmtinfoTag.Add( <span class="stringliteral">"TRNAMT"</span>, m_payment.amount );
<a name="l00180"></a>00180 pmtinfoTag.Add( payeeTag );
<a name="l00181"></a>00181 pmtinfoTag.Add( <span class="stringliteral">"PAYACCT"</span>, m_payment.account );
<a name="l00182"></a>00182 pmtinfoTag.Add( <span class="stringliteral">"DTDUE"</span>, m_payment.datedue );
<a name="l00183"></a>00183 pmtinfoTag.Add( <span class="stringliteral">"MEMO"</span>, m_payment.memo );
<a name="l00184"></a>00184
<a name="l00185"></a>00185 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> pmtrqTag(<span class="stringliteral">"PMTRQ"</span>);
<a name="l00186"></a>00186 pmtrqTag.Add( pmtinfoTag );
<a name="l00187"></a>00187
<a name="l00188"></a>00188 Add( RequestMessage(<span class="stringliteral">"BILLPAY"</span>,<span class="stringliteral">"PMT"</span>, pmtrqTag) );
<a name="l00189"></a>00189 }
<a name="l00190"></a>00190
<a name="l00191"></a><a class="code" href="fx-0_88_82_2lib_2ofx__request__statement_8cpp.html#b9b42a433677da688d0f9f37d9da24d1">00191</a> <a class="code" href="inc_2libofx_8h.html#47f3130aac7543264fac840fb657cc3d">CFCT</a> <span class="keywordtype">char</span>* <a class="code" href="inc_2libofx_8h.html#b9b42a433677da688d0f9f37d9da24d1">libofx_request_payment_status</a>( <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structOfxFiLogin.html" title="Information sufficient to log into an financial institution.">OfxFiLogin</a>* login, <span class="keyword">const</span> <span class="keywordtype">char</span>* transactionid )
<a name="l00192"></a>00192 {
<a name="l00193"></a>00193 <span class="preprocessor">#if 0</span>
<a name="l00194"></a>00194 <span class="preprocessor"></span> <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> pmtinqrqTag( <span class="stringliteral">"PMTINQRQ"</span> );
<a name="l00195"></a>00195 pmtinqrqTag.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">"SRVRTID"</span>, transactionid );
<a name="l00196"></a>00196
<a name="l00197"></a>00197 <a class="code" href="classOfxRequest.html" title="A generic request.">OfxRequest</a> ofx(*login);
<a name="l00198"></a>00198 ofx.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( ofx.<a class="code" href="classOfxRequest.html#b653f985a56f4cff3e87a82c700f4450">SignOnRequest</a>() );
<a name="l00199"></a>00199 ofx.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( ofx.<a class="code" href="classOfxRequest.html#e56ceb8ef12b9431dcd4d63eec60a377">RequestMessage</a>(<span class="stringliteral">"BILLPAY"</span>,<span class="stringliteral">"PMTINQ"</span>, pmtinqrqTag) );
<a name="l00200"></a>00200
<a name="l00201"></a>00201 <span class="keywordtype">string</span> request = <a class="code" href="ofx__request_8cpp.html#38a94b99f351615ee7a342f409db8499">OfxHeader</a>() + ofx.<a class="code" href="classOfxAggregate.html#b430ce663510ff8eea83bbe0e3bedf6d">Output</a>();
<a name="l00202"></a>00202
<a name="l00203"></a>00203 <span class="keywordtype">unsigned</span> size = request.size();
<a name="l00204"></a>00204 <span class="keywordtype">char</span>* result = (<span class="keywordtype">char</span>*)malloc(size + 1);
<a name="l00205"></a>00205 request.copy(result,size);
<a name="l00206"></a>00206 result[size] = 0;
<a name="l00207"></a>00207 <span class="preprocessor">#else</span>
<a name="l00208"></a>00208 <span class="preprocessor"></span> <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> payeesyncrq( <span class="stringliteral">"PAYEESYNCRQ"</span> );
<a name="l00209"></a>00209 payeesyncrq.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">"TOKEN"</span>, <span class="stringliteral">"0"</span> );
<a name="l00210"></a>00210 payeesyncrq.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">"TOKENONLY"</span>, <span class="stringliteral">"N"</span> );
<a name="l00211"></a>00211 payeesyncrq.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">"REFRESH"</span>, <span class="stringliteral">"Y"</span> );
<a name="l00212"></a>00212 payeesyncrq.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">"REJECTIFMISSING"</span>, <span class="stringliteral">"N"</span> );
<a name="l00213"></a>00213
<a name="l00214"></a>00214 <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> message( <span class="stringliteral">"BILLPAYMSGSRQV1"</span> );
<a name="l00215"></a>00215 message.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( payeesyncrq );
<a name="l00216"></a>00216
<a name="l00217"></a>00217 <a class="code" href="classOfxRequest.html" title="A generic request.">OfxRequest</a> ofx(*login);
<a name="l00218"></a>00218 ofx.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( ofx.<a class="code" href="classOfxRequest.html#b653f985a56f4cff3e87a82c700f4450">SignOnRequest</a>() );
<a name="l00219"></a>00219 ofx.<a class="code" href="classOfxAggregate.html#5abc7ac34d575eaecde5f16310c766b8">Add</a>( message );
<a name="l00220"></a>00220
<a name="l00221"></a>00221 <span class="keywordtype">string</span> request = <a class="code" href="ofx__request_8cpp.html#38a94b99f351615ee7a342f409db8499">OfxHeader</a>() + ofx.<a class="code" href="classOfxAggregate.html#b430ce663510ff8eea83bbe0e3bedf6d">Output</a>();
<a name="l00222"></a>00222
<a name="l00223"></a>00223 <span class="keywordtype">unsigned</span> size = request.size();
<a name="l00224"></a>00224 <span class="keywordtype">char</span>* result = (<span class="keywordtype">char</span>*)malloc(size + 1);
<a name="l00225"></a>00225 request.copy(result,size);
<a name="l00226"></a>00226 result[size] = 0;
<a name="l00227"></a>00227
<a name="l00228"></a>00228 <span class="preprocessor">#endif</span>
<a name="l00229"></a>00229 <span class="preprocessor"></span> <span class="keywordflow">return</span> result;
<a name="l00230"></a>00230 }
<a name="l00231"></a>00231
<a name="l00232"></a>00232 <span class="comment">// vim:cin:si:ai:et:ts=2:sw=2:</span>
<a name="l00233"></a>00233
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Mon Nov 19 20:27:59 2007 for LibOFX by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>
|