LibOFX

ofx_request_accountinfo.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 ofx_request_accountinfo.cpp
3 -------------------
4 copyright : (C) 2005 by Ace Jones
5 email : acejones@users.sourceforge.net
6 ***************************************************************************/
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
19
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23
24 #include <cstdlib>
25 #include <string>
26 #include "libofx.h"
27 #include "ofx_request_accountinfo.hh"
28
29 using namespace std;
30
31 char* libofx_request_accountinfo( const OfxFiLogin* login )
32 {
33 OfxAccountInfoRequest strq( *login );
34 string request = OfxHeader(login->header_version) + strq.Output();
35
36 unsigned size = request.size();
37 char* result = (char*)malloc(size + 1);
38 request.copy(result, size);
39 result[size] = 0;
40
41 return result;
42 }
43
44 /*
45 <OFX>
46 <SIGNONMSGSRQV1>
47 <SONRQ>
48 <DTCLIENT>20050417210306
49 <USERID>GnuCash
50 <USERPASS>gcash
51 <LANGUAGE>ENG
52 <FI>
53 <ORG>ReferenceFI
54 <FID>00000
55 </FI>
56 <APPID>QWIN
57 <APPVER>1100
58 </SONRQ>
59 </SIGNONMSGSRQV1>
60
61 <SIGNUPMSGSRQV1>
62 <ACCTINFOTRNRQ>
63 <TRNUID>FFAAA4AA-A9B1-47F4-98E9-DE635EB41E77
64 <CLTCOOKIE>4
65
66 <ACCTINFORQ>
67 <DTACCTUP>19700101000000
68 </ACCTINFORQ>
69
70 </ACCTINFOTRNRQ>
71 </SIGNUPMSGSRQV1>
72 </OFX>
73 */
74
75 OfxAccountInfoRequest::OfxAccountInfoRequest( const OfxFiLogin& fi ):
76 OfxRequest(fi)
77 {
78 Add( SignOnRequest() );
79
80 OfxAggregate acctinforqTag("ACCTINFORQ");
81 acctinforqTag.Add( "DTACCTUP", time_t_to_ofxdate( 0 ) );
82 Add ( RequestMessage("SIGNUP", "ACCTINFO", acctinforqTag) );
83 }
std
OfxAccountInfoRequest
An account information request.
Definition: ofx_request_accountinfo.hh:37
libofx_request_accountinfo
char * libofx_request_accountinfo(const struct OfxFiLogin *login)
Creates an OFX account info (list) request in string form.
OfxRequest
A generic request.
Definition: ofx_request.hh:36
OfxAggregate
A single aggregate as described in the OFX 1.02 specification.
Definition: ofx_aggregate.hh:42
OfxRequest::RequestMessage
OfxAggregate RequestMessage(const string &msgtype, const string &trntype, const OfxAggregate &aggregate) const
Definition: ofx_request.cpp:115
ofx_request_accountinfo.hh
Declaration of OfxRequestAccountInfo create an OFX file containing a request for all account info at ...
OfxAggregate::Add
void Add(const string &tag, const string &data)
Definition: ofx_aggregate.hh:59
OfxAccountInfoRequest::OfxAccountInfoRequest
OfxAccountInfoRequest(const OfxFiLogin &fi)
Definition: ofx_request_accountinfo.cpp:75
OfxRequest::SignOnRequest
OfxAggregate SignOnRequest(void) const
Definition: ofx_request.cpp:84
OfxFiLogin
Information sufficient to log into an financial institution.
Definition: inc/libofx.h:806