mirror of
https://github.com/aclindsa/ofxgo.git
synced 2024-12-25 22:43:21 -05:00
s/Id/ID/
This commit is contained in:
parent
e670b52a08
commit
cc90da4ed1
8
bank.go
8
bank.go
@ -79,10 +79,10 @@ type Transaction struct {
|
||||
DtUser *Date `xml:"DTUSER,omitempty"`
|
||||
DtAvail *Date `xml:"DTAVAIL,omitempty"`
|
||||
TrnAmt Amount `xml:"TRNAMT"`
|
||||
FiTId String `xml:"FITID"` // Client uses FITID to detect whether it has previously downloaded the transaction
|
||||
CorrectFiTId String `xml:"CORRECTFITID,omitempty"` // Transaction Id that this transaction corrects, if present
|
||||
FiTID String `xml:"FITID"` // Client uses FITID to detect whether it has previously downloaded the transaction
|
||||
CorrectFiTID String `xml:"CORRECTFITID,omitempty"` // Transaction ID that this transaction corrects, if present
|
||||
CorrectAction correctAction `xml:"CORRECTACTION,omitempty"` // One of DELETE, REPLACE
|
||||
SrvrTId String `xml:"SRVRTID,omitempty"`
|
||||
SrvrTID String `xml:"SRVRTID,omitempty"`
|
||||
CheckNum String `xml:"CHECKNUM,omitempty"`
|
||||
RefNum String `xml:"REFNUM,omitempty"`
|
||||
SIC Int `xml:"SIC,omitempty"` // Standard Industrial Code
|
||||
@ -111,7 +111,7 @@ type TransactionList struct {
|
||||
|
||||
// PendingTransaction represents a single pending transaction. It is similar to
|
||||
// Transaction, but is not finalized (and may never be). For instance, it lacks
|
||||
// FiTId and DtPosted fields.
|
||||
// FiTID and DtPosted fields.
|
||||
type PendingTransaction struct {
|
||||
XMLName xml.Name `xml:"STMTTRNP"`
|
||||
TrnType trnType `xml:"TRNTYPE"` // One of CREDIT, DEBIT, INT (interest earned or paid. Note: Depends on signage of amount), DIV, FEE, SRVCHG (service charge), DEP (deposit), ATM (Note: Depends on signage of amount), POS (Note: Depends on signage of amount), XFER, CHECK, PAYMENT, CASH, DIRECTDEP, DIRECTDEBIT, REPEATPMT, HOLD, OTHER
|
||||
|
24
bank_test.go
24
bank_test.go
@ -43,13 +43,13 @@ func TestMarshalBankStatementRequest(t *testing.T) {
|
||||
</OFX>`
|
||||
|
||||
var client = ofxgo.Client{
|
||||
AppId: "OFXGO",
|
||||
AppID: "OFXGO",
|
||||
AppVer: "0001",
|
||||
SpecVersion: "203",
|
||||
}
|
||||
|
||||
var request ofxgo.Request
|
||||
request.Signon.UserId = "myusername"
|
||||
request.Signon.UserID = "myusername"
|
||||
request.Signon.UserPass = "Pa$$word"
|
||||
request.Signon.Org = "BNK"
|
||||
request.Signon.Fid = "1987"
|
||||
@ -57,8 +57,8 @@ func TestMarshalBankStatementRequest(t *testing.T) {
|
||||
statementRequest := ofxgo.StatementRequest{
|
||||
TrnUID: "123",
|
||||
BankAcctFrom: ofxgo.BankAcct{
|
||||
BankId: "318398732",
|
||||
AcctId: "78346129",
|
||||
BankID: "318398732",
|
||||
AcctID: "78346129",
|
||||
AcctType: ofxgo.AcctTypeChecking,
|
||||
},
|
||||
Include: true,
|
||||
@ -117,13 +117,13 @@ NEWFILEUID:NONE
|
||||
</OFX>`
|
||||
|
||||
var client = ofxgo.Client{
|
||||
AppId: "OFXGO",
|
||||
AppID: "OFXGO",
|
||||
AppVer: "0001",
|
||||
SpecVersion: "103",
|
||||
}
|
||||
|
||||
var request ofxgo.Request
|
||||
request.Signon.UserId = "myusername"
|
||||
request.Signon.UserID = "myusername"
|
||||
request.Signon.UserPass = "Pa$$word"
|
||||
request.Signon.Org = "BNK"
|
||||
request.Signon.Fid = "1987"
|
||||
@ -131,8 +131,8 @@ NEWFILEUID:NONE
|
||||
statementRequest := ofxgo.StatementRequest{
|
||||
TrnUID: "123",
|
||||
BankAcctFrom: ofxgo.BankAcct{
|
||||
BankId: "318398732",
|
||||
AcctId: "78346129",
|
||||
BankID: "318398732",
|
||||
AcctID: "78346129",
|
||||
AcctType: ofxgo.AcctTypeChecking,
|
||||
},
|
||||
Include: true,
|
||||
@ -235,7 +235,7 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
|
||||
TrnType: ofxgo.TrnTypeCheck,
|
||||
DtPosted: *ofxgo.NewDateGMT(2006, 1, 4, 0, 0, 0, 0),
|
||||
TrnAmt: trnamt1,
|
||||
FiTId: "00592",
|
||||
FiTID: "00592",
|
||||
CheckNum: "2002",
|
||||
},
|
||||
{
|
||||
@ -243,7 +243,7 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
|
||||
DtPosted: *ofxgo.NewDateGMT(2006, 1, 12, 0, 0, 0, 0),
|
||||
DtUser: ofxgo.NewDateGMT(2006, 1, 12, 0, 0, 0, 0),
|
||||
TrnAmt: trnamt2,
|
||||
FiTId: "00679",
|
||||
FiTID: "00679",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -260,8 +260,8 @@ func TestUnmarshalBankStatementResponse(t *testing.T) {
|
||||
},
|
||||
CurDef: "USD",
|
||||
BankAcctFrom: ofxgo.BankAcct{
|
||||
BankId: "318398732",
|
||||
AcctId: "78346129",
|
||||
BankID: "318398732",
|
||||
AcctID: "78346129",
|
||||
AcctType: ofxgo.AcctTypeChecking,
|
||||
},
|
||||
BankTranList: &banktranlist,
|
||||
|
10
client.go
10
client.go
@ -11,7 +11,7 @@ type Client struct {
|
||||
// Request fields to overwrite with the client's values. If nonempty,
|
||||
// defaults are used
|
||||
SpecVersion string // VERSION in header
|
||||
AppId string // SONRQ>APPID
|
||||
AppID string // SONRQ>APPID
|
||||
AppVer string // SONRQ>APPVER
|
||||
|
||||
// Don't insert newlines or indentation when marshalling to SGML/XML
|
||||
@ -28,9 +28,9 @@ func (c *Client) OfxVersion() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) Id() String {
|
||||
if len(c.AppId) > 0 {
|
||||
return String(c.AppId)
|
||||
func (c *Client) ID() String {
|
||||
if len(c.AppID) > 0 {
|
||||
return String(c.AppID)
|
||||
} else {
|
||||
return String("OFXGO")
|
||||
}
|
||||
@ -102,7 +102,7 @@ func (c *Client) RequestNoParse(r *Request) (*http.Response, error) {
|
||||
//
|
||||
// Before being marshaled, some of the the Request object's values are
|
||||
// overwritten, namely those dictated by the Client's configuration (Version,
|
||||
// AppId, AppVer fields), and the client's curren time (DtClient). These are
|
||||
// AppID, AppVer fields), and the client's curren time (DtClient). These are
|
||||
// updated in place in the supplied Request object so they may later be
|
||||
// inspected by the caller.
|
||||
func (c *Client) Request(r *Request) (*Response, error) {
|
||||
|
@ -16,13 +16,13 @@ var downloadCommand = Command{
|
||||
Do: download,
|
||||
}
|
||||
|
||||
var filename, bankId, acctId, acctType string
|
||||
var filename, bankID, acctID, acctType string
|
||||
|
||||
func init() {
|
||||
defineServerFlags(downloadCommand.Flags)
|
||||
downloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
||||
downloadCommand.Flags.StringVar(&bankId, "bankid", "", "BankId (from `get-accounts` subcommand)")
|
||||
downloadCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
||||
downloadCommand.Flags.StringVar(&bankID, "bankid", "", "BankID (from `get-accounts` subcommand)")
|
||||
downloadCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||
downloadCommand.Flags.StringVar(&acctType, "accttype", "CHECKING", "AcctType (from `get-accounts` subcommand)")
|
||||
}
|
||||
|
||||
@ -55,8 +55,8 @@ func download() {
|
||||
statementRequest := ofxgo.StatementRequest{
|
||||
TrnUID: *uid,
|
||||
BankAcctFrom: ofxgo.BankAcct{
|
||||
BankId: ofxgo.String(bankId),
|
||||
AcctId: ofxgo.String(acctId),
|
||||
BankID: ofxgo.String(bankID),
|
||||
AcctID: ofxgo.String(acctID),
|
||||
AcctType: acctTypeEnum,
|
||||
},
|
||||
Include: true,
|
||||
|
@ -17,8 +17,8 @@ var bankTransactionsCommand = Command{
|
||||
|
||||
func init() {
|
||||
defineServerFlags(bankTransactionsCommand.Flags)
|
||||
bankTransactionsCommand.Flags.StringVar(&bankId, "bankid", "", "BankId (from `get-accounts` subcommand)")
|
||||
bankTransactionsCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
||||
bankTransactionsCommand.Flags.StringVar(&bankID, "bankid", "", "BankID (from `get-accounts` subcommand)")
|
||||
bankTransactionsCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||
bankTransactionsCommand.Flags.StringVar(&acctType, "accttype", "CHECKING", "AcctType (from `get-accounts` subcommand)")
|
||||
}
|
||||
|
||||
@ -40,8 +40,8 @@ func bankTransactions() {
|
||||
statementRequest := ofxgo.StatementRequest{
|
||||
TrnUID: *uid,
|
||||
BankAcctFrom: ofxgo.BankAcct{
|
||||
BankId: ofxgo.String(bankId),
|
||||
AcctId: ofxgo.String(acctId),
|
||||
BankID: ofxgo.String(bankID),
|
||||
AcctID: ofxgo.String(acctID),
|
||||
AcctType: acctTypeEnum,
|
||||
},
|
||||
Include: true,
|
||||
|
@ -19,7 +19,7 @@ var ccDownloadCommand = Command{
|
||||
func init() {
|
||||
defineServerFlags(ccDownloadCommand.Flags)
|
||||
ccDownloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
||||
ccDownloadCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
||||
ccDownloadCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||
}
|
||||
|
||||
func ccDownloadCheckFlags() bool {
|
||||
@ -45,7 +45,7 @@ func ccDownload() {
|
||||
statementRequest := ofxgo.CCStatementRequest{
|
||||
TrnUID: *uid,
|
||||
CCAcctFrom: ofxgo.CCAcct{
|
||||
AcctId: ofxgo.String(acctId),
|
||||
AcctID: ofxgo.String(acctID),
|
||||
},
|
||||
Include: true,
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ var ccTransactionsCommand = Command{
|
||||
|
||||
func init() {
|
||||
defineServerFlags(ccTransactionsCommand.Flags)
|
||||
ccTransactionsCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
||||
ccTransactionsCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||
}
|
||||
|
||||
func ccTransactions() {
|
||||
@ -32,7 +32,7 @@ func ccTransactions() {
|
||||
statementRequest := ofxgo.CCStatementRequest{
|
||||
TrnUID: *uid,
|
||||
CCAcctFrom: ofxgo.CCAcct{
|
||||
AcctId: ofxgo.String(acctId),
|
||||
AcctID: ofxgo.String(acctID),
|
||||
},
|
||||
Include: true,
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ func (c *Command) Usage() {
|
||||
}
|
||||
|
||||
// flags common to all server transactions
|
||||
var serverURL, username, password, org, fid, appId, appVer, ofxVersion, clientUID string
|
||||
var serverURL, username, password, org, fid, appID, appVer, ofxVersion, clientUID string
|
||||
var noIndentRequests bool
|
||||
|
||||
func defineServerFlags(f *flag.FlagSet) {
|
||||
@ -29,7 +29,7 @@ func defineServerFlags(f *flag.FlagSet) {
|
||||
f.StringVar(&password, "password", "", "Your password at financial institution")
|
||||
f.StringVar(&org, "org", "", "'ORG' for your financial institution")
|
||||
f.StringVar(&fid, "fid", "", "'FID' for your financial institution")
|
||||
f.StringVar(&appId, "appid", "QWIN", "'APPID' to pretend to be")
|
||||
f.StringVar(&appID, "appid", "QWIN", "'APPID' to pretend to be")
|
||||
f.StringVar(&appVer, "appver", "2400", "'APPVER' to pretend to be")
|
||||
f.StringVar(&ofxVersion, "ofxversion", "203", "OFX version to use")
|
||||
f.StringVar(&clientUID, "clientuid", "", "Client UID (only required by a few FIs, like Chase)")
|
||||
|
@ -30,7 +30,7 @@ func init() {
|
||||
// We keep a separate list of APPIDs to preserve the ordering (ordering isn't
|
||||
// guaranteed in maps). We want to try them in order from 'best' and most
|
||||
// likely to work to 'worse' and least likely to work
|
||||
var appIds = []string{
|
||||
var appIDs = []string{
|
||||
"OFXGO", // ofxgo (this library)
|
||||
"QWIN", // Intuit Quicken Windows
|
||||
"QMOFX", // Intuit Quicken Mac
|
||||
@ -92,13 +92,13 @@ var versions = []string{
|
||||
|
||||
func detectSettings() {
|
||||
var attempts uint
|
||||
for _, appId := range appIds {
|
||||
for _, appVer := range appVersions[appId] {
|
||||
for _, appID := range appIDs {
|
||||
for _, appVer := range appVersions[appID] {
|
||||
for _, version := range versions {
|
||||
for _, noIndent := range []bool{false, true} {
|
||||
if tryProfile(appId, appVer, version, noIndent) {
|
||||
if tryProfile(appID, appVer, version, noIndent) {
|
||||
fmt.Println("The following settings were found to work:")
|
||||
fmt.Printf("AppId: %s\n", appId)
|
||||
fmt.Printf("AppID: %s\n", appID)
|
||||
fmt.Printf("AppVer: %s\n", appVer)
|
||||
fmt.Printf("OFX Version: %s\n", version)
|
||||
fmt.Printf("noindent: %t\n", noIndent)
|
||||
@ -109,7 +109,7 @@ func detectSettings() {
|
||||
if noIndent {
|
||||
noIndentString = " noindent"
|
||||
}
|
||||
fmt.Printf("Attempt %d failed (%s %s %s%s), trying again after %dms...\n", attempts, appId, appVer, version, noIndentString, delay)
|
||||
fmt.Printf("Attempt %d failed (%s %s %s%s), trying again after %dms...\n", attempts, appID, appVer, version, noIndentString, delay)
|
||||
time.Sleep(time.Duration(delay) * time.Millisecond)
|
||||
}
|
||||
}
|
||||
@ -120,9 +120,9 @@ func detectSettings() {
|
||||
|
||||
const anonymous = "anonymous00000000000000000000000"
|
||||
|
||||
func tryProfile(appId, appVer, version string, noindent bool) bool {
|
||||
func tryProfile(appID, appVer, version string, noindent bool) bool {
|
||||
var client = ofxgo.Client{
|
||||
AppId: appId,
|
||||
AppID: appID,
|
||||
AppVer: appVer,
|
||||
SpecVersion: version,
|
||||
NoIndent: noindent,
|
||||
@ -131,7 +131,7 @@ func tryProfile(appId, appVer, version string, noindent bool) bool {
|
||||
var query ofxgo.Request
|
||||
query.URL = serverURL
|
||||
query.Signon.ClientUID = ofxgo.UID(clientUID)
|
||||
query.Signon.UserId = ofxgo.String(username)
|
||||
query.Signon.UserID = ofxgo.String(username)
|
||||
query.Signon.UserPass = ofxgo.String(password)
|
||||
query.Signon.Org = ofxgo.String(org)
|
||||
query.Signon.Fid = ofxgo.String(fid)
|
||||
@ -154,7 +154,7 @@ func tryProfile(appId, appVer, version string, noindent bool) bool {
|
||||
}
|
||||
|
||||
// try again with anonymous logins
|
||||
query.Signon.UserId = ofxgo.String(anonymous)
|
||||
query.Signon.UserID = ofxgo.String(anonymous)
|
||||
query.Signon.UserPass = ofxgo.String(anonymous)
|
||||
|
||||
_, err = client.Request(&query)
|
||||
|
@ -57,11 +57,11 @@ func getAccounts() {
|
||||
if acctinfo, ok := response.Signup[0].(*ofxgo.AcctInfoResponse); ok {
|
||||
for _, acct := range acctinfo.AcctInfo {
|
||||
if acct.BankAcctInfo != nil {
|
||||
fmt.Printf("Bank Account:\n\tBankId: \"%s\"\n\tAcctId: \"%s\"\n\tAcctType: %s\n", acct.BankAcctInfo.BankAcctFrom.BankId, acct.BankAcctInfo.BankAcctFrom.AcctId, acct.BankAcctInfo.BankAcctFrom.AcctType)
|
||||
fmt.Printf("Bank Account:\n\tBankID: \"%s\"\n\tAcctID: \"%s\"\n\tAcctType: %s\n", acct.BankAcctInfo.BankAcctFrom.BankID, acct.BankAcctInfo.BankAcctFrom.AcctID, acct.BankAcctInfo.BankAcctFrom.AcctType)
|
||||
} else if acct.CCAcctInfo != nil {
|
||||
fmt.Printf("Credit card:\n\tAcctId: \"%s\"\n", acct.CCAcctInfo.CCAcctFrom.AcctId)
|
||||
fmt.Printf("Credit card:\n\tAcctID: \"%s\"\n", acct.CCAcctInfo.CCAcctFrom.AcctID)
|
||||
} else if acct.InvAcctInfo != nil {
|
||||
fmt.Printf("Investment account:\n\tBrokerId: \"%s\"\n\tAcctId: \"%s\"\n", acct.InvAcctInfo.InvAcctFrom.BrokerId, acct.InvAcctInfo.InvAcctFrom.AcctId)
|
||||
fmt.Printf("Investment account:\n\tBrokerID: \"%s\"\n\tAcctID: \"%s\"\n", acct.InvAcctInfo.InvAcctFrom.BrokerID, acct.InvAcctInfo.InvAcctFrom.AcctID)
|
||||
} else {
|
||||
fmt.Printf("Unknown type: %s %s\n", acct.Name, acct.Desc)
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ var invDownloadCommand = Command{
|
||||
Do: invDownload,
|
||||
}
|
||||
|
||||
var brokerId string
|
||||
var brokerID string
|
||||
|
||||
func init() {
|
||||
defineServerFlags(invDownloadCommand.Flags)
|
||||
invDownloadCommand.Flags.StringVar(&filename, "filename", "./download.ofx", "The file to save to")
|
||||
invDownloadCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
||||
invDownloadCommand.Flags.StringVar(&brokerId, "brokerid", "", "BrokerId (from `get-accounts` subcommand)")
|
||||
invDownloadCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||
invDownloadCommand.Flags.StringVar(&brokerID, "brokerid", "", "BrokerID (from `get-accounts` subcommand)")
|
||||
}
|
||||
|
||||
func invDownloadCheckFlags() bool {
|
||||
@ -48,8 +48,8 @@ func invDownload() {
|
||||
statementRequest := ofxgo.InvStatementRequest{
|
||||
TrnUID: *uid,
|
||||
InvAcctFrom: ofxgo.InvAcct{
|
||||
BrokerId: ofxgo.String(brokerId),
|
||||
AcctId: ofxgo.String(acctId),
|
||||
BrokerID: ofxgo.String(brokerID),
|
||||
AcctID: ofxgo.String(acctID),
|
||||
},
|
||||
Include: true,
|
||||
IncludeOO: true,
|
||||
|
@ -17,8 +17,8 @@ var invTransactionsCommand = Command{
|
||||
|
||||
func init() {
|
||||
defineServerFlags(invTransactionsCommand.Flags)
|
||||
invTransactionsCommand.Flags.StringVar(&acctId, "acctid", "", "AcctId (from `get-accounts` subcommand)")
|
||||
invTransactionsCommand.Flags.StringVar(&brokerId, "brokerid", "", "BrokerId (from `get-accounts` subcommand)")
|
||||
invTransactionsCommand.Flags.StringVar(&acctID, "acctid", "", "AcctID (from `get-accounts` subcommand)")
|
||||
invTransactionsCommand.Flags.StringVar(&brokerID, "brokerid", "", "BrokerID (from `get-accounts` subcommand)")
|
||||
}
|
||||
|
||||
func invTransactions() {
|
||||
@ -33,8 +33,8 @@ func invTransactions() {
|
||||
statementRequest := ofxgo.InvStatementRequest{
|
||||
TrnUID: *uid,
|
||||
InvAcctFrom: ofxgo.InvAcct{
|
||||
BrokerId: ofxgo.String(brokerId),
|
||||
AcctId: ofxgo.String(acctId),
|
||||
BrokerID: ofxgo.String(brokerID),
|
||||
AcctID: ofxgo.String(acctID),
|
||||
},
|
||||
Include: true,
|
||||
IncludeOO: true,
|
||||
@ -99,7 +99,7 @@ func invTransactions() {
|
||||
} else if tran.OrigCurrency != nil {
|
||||
currency = tran.Currency.CurSym
|
||||
}
|
||||
fmt.Printf(" %s %s %s (%s %s)\n", tran.IncomeType, tran.Total, currency, tran.SecId.UniqueIdType, tran.SecId.UniqueId)
|
||||
fmt.Printf(" %s %s %s (%s %s)\n", tran.IncomeType, tran.Total, currency, tran.SecID.UniqueIDType, tran.SecID.UniqueID)
|
||||
// TODO print ticker instead of CUSIP
|
||||
case ofxgo.InvExpense:
|
||||
printInvTran(&tran.InvTran)
|
||||
@ -109,14 +109,14 @@ func invTransactions() {
|
||||
} else if tran.OrigCurrency != nil {
|
||||
currency = tran.Currency.CurSym
|
||||
}
|
||||
fmt.Printf(" %s %s (%s %s)\n", tran.Total, currency, tran.SecId.UniqueIdType, tran.SecId.UniqueId)
|
||||
fmt.Printf(" %s %s (%s %s)\n", tran.Total, currency, tran.SecID.UniqueIDType, tran.SecID.UniqueID)
|
||||
// TODO print ticker instead of CUSIP
|
||||
case ofxgo.JrnlFund:
|
||||
printInvTran(&tran.InvTran)
|
||||
fmt.Printf(" %s %s (%s -> %s)\n", tran.Total, stmt.CurDef, tran.SubAcctFrom, tran.SubAcctTo)
|
||||
case ofxgo.JrnlSec:
|
||||
printInvTran(&tran.InvTran)
|
||||
fmt.Printf(" %s %s %s (%s -> %s)\n", tran.Units, tran.SecId.UniqueIdType, tran.SecId.UniqueId, tran.SubAcctFrom, tran.SubAcctTo)
|
||||
fmt.Printf(" %s %s %s (%s -> %s)\n", tran.Units, tran.SecID.UniqueIDType, tran.SecID.UniqueID, tran.SubAcctFrom, tran.SubAcctTo)
|
||||
// TODO print ticker instead of CUSIP
|
||||
case ofxgo.MarginInterest:
|
||||
printInvTran(&tran.InvTran)
|
||||
@ -135,7 +135,7 @@ func invTransactions() {
|
||||
} else if tran.OrigCurrency != nil {
|
||||
currency = tran.Currency.CurSym
|
||||
}
|
||||
fmt.Printf(" %s (%s %s)@%s %s (Total: %s)\n", tran.Units, tran.SecId.UniqueIdType, tran.SecId.UniqueId, tran.UnitPrice, currency, tran.Total)
|
||||
fmt.Printf(" %s (%s %s)@%s %s (Total: %s)\n", tran.Units, tran.SecID.UniqueIDType, tran.SecID.UniqueID, tran.UnitPrice, currency, tran.Total)
|
||||
// TODO print ticker instead of CUSIP
|
||||
case ofxgo.RetOfCap:
|
||||
printInvTran(&tran.InvTran)
|
||||
@ -145,7 +145,7 @@ func invTransactions() {
|
||||
} else if tran.OrigCurrency != nil {
|
||||
currency = tran.Currency.CurSym
|
||||
}
|
||||
fmt.Printf(" %s %s (%s %s)\n", tran.Total, currency, tran.SecId.UniqueIdType, tran.SecId.UniqueId)
|
||||
fmt.Printf(" %s %s (%s %s)\n", tran.Total, currency, tran.SecID.UniqueIDType, tran.SecID.UniqueID)
|
||||
// TODO print ticker instead of CUSIP
|
||||
case ofxgo.SellDebt:
|
||||
printInvSell(stmt.CurDef, &tran.InvSell)
|
||||
@ -165,11 +165,11 @@ func invTransactions() {
|
||||
} else if tran.OrigCurrency != nil {
|
||||
currency = tran.Currency.CurSym
|
||||
}
|
||||
fmt.Printf(" %d/%d %s -> %s shares of %s %s (%s %s for fractional shares)\n", tran.Numerator, tran.Denominator, tran.OldUnits, tran.NewUnits, tran.SecId.UniqueIdType, tran.SecId.UniqueId, tran.FracCash, currency)
|
||||
fmt.Printf(" %d/%d %s -> %s shares of %s %s (%s %s for fractional shares)\n", tran.Numerator, tran.Denominator, tran.OldUnits, tran.NewUnits, tran.SecID.UniqueIDType, tran.SecID.UniqueID, tran.FracCash, currency)
|
||||
// TODO print ticker instead of CUSIP
|
||||
case ofxgo.Transfer:
|
||||
printInvTran(&tran.InvTran)
|
||||
fmt.Printf(" %s (%s %s) %s\n", tran.Units, tran.SecId.UniqueIdType, tran.SecId.UniqueId, tran.TferAction)
|
||||
fmt.Printf(" %s (%s %s) %s\n", tran.Units, tran.SecID.UniqueIDType, tran.SecID.UniqueID, tran.TferAction)
|
||||
// TODO print ticker instead of CUSIP
|
||||
}
|
||||
}
|
||||
@ -189,7 +189,7 @@ func printInvBuy(defCurrency ofxgo.String, ib *ofxgo.InvBuy) {
|
||||
currency = ib.Currency.CurSym
|
||||
}
|
||||
|
||||
fmt.Printf("%s (%s %s)@%s %s (Total: %s)\n", ib.Units, ib.SecId.UniqueIdType, ib.SecId.UniqueId, ib.UnitPrice, currency, ib.Total)
|
||||
fmt.Printf("%s (%s %s)@%s %s (Total: %s)\n", ib.Units, ib.SecID.UniqueIDType, ib.SecID.UniqueID, ib.UnitPrice, currency, ib.Total)
|
||||
// TODO print ticker instead of CUSIP
|
||||
}
|
||||
|
||||
@ -202,6 +202,6 @@ func printInvSell(defCurrency ofxgo.String, is *ofxgo.InvSell) {
|
||||
currency = is.Currency.CurSym
|
||||
}
|
||||
|
||||
fmt.Printf(" %s (%s %s)@%s %s (Total: %s)\n", is.Units, is.SecId.UniqueIdType, is.SecId.UniqueId, is.UnitPrice, currency, is.Total)
|
||||
fmt.Printf(" %s (%s %s)@%s %s (Total: %s)\n", is.Units, is.SecID.UniqueIDType, is.SecID.UniqueID, is.UnitPrice, currency, is.Total)
|
||||
// TODO print ticker instead of CUSIP
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
func NewRequest() (*ofxgo.Client, *ofxgo.Request) {
|
||||
var client = ofxgo.Client{
|
||||
AppId: appId,
|
||||
AppID: appID,
|
||||
AppVer: appVer,
|
||||
SpecVersion: ofxVersion,
|
||||
NoIndent: noIndentRequests,
|
||||
@ -15,7 +15,7 @@ func NewRequest() (*ofxgo.Client, *ofxgo.Request) {
|
||||
var query ofxgo.Request
|
||||
query.URL = serverURL
|
||||
query.Signon.ClientUID = ofxgo.UID(clientUID)
|
||||
query.Signon.UserId = ofxgo.String(username)
|
||||
query.Signon.UserID = ofxgo.String(username)
|
||||
query.Signon.UserPass = ofxgo.String(password)
|
||||
query.Signon.Org = ofxgo.String(org)
|
||||
query.Signon.Fid = ofxgo.String(fid)
|
||||
|
12
common.go
12
common.go
@ -267,9 +267,9 @@ func (s *Status) CodeConditions() (string, error) {
|
||||
// BankAcct represents the identifying information for one bank account
|
||||
type BankAcct struct {
|
||||
XMLName xml.Name // BANKACCTTO or BANKACCTFROM
|
||||
BankId String `xml:"BANKID"`
|
||||
BranchId String `xml:"BRANCHID,omitempty"` // Unused in USA
|
||||
AcctId String `xml:"ACCTID"`
|
||||
BankID String `xml:"BANKID"`
|
||||
BranchID String `xml:"BRANCHID,omitempty"` // Unused in USA
|
||||
AcctID String `xml:"ACCTID"`
|
||||
AcctType acctType `xml:"ACCTTYPE"` // One of CHECKING, SAVINGS, MONEYMRKT, CREDITLINE, CD
|
||||
AcctKey String `xml:"ACCTKEY,omitempty"` // Unused in USA
|
||||
}
|
||||
@ -277,15 +277,15 @@ type BankAcct struct {
|
||||
// CCAcct represents the identifying information for one checking account
|
||||
type CCAcct struct {
|
||||
XMLName xml.Name // CCACCTTO or CCACCTFROM
|
||||
AcctId String `xml:"ACCTID"`
|
||||
AcctID String `xml:"ACCTID"`
|
||||
AcctKey String `xml:"ACCTKEY,omitempty"` // Unused in USA
|
||||
}
|
||||
|
||||
// InvAcct represents the identifying information for one investment account
|
||||
type InvAcct struct {
|
||||
XMLName xml.Name // INVACCTTO or INVACCTFROM
|
||||
BrokerId String `xml:"BROKERID"`
|
||||
AcctId String `xml:"ACCTID"`
|
||||
BrokerID String `xml:"BROKERID"`
|
||||
AcctID String `xml:"ACCTID"`
|
||||
}
|
||||
|
||||
// Currency represents one ISO-4217 currency
|
||||
|
@ -42,13 +42,13 @@ func TestMarshalCCStatementRequest(t *testing.T) {
|
||||
</OFX>`
|
||||
|
||||
var client = ofxgo.Client{
|
||||
AppId: "OFXGO",
|
||||
AppID: "OFXGO",
|
||||
AppVer: "0001",
|
||||
SpecVersion: "203",
|
||||
}
|
||||
|
||||
var request ofxgo.Request
|
||||
request.Signon.UserId = "myusername"
|
||||
request.Signon.UserID = "myusername"
|
||||
request.Signon.UserPass = "Pa$$word"
|
||||
request.Signon.Org = "BNK"
|
||||
request.Signon.Fid = "1987"
|
||||
@ -56,7 +56,7 @@ func TestMarshalCCStatementRequest(t *testing.T) {
|
||||
statementRequest := ofxgo.CCStatementRequest{
|
||||
TrnUID: "913846",
|
||||
CCAcctFrom: ofxgo.CCAcct{
|
||||
AcctId: "XXXXXXXXXXXX1234",
|
||||
AcctID: "XXXXXXXXXXXX1234",
|
||||
},
|
||||
DtStart: ofxgo.NewDateGMT(2017, 1, 1, 0, 0, 0, 0),
|
||||
Include: true,
|
||||
@ -108,21 +108,21 @@ NEWFILEUID:NONE
|
||||
TrnType: ofxgo.TrnTypeDebit,
|
||||
DtPosted: *ofxgo.NewDateGMT(2017, 2, 9, 12, 0, 0, 0),
|
||||
TrnAmt: trnamt1,
|
||||
FiTId: "2017020924435657040207171600195",
|
||||
FiTID: "2017020924435657040207171600195",
|
||||
Name: "SLICE OF NY",
|
||||
},
|
||||
{
|
||||
TrnType: ofxgo.TrnTypeCredit,
|
||||
DtPosted: *ofxgo.NewDateGMT(2016, 12, 28, 12, 0, 0, 0),
|
||||
TrnAmt: trnamt2,
|
||||
FiTId: "2016122823633637200000258482730",
|
||||
FiTID: "2016122823633637200000258482730",
|
||||
Name: "Payment Thank You Electro",
|
||||
},
|
||||
{
|
||||
TrnType: ofxgo.TrnTypeDebit,
|
||||
DtPosted: *ofxgo.NewDateGMT(2017, 3, 27, 12, 0, 0, 0),
|
||||
TrnAmt: trnamt3,
|
||||
FiTId: "2017032724445727085300442885680",
|
||||
FiTID: "2017032724445727085300442885680",
|
||||
Name: "KROGER FUEL #9999",
|
||||
},
|
||||
},
|
||||
@ -140,7 +140,7 @@ NEWFILEUID:NONE
|
||||
},
|
||||
CurDef: "USD",
|
||||
CCAcctFrom: ofxgo.CCAcct{
|
||||
AcctId: "9283744488463775",
|
||||
AcctID: "9283744488463775",
|
||||
},
|
||||
BankTranList: &banktranlist,
|
||||
BalAmt: balamt,
|
||||
|
50
invstmt.go
50
invstmt.go
@ -39,18 +39,18 @@ func (r *InvStatementRequest) Type() messageType {
|
||||
|
||||
type InvTran struct {
|
||||
XMLName xml.Name `xml:"INVTRAN"`
|
||||
FiTId String `xml:"FITID"`
|
||||
SrvrTId String `xml:"SRVRTID,omitempty"`
|
||||
FiTID String `xml:"FITID"`
|
||||
SrvrTID String `xml:"SRVRTID,omitempty"`
|
||||
DtTrade Date `xml:"DTTRADE"` // trade date; for stock splits, day of record
|
||||
DtSettle *Date `xml:"DTSETTLE,omitempty"` // settlement date; for stock splits, execution date
|
||||
ReversalFiTId String `xml:"REVERSALFITID,omitempty"` // For a reversal transaction, the FITID of the transaction that is being reversed.
|
||||
ReversalFiTID String `xml:"REVERSALFITID,omitempty"` // For a reversal transaction, the FITID of the transaction that is being reversed.
|
||||
Memo String `xml:"MEMO,omitempty"`
|
||||
}
|
||||
|
||||
type InvBuy struct {
|
||||
XMLName xml.Name `xml:"INVBUY"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
||||
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
|
||||
Markup Amount `xml:"MARKUP,omitempty"` // Portion of UNITPRICE that is attributed to the dealer markup
|
||||
@ -65,7 +65,7 @@ type InvBuy struct {
|
||||
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
|
||||
|
||||
// The next three elements must either all be provided, or none of them
|
||||
LoanId String `xml:"LOANID,omitempty"` // For 401(k) accounts only. Indicates that the transaction was due to a loan or a loan repayment, and which loan it was
|
||||
LoanID String `xml:"LOANID,omitempty"` // For 401(k) accounts only. Indicates that the transaction was due to a loan or a loan repayment, and which loan it was
|
||||
LoanPrincipal Amount `xml:"LOANPRINCIPAL,omitempty"` // For 401(k) accounts only. Indicates how much of the loan repayment was principal
|
||||
LoanInterest Amount `xml:"LOANINTEREST,omitempty"` // For 401(k) accounts only. Indicates how much of the loan repayment was interest
|
||||
|
||||
@ -77,7 +77,7 @@ type InvBuy struct {
|
||||
type InvSell struct {
|
||||
XMLName xml.Name `xml:"INVSELL"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
||||
UnitPrice Amount `xml:"UNITPRICE"` // For stocks, MFs, other, price per share. Bonds = percentage of par. Option = premium per share of underlying security
|
||||
Markdown Amount `xml:"MARKDOWN,omitempty"` // Portion of UNITPRICE that is attributed to the dealer markdown
|
||||
@ -94,7 +94,7 @@ type InvSell struct {
|
||||
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
||||
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
|
||||
|
||||
LoanId String `xml:"LOANID,omitempty"` // For 401(k) accounts only. Indicates that the transaction was due to a loan or a loan repayment, and which loan it was
|
||||
LoanID String `xml:"LOANID,omitempty"` // For 401(k) accounts only. Indicates that the transaction was due to a loan or a loan repayment, and which loan it was
|
||||
StateWitholding Amount `xml:"STATEWITHHOLDING,omitempty"` // State tax witholdings
|
||||
Penalty Amount `xml:"PENALTY,omitempty"` // Amount withheld due to penalty
|
||||
|
||||
@ -115,7 +115,7 @@ type BuyMF struct {
|
||||
XMLName xml.Name `xml:"BUYMF"`
|
||||
InvBuy InvBuy `xml:"INVBUY"`
|
||||
BuyType buyType `xml:"BUYTYPE"` // One of BUY, BUYTOCOVER (BUYTOCOVER used to close short sales.)
|
||||
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||
RelFiTID String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||
}
|
||||
|
||||
func (t BuyMF) TransactionType() string {
|
||||
@ -155,12 +155,12 @@ func (t BuyStock) TransactionType() string {
|
||||
type ClosureOpt struct {
|
||||
XMLName xml.Name `xml:"CLOSUREOPT"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
OptAction optAction `xml:"OPTACTION"` // One of EXERCISE, ASSIGN, EXPIRE. The EXERCISE action is used to close out an option that is exercised. The ASSIGN action is used when an option writer is assigned. The EXPIRE action is used when the option’s expired date is reached
|
||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
||||
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
|
||||
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
||||
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||
RelFiTID String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||
Gain Amount `xml:"GAIN,omitempty"` // Total gain
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ func (t ClosureOpt) TransactionType() string {
|
||||
type Income struct {
|
||||
XMLName xml.Name `xml:"INCOME"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
IncomeType incomeType `xml:"INCOMETYPE"` // Type of investment income: CGLONG (capital gains-long term), CGSHORT (capital gains-short term), DIV (dividend), INTEREST, MISC
|
||||
Total Amount `xml:"TOTAL"`
|
||||
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
||||
@ -192,7 +192,7 @@ func (t Income) TransactionType() string {
|
||||
type InvExpense struct {
|
||||
XMLName xml.Name `xml:"INVEXPENSE"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
Total Amount `xml:"TOTAL"`
|
||||
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
||||
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
|
||||
@ -222,7 +222,7 @@ func (t JrnlFund) TransactionType() string {
|
||||
type JrnlSec struct {
|
||||
XMLName xml.Name `xml:"JRNLSEC"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
SubAcctFrom subAcctType `xml:"SUBACCTFROM"` // Sub-account cash is being transferred from: CASH, MARGIN, SHORT, OTHER
|
||||
SubAcctTo subAcctType `xml:"SUBACCTTO"` // Sub-account cash is being transferred to: CASH, MARGIN, SHORT, OTHER
|
||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
||||
@ -249,7 +249,7 @@ func (t MarginInterest) TransactionType() string {
|
||||
type Reinvest struct {
|
||||
XMLName xml.Name `xml:"REINVEST"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
IncomeType incomeType `xml:"INCOMETYPE"` // Type of investment income: CGLONG (capital gains-long term), CGSHORT (capital gains-short term), DIV (dividend), INTEREST, MISC
|
||||
Total Amount `xml:"TOTAL"` // Transaction total. Buys, sells, etc.:((quan. * (price +/- markup/markdown)) +/-(commission + fees + load + taxes + penalty + withholding + statewithholding)). Distributions, interest, margin interest, misc. expense, etc.: amount. Return of cap: cost basis
|
||||
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
||||
@ -272,7 +272,7 @@ func (t Reinvest) TransactionType() string {
|
||||
type RetOfCap struct {
|
||||
XMLName xml.Name `xml:"RETOFCAP"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
Total Amount `xml:"TOTAL"`
|
||||
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
||||
SubAcctFund subAcctType `xml:"SUBACCTFUND"` // Where did the money for the transaction come from or go to? CASH, MARGIN, SHORT, OTHER
|
||||
@ -301,7 +301,7 @@ type SellMF struct {
|
||||
InvSell InvSell `xml:"INVSELL"`
|
||||
SellType sellType `xml:"SELLTYPE"` // Type of sell. SELL, SELLSHORT
|
||||
AvgCostBasis Amount `xml:"AVGCOSTBASIS"`
|
||||
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||
RelFiTID String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||
}
|
||||
|
||||
func (t SellMF) TransactionType() string {
|
||||
@ -313,7 +313,7 @@ type SellOpt struct {
|
||||
InvSell InvSell `xml:"INVSELL"`
|
||||
OptSellType optSellType `xml:"OPTSELLTYPE"` // For options, type of sell: SELLTOCLOSE, SELLTOOPEN. The SELLTOCLOSE action is selling a previously bought option. The SELLTOOPEN action is writing an option
|
||||
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
|
||||
RelFiTId String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||
RelFiTID String `xml:"RELFITID,omitempty"` // used to relate transactions associated with mutual fund exchanges
|
||||
RelType relType `xml:"RELTYPE,omitempty"` // Related option transaction type: SPREAD, STRADDLE, NONE, OTHER
|
||||
Secured secured `xml:"SECURED,omitempty"` // NAKED, COVERED
|
||||
}
|
||||
@ -344,7 +344,7 @@ func (t SellStock) TransactionType() string {
|
||||
type Split struct {
|
||||
XMLName xml.Name `xml:"SPLIT"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
||||
OldUnits Amount `xml:"OLDUNITS"` // number of shares before the split
|
||||
NewUnits Amount `xml:"NEWUNITS"` // number of shares after the split
|
||||
@ -364,7 +364,7 @@ func (t Split) TransactionType() string {
|
||||
type Transfer struct {
|
||||
XMLName xml.Name `xml:"TRANSFER"`
|
||||
InvTran InvTran `xml:"INVTRAN"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
SubAcctSec subAcctType `xml:"SUBACCTSEC"` // Sub-account type for this security. One of CASH, MARGIN, SHORT, OTHER
|
||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
||||
TferAction tferAction `xml:"TFERACTION"` // One of IN, OUT
|
||||
@ -558,7 +558,7 @@ func (l *InvTranList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
|
||||
|
||||
type InvPosition struct {
|
||||
XMLName xml.Name `xml:"INVPOS"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
HeldInAcct subAcctType `xml:"HELDINACCT"` // Sub-account type, one of CASH, MARGIN, SHORT, OTHER
|
||||
PosType posType `xml:"POSTYPE"` // SHORT = Writer for options, Short for all others; LONG = Holder for options, Long for all others.
|
||||
Units Amount `xml:"UNITS"` // For stocks, MFs, other, number of shares held. Bonds = face value. Options = number of contracts
|
||||
@ -690,9 +690,9 @@ type InvBalance struct {
|
||||
|
||||
type OO struct {
|
||||
XMLName xml.Name `xml:"OO"`
|
||||
FiTId String `xml:"FITID"`
|
||||
SrvrTId String `xml:"SRVRTID,omitempty"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
FiTID String `xml:"FITID"`
|
||||
SrvrTID String `xml:"SRVRTID,omitempty"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
DtPlaced Date `xml:"DTPLACED"` // Date the order was placed
|
||||
Units Amount `xml:"UNITS"` // Quantity of the security the open order is for
|
||||
SubAcct subAcctType `xml:"SUBACCT"` // One of CASH, MARGIN, SHORT, OTHER
|
||||
@ -816,7 +816,7 @@ func (o OOSellStock) OrderType() string {
|
||||
type OOSwitchMF struct {
|
||||
XMLName xml.Name `xml:"SWITCHMF"`
|
||||
OO OO `xml:"OO"`
|
||||
SecId SecurityId `xml:"SECID"` // Security ID of the fund to switch to or purchase
|
||||
SecID SecurityID `xml:"SECID"` // Security ID of the fund to switch to or purchase
|
||||
UnitType unitType `xml:"UNITTYPE"` // What the units represent: one of SHARES, CURRENCY
|
||||
SwitchAll Boolean `xml:"SWITCHALL"` // Switch entire holding
|
||||
}
|
||||
@ -914,7 +914,7 @@ func (o *OOList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
||||
|
||||
type ContribSecurity struct {
|
||||
XMLName xml.Name `xml:"CONTRIBSECURITY"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
PreTaxContribPct Amount `xml:"PRETAXCONTRIBPCT,omitempty"` // Percentage of each new employee pretax contribution allocated to this security, rate.
|
||||
PreTaxContribAmt Amount `xml:"PRETAXCONTRIBAMT,omitempty"` // Fixed amount of each new employee pretax contribution allocated to this security, amount
|
||||
AfterTaxContribPct Amount `xml:"AFTERTAXCONTRIBPCT,omitempty"` // Percentage of each new employee after tax contribution allocated to this security, rate.
|
||||
|
350
invstmt_test.go
350
invstmt_test.go
@ -50,13 +50,13 @@ func TestMarshalInvStatementRequest(t *testing.T) {
|
||||
</OFX>`
|
||||
|
||||
var client = ofxgo.Client{
|
||||
AppId: "MYAPP",
|
||||
AppID: "MYAPP",
|
||||
AppVer: "1234",
|
||||
SpecVersion: "203",
|
||||
}
|
||||
|
||||
var request ofxgo.Request
|
||||
request.Signon.UserId = "1998124"
|
||||
request.Signon.UserID = "1998124"
|
||||
request.Signon.UserPass = "Sup3eSekrit"
|
||||
request.Signon.Org = "First Bank"
|
||||
request.Signon.Fid = "01"
|
||||
@ -66,8 +66,8 @@ func TestMarshalInvStatementRequest(t *testing.T) {
|
||||
statementRequest := ofxgo.InvStatementRequest{
|
||||
TrnUID: "382827d6-e2d0-4396-bf3b-665979285420",
|
||||
InvAcctFrom: ofxgo.InvAcct{
|
||||
BrokerId: "fi.example.com",
|
||||
AcctId: "82736664",
|
||||
BrokerID: "fi.example.com",
|
||||
AcctID: "82736664",
|
||||
},
|
||||
DtStart: ofxgo.NewDate(2016, 1, 1, 0, 0, 0, 0, EST),
|
||||
Include: true,
|
||||
@ -344,13 +344,13 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
ofxgo.BuyStock{
|
||||
InvBuy: ofxgo.InvBuy{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "729483191",
|
||||
FiTID: "729483191",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
DtSettle: ofxgo.NewDateGMT(2017, 2, 7, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Units: units1,
|
||||
UnitPrice: unitprice1,
|
||||
@ -372,7 +372,7 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
DtAvail: ofxgo.NewDateGMT(2017, 1, 23, 0, 0, 0, 0),
|
||||
|
||||
TrnAmt: amount2,
|
||||
FiTId: "993838",
|
||||
FiTID: "993838",
|
||||
Name: "DEPOSIT",
|
||||
Memo: "CHECK 19980",
|
||||
},
|
||||
@ -426,16 +426,16 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
DtAsOf: *ofxgo.NewDateGMT(2017, 3, 31, 0, 0, 0, 0),
|
||||
CurDef: "USD",
|
||||
InvAcctFrom: ofxgo.InvAcct{
|
||||
BrokerId: "invstrus.com",
|
||||
AcctId: "91827364",
|
||||
BrokerID: "invstrus.com",
|
||||
AcctID: "91827364",
|
||||
},
|
||||
InvTranList: &invtranlist,
|
||||
InvPosList: ofxgo.PositionList{
|
||||
ofxgo.StockPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeLong,
|
||||
@ -448,9 +448,9 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
},
|
||||
ofxgo.OptPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "129887339",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "129887339",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeLong,
|
||||
@ -465,10 +465,10 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
InvOOList: ofxgo.OOList{
|
||||
ofxgo.OOBuyMF{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "76464632",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "922908645",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "76464632",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "922908645",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
||||
Units: oounits1,
|
||||
@ -482,10 +482,10 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOBuyStock{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -510,55 +510,55 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
Securities: []ofxgo.Security{
|
||||
ofxgo.StockInfo{
|
||||
SecInfo: ofxgo.SecInfo{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SecName: "S&P 500 ETF",
|
||||
Ticker: "SPY",
|
||||
FiId: "99184",
|
||||
FiID: "99184",
|
||||
},
|
||||
Yield: yield1,
|
||||
AssetClass: ofxgo.AssetClassOther,
|
||||
},
|
||||
ofxgo.OptInfo{
|
||||
SecInfo: ofxgo.SecInfo{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "129887339",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "129887339",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SecName: "John's Fertilizer Puts",
|
||||
Ticker: "FERTP",
|
||||
FiId: "882919",
|
||||
FiID: "882919",
|
||||
},
|
||||
OptType: ofxgo.OptTypePut,
|
||||
StrikePrice: strikeprice,
|
||||
DtExpire: *ofxgo.NewDateGMT(2017, 9, 1, 0, 0, 0, 0),
|
||||
ShPerCtrct: 100,
|
||||
SecId: &ofxgo.SecurityId{
|
||||
UniqueId: "983322180",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: &ofxgo.SecurityID{
|
||||
UniqueID: "983322180",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
AssetClass: ofxgo.AssetClassLargeStock,
|
||||
},
|
||||
ofxgo.StockInfo{
|
||||
SecInfo: ofxgo.SecInfo{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SecName: "Whatchamacallit, Inc.",
|
||||
Ticker: "WHAT",
|
||||
FiId: "883897",
|
||||
FiID: "883897",
|
||||
},
|
||||
Yield: yield2,
|
||||
AssetClass: ofxgo.AssetClassSmallStock,
|
||||
},
|
||||
ofxgo.MFInfo{
|
||||
SecInfo: ofxgo.SecInfo{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "922908645",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "922908645",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SecName: "Mid-Cap Index Fund Admiral Shares",
|
||||
Ticker: "VIMAX",
|
||||
@ -566,9 +566,9 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
},
|
||||
ofxgo.DebtInfo{
|
||||
SecInfo: ofxgo.SecInfo{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "99182828",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "99182828",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SecName: "Someone's Class B Debt",
|
||||
},
|
||||
@ -579,9 +579,9 @@ func TestUnmarshalInvStatementResponse(t *testing.T) {
|
||||
},
|
||||
ofxgo.OtherInfo{
|
||||
SecInfo: ofxgo.SecInfo{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "88181818",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "88181818",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SecName: "Foo Bar",
|
||||
},
|
||||
@ -790,13 +790,13 @@ NEWFILEUID: NONE
|
||||
ofxgo.SellOpt{
|
||||
InvSell: ofxgo.InvSell{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "12341234-20161207-1",
|
||||
FiTID: "12341234-20161207-1",
|
||||
DtTrade: *ofxgo.NewDateGMT(2016, 12, 7, 12, 0, 0, 0),
|
||||
DtSettle: ofxgo.NewDateGMT(2016, 12, 8, 12, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "SPY161216C00226000",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "SPY161216C00226000",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Units: units1,
|
||||
UnitPrice: unitprice1,
|
||||
@ -811,13 +811,13 @@ NEWFILEUID: NONE
|
||||
},
|
||||
ofxgo.ClosureOpt{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "12341234-20161215-1",
|
||||
FiTID: "12341234-20161215-1",
|
||||
DtTrade: *ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
||||
DtSettle: ofxgo.NewDateGMT(2016, 12, 20, 12, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F10",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F10",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
OptAction: ofxgo.OptActionAssign,
|
||||
Units: units2,
|
||||
@ -826,13 +826,13 @@ NEWFILEUID: NONE
|
||||
},
|
||||
ofxgo.ClosureOpt{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "12341234-20161215-2",
|
||||
FiTID: "12341234-20161215-2",
|
||||
DtTrade: *ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
||||
DtSettle: ofxgo.NewDateGMT(2016, 12, 15, 12, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "SPY161216C00226000",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "SPY161216C00226000",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
OptAction: ofxgo.OptActionAssign,
|
||||
Units: units3,
|
||||
@ -870,16 +870,16 @@ NEWFILEUID: NONE
|
||||
DtAsOf: *ofxgo.NewDateGMT(2017, 4, 3, 12, 0, 0, 0),
|
||||
CurDef: "USD",
|
||||
InvAcctFrom: ofxgo.InvAcct{
|
||||
BrokerId: "www.exampletrader.com",
|
||||
AcctId: "12341234",
|
||||
BrokerID: "www.exampletrader.com",
|
||||
AcctID: "12341234",
|
||||
},
|
||||
InvTranList: &invtranlist,
|
||||
InvPosList: ofxgo.PositionList{
|
||||
ofxgo.StockPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "04956010",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "04956010",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeLong,
|
||||
@ -891,9 +891,9 @@ NEWFILEUID: NONE
|
||||
},
|
||||
ofxgo.StockPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "36960410",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "36960410",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeLong,
|
||||
@ -915,9 +915,9 @@ NEWFILEUID: NONE
|
||||
Securities: []ofxgo.Security{
|
||||
ofxgo.StockInfo{
|
||||
SecInfo: ofxgo.SecInfo{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F10",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F10",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SecName: "SPDR S&P 500 ETF TRUST",
|
||||
Ticker: "SPY",
|
||||
@ -925,9 +925,9 @@ NEWFILEUID: NONE
|
||||
},
|
||||
ofxgo.OptInfo{
|
||||
SecInfo: ofxgo.SecInfo{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "SPY161216C00226000",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "SPY161216C00226000",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SecName: "SPY Dec 16 2016 226.00 Call",
|
||||
Ticker: "SPY 161216C00226000",
|
||||
@ -1137,13 +1137,13 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
ofxgo.BuyDebt{
|
||||
InvBuy: ofxgo.InvBuy{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "81818",
|
||||
FiTID: "81818",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
DtSettle: ofxgo.NewDateGMT(2017, 2, 7, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Units: units1,
|
||||
UnitPrice: unitprice1,
|
||||
@ -1158,13 +1158,13 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
ofxgo.BuyOpt{
|
||||
InvBuy: ofxgo.InvBuy{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "81818",
|
||||
FiTID: "81818",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
Memo: "Something to make a memo about",
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Units: units1,
|
||||
UnitPrice: unitprice1,
|
||||
@ -1177,12 +1177,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
},
|
||||
ofxgo.InvExpense{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "129837-1111",
|
||||
FiTID: "129837-1111",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Total: fees1,
|
||||
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||
@ -1190,12 +1190,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
},
|
||||
ofxgo.JrnlSec{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "129837-1112",
|
||||
FiTID: "129837-1112",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Units: total2,
|
||||
SubAcctTo: ofxgo.SubAcctTypeCash,
|
||||
@ -1203,7 +1203,7 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
},
|
||||
ofxgo.JrnlFund{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "129837-1112",
|
||||
FiTID: "129837-1112",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
Total: total2,
|
||||
@ -1213,12 +1213,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
ofxgo.BuyOther{
|
||||
InvBuy: ofxgo.InvBuy{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "81818",
|
||||
FiTID: "81818",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Units: units1,
|
||||
UnitPrice: unitprice1,
|
||||
@ -1229,7 +1229,7 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
},
|
||||
ofxgo.MarginInterest{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "129837-1112",
|
||||
FiTID: "129837-1112",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
Total: total2,
|
||||
@ -1238,12 +1238,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
ofxgo.SellDebt{
|
||||
InvSell: ofxgo.InvSell{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "129837-1111",
|
||||
FiTID: "129837-1111",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Units: units1,
|
||||
UnitPrice: unitprice1,
|
||||
@ -1255,12 +1255,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
},
|
||||
ofxgo.RetOfCap{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "129837-1111",
|
||||
FiTID: "129837-1111",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Total: total2,
|
||||
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||
@ -1268,12 +1268,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
},
|
||||
ofxgo.Split{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "129837-1111",
|
||||
FiTID: "129837-1111",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
SubAcctSec: ofxgo.SubAcctTypeCash,
|
||||
OldUnits: oldunits1,
|
||||
@ -1284,12 +1284,12 @@ func TestUnmarshalInvTranList(t *testing.T) {
|
||||
ofxgo.SellOther{
|
||||
InvSell: ofxgo.InvSell{
|
||||
InvTran: ofxgo.InvTran{
|
||||
FiTId: "129837-1111",
|
||||
FiTID: "129837-1111",
|
||||
DtTrade: *ofxgo.NewDateGMT(2017, 2, 3, 0, 0, 0, 0),
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
Units: units1,
|
||||
UnitPrice: unitprice1,
|
||||
@ -1399,9 +1399,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
||||
expected := ofxgo.PositionList{
|
||||
ofxgo.OtherPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeLong,
|
||||
@ -1413,9 +1413,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
||||
},
|
||||
ofxgo.StockPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeShort,
|
||||
@ -1429,9 +1429,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
||||
},
|
||||
ofxgo.DebtPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "129887339",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "129887339",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeLong,
|
||||
@ -1443,9 +1443,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OptPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "129887339",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "129887339",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeLong,
|
||||
@ -1457,9 +1457,9 @@ func TestUnmarshalPositionList(t *testing.T) {
|
||||
},
|
||||
ofxgo.MFPosition{
|
||||
InvPos: ofxgo.InvPosition{
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "78462F103",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "78462F103",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
HeldInAcct: ofxgo.SubAcctTypeCash,
|
||||
PosType: ofxgo.PosTypeLong,
|
||||
@ -1672,10 +1672,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
expected := ofxgo.OOList{
|
||||
ofxgo.OOBuyDebt{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "76464632",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "922908645",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "76464632",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "922908645",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
||||
Units: oounits1,
|
||||
@ -1687,10 +1687,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOBuyMF{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "76464632",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "922908645",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "76464632",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "922908645",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 10, 12, 44, 45, 0),
|
||||
Units: oounits1,
|
||||
@ -1704,10 +1704,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOBuyOpt{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1720,10 +1720,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOBuyStock{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1736,10 +1736,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOBuyOther{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1752,10 +1752,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOSellDebt{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1766,10 +1766,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOSellMF{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1783,10 +1783,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOSellOpt{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1798,10 +1798,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOSellOther{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1813,10 +1813,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOSellStock{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1828,10 +1828,10 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
},
|
||||
ofxgo.OOSwitchMF{
|
||||
OO: ofxgo.OO{
|
||||
FiTId: "999387423",
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422348",
|
||||
UniqueIdType: "CUSIP",
|
||||
FiTID: "999387423",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422348",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
DtPlaced: *ofxgo.NewDateGMT(2017, 3, 24, 3, 19, 0, 0),
|
||||
Units: oounits2,
|
||||
@ -1839,9 +1839,9 @@ func TestUnmarshalOOList(t *testing.T) {
|
||||
Duration: ofxgo.DurationGoodTilCancel,
|
||||
Restriction: ofxgo.RestrictionAllOrNone,
|
||||
},
|
||||
SecId: ofxgo.SecurityId{
|
||||
UniqueId: "899422389",
|
||||
UniqueIdType: "CUSIP",
|
||||
SecID: ofxgo.SecurityID{
|
||||
UniqueID: "899422389",
|
||||
UniqueIDType: "CUSIP",
|
||||
},
|
||||
UnitType: ofxgo.UnitTypeCurrency,
|
||||
SwitchAll: false,
|
||||
|
@ -37,13 +37,13 @@ func TestMarshalProfileRequest(t *testing.T) {
|
||||
</OFX>`
|
||||
|
||||
var client = ofxgo.Client{
|
||||
AppId: "OFXGO",
|
||||
AppID: "OFXGO",
|
||||
AppVer: "0001",
|
||||
SpecVersion: "203",
|
||||
}
|
||||
|
||||
var request ofxgo.Request
|
||||
request.Signon.UserId = "anonymous00000000000000000000000"
|
||||
request.Signon.UserID = "anonymous00000000000000000000000"
|
||||
request.Signon.UserPass = "anonymous00000000000000000000000"
|
||||
request.Signon.Org = "BNK"
|
||||
request.Signon.Fid = "1987"
|
||||
|
@ -66,7 +66,7 @@ func (oq *Request) SetClientFields(c *Client) {
|
||||
|
||||
// Overwrite fields that the client controls
|
||||
oq.Version = c.OfxVersion()
|
||||
oq.Signon.AppId = c.Id()
|
||||
oq.Signon.AppID = c.ID()
|
||||
oq.Signon.AppVer = c.Version()
|
||||
oq.indent = c.IndentRequests()
|
||||
}
|
||||
|
16
seclist.go
16
seclist.go
@ -5,18 +5,18 @@ import (
|
||||
"github.com/aclindsa/go/src/encoding/xml"
|
||||
)
|
||||
|
||||
type SecurityId struct {
|
||||
type SecurityID struct {
|
||||
XMLName xml.Name `xml:"SECID"`
|
||||
UniqueId String `xml:"UNIQUEID"` // CUSIP for US FI's
|
||||
UniqueIdType String `xml:"UNIQUEIDTYPE"` // Should always be "CUSIP" for US FI's
|
||||
UniqueID String `xml:"UNIQUEID"` // CUSIP for US FI's
|
||||
UniqueIDType String `xml:"UNIQUEIDTYPE"` // Should always be "CUSIP" for US FI's
|
||||
}
|
||||
|
||||
type SecurityRequest struct {
|
||||
XMLName xml.Name `xml:"SECRQ"`
|
||||
// Only one of the next three should be present
|
||||
SecId *SecurityId `xml:"SECID,omitempty"`
|
||||
SecID *SecurityID `xml:"SECID,omitempty"`
|
||||
Ticker String `xml:"TICKER,omitempty"`
|
||||
FiId String `xml:"FIID,omitempty"`
|
||||
FiID String `xml:"FIID,omitempty"`
|
||||
}
|
||||
|
||||
type SecListRequest struct {
|
||||
@ -69,10 +69,10 @@ type Security interface {
|
||||
|
||||
type SecInfo struct {
|
||||
XMLName xml.Name `xml:"SECINFO"`
|
||||
SecId SecurityId `xml:"SECID"`
|
||||
SecID SecurityID `xml:"SECID"`
|
||||
SecName String `xml:"SECNAME"` // Full name of security
|
||||
Ticker String `xml:"TICKER,omitempty"` // Ticker symbol
|
||||
FiId String `xml:"FIID,omitempty"`
|
||||
FiID String `xml:"FIID,omitempty"`
|
||||
Rating String `xml:"RATING,omitempty"`
|
||||
UnitPrice Amount `xml:"UNITPRICE,omitempty"` // Current price, as of DTASOF
|
||||
DtAsOf *Date `xml:"DTASOF,omitempty"` // Date UNITPRICE was for
|
||||
@ -136,7 +136,7 @@ type OptInfo struct {
|
||||
StrikePrice Amount `xml:"STRIKEPRICE"`
|
||||
DtExpire Date `xml:"DTEXPIRE"` // Expiration date
|
||||
ShPerCtrct Int `xml:"SHPERCTRCT"` // Shares per contract
|
||||
SecId *SecurityId `xml:"SECID,omitempty"` // Security ID of the underlying security
|
||||
SecID *SecurityID `xml:"SECID,omitempty"` // Security ID of the underlying security
|
||||
AssetClass assetClass `xml:"ASSETCLASS,omitempty"` // One of DOMESTICBOND, INTLBOND, LARGESTOCK, SMALLSTOCK, INTLSTOCK, MONEYMRKT, OTHER
|
||||
FiAssetClass String `xml:"FIASSETCLASS,omitempty"` // FI-defined asset class
|
||||
}
|
||||
|
@ -9,13 +9,13 @@ import (
|
||||
type SignonRequest struct {
|
||||
XMLName xml.Name `xml:"SONRQ"`
|
||||
DtClient Date `xml:"DTCLIENT"` // Current time on client, overwritten in Client.Request()
|
||||
UserId String `xml:"USERID"`
|
||||
UserID String `xml:"USERID"`
|
||||
UserPass String `xml:"USERPASS,omitempty"`
|
||||
UserKey String `xml:"USERKEY,omitempty"`
|
||||
Language String `xml:"LANGUAGE"` // Defaults to ENG
|
||||
Org String `xml:"FI>ORG"`
|
||||
Fid String `xml:"FI>FID"`
|
||||
AppId String `xml:"APPID"` // Overwritten in Client.Request()
|
||||
AppID String `xml:"APPID"` // Overwritten in Client.Request()
|
||||
AppVer String `xml:"APPVER"` // Overwritten in Client.Request()
|
||||
ClientUID UID `xml:"CLIENTUID,omitempty"`
|
||||
}
|
||||
@ -25,7 +25,7 @@ func (r *SignonRequest) Name() string {
|
||||
}
|
||||
|
||||
func (r *SignonRequest) Valid() (bool, error) {
|
||||
if len(r.UserId) < 1 || len(r.UserId) > 32 {
|
||||
if len(r.UserID) < 1 || len(r.UserID) > 32 {
|
||||
return false, errors.New("SONRQ>USERID invalid length")
|
||||
}
|
||||
if (len(r.UserPass) == 0) == (len(r.UserKey) == 0) {
|
||||
@ -42,7 +42,7 @@ func (r *SignonRequest) Valid() (bool, error) {
|
||||
} else if len(r.Language) != 3 {
|
||||
return false, fmt.Errorf("SONRQ>LANGUAGE invalid length: \"%s\"\n", r.Language)
|
||||
}
|
||||
if len(r.AppId) < 1 || len(r.AppId) > 5 {
|
||||
if len(r.AppID) < 1 || len(r.AppID) > 5 {
|
||||
return false, errors.New("SONRQ>APPID invalid length")
|
||||
}
|
||||
if len(r.AppVer) < 1 || len(r.AppVer) > 4 {
|
||||
|
@ -7,13 +7,13 @@ import (
|
||||
|
||||
func TestMarshalInvalidSignons(t *testing.T) {
|
||||
var client = ofxgo.Client{
|
||||
AppId: "OFXGO",
|
||||
AppID: "OFXGO",
|
||||
AppVer: "0001",
|
||||
SpecVersion: "203",
|
||||
}
|
||||
|
||||
var request ofxgo.Request
|
||||
request.Signon.UserId = "myusername"
|
||||
request.Signon.UserID = "myusername"
|
||||
request.Signon.UserPass = "Pa$$word"
|
||||
request.Signon.Org = "BNK"
|
||||
request.Signon.Fid = "1987"
|
||||
@ -36,16 +36,16 @@ func TestMarshalInvalidSignons(t *testing.T) {
|
||||
t.Fatalf("Unexpected error marshalling signon: %s\n", err)
|
||||
}
|
||||
|
||||
request.Signon.UserId = ""
|
||||
request.Signon.UserID = ""
|
||||
_, err = request.Marshal()
|
||||
if err == nil {
|
||||
t.Fatalf("Expected error due to unspecified UserId\n")
|
||||
t.Fatalf("Expected error due to unspecified UserID\n")
|
||||
}
|
||||
request.Signon.UserId = "lakhgdlsakhgdlkahdglkhsadlkghaslkdghsalkdghalsdhg"
|
||||
request.Signon.UserID = "lakhgdlsakhgdlkahdglkhsadlkghaslkdghsalkdghalsdhg"
|
||||
if err == nil {
|
||||
t.Fatalf("Expected error due to UserId too long\n")
|
||||
t.Fatalf("Expected error due to UserID too long\n")
|
||||
}
|
||||
request.Signon.UserId = "myusername"
|
||||
request.Signon.UserID = "myusername"
|
||||
|
||||
request.Signon.UserKey = "adlfahdslkgahdweoihadf98agrha87rghasdf9hawhra2hrkwahhaguhwaoefajkei23hff"
|
||||
_, err = request.Marshal()
|
||||
@ -78,23 +78,23 @@ func TestMarshalInvalidSignons(t *testing.T) {
|
||||
}
|
||||
request.Signon.Language = "ENG"
|
||||
|
||||
request.Signon.AppId = ""
|
||||
request.Signon.AppID = ""
|
||||
_, err = request.Marshal()
|
||||
if err == nil {
|
||||
t.Fatalf("Expected error due to missing AppId\n")
|
||||
t.Fatalf("Expected error due to missing AppID\n")
|
||||
}
|
||||
request.SetClientFields(&client)
|
||||
_, err = request.Marshal()
|
||||
if err != nil {
|
||||
t.Fatalf("Client expected to set empty AppId: %s\n", err)
|
||||
t.Fatalf("Client expected to set empty AppID: %s\n", err)
|
||||
}
|
||||
client.AppId = "ALKHGDH"
|
||||
client.AppID = "ALKHGDH"
|
||||
request.SetClientFields(&client)
|
||||
_, err = request.Marshal()
|
||||
if err == nil {
|
||||
t.Fatalf("Expected error due to AppId too long\n")
|
||||
t.Fatalf("Expected error due to AppID too long\n")
|
||||
}
|
||||
client.AppId = "OFXGO"
|
||||
client.AppID = "OFXGO"
|
||||
|
||||
request.Signon.AppVer = ""
|
||||
_, err = request.Marshal()
|
||||
|
@ -38,13 +38,13 @@ func TestMarshalAcctInfoRequest(t *testing.T) {
|
||||
EST := time.FixedZone("EST", -5*60*60)
|
||||
|
||||
var client = ofxgo.Client{
|
||||
AppId: "OFXGO",
|
||||
AppID: "OFXGO",
|
||||
AppVer: "0001",
|
||||
SpecVersion: "203",
|
||||
}
|
||||
|
||||
var request ofxgo.Request
|
||||
request.Signon.UserId = "myusername"
|
||||
request.Signon.UserID = "myusername"
|
||||
request.Signon.UserPass = "Pa$$word"
|
||||
request.Signon.Org = "BNK"
|
||||
request.Signon.Fid = "1987"
|
||||
@ -124,8 +124,8 @@ func TestUnmarshalAcctInfoResponse(t *testing.T) {
|
||||
|
||||
bankacctinfo := ofxgo.BankAcctInfo{
|
||||
BankAcctFrom: ofxgo.BankAcct{
|
||||
BankId: "8367556009",
|
||||
AcctId: "000999847",
|
||||
BankID: "8367556009",
|
||||
AcctID: "000999847",
|
||||
AcctType: ofxgo.AcctTypeMoneyMrkt,
|
||||
},
|
||||
SupTxDl: true,
|
||||
|
Loading…
Reference in New Issue
Block a user