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 char* libofx_request_accountinfo( const OfxFiLogin* login )
30 {
31 OfxAccountInfoRequest strq( *login );
32 std::string request = OfxHeader(login->header_version) + strq.Output();
33
34 unsigned size = request.size();
35 char* result = (char*)malloc(size + 1);
36 request.copy(result, size);
37 result[size] = 0;
38
39 return result;
40 }
41
42 /*
43 <OFX>
44 <SIGNONMSGSRQV1>
45 <SONRQ>
46 <DTCLIENT>20050417210306
47 <USERID>GnuCash
48 <USERPASS>gcash
49 <LANGUAGE>ENG
50 <FI>
51 <ORG>ReferenceFI
52 <FID>00000
53 </FI>
54 <APPID>QWIN
55 <APPVER>1100
56 </SONRQ>
57 </SIGNONMSGSRQV1>
58
59 <SIGNUPMSGSRQV1>
60 <ACCTINFOTRNRQ>
61 <TRNUID>FFAAA4AA-A9B1-47F4-98E9-DE635EB41E77
62 <CLTCOOKIE>4
63
64 <ACCTINFORQ>
65 <DTACCTUP>19700101000000
66 </ACCTINFORQ>
67
68 </ACCTINFOTRNRQ>
69 </SIGNUPMSGSRQV1>
70 </OFX>
71 */
72
73 OfxAccountInfoRequest::OfxAccountInfoRequest( const OfxFiLogin& fi ):
74 OfxRequest(fi)
75 {
76 Add( SignOnRequest() );
77
78 OfxAggregate acctinforqTag("ACCTINFORQ");
79 acctinforqTag.Add( "DTACCTUP", time_t_to_ofxdate( 0 ) );
80 Add ( RequestMessage("SIGNUP", "ACCTINFO", acctinforqTag) );
81 }
OfxAggregate::Add
void Add(const std::string &tag, const std::string &data)
Definition: ofx_aggregate.hh:64
ofx_request_accountinfo.hh
Declaration of OfxRequestAccountInfo create an OFX file containing a request for all account info at ...
OfxRequest::RequestMessage
OfxAggregate RequestMessage(const std::string &msgtype, const std::string &trntype, const OfxAggregate &aggregate) const
Definition: ofx_request.cpp:113
OfxRequest::SignOnRequest
OfxAggregate SignOnRequest(void) const
Definition: ofx_request.cpp:82
OfxAccountInfoRequest
An account information request.
Definition: ofx_request_accountinfo.hh:34
OfxFiLogin
Information sufficient to log into an financial institution.
Definition: inc/libofx.h:1383
OfxAggregate
A single aggregate as described in the OFX 1.02 specification.
Definition: ofx_aggregate.hh:40
OfxRequest
A generic request.
Definition: ofx_request.hh:34
libofx_request_accountinfo
char * libofx_request_accountinfo(const struct OfxFiLogin *login)
Creates an OFX account info (list) request in string form.
OfxAccountInfoRequest::OfxAccountInfoRequest
OfxAccountInfoRequest(const OfxFiLogin &fi)
Definition: ofx_request_accountinfo.cpp:73