parse

package
v0.0.0-...-d5f7082 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HMAC_HEADER         = "00"
	SECTION_START       = "01"
	SECTION_END         = "09"
	SECTION_START_IBANK = "51"
	SECTION_END_IBANK   = "59"
	HMAC_SECTION_SEAL   = "08"
	HMAC_FILE_SEAL      = "99"
)

Variables

View Source
var SectionTypes []SectionType = []SectionType{
	{
		Name:            "Utdrag Bevakningsregister (Gammalt/Nytt Format)",
		Code:            "bevakningsreg",
		Tk01Start:       22,
		Tk01End:         35,
		Match:           "BEVAKNINGSREG",
		AllowedSections: []string{"82", "32"},
		CustomerNumber:  []int{62, 68},
		AccountNumber:   []int{68, 78},
	},
	{
		Name:            "Medgivandeavisering (Gammalt Format)",
		Code:            "medgivandeavi-old",
		Tk01Start:       24,
		Tk01End:         33,
		Match:           "AG-MEDAVI",
		AllowedSections: []string{"73"},
		CustomerNumber:  []int{0, 0},
		AccountNumber:   []int{14, 24},
	},
	{
		Name:            "Avvisade Betalningar (Gammalt Format)",
		Code:            "avvisade-old",
		Tk01Start:       22,
		Tk01End:         41,
		Match:           "FELLISTA REG.KONTRL",
		AllowedSections: []string{"82", "32"},
		CustomerNumber:  []int{62, 68},
		AccountNumber:   []int{68, 78},
	},
	{
		Name:            "Makulerings-/Ändringslista (Gammalt Format)",
		Code:            "andringslista-old",
		Tk01Start:       22,
		Tk01End:         40,
		Match:           "MAK/ÄNDRINGSLISTA",
		AllowedSections: []string{"03", "21", "22", "23", "24", "25", "26", "27", "28", "29"},
		CustomerNumber:  []int{62, 68},
		AccountNumber:   []int{68, 78},
	},
	{
		Name:            "Betalningsspecifikation (Nytt Format)",
		Code:            "betalningsspec-new",
		Tk01Start:       44,
		Tk01End:         64,
		Match:           "BET. SPEC & STOPP TK",
		AllowedSections: []string{"15", "82", "16", "32", "17", "77"},
		CustomerNumber:  []int{64, 70},
		AccountNumber:   []int{70, 80},
	},
	{
		Name:            "Medgivandeavisering (Nytt Format)",
		Code:            "medgivandeavi-new",
		Tk01Start:       44,
		Tk01End:         53,
		Match:           "AG-MEDAVI",
		AllowedSections: []string{"73"},
		CustomerNumber:  []int{64, 70},
		AccountNumber:   []int{70, 80},
	},
	{
		Name:            "Emedgivande Internetbank",
		Code:            "ag-emedgiv",
		Tk01Start:       24,
		Tk01End:         34,
		Match:           "AG-EMEDGIV",
		AllowedSections: []string{"52", "53", "54", "55", "56"},
		CustomerNumber:  []int{0, 0},
		AccountNumber:   []int{15, 24},
	},
	{
		Name:            "Avvisade Betalningar (Nytt Format)",
		Code:            "avvisade-new",
		Tk01Start:       44,
		Tk01End:         62,
		Match:           "AVVISADE BET UPPDR",
		AllowedSections: []string{"82", "32"},
		CustomerNumber:  []int{64, 70},
		AccountNumber:   []int{70, 80},
	},
	{
		Name:            "Makulerings-/Ändringslista (Nytt Format)",
		Code:            "andringslista-new",
		Tk01Start:       44,
		Tk01End:         63,
		Match:           "MAKULERING/ÄNDRING",
		AllowedSections: []string{"03", "11", "21", "22", "23", "24", "25", "26", "27", "28", "29"},
		CustomerNumber:  []int{64, 70},
		AccountNumber:   []int{70, 80},
	},
	{
		Name:            "Betalningsspecifikation (Gammalt Format)",
		Code:            "betalningsspec-old",
		Tk01Start:       10,
		Tk01End:         18,
		Match:           "AUTOGIRO",
		AllowedSections: []string{"82", "32"},
		CustomerNumber:  []int{62, 68},
		AccountNumber:   []int{68, 78},
	},
	{
		Name:            "INVALID FILE TYPE",
		Code:            "invalid",
		Tk01Start:       0,
		Tk01End:         2,
		Match:           "01",
		AllowedSections: []string{},
		CustomerNumber:  []int{0, 0},
		AccountNumber:   []int{0, 0},
	},
}

Functions

This section is empty.

Types

type AutogiroFile

type AutogiroFile struct {
	HMACStartFound  bool
	HMACEndFound    bool
	HmacData        string
	Content         []string
	SealCalcContent []string
	Sections        []AutogiroSection
}

func (*AutogiroFile) ParseFile

func (file *AutogiroFile) ParseFile(data string) error

type AutogiroSection

type AutogiroSection struct {
	StartFound      bool
	SectionType     SectionType
	EndFound        bool
	SectionSeal     string
	Rows            []string
	SealCalcContent []string
	Errors          []string
}

func (*AutogiroSection) AddLine

func (sec *AutogiroSection) AddLine(line string) error

Input: Line Output: End of Section

func (*AutogiroSection) GetAccountNumber

func (sec *AutogiroSection) GetAccountNumber() string

func (*AutogiroSection) GetCustomerNumber

func (sec *AutogiroSection) GetCustomerNumber() string

func (*AutogiroSection) GetUtf8Bytes

func (sec *AutogiroSection) GetUtf8Bytes() []byte

func (*AutogiroSection) GetUtf8String

func (sec *AutogiroSection) GetUtf8String() string

func (*AutogiroSection) SetEnd

func (sec *AutogiroSection) SetEnd(line string, lookaheadRow string) error

func (*AutogiroSection) SetStart

func (sec *AutogiroSection) SetStart(line string) error

type SectionInterface

type SectionInterface struct {
	GetAccountNumber  func() string
	GetCustomerNumber func() string
	GetUtf8Bytes      func() []byte
	GetUtf8String     func() []byte
}

type SectionType

type SectionType struct {
	Name            string
	Code            string
	Tk01Start       int
	Tk01End         int
	Match           string
	AllowedSections []string
	CustomerNumber  []int
	AccountNumber   []int
}

Jump to

Keyboard shortcuts

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