-
Notifications
You must be signed in to change notification settings - Fork 28
/
util.go
44 lines (38 loc) · 931 Bytes
/
util.go
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
package main
import (
"fmt"
"github.com/aclindsa/ofxgo"
"os"
)
func newRequest() (ofxgo.Client, *ofxgo.Request) {
ver, err := ofxgo.NewOfxVersion(ofxVersion)
if err != nil {
fmt.Println("Error creating new OfxVersion enum:", err)
os.Exit(1)
}
var client = ofxgo.GetClient(serverURL,
&ofxgo.BasicClient{
AppID: appID,
AppVer: appVer,
SpecVersion: ver,
NoIndent: noIndentRequests,
CarriageReturn: carriageReturn,
})
var query ofxgo.Request
query.URL = serverURL
query.Signon.ClientUID = ofxgo.UID(clientUID)
query.Signon.UserID = ofxgo.String(username)
query.Signon.UserPass = ofxgo.String(password)
query.Signon.Org = ofxgo.String(org)
query.Signon.Fid = ofxgo.String(fid)
return client, &query
}
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)
}