direct

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CheckingType refers to a bank checking account
	CheckingType accountType = iota + 1
	// SavingsType refers to a bank savings account
	SavingsType
)

Variables

View Source
var (
	// ErrAuthFailed is returned whenever a signon request fails with an authentication problem
	ErrAuthFailed = errors.New("Username or password is incorrect")
)

Functions

func Accounts

func Accounts(connector Connector, logger *zap.Logger) ([]model.Account, error)

Accounts fetches available accounts at the direct connector's institution

func IsLocalhostTestURL

func IsLocalhostTestURL(urlStr string) bool

IsLocalhostTestURL returns true if this is a valid URL and starts with http://localhost

func ParseAccountType

func ParseAccountType(s string) accountType

ParseAccountType parses s as a bank account type, like checking or savings

func Register added in v0.7.0

func Register(drivers ...Driver)

func Statement

func Statement(connector Connector, start, end time.Time, requestors []Requestor, parser model.TransactionParser) ([]ledger.Transaction, error)

Statement downloads and returns transactions from a direct connector for the given time period

func Validate

func Validate(account Account) error

Validate checks the direct connect account for invalid data

func ValidateConnector

func ValidateConnector(connector Connector) error

ValidateConnector checks the state of the direct connector for correctness

func Verify

func Verify(connector Connector, requestor Requestor, parser model.TransactionParser) error

Verify attempts to sign in with the given account. Returns any encountered errors

Types

type Account

type Account interface {
	model.Account
	Requestor
}

Account is a direct connect enabled account

func NewCheckingAccount

func NewCheckingAccount(id, bankID, description string, institution Connector) Account

NewCheckingAccount creates an account from checking details

func NewCreditCard

func NewCreditCard(id, description string, connector Connector) Account

NewCreditCard creates an account from credit card details

func NewSavingsAccount

func NewSavingsAccount(id, bankID, description string, institution Connector) Account

NewSavingsAccount creates an account from savings details

func UnmarshalAccount

func UnmarshalAccount(b []byte) (Account, error)

UnmarshalAccount attempts to unmarshal the given bytes into a known Direct Connect account type

type Bank

type Bank interface {
	model.Account

	BankID() string
}

Bank is an account with a bank's routing number or 'bank ID'

type Config

type Config struct {
	AppID      string
	AppVersion string
	ClientID   string `json:",omitempty"`
	OFXVersion string
	NoIndent   bool `json:",omitempty"`
}

Config contains financial institution connection details

type Connector

type Connector interface {
	model.Institution

	URL() string
	Username() string
	Password() redactor.String
	SetPassword(redactor.String)
	Config() Config
}

Connector downloads statements directly from an institution's OFX/QFX API

func New

func New(
	description,
	fid,
	org,
	url,
	username, password string,
	config Config,
) Connector

New creates an institution that can automatically download statements

func UnmarshalConnector

func UnmarshalConnector(b []byte) (Connector, error)

UnmarshalConnector unmarshals the given bytes into a direct connector

type CreditCard

type CreditCard struct {
	// contains filtered or unexported fields
}

CreditCard represents a credit card account

func (*CreditCard) Description

func (d *CreditCard) Description() string

Description implements model.Account

func (*CreditCard) ID

func (d *CreditCard) ID() string

ID implements model.Account

func (*CreditCard) Institution

func (d *CreditCard) Institution() model.Institution

Institution implements model.Account

func (*CreditCard) Statement

func (cc *CreditCard) Statement(req *ofxgo.Request, start, end time.Time) error

Statement implements Requestor

func (*CreditCard) Type

func (cc *CreditCard) Type() string

func (*CreditCard) UnmarshalJSON

func (d *CreditCard) UnmarshalJSON(b []byte) error

type Driver added in v0.7.0

type Driver interface {
	ID() string
	Description() string
	FID() string
	Org() string
	URL() string
	MessageSupport() []DriverMessage
}
func Search(query string) []Driver

type DriverMessage added in v0.7.0

type DriverMessage int
const (
	MessageSignon DriverMessage = iota + 1
	MessageBank
	MessageCreditCard
)

type Requestor

type Requestor interface {
	Statement(req *ofxgo.Request, start, end time.Time) error
}

Requestor can annotate an ofxgo.Request to fetch statements

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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