-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtransaction.go
139 lines (125 loc) · 4.33 KB
/
transaction.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package budget
import (
"sort"
"time"
)
type Transaction struct {
// UUID for the transaction, assigned when it's imported
ID string
// ID of the Account this Transaction belongs to
AccountID string
// Type of transaction
TransactionType string
// Date the transaction was posted
DatePosted time.Time
// Date the user initiated the transaction, if known
DateUser time.Time
// Date the funds are available
DateAvailable time.Time
// Amount of the transaction, in whole cents
Amount int64
// The ID for the transaction, assigned by the financial institution
FiTID string
// Server-assigned transaction ID, for transactions initiated by the server
ServerTID string
// Check (or other reference) number
CheckNum string
// Reference number to uniquely identify this transaction. Alternative or addition to CheckNum.
RefNum string
// Standard Industrial Code
SIC int64
// Payee identifier, if available
PayeeID string
// Name of payee or description of transaction
Name string
// Extended name of payee or description of transaction
ExtendedName string
// Edited name of description, containing user-corrected text
EditedName string
// Extra information not in Name
Memo string
// Source of cash for this transaction, if a 401k transaction.
Inv401kSource string `sql_column:"inv_401k_source"`
// ID of the group to associate this transaction with.
GroupID string
// ID of the Trend to associate this transaction wtih.
TrendID string
// The three letter code for the currency the amount is specified in
Currency string
// The three letter code for the currency the transaction was in before being converted
OriginalCurrency string
// The FiTID of a previously downloaded transaction that is being corrected by this transaction
CorrectFiTID string
// REPLACE or DELETE; REPLACE means this transaction should replace CorrectFiTID; delete means just remove it.
CorrectAction string
// Name of the Payee, if available
PayeeName string
// First line of the Payee's address, if available
PayeeAddr1 string
// Second line of the Payee's address, if available
PayeeAddr2 string
// Third line of the Payee's address, if available
PayeeAddr3 string
// City the payee is in, if available
PayeeCity string
// State the payee is in, if available
PayeeState string
// Postal code the payee is in, if available
PayeePostalCode string
// Country the payee is in, if available
PayeeCountry string
// Phone number for the payee, if available
PayeePhone string
// If this was a transfer to a bank account, and that account's information is available, this is the
// BankID for that account.
BankAccountToBankID string
// If this was a transfer to a bank account, and that account's information is available, this is the
// BranchID for that account.
BankAccountToBranchID string
// If this was a transfer to a bank account, and that account's information is available, this is the
// AccountID for that account.
BankAccountToAccountID string
// If this was a transfer to a bank account, and that account's information is available, this is the
// AccountType for that account.
BankAccountToAccountType string
// If this was a transfer to a bank account, and that account's information is available, this is the
// AccountKey for that account.
BankAccountToAccountKey string
// If this was a transfer to a credit card account, and that account's information is available, this
// is the AccountID for that account.
CreditCardAccountToAccountID string
// If this was a transfer to a credit card account, and that account's information is available, this
// is the AccountKey for that account.
CreditCardAccountToAccountKey string
}
func (t Transaction) GetSQLTableName() string {
return "ofx_transactions"
}
func TransactionsByDate(t []Transaction) {
sort.Slice(t, func(i, j int) bool {
return t[i].DatePosted.Before(t[j].DatePosted)
})
}
type TransactionFilters struct {
IDs []string
AccountIDs []string
TransactionTypes []string
DatePostedBefore *time.Time
DatePostedAfter *time.Time
Amount *int64
AmountGreaterThan *int64
AmountLessThan *int64
CheckNum *string
RefNum *string
Name *string
GroupID *string
}
type TransactionChange struct {
GroupID *string
}
func (c TransactionChange) IsEmpty() bool {
if c.GroupID != nil {
return false
}
return true
}