File: ofx_request_accountinfo.cpp

package info (click to toggle)
libofx 1%3A0.9.10-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 11,128 kB
  • sloc: sh: 11,428; cpp: 6,242; ansic: 2,459; makefile: 170; xml: 61
file content (83 lines) | stat: -rw-r--r-- 2,285 bytes parent folder | download | duplicates (6)
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
/***************************************************************************
         ofx_request_accountinfo.cpp
                             -------------------
    copyright            : (C) 2005 by Ace Jones
    email                : acejones@users.sourceforge.net
***************************************************************************/
/**@file
 * \brief Implementation of libofx_request_accountinfo to create an OFX file
 *   containing a request for all account info at this FI for this user.
*/
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <cstdlib>
#include <string>
#include "libofx.h"
#include "ofx_request_accountinfo.hh"

using namespace std;

char* libofx_request_accountinfo( const OfxFiLogin* login )
{
  OfxAccountInfoRequest strq( *login );
  string request = OfxHeader(login->header_version) + strq.Output();

  unsigned size = request.size();
  char* result = (char*)malloc(size + 1);
  request.copy(result, size);
  result[size] = 0;

  return result;
}

/*
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20050417210306
<USERID>GnuCash
<USERPASS>gcash
<LANGUAGE>ENG
<FI>
<ORG>ReferenceFI
<FID>00000
</FI>
<APPID>QWIN
<APPVER>1100
</SONRQ>
</SIGNONMSGSRQV1>

<SIGNUPMSGSRQV1>
<ACCTINFOTRNRQ>
<TRNUID>FFAAA4AA-A9B1-47F4-98E9-DE635EB41E77
<CLTCOOKIE>4

<ACCTINFORQ>
<DTACCTUP>19700101000000
</ACCTINFORQ>

</ACCTINFOTRNRQ>
</SIGNUPMSGSRQV1>
</OFX>
*/

OfxAccountInfoRequest::OfxAccountInfoRequest( const OfxFiLogin& fi ):
  OfxRequest(fi)
{
  Add( SignOnRequest() );

  OfxAggregate acctinforqTag("ACCTINFORQ");
  acctinforqTag.Add( "DTACCTUP", time_t_to_ofxdate( 0 ) );
  Add ( RequestMessage("SIGNUP", "ACCTINFO", acctinforqTag) );
}