1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-11-21 19:20:05 -05:00

Standardize transaction wrapper fields

This commit is contained in:
Aaron Lindsay 2017-03-30 10:24:26 -04:00
parent 6efd3ae921
commit c1777df3df
7 changed files with 56 additions and 36 deletions

View File

@ -6,8 +6,11 @@ import (
)
type StatementRequest struct {
XMLName xml.Name `xml:"STMTTRNRQ"`
TrnUID UID `xml:"TRNUID"`
XMLName xml.Name `xml:"STMTTRNRQ"`
TrnUID UID `xml:"TRNUID"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
TAN String `xml:"TAN,omitempty"` // Transaction authorization number
// TODO `xml:"OFXEXTENSION,omitempty"`
BankAcctFrom BankAcct `xml:"STMTRQ>BANKACCTFROM"`
DtStart *Date `xml:"STMTRQ>INCTRAN>DTSTART,omitempty"`
DtEnd *Date `xml:"STMTRQ>INCTRAN>DTEND,omitempty"`
@ -124,9 +127,11 @@ type Balance struct {
}
type StatementResponse struct {
XMLName xml.Name `xml:"STMTTRNRS"`
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
XMLName xml.Name `xml:"STMTTRNRS"`
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
// TODO `xml:"OFXEXTENSION,omitempty"`
CurDef String `xml:"STMTRS>CURDEF"`
BankAcctFrom BankAcct `xml:"STMTRS>BANKACCTFROM"`
BankTranList *TransactionList `xml:"STMTRS>BANKTRANLIST,omitempty"`

View File

@ -30,9 +30,8 @@ func getAccounts() {
}
acctInfo := ofxgo.AcctInfoRequest{
TrnUID: *uid,
DtAcctUp: ofxgo.Date(time.Unix(0, 0)),
CltCookie: 1,
TrnUID: *uid,
DtAcctUp: ofxgo.Date(time.Unix(0, 0)),
}
query.Signup = append(query.Signup, &acctInfo)

View File

@ -6,14 +6,17 @@ import (
)
type CCStatementRequest struct {
XMLName xml.Name `xml:"CCSTMTTRNRQ"`
TrnUID UID `xml:"TRNUID"`
CCAcctFrom CCAcct `xml:"CCSTMTRQ>CCACCTFROM"`
DtStart *Date `xml:"CCSTMTRQ>INCTRAN>DTSTART,omitempty"`
DtEnd *Date `xml:"CCSTMTRQ>INCTRAN>DTEND,omitempty"`
Include Boolean `xml:"CCSTMTRQ>INCTRAN>INCLUDE"` // Include transactions (instead of just balance)
IncludePending Boolean `xml:"CCSTMTRQ>INCLUDEPENDING,omitempty"` // Include pending transactions
IncTranImg Boolean `xml:"CCSTMTRQ>INCTRANIMG,omitempty"` // Include transaction images
XMLName xml.Name `xml:"CCSTMTTRNRQ"`
TrnUID UID `xml:"TRNUID"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
TAN String `xml:"TAN,omitempty"`
// TODO OFXEXTENSION
CCAcctFrom CCAcct `xml:"CCSTMTRQ>CCACCTFROM"`
DtStart *Date `xml:"CCSTMTRQ>INCTRAN>DTSTART,omitempty"`
DtEnd *Date `xml:"CCSTMTRQ>INCTRAN>DTEND,omitempty"`
Include Boolean `xml:"CCSTMTRQ>INCTRAN>INCLUDE"` // Include transactions (instead of just balance)
IncludePending Boolean `xml:"CCSTMTRQ>INCLUDEPENDING,omitempty"` // Include pending transactions
IncTranImg Boolean `xml:"CCSTMTRQ>INCTRANIMG,omitempty"` // Include transaction images
}
func (r *CCStatementRequest) Name() string {
@ -26,9 +29,11 @@ func (r *CCStatementRequest) Valid() (bool, error) {
}
type CCStatementResponse struct {
XMLName xml.Name `xml:"CCSTMTTRNRS"`
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
XMLName xml.Name `xml:"CCSTMTTRNRS"`
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
// TODO `xml:"OFXEXTENSION,omitempty"`
CurDef String `xml:"CCSTMTRS>CURDEF"`
CCAcctFrom CCAcct `xml:"CCSTMTRS>CCACCTFROM"`
BankTranList *TransactionList `xml:"CCSTMTRS>BANKTRANLIST,omitempty"`

View File

@ -794,7 +794,7 @@ type InvStatementResponse struct {
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
// TODO OFXEXTENSION
// TODO `xml:"OFXEXTENSION,omitempty"`
DtAsOf Date `xml:"INVSTMTRS>DTASOF"`
CurDef String `xml:"INVSTMTRS>CURDEF"`
InvAcctFrom InvAcct `xml:"INVSTMTRS>INVACCTFROM"`

View File

@ -6,10 +6,13 @@ import (
)
type ProfileRequest struct {
XMLName xml.Name `xml:"PROFTRNRQ"`
TrnUID UID `xml:"TRNUID"`
ClientRouting String `xml:"PROFRQ>CLIENTROUTING"` // Forced to NONE
DtProfUp Date `xml:"PROFRQ>DTPROFUP"`
XMLName xml.Name `xml:"PROFTRNRQ"`
TrnUID UID `xml:"TRNUID"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
TAN String `xml:"TAN,omitempty"` // Transaction authorization number
// TODO `xml:"OFXEXTENSION,omitempty"`
ClientRouting String `xml:"PROFRQ>CLIENTROUTING"` // Forced to NONE
DtProfUp Date `xml:"PROFRQ>DTPROFUP"`
}
func (r *ProfileRequest) Name() string {
@ -95,9 +98,11 @@ func (msl *MessageSetList) UnmarshalXML(d *xml.Decoder, start xml.StartElement)
}
type ProfileResponse struct {
XMLName xml.Name `xml:"PROFTRNRS"`
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
XMLName xml.Name `xml:"PROFTRNRS"`
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
// TODO `xml:"OFXEXTENSION,omitempty"`
MessageSetList MessageSetList `xml:"PROFRS>MSGSETLIST"`
SignonInfoList []SignonInfo `xml:"PROFRS>SIGNONINFOLIST>SIGNONINFO"`
DtProfUp Date `xml:"PROFRS>DTPROFUP"`

View File

@ -20,10 +20,11 @@ type SecurityRequest struct {
}
type SecListRequest struct {
XMLName xml.Name `xml:"SECLISTTRNRQ"`
TrnUID UID `xml:"TRNUID"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
TAN String `xml:"TAN,omitempty"` // Transaction authorization number
XMLName xml.Name `xml:"SECLISTTRNRQ"`
TrnUID UID `xml:"TRNUID"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
TAN String `xml:"TAN,omitempty"` // Transaction authorization number
// TODO `xml:"OFXEXTENSION,omitempty"`
Securities []SecurityRequest `xml:"SECLISTRQ>SECRQ,omitempty"`
}
@ -41,6 +42,7 @@ type SecListResponse struct {
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
// TODO `xml:"OFXEXTENSION,omitempty"`
// SECLISTRS is always empty, so we don't parse it here. The actual securities list will be in a top-level element parallel to SECLISTTRNRS
}

View File

@ -9,8 +9,10 @@ import (
type AcctInfoRequest struct {
XMLName xml.Name `xml:"ACCTINFOTRNRQ"`
TrnUID UID `xml:"TRNUID"`
CltCookie Int `xml:"CLTCOOKIE"`
DtAcctUp Date `xml:"ACCTINFORQ>DTACCTUP"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
TAN String `xml:"TAN,omitempty"` // Transaction authorization number
// TODO `xml:"OFXEXTENSION,omitempty"`
DtAcctUp Date `xml:"ACCTINFORQ>DTACCTUP"`
}
func (r *AcctInfoRequest) Name() string {
@ -105,9 +107,11 @@ type AcctInfo struct {
}
type AcctInfoResponse struct {
XMLName xml.Name `xml:"ACCTINFOTRNRS"`
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
XMLName xml.Name `xml:"ACCTINFOTRNRS"`
TrnUID UID `xml:"TRNUID"`
Status Status `xml:"STATUS"`
CltCookie String `xml:"CLTCOOKIE,omitempty"`
// TODO `xml:"OFXEXTENSION,omitempty"`
DtAcctUp Date `xml:"ACCTINFORS>DTACCTUP"`
AcctInfo []AcctInfo `xml:"ACCTINFORS>ACCTINFO,omitempty"`
}