Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 2c293755396b61d5feb669b6e142f13b > files > 187

lib64ofx-devel-0.9.9-2.mga4.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>LibOFX: ofx_request_statement.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">LibOFX</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('ofx__request__statement_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">ofx_request_statement.cpp</div>  </div>
</div>
<div class="contents">
<a href="ofx__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 &lt;config.h&gt;</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 &lt;cstdlib&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;libofx.h&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="ofx__utilities_8hh.html" title="Various simple functions for type conversion &amp; al.">ofx_utilities.hh</a>&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;<a class="code" href="ofx__request__statement_8hh.html" title="Declaration of libofx_request_statement to create an OFX file containing a request for a statement...">ofx_request_statement.hh</a>&quot;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="keyword">using namespace </span>std;
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="keywordtype">char</span>* <a class="code" href="inc_2libofx_8h.html#ab42403a95d9a15edbce0240a5cad4dfe" 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="l00033"></a>00033 {
<a name="l00034"></a>00034   <a class="code" href="classOfxStatementRequest.html" title="A statement request.">OfxStatementRequest</a> strq( *login, *account, date_from );
<a name="l00035"></a>00035   <span class="keywordtype">string</span> request = OfxHeader(login-&gt;header_version) + strq.Output();
<a name="l00036"></a>00036 
<a name="l00037"></a>00037   <span class="keywordtype">unsigned</span> size = request.size();
<a name="l00038"></a>00038   <span class="keywordtype">char</span>* result = (<span class="keywordtype">char</span>*)malloc(size + 1);
<a name="l00039"></a>00039   request.copy(result, size);
<a name="l00040"></a>00040   result[size] = 0;
<a name="l00041"></a>00041 
<a name="l00042"></a>00042   <span class="keywordflow">return</span> result;
<a name="l00043"></a>00043 }
<a name="l00044"></a>00044 
<a name="l00045"></a><a class="code" href="classOfxStatementRequest.html#a26f2cb4111c3965436129c2bdfbf678b">00045</a> <a class="code" href="classOfxStatementRequest.html#a26f2cb4111c3965436129c2bdfbf678b">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>&amp; fi, <span class="keyword">const</span> <a class="code" href="structOfxAccountData.html" title="An abstraction of an account.">OfxAccountData</a>&amp; account, time_t from ):
<a name="l00046"></a>00046   <a class="code" href="classOfxRequest.html" title="A generic request.">OfxRequest</a>(fi),
<a name="l00047"></a>00047   m_account(account),
<a name="l00048"></a>00048   m_date_from(from)
<a name="l00049"></a>00049 {
<a name="l00050"></a>00050   <a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <a class="code" href="classOfxRequest.html#ab653f985a56f4cff3e87a82c700f4450">SignOnRequest</a>() );
<a name="l00051"></a>00051 
<a name="l00052"></a>00052   <span class="keywordflow">if</span> ( account.account_type == account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284aef7a40d4a94b79cb30e36e9d2d767446">OFX_CREDITCARD</a> )
<a name="l00053"></a>00053     <a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>(<a class="code" href="classOfxStatementRequest.html#a721c88927e57c1bc189b3e4b9410690d">CreditCardStatementRequest</a>());
<a name="l00054"></a>00054   <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( account.account_type == account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a71412f0985b2443ef3cf35dc131c227a">OFX_INVESTMENT</a> )
<a name="l00055"></a>00055     <a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>(<a class="code" href="classOfxStatementRequest.html#ac3df87c5377e4d0d6f5944010527bea4">InvestmentStatementRequest</a>());
<a name="l00056"></a>00056   <span class="keywordflow">else</span>
<a name="l00057"></a>00057     <a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>(<a class="code" href="classOfxStatementRequest.html#a42f8752cca60b057325785563d67e92f">BankStatementRequest</a>());
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059 
<a name="l00060"></a><a class="code" href="classOfxStatementRequest.html#a42f8752cca60b057325785563d67e92f">00060</a> <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#a42f8752cca60b057325785563d67e92f">OfxStatementRequest::BankStatementRequest</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00061"></a>00061 <span class="keyword"></span>{
<a name="l00062"></a>00062   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> bankacctfromTag(<span class="stringliteral">&quot;BANKACCTFROM&quot;</span>);
<a name="l00063"></a>00063   bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;BANKID&quot;</span>, m_account.<a class="code" href="structOfxAccountData.html#ae7f1e1e41cb6c19ca9a4bdee2b6d3c3b">bank_id</a> );
<a name="l00064"></a>00064   bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTID&quot;</span>, m_account.<a class="code" href="structOfxAccountData.html#ab7a689ab5977bd72653046449534f7f7">account_number</a> );
<a name="l00065"></a>00065   <span class="keywordflow">if</span> ( m_account.account_type ==  m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a32212e64e77d0f487d8ac7078204a56c">OFX_CHECKING</a> )
<a name="l00066"></a>00066     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;CHECKING&quot;</span> );
<a name="l00067"></a>00067   <span class="keywordflow">else</span> <span class="keywordflow">if</span>  ( m_account.account_type == m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a20ea5732b04980ca296c6c25673bd324">OFX_SAVINGS</a> )
<a name="l00068"></a>00068     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;SAVINGS&quot;</span> );
<a name="l00069"></a>00069   <span class="keywordflow">else</span> <span class="keywordflow">if</span>  ( m_account.account_type == m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a7c19e4fda38aeb2ee1120be2a638d28d">OFX_MONEYMRKT</a> )
<a name="l00070"></a>00070     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;MONEYMRKT&quot;</span> );
<a name="l00071"></a>00071   <span class="keywordflow">else</span> <span class="keywordflow">if</span>  ( m_account.account_type == m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a9a7eac1e4fc43f03821fc6c42d468a71">OFX_CREDITLINE</a> )
<a name="l00072"></a>00072     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;CREDITLINE&quot;</span> );
<a name="l00073"></a>00073   <span class="keywordflow">else</span> <span class="keywordflow">if</span>  ( m_account.account_type == m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a381147bb1b704c18f716cf7fa318f72d">OFX_CMA</a> )
<a name="l00074"></a>00074     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;CMA&quot;</span> );
<a name="l00075"></a>00075 
<a name="l00076"></a>00076   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> inctranTag(<span class="stringliteral">&quot;INCTRAN&quot;</span>);
<a name="l00077"></a>00077   inctranTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;DTSTART&quot;</span>, time_t_to_ofxdate( m_date_from ) );
<a name="l00078"></a>00078   inctranTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;INCLUDE&quot;</span>, <span class="stringliteral">&quot;Y&quot;</span> );
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> stmtrqTag(<span class="stringliteral">&quot;STMTRQ&quot;</span>);
<a name="l00081"></a>00081   stmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( bankacctfromTag );
<a name="l00082"></a>00082   stmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( inctranTag );
<a name="l00083"></a>00083 
<a name="l00084"></a>00084   <span class="keywordflow">return</span> <a class="code" href="classOfxRequest.html#ae56ceb8ef12b9431dcd4d63eec60a377">RequestMessage</a>(<span class="stringliteral">&quot;BANK&quot;</span>, <span class="stringliteral">&quot;STMT&quot;</span>, stmtrqTag);
<a name="l00085"></a>00085 }
<a name="l00086"></a>00086 
<a name="l00087"></a><a class="code" href="classOfxStatementRequest.html#a721c88927e57c1bc189b3e4b9410690d">00087</a> <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#a721c88927e57c1bc189b3e4b9410690d">OfxStatementRequest::CreditCardStatementRequest</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00088"></a>00088 <span class="keyword"></span>{
<a name="l00089"></a>00089   <span class="comment">/*</span>
<a name="l00090"></a>00090 <span class="comment">   QString dtstart_string = _dtstart.toString(Qt::ISODate).remove(QRegExp(&quot;[^0-9]&quot;));</span>
<a name="l00091"></a>00091 <span class="comment"></span>
<a name="l00092"></a>00092 <span class="comment">   return message(&quot;CREDITCARD&quot;,&quot;CCSTMT&quot;,Tag(&quot;CCSTMTRQ&quot;)</span>
<a name="l00093"></a>00093 <span class="comment">     .subtag(Tag(&quot;CCACCTFROM&quot;).element(&quot;ACCTID&quot;,accountnum()))</span>
<a name="l00094"></a>00094 <span class="comment">     .subtag(Tag(&quot;INCTRAN&quot;).element(&quot;DTSTART&quot;,dtstart_string).element(&quot;INCLUDE&quot;,&quot;Y&quot;)));</span>
<a name="l00095"></a>00095 <span class="comment">  }</span>
<a name="l00096"></a>00096 <span class="comment">  */</span>
<a name="l00097"></a>00097   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> ccacctfromTag(<span class="stringliteral">&quot;CCACCTFROM&quot;</span>);
<a name="l00098"></a>00098   ccacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTID&quot;</span>, m_account.<a class="code" href="structOfxAccountData.html#ab7a689ab5977bd72653046449534f7f7">account_number</a> );
<a name="l00099"></a>00099 
<a name="l00100"></a>00100   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> inctranTag(<span class="stringliteral">&quot;INCTRAN&quot;</span>);
<a name="l00101"></a>00101   inctranTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;DTSTART&quot;</span>, time_t_to_ofxdate( m_date_from ) );
<a name="l00102"></a>00102   inctranTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;INCLUDE&quot;</span>, <span class="stringliteral">&quot;Y&quot;</span> );
<a name="l00103"></a>00103 
<a name="l00104"></a>00104   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> ccstmtrqTag(<span class="stringliteral">&quot;CCSTMTRQ&quot;</span>);
<a name="l00105"></a>00105   ccstmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( ccacctfromTag );
<a name="l00106"></a>00106   ccstmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( inctranTag );
<a name="l00107"></a>00107 
<a name="l00108"></a>00108   <span class="keywordflow">return</span> <a class="code" href="classOfxRequest.html#ae56ceb8ef12b9431dcd4d63eec60a377">RequestMessage</a>(<span class="stringliteral">&quot;CREDITCARD&quot;</span>, <span class="stringliteral">&quot;CCSTMT&quot;</span>, ccstmtrqTag);
<a name="l00109"></a>00109 }
<a name="l00110"></a>00110 
<a name="l00111"></a><a class="code" href="classOfxStatementRequest.html#ac3df87c5377e4d0d6f5944010527bea4">00111</a> <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#ac3df87c5377e4d0d6f5944010527bea4">OfxStatementRequest::InvestmentStatementRequest</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00112"></a>00112 <span class="keyword"></span>{
<a name="l00113"></a>00113   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> invacctfromTag(<span class="stringliteral">&quot;INVACCTFROM&quot;</span>);
<a name="l00114"></a>00114 
<a name="l00115"></a>00115   invacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;BROKERID&quot;</span>, m_account.broker_id );
<a name="l00116"></a>00116   invacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTID&quot;</span>, m_account.<a class="code" href="structOfxAccountData.html#ab7a689ab5977bd72653046449534f7f7">account_number</a> );
<a name="l00117"></a>00117 
<a name="l00118"></a>00118   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> inctranTag(<span class="stringliteral">&quot;INCTRAN&quot;</span>);
<a name="l00119"></a>00119   inctranTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;DTSTART&quot;</span>, time_t_to_ofxdate( m_date_from ) );
<a name="l00120"></a>00120   inctranTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;INCLUDE&quot;</span>, <span class="stringliteral">&quot;Y&quot;</span> );
<a name="l00121"></a>00121 
<a name="l00122"></a>00122   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> incposTag(<span class="stringliteral">&quot;INCPOS&quot;</span>);
<a name="l00123"></a>00123   incposTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;DTASOF&quot;</span>, time_t_to_ofxdatetime( time(NULL) ) );
<a name="l00124"></a>00124   incposTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;INCLUDE&quot;</span>, <span class="stringliteral">&quot;Y&quot;</span> );
<a name="l00125"></a>00125 
<a name="l00126"></a>00126   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> invstmtrqTag(<span class="stringliteral">&quot;INVSTMTRQ&quot;</span>);
<a name="l00127"></a>00127   invstmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( invacctfromTag );
<a name="l00128"></a>00128   invstmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( inctranTag );
<a name="l00129"></a>00129   invstmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;INCOO&quot;</span>, <span class="stringliteral">&quot;Y&quot;</span> );
<a name="l00130"></a>00130   invstmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( incposTag );
<a name="l00131"></a>00131   invstmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;INCBAL&quot;</span>, <span class="stringliteral">&quot;Y&quot;</span> );
<a name="l00132"></a>00132 
<a name="l00133"></a>00133   <span class="keywordflow">return</span> <a class="code" href="classOfxRequest.html#ae56ceb8ef12b9431dcd4d63eec60a377">RequestMessage</a>(<span class="stringliteral">&quot;INVSTMT&quot;</span>, <span class="stringliteral">&quot;INVSTMT&quot;</span>, invstmtrqTag);
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135 
<a name="l00136"></a>00136 <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="l00137"></a>00137 {
<a name="l00138"></a>00138   <a class="code" href="classOfxPaymentRequest.html">OfxPaymentRequest</a> strq( *login, *account, *payee, *payment );
<a name="l00139"></a>00139   <span class="keywordtype">string</span> request = OfxHeader(login-&gt;header_version) + strq.Output();
<a name="l00140"></a>00140 
<a name="l00141"></a>00141   <span class="keywordtype">unsigned</span> size = request.size();
<a name="l00142"></a>00142   <span class="keywordtype">char</span>* result = (<span class="keywordtype">char</span>*)malloc(size + 1);
<a name="l00143"></a>00143   request.copy(result, size);
<a name="l00144"></a>00144   result[size] = 0;
<a name="l00145"></a>00145 
<a name="l00146"></a>00146   <span class="keywordflow">return</span> result;
<a name="l00147"></a>00147 }
<a name="l00148"></a>00148 
<a name="l00149"></a><a class="code" href="classOfxPaymentRequest.html#ace1a35797c9b4d7a81f6cc43870bc909">00149</a> <a class="code" href="classOfxPaymentRequest.html#ace1a35797c9b4d7a81f6cc43870bc909">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>&amp; fi, <span class="keyword">const</span> <a class="code" href="structOfxAccountData.html" title="An abstraction of an account.">OfxAccountData</a>&amp; account, <span class="keyword">const</span> <a class="code" href="structOfxPayee.html">OfxPayee</a>&amp; payee, <span class="keyword">const</span> <a class="code" href="structOfxPayment.html">OfxPayment</a>&amp; payment ):
<a name="l00150"></a>00150   <a class="code" href="classOfxRequest.html" title="A generic request.">OfxRequest</a>(fi),
<a name="l00151"></a>00151   m_account(account),
<a name="l00152"></a>00152   m_payee(payee),
<a name="l00153"></a>00153   m_payment(payment)
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155   <a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <a class="code" href="classOfxRequest.html#ab653f985a56f4cff3e87a82c700f4450">SignOnRequest</a>() );
<a name="l00156"></a>00156 
<a name="l00157"></a>00157   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> bankacctfromTag(<span class="stringliteral">&quot;BANKACCTFROM&quot;</span>);
<a name="l00158"></a>00158   bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;BANKID&quot;</span>, m_account.<a class="code" href="structOfxAccountData.html#ae7f1e1e41cb6c19ca9a4bdee2b6d3c3b">bank_id</a> );
<a name="l00159"></a>00159   bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTID&quot;</span>, m_account.<a class="code" href="structOfxAccountData.html#ab7a689ab5977bd72653046449534f7f7">account_number</a> );
<a name="l00160"></a>00160   <span class="keywordflow">if</span> ( m_account.account_type == m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a32212e64e77d0f487d8ac7078204a56c">OFX_CHECKING</a>)
<a name="l00161"></a>00161     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;CHECKING&quot;</span> );
<a name="l00162"></a>00162   <span class="keywordflow">else</span> <span class="keywordflow">if</span>  ( m_account.account_type == m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a20ea5732b04980ca296c6c25673bd324">OFX_SAVINGS</a> )
<a name="l00163"></a>00163     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;SAVINGS&quot;</span> );
<a name="l00164"></a>00164   <span class="keywordflow">else</span> <span class="keywordflow">if</span>  ( m_account.account_type == m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a7c19e4fda38aeb2ee1120be2a638d28d">OFX_MONEYMRKT</a> )
<a name="l00165"></a>00165     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;MONEYMRKT&quot;</span> );
<a name="l00166"></a>00166   <span class="keywordflow">else</span> <span class="keywordflow">if</span>  ( m_account.account_type ==  m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a9a7eac1e4fc43f03821fc6c42d468a71">OFX_CREDITLINE</a> )
<a name="l00167"></a>00167     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;CREDITLINE&quot;</span> );
<a name="l00168"></a>00168   <span class="keywordflow">else</span> <span class="keywordflow">if</span>  ( m_account.account_type == m_account.<a class="code" href="structOfxAccountData.html#a3835390f3072fc32736780f44ab10284a381147bb1b704c18f716cf7fa318f72d">OFX_CMA</a> )
<a name="l00169"></a>00169     bankacctfromTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ACCTTYPE&quot;</span>, <span class="stringliteral">&quot;CMA&quot;</span> );
<a name="l00170"></a>00170 
<a name="l00171"></a>00171   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> payeeTag(<span class="stringliteral">&quot;PAYEE&quot;</span>);
<a name="l00172"></a>00172   payeeTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;NAME&quot;</span>, m_payee.name );
<a name="l00173"></a>00173   payeeTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;ADDR1&quot;</span>, m_payee.address1 );
<a name="l00174"></a>00174   payeeTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;CITY&quot;</span>, m_payee.city );
<a name="l00175"></a>00175   payeeTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;STATE&quot;</span>, m_payee.state );
<a name="l00176"></a>00176   payeeTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;POSTALCODE&quot;</span>, m_payee.postalcode );
<a name="l00177"></a>00177   payeeTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;PHONE&quot;</span>, m_payee.phone );
<a name="l00178"></a>00178 
<a name="l00179"></a>00179   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> pmtinfoTag(<span class="stringliteral">&quot;PMTINFO&quot;</span>);
<a name="l00180"></a>00180   pmtinfoTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( bankacctfromTag );
<a name="l00181"></a>00181   pmtinfoTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;TRNAMT&quot;</span>, m_payment.amount );
<a name="l00182"></a>00182   pmtinfoTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( payeeTag );
<a name="l00183"></a>00183   pmtinfoTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;PAYACCT&quot;</span>, m_payment.account );
<a name="l00184"></a>00184   pmtinfoTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;DTDUE&quot;</span>, m_payment.datedue );
<a name="l00185"></a>00185   pmtinfoTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <span class="stringliteral">&quot;MEMO&quot;</span>, m_payment.memo );
<a name="l00186"></a>00186 
<a name="l00187"></a>00187   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> pmtrqTag(<span class="stringliteral">&quot;PMTRQ&quot;</span>);
<a name="l00188"></a>00188   pmtrqTag.<a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( pmtinfoTag );
<a name="l00189"></a>00189 
<a name="l00190"></a>00190   <a class="code" href="classOfxAggregate.html#a5abc7ac34d575eaecde5f16310c766b8">Add</a>( <a class="code" href="classOfxRequest.html#ae56ceb8ef12b9431dcd4d63eec60a377">RequestMessage</a>(<span class="stringliteral">&quot;BILLPAY&quot;</span>, <span class="stringliteral">&quot;PMT&quot;</span>, pmtrqTag) );
<a name="l00191"></a>00191 }
<a name="l00192"></a>00192 
<a name="l00193"></a>00193 <span class="keywordtype">char</span>* libofx_request_payment_status( <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="l00194"></a>00194 {
<a name="l00195"></a>00195 <span class="preprocessor">#if 0</span>
<a name="l00196"></a>00196 <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">&quot;PMTINQRQ&quot;</span> );
<a name="l00197"></a>00197   pmtinqrqTag.Add( <span class="stringliteral">&quot;SRVRTID&quot;</span>, transactionid );
<a name="l00198"></a>00198 
<a name="l00199"></a>00199   <a class="code" href="classOfxRequest.html" title="A generic request.">OfxRequest</a> ofx(*login);
<a name="l00200"></a>00200   ofx.Add( ofx.SignOnRequest() );
<a name="l00201"></a>00201   ofx.Add( ofx.RequestMessage(<span class="stringliteral">&quot;BILLPAY&quot;</span>, <span class="stringliteral">&quot;PMTINQ&quot;</span>, pmtinqrqTag) );
<a name="l00202"></a>00202 
<a name="l00203"></a>00203   <span class="keywordtype">string</span> request = OfxHeader() + ofx.Output();
<a name="l00204"></a>00204 
<a name="l00205"></a>00205   <span class="keywordtype">unsigned</span> size = request.size();
<a name="l00206"></a>00206   <span class="keywordtype">char</span>* result = (<span class="keywordtype">char</span>*)malloc(size + 1);
<a name="l00207"></a>00207   request.copy(result, size);
<a name="l00208"></a>00208   result[size] = 0;
<a name="l00209"></a>00209 <span class="preprocessor">#else</span>
<a name="l00210"></a>00210 <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">&quot;PAYEESYNCRQ&quot;</span> );
<a name="l00211"></a>00211   payeesyncrq.Add( <span class="stringliteral">&quot;TOKEN&quot;</span>, <span class="stringliteral">&quot;0&quot;</span> );
<a name="l00212"></a>00212   payeesyncrq.Add( <span class="stringliteral">&quot;TOKENONLY&quot;</span>, <span class="stringliteral">&quot;N&quot;</span> );
<a name="l00213"></a>00213   payeesyncrq.Add( <span class="stringliteral">&quot;REFRESH&quot;</span>, <span class="stringliteral">&quot;Y&quot;</span> );
<a name="l00214"></a>00214   payeesyncrq.Add( <span class="stringliteral">&quot;REJECTIFMISSING&quot;</span>, <span class="stringliteral">&quot;N&quot;</span> );
<a name="l00215"></a>00215 
<a name="l00216"></a>00216   <a class="code" href="classOfxAggregate.html" title="A single aggregate as described in the OFX 1.02 specification.">OfxAggregate</a> message( <span class="stringliteral">&quot;BILLPAYMSGSRQV1&quot;</span> );
<a name="l00217"></a>00217   message.Add( payeesyncrq );
<a name="l00218"></a>00218 
<a name="l00219"></a>00219   <a class="code" href="classOfxRequest.html" title="A generic request.">OfxRequest</a> ofx(*login);
<a name="l00220"></a>00220   ofx.Add( ofx.SignOnRequest() );
<a name="l00221"></a>00221   ofx.Add( message );
<a name="l00222"></a>00222 
<a name="l00223"></a>00223   <span class="keywordtype">string</span> request = OfxHeader(login-&gt;header_version) + ofx.Output();
<a name="l00224"></a>00224 
<a name="l00225"></a>00225   <span class="keywordtype">unsigned</span> size = request.size();
<a name="l00226"></a>00226   <span class="keywordtype">char</span>* result = (<span class="keywordtype">char</span>*)malloc(size + 1);
<a name="l00227"></a>00227   request.copy(result, size);
<a name="l00228"></a>00228   result[size] = 0;
<a name="l00229"></a>00229 
<a name="l00230"></a>00230 <span class="preprocessor">#endif</span>
<a name="l00231"></a>00231 <span class="preprocessor"></span>  <span class="keywordflow">return</span> result;
<a name="l00232"></a>00232 }
<a name="l00233"></a>00233 
<a name="l00234"></a>00234 <span class="comment">// vim:cin:si:ai:et:ts=2:sw=2:</span>
<a name="l00235"></a>00235 
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="ofx__request__statement_8cpp.html">ofx_request_statement.cpp</a>      </li>
      <li class="footer">Generated on Wed Apr 17 2013 22:12:00 for LibOFX by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
    </ul>
  </div>

</body>
</html>