[GNC] AQBanking OFX DirectConnect

John Ralls jralls at ceridwen.us
Wed Mar 18 19:34:01 EDT 2020


I did
--- a/src/libs/plugins/backends/aqofxconnect/v1/r_statements.c
+++ b/src/libs/plugins/backends/aqofxconnect/v1/r_statements.c
@@ -77,7 +77,7 @@ int AO_V1_RequestStatements(AB_PROVIDER *pro, AB_USER *u, AB_ACCOUNT *a, AB_TRAN
   }
   GWEN_XMLNode_free(xmlRoot);

-#if 0
+#if 1
   DBG_ERROR(AQOFXCONNECT_LOGDOMAIN, "OFX request:");
   fprintf(stderr, "%s\n", GWEN_Buffer_GetStart(bufRequest));
   GWEN_Text_LogString(GWEN_Buffer_GetStart(bufRequest),
@@ -99,7 +99,7 @@ int AO_V1_RequestStatements(AB_PROVIDER *pro, AB_USER *u, AB_ACCOUNT *a, AB_TRAN
   GWEN_Buffer_free(bufRequest);


-#if 0
+#if 1
   DBG_ERROR(AQOFXCONNECT_LOGDOMAIN, "OFX response:");
   GWEN_Text_LogString(GWEN_Buffer_GetStart(bufResponse),
                       GWEN_Buffer_GetUsedBytes(bufResponse),

to get some more out of the logs. That inserted the exact same string as in ofx.log, which is good, but with GWEN_LOGLEVEL=debug the next bit of the log is
* 15:22:21 ERROR <aqofxconnect> io_network.c:  165: Saving OFX log to "/tmp/ofx.log" ...
7:2020/03/18 15-22-21:gwen(83151):/Users/john/Development/Gnucash-Build/Gnucash-3/src/gwenhywfar-5.2.0/src/parser/urlfns.c:  123: Server: [service2.usaa.com]
7:2020/03/18 15-22-21:gwen(83151):/Users/john/Development/Gnucash-Build/Gnucash-3/src/gwenhywfar-5.2.0/src/parser/urlfns.c:  176: Path: [/ofx/OFXServlet]
7:2020/03/18 15-22-21:gwen(83151):/Users/john/Development/Gnucash-Build/Gnucash-3/src/gwenhywfar-5.2.0/src/parser/urlfns.c:  123: Server: [service2.usaa.com]
7:2020/03/18 15-22-21:gwen(83151):/Users/john/Development/Gnucash-Build/Gnucash-3/src/gwenhywfar-5.2.0/src/parser/urlfns.c:  176: Path: [/ofx/OFXServlet]
7:2020/03/18 15-22-21:gwen(83151):String size is 31
7:2020/03/18 15-22-21:gwen(83151):0000: 50 4f 53 54 20 2f 6f 66 78 2f 4f 46 58 53 65 72 POST /ofx/OFXSer
7:2020/03/18 15-22-21:gwen(83151):0010: 76 6c 65 74 20 48 54 54 50 2f 31 2e 30 0d 0a    vlet HTTP/1.0..
7:2020/03/18 15-22-21:gwen(83151):String size is 159
7:2020/03/18 15-22-21:gwen(83151):0000: 48 6f 73 74 3a 73 65 72 76 69 63 65 32 2e 75 73 Host:service2.us
7:2020/03/18 15-22-21:gwen(83151):0010: 61 61 2e 63 6f 6d 0d 0a 43 6f 6e 6e 65 63 74 69 aa.com..Connecti
7:2020/03/18 15-22-21:gwen(83151):0020: 6f 6e 3a 63 6c 6f 73 65 0d 0a 50 72 61 67 6d 61 on:close..Pragma
7:2020/03/18 15-22-21:gwen(83151):0030: 3a 6e 6f 2d 63 61 63 68 65 0d 0a 43 61 63 68 65 :no-cache..Cache
7:2020/03/18 15-22-21:gwen(83151):0040: 2d 63 6f 6e 74 72 6f 6c 3a 6e 6f 20 63 61 63 68 -control:no cach
7:2020/03/18 15-22-21:gwen(83151):0050: 65 0d 0a 43 6f 6e 74 65 6e 74 2d 74 79 70 65 3a e..Content-type:
7:2020/03/18 15-22-21:gwen(83151):0060: 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 6f 66 application/x-of
7:2020/03/18 15-22-21:gwen(83151):0070: 78 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a 41 71 x..User-Agent:Aq
7:2020/03/18 15-22-21:gwen(83151):0080: 42 61 6e 6b 69 6e 67 0d 0a 43 6f 6e 74 65 6e 74 Banking..Content
7:2020/03/18 15-22-21:gwen(83151):0090: 2d 6c 65 6e 67 74 68 3a 35 37 35 0d 0a 0d 0a    -length:575....
7:2020/03/18 15-22-21:gwen(83151):String size is 25
7:2020/03/18 15-22-21:gwen(83151):0000: 48 54 54 50 2f 31 2e 30 20 34 30 30 20 42 61 64 HTTP/1.0 400 Bad
7:2020/03/18 15-22-21:gwen(83151):0010: 20 52 65 71 75 65 73 74 00                       Request.
:

Should there be two \n\r after the length header and is it supposed to log the request content? Unfortunately Gwen4 doesn't emit anything useful for comparison.

Regards,
John Ralls

> On Mar 18, 2020, at 3:20 PM, John Ralls <jralls at ceridwen.us> wrote:
> 
> Sigh, that's not it either:
> Sending:
> -------------------------------------
> OFXHEADER:100
> DATA:OFXSGML
> VERSION:102
> SECURITY:NONE
> ENCODING:USASCII
> CHARSET:1252
> COMPRESSION:NONE
> OLDFILEUID:NONE
> NEWFILEUID:20200318151247.000
> 
> <OFX><SIGNONMSGSRQV1><SONRQ><DTCLIENT>20200318151243<USERID>XXXXXXXX<USERPASS>XXXXXXXXXX<LANG>ENG<FI><ORG>USAA<FID>24591</FI><APPID>QWIN<APPVER>2300</SONRQ></SIGNONMSGSRQV1><CREDITCARDMSGSRQV1><CCSTMTTRNRQ><TRNUID>20200318151247<CCSTMTRQ><CCACCTFROM><BANKID>24591<ACCTID>XXXXXXXXXXX</CCACCTFROM><INCTRAN><DTSTART>20200309000000<DTEND>20200318000000<INCLUDE>Y</INCTRAN></CCSTMTRQ></CCSTMTTRNRQ></CREDITCARDMSGSRQV1></OFX>
> 
> and a 400.
> 
> Regards,
> John Ralls
> 
> 
>> On Mar 18, 2020, at 3:08 PM, Martin Preuss <martin at aqbanking.de> wrote:
>> 
>> Hi,
>> 
>> hmm, so no linebreaks...
>> 
>> Could either of you please try with the following lines commented out in
>> v1/n_toofx.c:
>> - 105:   if (hasSubTags)
>> - 106:     GWEN_Buffer_AppendString(buf, "\r\n");
>> - 128:   GWEN_Buffer_AppendString(buf, "\r\n");
>> 
>> Will be back in a few mins, have to watch an episode of "Bull" on my
>> wifes request... ;-)
>> 
>> 
>> Regards
>> Martin
>> 
>> 
>> Am 18.03.20 um 23:02 schrieb John Ralls:
>>> Remember, the working ofx from AQB5 is
>>> Sending:
>>> -------------------------------------
>>> OFXHEADER:100
>>> DATA:OFXSGML
>>> VERSION:102
>>> SECURITY:NONE
>>> ENCODING:USASCII
>>> CHARSET:1252
>>> COMPRESSION:NONE
>>> OLDFILEUID:NONE
>>> NEWFILEUID:20200315112517.000
>>> 
>>> <OFX><SIGNONMSGSRQV1><SONRQ><DTCLIENT>20200315112517<USERID>XXXXXXXX
>>> <USERPASS>XXXXXXXX
>>> <LANGUAGE>ENG<FI><ORG>USAA<FID>24591</FI><APPID>QWIN<APPVER>2300</SONRQ></SIGNONMSGSRQV1><CREDITCARDMSGSRQV1><CCSTMTTRNRQ><TRNUID>20200315112517<CLTCOOKIE>1<CCSTMTRQ><CCACCTFROM><ACCTID>XXXXXXXX</CCACCTFROM><INCTRAN><DTSTART>20200314000000<DTEND>20200315112517<INCLUDE>Y</INCTRAN></CCSTMTRQ></CCSTMTTRNRQ></CREDITCARDMSGSRQV1></OFX>
>>> 
>>> 
>>> Regards,
>>> John Ralls
>>> 
>>>> On Mar 18, 2020, at 2:54 PM, Martin Preuss <martin at aqbanking.de> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> please see my other mail (latest GIT).
>>>> 
>>>> Maybe "103" then (I heard of some cases where "103" was necessary)? Or
>>>> perhaps "160"?
>>>> 
>>>> Will fix the gui btw...
>>>> 
>>>> 
>>>> Regards
>>>> Martin
>>>> 
>>>> Am 18.03.20 um 22:50 schrieb Chris Graves:
>>>>> Hi Martin,
>>>>> 
>>>>> The GUI wouldn't let me leave that field blank, so I manually deleted
>>>>> the entry from the .conf file. Running again, it did use the defaults
>>>>> that you specified.  However, still the http 400 error and no response.
>>>>> 
>>>>> Sending:
>>>>> -------------------------------------
>>>>> OFXHEADER:100
>>>>> DATA:OFXSGML
>>>>> VERSION:102
>>>>> SECURITY:NONE
>>>>> ENCODING:USASCII
>>>>> CHARSET:1252
>>>>> COMPRESSION:NONE
>>>>> OLDFILEUID:NONE
>>>>> NEWFILEUID:20200318144035.000
>>>>> 
>>>>> On Wed, Mar 18, 2020 at 2:34 PM Martin Preuss <martin at aqbanking.de
>>>>> <mailto:martin at aqbanking.de>> wrote:
>>>>> 
>>>>>  Hi,
>>>>> 
>>>>>  not ATM, but that can be arranged. However, how about leaving that field
>>>>>  empty in the settings dialog? That should default to 100 for OFXHEADER
>>>>>  and 102 for VERSION (for - ahem - historic reasons, I'm sure I had
>>>>>  good^H^H^H reasons for those mixed defaults... :-})
>>>>> 
>>>>>  Regards
>>>>>  Martin
>>>>> 
>>>>> 
>>>>>  Am 18.03.20 um 22:26 schrieb Chris Graves:
>>>>>> Nice!  I see that the change has been made, but still receive the HTTP
>>>>>> 400 error.
>>>>>> 
>>>>>> In the AQB5 ofx.log file for a successful case, I see
>>>>>> OFXHEADER:100
>>>>>> VERSION:102
>>>>>> 
>>>>>> In the AQB6 file, I see
>>>>>> OFXHEADER:102
>>>>>> VERSION:102
>>>>>> 
>>>>>> Not sure if this could be the problem.  Is there a way to set
>>>>>  OFXHEADER
>>>>>> and VERSION independently?
>>>>>> 
>>>>>> 
>>>>>> On Wed, Mar 18, 2020 at 2:02 PM Martin Preuss <martin at aqbanking.de
>>>>>  <mailto:martin at aqbanking.de>
>>>>>> <mailto:martin at aqbanking.de <mailto:martin at aqbanking.de>>> wrote:
>>>>>> 
>>>>>>    Hi,
>>>>>> 
>>>>>>    you can change the header manually to 102/103 in the
>>>>>  homebanking setup
>>>>>>    dialog (select user, edit user, switch to app settings and type-in
>>>>>>    header version 102).
>>>>>> 
>>>>>>    Regards
>>>>>>    Martin
>>>>>> 
>>>>>> 
>>>>>>    Am 18.03.20 um 21:57 schrieb Chris Graves:
>>>>>>> Hi Martin,
>>>>>>> 
>>>>>>> Looking better!  However, to my knowledge, my bank only
>>>>>  supports OFX
>>>>>>> version 102 or 103.  I had been using 102.
>>>>>>> 
>>>>>>> ofx.log:
>>>>>>> Sending:
>>>>>>> -------------------------------------
>>>>>>> OFXHEADER:220
>>>>>>> DATA:OFXSGML
>>>>>>> VERSION:220
>>>>>>> SECURITY:NONE
>>>>>>> ENCODING:USASCII
>>>>>>> CHARSET:1252
>>>>>>> COMPRESSION:NONE
>>>>>>> OLDFILEUID:NONE
>>>>>>> NEWFILEUID:20200318135033.000
>>>>>>> 
>>>>>>> <OFX>
>>>>>>> <SIGNONMSGSRQV1>
>>>>>>> <SONRQ>
>>>>>>> <DTCLIENT>20200318135025.000
>>>>>>> 
>>>>>>> On Wed, Mar 18, 2020 at 1:32 PM Martin Preuss
>>>>>  <martin at aqbanking.de <mailto:martin at aqbanking.de>
>>>>>>    <mailto:martin at aqbanking.de <mailto:martin at aqbanking.de>>
>>>>>>> <mailto:martin at aqbanking.de <mailto:martin at aqbanking.de>
>>>>>  <mailto:martin at aqbanking.de <mailto:martin at aqbanking.de>>>> wrote:
>>>>>>> 
>>>>>>>   Hi Chris,
>>>>>>> 
>>>>>>>   could you please test the latest GIT version? It should
>>>>>  create
>>>>>>    valid
>>>>>>>   OFXv1 requests now, however, I can't test it completely
>>>>>  since
>>>>>>    I only
>>>>>>>   have access to an OFXv2 server...
>>>>>>> 
>>>>>>> 
>>>>>>>   Regards
>>>>>>>   Martin
>>>>>>> 
>>>>>>> 
>>>>>>>   Am 18.03.20 um 16:31 schrieb chris graves:
>>>>>>>> An additional bit of information from /tmp/ofx.log:
>>>>>>>> AQB5:
>>>>>>>> Sending:
>>>>>>>> -------------------------------------
>>>>>>>> OFXHEADER:100
>>>>>>>> DATA:OFXSGML
>>>>>>>> VERSION:102
>>>>>>>> SECURITY:NONE
>>>>>>>> ENCODING:USASCII
>>>>>>>> CHARSET:1252
>>>>>>>> COMPRESSION:NONE
>>>>>>>> OLDFILEUID:NONE
>>>>>>>> NEWFILEUID:20200318081757.000
>>>>>>>> 
>>>>>>>> <OFX>...
>>>>>>>   [...]
>>>>>>> 
>>>>>>> 
>>>>>>>   --
>>>>>>>   "Things are only impossible until they're not"
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>    --
>>>>>>    "Things are only impossible until they're not"
>>>>>> 
>>>>> 
>>>>> 
>>>>>  -- 
>>>>>  "Things are only impossible until they're not"
>>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> "Things are only impossible until they're not"
>>> 
>> 
>> 
>> -- 
>> "Things are only impossible until they're not"
> 
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.



More information about the gnucash-user mailing list