mirror of
https://github.com/aclindsa/ofxgo.git
synced 2025-06-14 13:58:37 -04:00
s/Id/ID/
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user