File: pin_bpd.go

package info (click to toggle)
golang-github-mitch000001-go-hbci 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,468 kB
  • sloc: java: 1,092; makefile: 5
file content (53 lines) | stat: -rw-r--r-- 1,876 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package segment

import (
	"github.com/mitch000001/go-hbci/domain"
	"github.com/mitch000001/go-hbci/element"
)

const PinTanBankParameterID = "HIPINS"

type PinTanBankParameter interface {
	BankSegment
	PinTanBusinessTransactions() []domain.PinTanBusinessTransaction
}

//go:generate go run ../cmd/unmarshaler/unmarshaler_generator.go -segment PinTanBankParameterSegment -segment_interface PinTanBankParameter -segment_versions="PinTanBankParameterV1:1:Segment"

type PinTanBankParameterSegment struct {
	PinTanBankParameter
}

// PinTanBankParameterV1
//
// PIN/TAN-spezifische Informationen
type PinTanBankParameterV1 struct {
	Segment
	MaxJobs       *element.NumberDataElement `yaml:"MaxJobs"`
	MinSignatures *element.NumberDataElement `yaml:"MinSignatures"`
	// TODO/FIXME: find out which parameters are here actually
	XXX_Unknown          *element.NumberDataElement              `yaml:"-"`
	PinTanSpecificParams *element.PinTanSpecificParamDataElement `yaml:"PinTanSpecificParams"`
}

func (t *PinTanBankParameterV1) Version() int         { return 1 }
func (t *PinTanBankParameterV1) ID() string           { return PinTanBankParameterID }
func (t *PinTanBankParameterV1) referencedId() string { return ProcessingPreparationID }
func (t *PinTanBankParameterV1) sender() string       { return senderBank }

func (t *PinTanBankParameterV1) elements() []element.DataElement {
	return []element.DataElement{
		t.MaxJobs,
		t.MinSignatures,
		t.XXX_Unknown,
		t.PinTanSpecificParams,
	}
}

func (t *PinTanBankParameterV1) PinTanBusinessTransactions() []domain.PinTanBusinessTransaction {
	var transactions []domain.PinTanBusinessTransaction
	for _, transactionDe := range t.PinTanSpecificParams.JobSpecificPinTanInformation.GroupDataElements() {
		transactions = append(transactions, transactionDe.(*element.PinTanBusinessTransactionParameter).Val())
	}
	return transactions
}