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

Switch Date to contain time.Time instead of being a typedef

This commit is contained in:
2017-04-04 05:45:19 -04:00
parent 7f5ef5751d
commit 1560f44a3c
10 changed files with 151 additions and 167 deletions

View File

@ -53,21 +53,19 @@ func TestMarshalCCStatementRequest(t *testing.T) {
request.Signon.Org = "BNK"
request.Signon.Fid = "1987"
GMT := time.FixedZone("GMT", 0)
dtstart := ofxgo.Date(time.Date(2017, 1, 1, 0, 0, 0, 0, GMT))
statementRequest := ofxgo.CCStatementRequest{
TrnUID: "913846",
CCAcctFrom: ofxgo.CCAcct{
AcctId: "XXXXXXXXXXXX1234",
},
DtStart: &dtstart,
DtStart: ofxgo.NewDateGMT(2017, 1, 1, 0, 0, 0, 0),
Include: true,
}
request.CreditCard = append(request.CreditCard, &statementRequest)
request.SetClientFields(&client)
// Overwrite the DtClient value set by SetClientFields to time.Now()
request.Signon.DtClient = ofxgo.Date(time.Date(2017, 3, 31, 15, 38, 48, 0, GMT))
request.Signon.DtClient = *ofxgo.NewDateGMT(2017, 3, 31, 15, 38, 48, 0)
marshalCheckRequest(t, &request, expectedString)
}
@ -85,7 +83,6 @@ NEWFILEUID:NONE
<OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>0<SEVERITY>INFO<MESSAGE>SUCCESS</STATUS><DTSERVER>20170331154648.331[-4:EDT]<LANGUAGE>ENG<FI><ORG>01<FID>81729</FI></SONRS></SIGNONMSGSRSV1><CREDITCARDMSGSRSV1><CCSTMTTRNRS><TRNUID>59e850ad-7448-b4ce-4b71-29057763b306<STATUS><CODE>0<SEVERITY>INFO</STATUS><CCSTMTRS><CURDEF>USD<CCACCTFROM><ACCTID>9283744488463775</CCACCTFROM><BANKTRANLIST><DTSTART>20161201154648.688[-5:EST]<DTEND>20170331154648.688[-4:EDT]<STMTTRN><TRNTYPE>DEBIT<DTPOSTED>20170209120000[0:GMT]<TRNAMT>-7.96<FITID>2017020924435657040207171600195<NAME>SLICE OF NY</STMTTRN><STMTTRN><TRNTYPE>CREDIT<DTPOSTED>20161228120000[0:GMT]<TRNAMT>3830.46<FITID>2016122823633637200000258482730<NAME>Payment Thank You Electro</STMTTRN><STMTTRN><TRNTYPE>DEBIT<DTPOSTED>20170327120000[0:GMT]<TRNAMT>-17.7<FITID>2017032724445727085300442885680<NAME>KROGER FUEL #9999</STMTTRN></BANKTRANLIST><LEDGERBAL><BALAMT>-9334<DTASOF>20170331080000.000[-4:EDT]</LEDGERBAL><AVAILBAL><BALAMT>7630.17<DTASOF>20170331080000.000[-4:EDT]</AVAILBAL></CCSTMTRS></CCSTMTTRNRS></CREDITCARDMSGSRSV1></OFX>`)
var expected ofxgo.Response
GMT := time.FixedZone("GMT", 0)
EDT := time.FixedZone("EDT", -4*60*60)
EST := time.FixedZone("EST", -5*60*60)
@ -93,7 +90,7 @@ NEWFILEUID:NONE
expected.Signon.Status.Code = 0
expected.Signon.Status.Severity = "INFO"
expected.Signon.Status.Message = "SUCCESS"
expected.Signon.DtServer = ofxgo.Date(time.Date(2017, 3, 31, 15, 46, 48, 331000000, EDT))
expected.Signon.DtServer = *ofxgo.NewDate(2017, 3, 31, 15, 46, 48, 331000000, EDT)
expected.Signon.Language = "ENG"
expected.Signon.Org = "01"
expected.Signon.Fid = "81729"
@ -104,26 +101,26 @@ NEWFILEUID:NONE
trnamt3.SetFrac64(-1770, 100)
banktranlist := ofxgo.TransactionList{
DtStart: ofxgo.Date(time.Date(2016, 12, 1, 15, 46, 48, 688000000, EST)),
DtEnd: ofxgo.Date(time.Date(2017, 3, 31, 15, 46, 48, 688000000, EDT)),
DtStart: *ofxgo.NewDate(2016, 12, 1, 15, 46, 48, 688000000, EST),
DtEnd: *ofxgo.NewDate(2017, 3, 31, 15, 46, 48, 688000000, EDT),
Transactions: []ofxgo.Transaction{
{
TrnType: "DEBIT",
DtPosted: ofxgo.Date(time.Date(2017, 2, 9, 12, 0, 0, 0, GMT)),
DtPosted: *ofxgo.NewDateGMT(2017, 2, 9, 12, 0, 0, 0),
TrnAmt: trnamt1,
FiTId: "2017020924435657040207171600195",
Name: "SLICE OF NY",
},
{
TrnType: "CREDIT",
DtPosted: ofxgo.Date(time.Date(2016, 12, 28, 12, 0, 0, 0, GMT)),
DtPosted: *ofxgo.NewDateGMT(2016, 12, 28, 12, 0, 0, 0),
TrnAmt: trnamt2,
FiTId: "2016122823633637200000258482730",
Name: "Payment Thank You Electro",
},
{
TrnType: "DEBIT",
DtPosted: ofxgo.Date(time.Date(2017, 3, 27, 12, 0, 0, 0, GMT)),
DtPosted: *ofxgo.NewDateGMT(2017, 3, 27, 12, 0, 0, 0),
TrnAmt: trnamt3,
FiTId: "2017032724445727085300442885680",
Name: "KROGER FUEL #9999",
@ -135,8 +132,6 @@ NEWFILEUID:NONE
balamt.SetFrac64(-933400, 100)
availbalamt.SetFrac64(763017, 100)
availdtasof := ofxgo.Date(time.Date(2017, 3, 31, 8, 0, 0, 0, EDT))
statementResponse := ofxgo.CCStatementResponse{
TrnUID: "59e850ad-7448-b4ce-4b71-29057763b306",
Status: ofxgo.Status{
@ -149,9 +144,9 @@ NEWFILEUID:NONE
},
BankTranList: &banktranlist,
BalAmt: balamt,
DtAsOf: ofxgo.Date(time.Date(2017, 3, 31, 8, 0, 0, 0, EDT)),
DtAsOf: *ofxgo.NewDate(2017, 3, 31, 8, 0, 0, 0, EDT),
AvailBalAmt: &availbalamt,
AvailDtAsOf: &availdtasof,
AvailDtAsOf: ofxgo.NewDate(2017, 3, 31, 8, 0, 0, 0, EDT),
}
expected.CreditCard = append(expected.CreditCard, &statementResponse)