domain

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 13

Documentation

Index

Constants

View Source
const (
	// MessageAcknowledgement defines the message ack type
	MessageAcknowledgement = "MessageAcknowledgement"
	// SegmentAcknowledgement defines the segemtn ack type
	SegmentAcknowledgement = "SegmentAcknowledgement"
)
View Source
const (
	// HBCIVersion220 represents version 2.2.0 of HBCI protocol
	HBCIVersion220 = 220
	// FINTSVersion300 represents version 3.0.0 of FINTS protocol
	FINTSVersion300 = 300
)
View Source
const (
	KeyTypeSigning    = KeyType("S")
	KeyTypeEncryption = KeyType("V")
)

Variables

View Source
var SupportedHBCIVersions = []int{
	HBCIVersion220,
	FINTSVersion300,
}

SupportedHBCIVersions provides a list of supported versions

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance struct {
	Account          AccountConnection
	ProductName      string
	Currency         string
	BookedBalance    Balance
	EarmarkedBalance *Balance
	CreditLimit      *Amount
	AvailableAmount  *Amount
	UsedAmount       *Amount
	BookingDate      *time.Time
	DueDate          *time.Time
}

AccountBalance represents a balance for a specific account

func (AccountBalance) String

func (a AccountBalance) String() string

type AccountBalances added in v0.1.5

type AccountBalances []AccountBalance

AccountBalances represents a printable version of a slice of account balances

func (AccountBalances) String added in v0.1.5

func (ab AccountBalances) String() string

type AccountConnection

type AccountConnection struct {
	AccountID                 string
	SubAccountCharacteristics string
	CountryCode               int
	BankID                    string
}

AccountConnection represents an identification for a bank account

type AccountInformation

type AccountInformation struct {
	AccountConnection           AccountConnection
	UserID                      string
	Currency                    string
	Name1                       string
	Name2                       string
	ProductID                   string
	Limit                       *AccountLimit
	AllowedBusinessTransactions []BusinessTransaction
}

AccountInformation represents bank specific information about an account

func (AccountInformation) String added in v0.1.5

func (a AccountInformation) String() string

type AccountInfos added in v0.1.5

type AccountInfos []AccountInformation

AccountInfos represent a printable version of a slice of AccountInformation

func (AccountInfos) String added in v0.1.5

func (ai AccountInfos) String() string

type AccountLimit

type AccountLimit struct {
	Kind   string
	Amount Amount
	Days   int
}

AccountLimit represents a limit for an account with a possible timespan

type AccountTransaction

type AccountTransaction struct {
	Account              AccountConnection
	Amount               Amount
	ValutaDate           time.Time
	BookingDate          time.Time
	BookingText          string
	BankID               string
	AccountID            string
	Name                 string
	Purpose              string
	Purpose2             string
	TransactionID        int
	AccountBalanceBefore Balance
	AccountBalanceAfter  Balance
}

AccountTransaction represents one transaction entry for a given account

func (AccountTransaction) String

func (a AccountTransaction) String() string

type AccountTransactions added in v0.1.4

type AccountTransactions []AccountTransaction

AccountTransactions represents a printable version of a slice of account transactions

func (AccountTransactions) String added in v0.1.4

func (at AccountTransactions) String() string

type Acknowledgement

type Acknowledgement struct {
	Type                     string
	Code                     int
	ReferenceDataElement     string
	Text                     string
	Params                   []string
	ReferencingMessage       MessageReference
	ReferencingSegmentNumber int
}

Acknowledgement represents an acknowledgement from the bank institute

func NewMessageAcknowledgement

func NewMessageAcknowledgement(code int, referenceDataElement, text string, params []string) Acknowledgement

NewMessageAcknowledgement creactes a new message acknowledgement

func NewSegmentAcknowledgement

func NewSegmentAcknowledgement(code int, referenceDataElement, text string, params []string) Acknowledgement

NewSegmentAcknowledgement creactes a new segment acknowledgement

func (Acknowledgement) IsError

func (a Acknowledgement) IsError() bool

IsError returns true if the acknowledgement represents an error

func (Acknowledgement) IsMessageAcknowledgement

func (a Acknowledgement) IsMessageAcknowledgement() bool

IsMessageAcknowledgement returns true if the type is MessageAcknowledgement, false otherwise

func (Acknowledgement) IsSegmentAcknowledgement

func (a Acknowledgement) IsSegmentAcknowledgement() bool

IsSegmentAcknowledgement returns true if type is SegmentAcknowledgement, false otherwise

func (Acknowledgement) IsSuccess

func (a Acknowledgement) IsSuccess() bool

IsSuccess returns true if the acknowledgement represents a success

func (Acknowledgement) IsWarning

func (a Acknowledgement) IsWarning() bool

IsWarning returns true if the acknowledgement represents a warning

func (Acknowledgement) String

func (a Acknowledgement) String() string

type Address

type Address struct {
	Name1       string
	Name2       string
	Street      string
	PLZ         string
	City        string
	CountryCode int
	Phone       string
	Fax         string
	Email       string
}

Address represents an address

type Amount

type Amount struct {
	Amount   float64
	Currency string
}

Amount represents a value associated with a currency

type Balance

type Balance struct {
	Amount           Amount
	TransmissionDate time.Time
	TransmissionTime *time.Time
}

Balance represents a blanace at a given date

type BankID

type BankID struct {
	CountryCode int
	ID          string
}

BankID represents a bank identifier for a specific country

type BankParameterData

type BankParameterData struct {
	Version                    int
	BankID                     BankID          `yaml:",inline"`
	BankName                   string          `yaml:"bankName"`
	MaxTransactionsPerMessage  int             `yaml:"maxTransactionsPerMessage"`
	MaxMessageSize             int             `yaml:"maxMessageSize"`
	MinTimeout                 int             `yaml:"minTimeout"`
	MaxTimeout                 int             `yaml:"maxTimeout"`
	PinTanBusinessTransactions map[string]bool `yaml:"pinTanBusinessTransactions"`
}

BankParameterData represent metadata prvided by a bank institute that reflect limitations and limits when talking to that institute

type BusinessTransaction

type BusinessTransaction struct {
	ID               string
	NeededSignatures int
	Limit            *AccountLimit
}

BusinessTransaction provides information about a transaction and whether there is a signature needed or not

type CommunicationParameter

type CommunicationParameter struct {
	Protocol              int
	Address               string
	AddressAddition       string
	FilterFunction        string
	FilterFunctionVersion int
}

CommunicationParameter provides information about the access point to a bank institute

type InternationalAccountConnection

type InternationalAccountConnection struct {
	IBAN                      string
	BIC                       string
	AccountID                 string
	SubAccountCharacteristics string
	BankID                    BankID
}

InternationalAccountConnection represents an international identification for a bank account

func (InternationalAccountConnection) ToAccountConnection added in v0.1.4

func (i InternationalAccountConnection) ToAccountConnection() AccountConnection

ToAccountConnection transforms i into an AccountConnection

type Key

type Key interface {
	// KeyName returns the KeyName
	KeyName() KeyName
	// SetKeyNumber sets the key number in the KeyName
	SetKeyNumber(number int)
	// SetKeyVersion sets the key version in the KeyName
	SetKeyVersion(version int)
	// Sign signs message
	Sign(message []byte) (signature []byte, err error)
	// Encrypt encrypts message
	Encrypt(message []byte) (encrypted []byte, err error)
	// CanSign returns true if the key can be used for signing
	CanSign() bool
	// CanEncrypt returns true if the key can be used for encryption
	CanEncrypt() bool
}

Key provides an interface to an encryption/signing key

type KeyName

type KeyName struct {
	BankID     BankID
	UserID     string
	KeyType    KeyType
	KeyNumber  int
	KeyVersion int
}

KeyName provides data about a given key

func NewInitialKeyName

func NewInitialKeyName(countryCode int, bankID, userID string, keyType KeyType) *KeyName

NewInitialKeyName represents a KeyName ready to use for initial communication

func NewPinTanKeyName

func NewPinTanKeyName(bankID BankID, userID string, keyType KeyType) *KeyName

NewPinTanKeyName returns a new KeyName for the pin/tan flow

func (*KeyName) IsInitial

func (k *KeyName) IsInitial() bool

IsInitial returns true if the KeyName represents an initial KeyName, false otherwise

func (*KeyName) SetInitial

func (k *KeyName) SetInitial()

SetInitial resets the KeyName to reflect an initial KeyName

type KeyType added in v0.4.0

type KeyType string

func (KeyType) String added in v0.4.0

func (k KeyType) String() string

type Language

type Language int

Language represents the language in which the communication from the bank institute can be accessed in

const (
	// German represents the german language
	German Language = 1
	// English represents the english language
	English
	// French represents the french language
	French
)

type MessageReference added in v0.4.0

type MessageReference struct {
	DialogID      string
	MessageNumber int
}

MessageReference represents a reference to another message within a given dialog

type PinKey

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

PinKey represents a Key used for pin/tan flow

func NewPinKey

func NewPinKey(pin string, keyName *KeyName) *PinKey

NewPinKey returns a new PinKey

func (*PinKey) CanEncrypt

func (p *PinKey) CanEncrypt() bool

CanEncrypt returns true if the key can be used for encryption

func (*PinKey) CanSign

func (p *PinKey) CanSign() bool

CanSign returns true if the key can be used for signing

func (*PinKey) Decrypt

func (p *PinKey) Decrypt(encryptedMessage []byte) ([]byte, error)

Decrypt decrypts the encryptedMessage

func (*PinKey) Encrypt

func (p *PinKey) Encrypt(message []byte) ([]byte, error)

Encrypt encryptes the message

func (*PinKey) KeyName

func (p *PinKey) KeyName() KeyName

KeyName returns the KeyName

func (*PinKey) Pin

func (p *PinKey) Pin() string

Pin returns the pin within this key

func (*PinKey) SetKeyNumber

func (p *PinKey) SetKeyNumber(number int)

SetKeyNumber sets the key number in the KeyName

func (*PinKey) SetKeyVersion

func (p *PinKey) SetKeyVersion(version int)

SetKeyVersion sets the key version in the KeyName

func (*PinKey) Sign

func (p *PinKey) Sign(message []byte) ([]byte, error)

Sign signs message

type PinTanBusinessTransaction

type PinTanBusinessTransaction struct {
	SegmentID string `yaml:"segmentID"`
	NeedsTan  bool   `yaml:"needsTan"`
}

PinTanBusinessTransaction provides information about whether a given Segment needs a TAN or not.

type PinTanBusinessTransactions added in v0.4.0

type PinTanBusinessTransactions []PinTanBusinessTransaction

func (PinTanBusinessTransactions) NeedsTan added in v0.4.0

func (p PinTanBusinessTransactions) NeedsTan(segmentID string) (bool, bool)

type PublicKey

type PublicKey struct {
	Type     string
	Modulus  []byte
	Exponent []byte
	// contains filtered or unexported fields
}

PublicKey represents a key which can either embed a private or public RSA key

func GenerateSigningKey

func GenerateSigningKey() (*PublicKey, error)

GenerateSigningKey generates a new signing key

func NewEncryptionKey

func NewEncryptionKey(modulus, exponent []byte) *PublicKey

NewEncryptionKey creates a new RSA encryption key

func (*PublicKey) Encrypt

func (p *PublicKey) Encrypt(message []byte) ([]byte, error)

Encrypt encryptes the message with the public key

func (*PublicKey) Sign

func (p *PublicKey) Sign(message []byte) ([]byte, error)

Sign signs message with the private key

func (*PublicKey) SigningKey

func (p *PublicKey) SigningKey() *rsa.PrivateKey

SigningKey returns the RSA private key to sign with, or nil when not set

type RSAKey

type RSAKey struct {
	*PublicKey
	// contains filtered or unexported fields
}

RSAKey represents a public RSA key which implements the Key interface

func NewRSAKey

func NewRSAKey(pubKey *PublicKey, keyName *KeyName) *RSAKey

NewRSAKey returns a new RSA key

func (*RSAKey) CanEncrypt

func (r *RSAKey) CanEncrypt() bool

CanEncrypt returns true if the key can be used for encryption

func (*RSAKey) CanSign

func (r *RSAKey) CanSign() bool

CanSign returns true if the key can be used for signing

func (*RSAKey) KeyName

func (r *RSAKey) KeyName() KeyName

KeyName returns the KeyName

func (*RSAKey) SetKeyNumber

func (r *RSAKey) SetKeyNumber(number int)

SetKeyNumber sets the key number in the KeyName

func (*RSAKey) SetKeyVersion

func (r *RSAKey) SetKeyVersion(version int)

SetKeyVersion sets the key version in the KeyName

type SepaAccountBalance added in v0.4.1

type SepaAccountBalance struct {
	Account            InternationalAccountConnection
	ProductName        string
	Currency           string
	BookedBalance      Balance
	EarmarkedBalance   *Balance
	CreditLimit        *Amount
	AvailableAmount    *Amount
	UsedAmount         *Amount
	BookingDate        *time.Time
	DueDate            *time.Time
	SeizableAfterMonth *Amount
}

SepaAccountBalance represents a balance for a specific account

func (SepaAccountBalance) String added in v0.4.1

func (a SepaAccountBalance) String() string

type SepaAccountBalances added in v0.4.1

type SepaAccountBalances []SepaAccountBalance

SepaAccountBalances represents a printable version of a slice of account balances

func (SepaAccountBalances) String added in v0.4.1

func (ab SepaAccountBalances) String() string

type ShortDate

type ShortDate struct {
	time.Time
}

ShortDate represents a date without a time, i.e. the time is always zero.

func Date

func Date(year int, month time.Month, day int, location *time.Location) ShortDate

Date returns a new ShortDate for the given year, month, day and location

func NewShortDate

func NewShortDate(date time.Time) ShortDate

NewShortDate creates a ShortDate from a given time

func (*ShortDate) MarshalJSON

func (s *ShortDate) MarshalJSON() ([]byte, error)

MarshalJSON marshals the date into a JSON representation

func (*ShortDate) MarshalText

func (s *ShortDate) MarshalText() ([]byte, error)

MarshalText marshals the date into a byte representation

func (*ShortDate) String

func (s *ShortDate) String() string

func (*ShortDate) UnmarshalJSON

func (s *ShortDate) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the JSON representation into a date

func (*ShortDate) UnmarshalText

func (s *ShortDate) UnmarshalText(text []byte) error

UnmarshalText unmarshals text into a ShortDate

type StatusAcknowledgement

type StatusAcknowledgement struct {
	Acknowledgement
	TransmittedAt time.Time
}

StatusAcknowledgement represents an Acknowledgement with a transmission date

func (StatusAcknowledgement) String

func (s StatusAcknowledgement) String() string

type Timeframe

type Timeframe struct {
	StartDate ShortDate
	EndDate   ShortDate
}

Timeframe represents a date range

func TimeframeFromDate

func TimeframeFromDate(date ShortDate) Timeframe

TimeframeFromDate returns a Timeframe with the StartDate set to date and the EndDate set to today. The EndDate will use the same timezone location as provided in StartDate

func TimeframeFromQuery

func TimeframeFromQuery(params url.Values) (Timeframe, error)

TimeframeFromQuery parses a timeframe from a query. The param keys are expected to be `from` for the StartDate and `to` for the EndDate

func (*Timeframe) IsZero

func (tf *Timeframe) IsZero() bool

IsZero returns true when StartDate and EndDate are both zero, i.e. when the Timeframe is uninitialized.

func (*Timeframe) MarshalJSON

func (tf *Timeframe) MarshalJSON() ([]byte, error)

MarshalJSON marhsals the timeframe into a JSON string

func (*Timeframe) String

func (tf *Timeframe) String() string

func (*Timeframe) ToQuery

func (tf *Timeframe) ToQuery() url.Values

ToQuery transforms a timeframe to a query. The param keys are `from` for the StartDate and `to` for the EndDate

func (*Timeframe) UnmarshalJSON

func (tf *Timeframe) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals data into a timeframe

type UserParameterData

type UserParameterData struct {
	UserID    string
	Version   int
	Usage     int
	UserName  string
	Additions string
}

UserParameterData represents metadata of the User

Jump to

Keyboard shortcuts

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