ofx

package module
v0.0.0-...-0312269 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2019 License: AGPL-3.0 Imports: 4 Imported by: 3

README

go-ofx

Library to generate OFX files for YNAB, HomeBank or similar applications

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankTransaction

type BankTransaction struct {
	PostedDate         time.Time
	InterestDate       time.Time
	Ref                string
	DestinationAccount string
	TxType             string
	Memo               string
	Amount             float64
}

func (*BankTransaction) ToOfx

func (btx *BankTransaction) ToOfx() OfxTransaction

ToOfx converts a single bank transaction (BankTransaction) to a single OfxTransaction

type OfxTransaction

type OfxTransaction struct {
	XMLName          xml.Name `xml:"STMTTRN"`
	Type             string   `xml:"TRNTYPE"`
	DatePosted       string   `xml:"DTPOSTED"`
	DateUser         string   `xml:"DTUSER"`
	Amount           float64  `xml:"TRNAMT"`
	ID               string   `xml:"FITID"`
	Payee            string   `xml:"NAME"`
	Memo             string   `xml:"MEMO"`
	PayeeBank        string   `xml:"BANKACCTTO>BANKID"`
	PayeeAccount     string   `xml:"BANKACCTTO>ACCTID"`
	PayeeAccountType string   `xml:"BANKACCTTO>ACCTTYPE"`
}

type OfxTransactionList

type OfxTransactionList struct {
	XMLName          xml.Name         `xml:"OFX"`
	CurDef           string           `xml:"BANKMSGSRSV1>STMTTRNRS>STMTRS>CURDEF"`
	PayerBank        string           `xml:"BANKMSGSRSV1>STMTTRNRS>STMTRS>BANKACCTFROM>BANKID"`
	PayerAccount     string           `xml:"BANKMSGSRSV1>STMTTRNRS>STMTRS>BANKACCTFROM>ACCTID"`
	PayerAccountType string           `xml:"BANKMSGSRSV1>STMTTRNRS>STMTRS>BANKACCTFROM>ACCTTYPE"`
	Transactions     []OfxTransaction `xml:"BANKMSGSRSV1>STMTTRNRS>STMTRS>BANKTRANLIST>STMTTRN"`
}

func (*OfxTransactionList) WriteOFX

func (txs *OfxTransactionList) WriteOFX(w io.Writer)

WriteOFX creates an XML document from a OfxTransactionList, and writes it to the Writer passed in as an argument

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL