mirror of
https://github.com/aclindsa/ofxgo.git
synced 2024-11-22 03:30:04 -05:00
Add v1.0.3 bank request test
This commit is contained in:
parent
749c2e9f3a
commit
3f5249cad4
74
bank_test.go
74
bank_test.go
@ -73,6 +73,80 @@ func TestMarshalBankStatementRequest(t *testing.T) {
|
|||||||
marshalCheckRequest(t, &request, expectedString)
|
marshalCheckRequest(t, &request, expectedString)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMarshalBankStatementRequest103(t *testing.T) {
|
||||||
|
var expectedString string = `OFXHEADER:100
|
||||||
|
DATA:OFXSGML
|
||||||
|
VERSION:103
|
||||||
|
SECURITY:NONE
|
||||||
|
ENCODING:USASCII
|
||||||
|
CHARSET:1252
|
||||||
|
COMPRESSION:NONE
|
||||||
|
OLDFILEUID:NONE
|
||||||
|
NEWFILEUID:NONE
|
||||||
|
|
||||||
|
<OFX>
|
||||||
|
<SIGNONMSGSRQV1>
|
||||||
|
<SONRQ>
|
||||||
|
<DTCLIENT>20060115112300.000[-5:EST]</DTCLIENT>
|
||||||
|
<USERID>myusername</USERID>
|
||||||
|
<USERPASS>Pa$$word</USERPASS>
|
||||||
|
<LANGUAGE>ENG</LANGUAGE>
|
||||||
|
<FI>
|
||||||
|
<ORG>BNK</ORG>
|
||||||
|
<FID>1987</FID>
|
||||||
|
</FI>
|
||||||
|
<APPID>OFXGO</APPID>
|
||||||
|
<APPVER>0001</APPVER>
|
||||||
|
</SONRQ>
|
||||||
|
</SIGNONMSGSRQV1>
|
||||||
|
<BANKMSGSRQV1>
|
||||||
|
<STMTTRNRQ>
|
||||||
|
<TRNUID>123</TRNUID>
|
||||||
|
<STMTRQ>
|
||||||
|
<BANKACCTFROM>
|
||||||
|
<BANKID>318398732</BANKID>
|
||||||
|
<ACCTID>78346129</ACCTID>
|
||||||
|
<ACCTTYPE>CHECKING</ACCTTYPE>
|
||||||
|
</BANKACCTFROM>
|
||||||
|
<INCTRAN>
|
||||||
|
<INCLUDE>Y</INCLUDE>
|
||||||
|
</INCTRAN>
|
||||||
|
</STMTRQ>
|
||||||
|
</STMTTRNRQ>
|
||||||
|
</BANKMSGSRQV1>
|
||||||
|
</OFX>`
|
||||||
|
|
||||||
|
var client = ofxgo.Client{
|
||||||
|
AppId: "OFXGO",
|
||||||
|
AppVer: "0001",
|
||||||
|
SpecVersion: "103",
|
||||||
|
}
|
||||||
|
|
||||||
|
var request ofxgo.Request
|
||||||
|
request.Signon.UserId = "myusername"
|
||||||
|
request.Signon.UserPass = "Pa$$word"
|
||||||
|
request.Signon.Org = "BNK"
|
||||||
|
request.Signon.Fid = "1987"
|
||||||
|
|
||||||
|
statementRequest := ofxgo.StatementRequest{
|
||||||
|
TrnUID: "123",
|
||||||
|
BankAcctFrom: ofxgo.BankAcct{
|
||||||
|
BankId: "318398732",
|
||||||
|
AcctId: "78346129",
|
||||||
|
AcctType: ofxgo.AcctTypeChecking,
|
||||||
|
},
|
||||||
|
Include: true,
|
||||||
|
}
|
||||||
|
request.Bank = append(request.Bank, &statementRequest)
|
||||||
|
|
||||||
|
request.SetClientFields(&client)
|
||||||
|
// Overwrite the DtClient value set by SetClientFields to time.Now()
|
||||||
|
EST := time.FixedZone("EST", -5*60*60)
|
||||||
|
request.Signon.DtClient = *ofxgo.NewDate(2006, 1, 15, 11, 23, 0, 0, EST)
|
||||||
|
|
||||||
|
marshalCheckRequest(t, &request, expectedString)
|
||||||
|
}
|
||||||
|
|
||||||
func TestUnmarshalBankStatementResponse(t *testing.T) {
|
func TestUnmarshalBankStatementResponse(t *testing.T) {
|
||||||
responseReader := strings.NewReader(`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
responseReader := strings.NewReader(`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<?OFX OFXHEADER="200" VERSION="203" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>
|
<?OFX OFXHEADER="200" VERSION="203" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>
|
||||||
|
Loading…
Reference in New Issue
Block a user