1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2025-07-01 11:48:38 -04:00

Add simple investment requests/responses

This is lacking (at least) parsing the list of securities frequently
sent with investment statements
This commit is contained in:
2017-03-19 21:08:58 -04:00
parent 81814feaff
commit f59f3713c2
7 changed files with 148 additions and 28 deletions

View File

@ -1,6 +1,7 @@
package ofxgo
import (
"errors"
"github.com/golang/go/src/encoding/xml"
)
@ -11,6 +12,22 @@ type Message interface {
// it's unmarshaled to ensure the request or response is valid
}
type Status struct {
XMLName xml.Name `xml:"STATUS"`
Code Int `xml:"CODE"`
Severity String `xml:"SEVERITY"`
Message String `xml:"MESSAGE,omitempty"`
}
func (s *Status) Valid() (bool, error) {
switch s.Severity {
case "INFO", "WARN", "ERROR":
return true, nil
default:
return false, errors.New("Invalid STATUS>SEVERITY")
}
}
type BankAcct struct {
XMLName xml.Name // BANKACCTTO or BANKACCTFROM
BankId String `xml:"BANKID"`
@ -25,3 +42,9 @@ type CCAcct struct {
AcctId String `xml:"ACCTID"`
AcctKey String `xml:"ACCTKEY,omitempty"` // Unused in USA
}
type InvAcct struct {
XMLName xml.Name // INVACCTTO or INVACCTFROM
BrokerId String `xml:"BROKERID"`
AcctId String `xml:"ACCTID"`
}