2017-03-22 20:29:08 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-04-17 10:54:20 -04:00
|
|
|
"fmt"
|
2017-03-22 20:29:08 -04:00
|
|
|
"github.com/aclindsa/ofxgo"
|
2017-04-17 10:54:20 -04:00
|
|
|
"os"
|
2017-03-22 20:29:08 -04:00
|
|
|
)
|
|
|
|
|
2018-10-02 20:55:25 -04:00
|
|
|
func newRequest() (ofxgo.Client, *ofxgo.Request) {
|
2017-04-17 10:54:20 -04:00
|
|
|
ver, err := ofxgo.NewOfxVersion(ofxVersion)
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error creating new OfxVersion enum:", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
2018-10-03 09:59:04 -04:00
|
|
|
var client = ofxgo.GetClient(serverURL,
|
|
|
|
&ofxgo.BasicClient{
|
2020-11-17 09:20:27 -05:00
|
|
|
AppID: appID,
|
|
|
|
AppVer: appVer,
|
|
|
|
SpecVersion: ver,
|
|
|
|
NoIndent: noIndentRequests,
|
|
|
|
CarriageReturn: carriageReturn,
|
2021-03-16 15:24:36 -04:00
|
|
|
UserAgent: userAgent,
|
2018-10-03 09:59:04 -04:00
|
|
|
})
|
2017-03-22 20:29:08 -04:00
|
|
|
|
|
|
|
var query ofxgo.Request
|
|
|
|
query.URL = serverURL
|
|
|
|
query.Signon.ClientUID = ofxgo.UID(clientUID)
|
2017-04-12 21:40:42 -04:00
|
|
|
query.Signon.UserID = ofxgo.String(username)
|
2017-03-22 20:29:08 -04:00
|
|
|
query.Signon.UserPass = ofxgo.String(password)
|
|
|
|
query.Signon.Org = ofxgo.String(org)
|
|
|
|
query.Signon.Fid = ofxgo.String(fid)
|
|
|
|
|
2018-10-03 09:59:04 -04:00
|
|
|
return client, &query
|
2017-03-22 20:29:08 -04:00
|
|
|
}
|
2020-12-07 13:37:43 -05:00
|
|
|
|
|
|
|
func printRequest(c ofxgo.Client, r *ofxgo.Request) {
|
|
|
|
r.SetClientFields(c)
|
|
|
|
|
|
|
|
b, err := r.Marshal()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
fmt.Println(b)
|
|
|
|
}
|