lib

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FundsType0 = "0"
	FundsType1 = "1"
	FundsType2 = "2"
	FundsTypeS = "S"
	FundsTypeV = "V"
	FundsTypeD = "D"
	FundsTypeZ = "Z"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v0.2.0

type Account struct {
	// Account Identifier
	AccountNumber string           `json:"accountNumber"`
	CurrencyCode  string           `json:"currencyCode,omitempty"`
	Summaries     []AccountSummary `json:"summaries,omitempty"`

	// Account Trailer
	AccountControlTotal string `json:"accountControlTotal"`
	NumberRecords       int64  `json:"numberRecords"`

	Details []Detail
	// contains filtered or unexported fields
}

Account Format

func NewAccount added in v0.2.0

func NewAccount() *Account

Creating new account object

func (*Account) Read added in v0.2.0

func (r *Account) Read(scan *Bai2Scanner, useCurrentLine bool) error

func (*Account) String added in v0.2.0

func (r *Account) String(opts ...int64) string

func (*Account) SumDetailAmounts added in v0.3.0

func (a *Account) SumDetailAmounts() (string, error)

Sums the Amount fields from all 03 and 16 records. Maps to the AccountControlTotal field

func (*Account) SumRecords added in v0.3.0

func (a *Account) SumRecords(opts ...int64) int64

Sums the number of 03,16,88,49 records in the account. Maps to the NumberRecords field

func (*Account) Validate added in v0.2.0

func (r *Account) Validate() error

type AccountSummary added in v0.2.0

type AccountSummary struct {
	TypeCode  string
	Amount    string
	ItemCount int64
	FundsType FundsType
}

type Bai2 added in v0.2.0

type Bai2 struct {
	// File Header
	Sender               string `json:"sender"`
	Receiver             string `json:"receiver"`
	FileCreatedDate      string `json:"fileCreatedDate"`
	FileCreatedTime      string `json:"fileCreatedTime"`
	FileIdNumber         string `json:"fileIdNumber"`
	PhysicalRecordLength int64  `json:"physicalRecordLength,omitempty"`
	BlockSize            int64  `json:"blockSize,omitempty"`
	VersionNumber        int64  `json:"versionNumber"`

	// File trailer
	FileControlTotal string `json:"fileControlTotal"`
	NumberOfGroups   int64  `json:"numberOfGroups"`
	NumberOfRecords  int64  `json:"numberOfRecords"`

	// Groups
	Groups []Group
	// contains filtered or unexported fields
}

FILE with BAI Format

func NewBai2 added in v0.2.0

func NewBai2() *Bai2

NewBai2With returns a BAI2 file with the default options

func NewBai2With added in v0.4.0

func NewBai2With(options Options) *Bai2

NewBai2With returns a BAI2 file with the specified options

func (*Bai2) Read added in v0.2.0

func (r *Bai2) Read(scan *Bai2Scanner) error

func (*Bai2) SetOptions added in v0.4.0

func (r *Bai2) SetOptions(options Options)

func (*Bai2) String added in v0.2.0

func (r *Bai2) String() string

func (*Bai2) SumGroupControlTotals added in v0.3.0

func (a *Bai2) SumGroupControlTotals() (string, error)

Sums the Group Control Totals. Maps to the FileControlTotal field.

func (*Bai2) SumNumberOfGroups added in v0.3.0

func (g *Bai2) SumNumberOfGroups() int64

Sums the number of groups. Maps to the NumberOfGroups field.

func (*Bai2) SumRecords added in v0.3.0

func (f *Bai2) SumRecords() int64

Sums the groups NumberOfRecords plus file header and trailer. Maps to the NumberOfRecords field.

func (*Bai2) Validate added in v0.2.0

func (r *Bai2) Validate() error

type Bai2Scanner added in v0.2.0

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

func NewBai2Scanner added in v0.2.0

func NewBai2Scanner(fd io.Reader) Bai2Scanner

func (*Bai2Scanner) GetLine added in v0.2.0

func (b *Bai2Scanner) GetLine() string

func (*Bai2Scanner) GetLineIndex added in v0.2.0

func (b *Bai2Scanner) GetLineIndex() int

func (*Bai2Scanner) ScanLine added in v0.2.0

func (b *Bai2Scanner) ScanLine(arg ...bool) string

ScanLine returns a line from the underlying reader arg[0]: useCurrentLine (if false read a new line)

type Detail added in v0.2.0

type Detail transactionDetail

Detail Format

func NewDetail added in v0.2.0

func NewDetail() *Detail

Creating new account object

func (*Detail) Read added in v0.2.0

func (r *Detail) Read(scan *Bai2Scanner, useCurrentLine bool) error

func (*Detail) String added in v0.2.0

func (r *Detail) String(opts ...int64) string

func (*Detail) Validate added in v0.2.0

func (r *Detail) Validate() error

type Distribution added in v0.2.0

type Distribution struct {
	Day    int64 `json:"day,omitempty"`    // availability amount
	Amount int64 `json:"amount,omitempty"` // availability amount
}

type FundsType added in v0.2.0

type FundsType struct {
	TypeCode FundsTypeCode `json:"type_code,omitempty"`

	// Type 0,1,2,S
	ImmediateAmount int64 `json:"immediate_amount,omitempty"` // availability amount
	OneDayAmount    int64 `json:"one_day_amount,omitempty"`   // one-day availability amount
	TwoDayAmount    int64 `json:"two_day_amount,omitempty"`   // more than one-day availability amount

	// Type V
	Date string `json:"date,omitempty"`
	Time string `json:"time,omitempty"`

	// Type D
	DistributionNumber int64          `json:"distribution_number,omitempty"`
	Distributions      []Distribution `json:"distributions,omitempty"`
}

func (*FundsType) String added in v0.2.0

func (f *FundsType) String() string

func (*FundsType) Validate added in v0.2.0

func (f *FundsType) Validate() error

type FundsTypeCode added in v0.2.0

type FundsTypeCode string

func (FundsTypeCode) Validate added in v0.2.0

func (c FundsTypeCode) Validate() error

type Group added in v0.2.0

type Group struct {
	// Group Header
	Receiver         string `json:"receiver,omitempty"`
	Originator       string `json:"originator"`
	GroupStatus      int64  `json:"groupStatus"`
	AsOfDate         string `json:"asOfDate"`
	AsOfTime         string `json:"asOfTime,omitempty"`
	CurrencyCode     string `json:"currencyCode,omitempty"`
	AsOfDateModifier int64  `json:"asOfDateModifier,omitempty"`

	// Group Trailer
	GroupControlTotal string `json:"groupControlTotal"`
	NumberOfAccounts  int64  `json:"numberOfAccounts"`
	NumberOfRecords   int64  `json:"numberOfRecords"`

	Accounts []Account
	// contains filtered or unexported fields
}

Group Format

func NewGroup added in v0.2.0

func NewGroup() *Group

Creating new group object

func (*Group) Read added in v0.2.0

func (r *Group) Read(scan *Bai2Scanner, useCurrentLine bool) error

func (*Group) String added in v0.2.0

func (r *Group) String(opts ...int64) string

func (*Group) SumAccountControlTotals added in v0.3.0

func (a *Group) SumAccountControlTotals() (string, error)

Sums the account control totals in the group. Maps to the GroupControlTotal field

func (*Group) SumNumberOfAccounts added in v0.3.0

func (g *Group) SumNumberOfAccounts() int64

Sums the number of accounts in the group. Maps to the NumberOfAccounts field

func (*Group) SumRecords added in v0.3.0

func (g *Group) SumRecords() int64

Sums the number of 02,03,16,88,49,98 records in the group. Maps to the NumberOfRecords field

func (*Group) Validate added in v0.2.0

func (r *Group) Validate() error

type Options added in v0.4.0

type Options struct {
	IgnoreVersion bool
}

Jump to

Keyboard shortcuts

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