~mendelmaleh/pfin

ref: 1f051309601a4da2841fade1e72cb120bccab370 pfin/parser/capitalone/types.go -rw-r--r-- 583 bytes
1f051309Mendel E Add license 7 months ago
                                                                                
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
package capitalone

import "time"

type RawTransaction struct {
	TransactionDate Date    `csv:"Transaction Date"`
	PostedDate      Date    `csv:"Posted Date"`
	CardNumber      string  `csv:"Card No."`
	Description     string  `csv:"Description"`
	Category        string  `csv:"Category"`
	Debit           float64 `csv:"Debit,omitempty"`
	Credit          float64 `csv:"Credit,omitempty"`
}

type Date struct {
	time.Time
}

func (d *Date) UnmarshalText(data []byte) error {
	t, err := time.Parse("2006-01-02", string(data))
	if err != nil {
		return err
	}

	d.Time = t
	return nil
}