Debian Codegraph @

segment/identification.go

raw
1 package segment
2
3 import (
4 "github.com/mitch000001/go-hbci/domain"
5 "github.com/mitch000001/go-hbci/element"
6 )
7
8 const IdentificationID = "HKIDN"
9
10 func NewIdentificationSegment(bankId domain.BankID, clientId string, clientSystemId string, systemIdRequired bool) *IdentificationSegment {
11 var clientSystemStatus *element.NumberDataElement
12 if systemIdRequired {
13 clientSystemStatus = element.NewNumber(1, 1)
14 } else {
15 clientSystemStatus = element.NewNumber(0, 1)
16 }
17 id := &IdentificationSegment{
18 BankId: element.NewBankIdentification(bankId),
19 ClientId: element.NewIdentification(clientId),
20 ClientSystemId: element.NewIdentification(clientSystemId),
21 ClientSystemStatus: clientSystemStatus,
22 }
23 id.ClientSegment = NewBasicSegment(3, id)
24 return id
25 }
26
27 type IdentificationSegment struct {
28 ClientSegment
29 BankId *element.BankIdentificationDataElement
30 ClientId *element.IdentificationDataElement
31 ClientSystemId *element.IdentificationDataElement
32 ClientSystemStatus *element.NumberDataElement
33 }
34
35 func (i *IdentificationSegment) Version() int { return 2 }
36 func (i *IdentificationSegment) ID() string { return IdentificationID }
37 func (i *IdentificationSegment) referencedId() string { return "" }
38 func (i *IdentificationSegment) sender() string { return senderUser }
39
40 func (i *IdentificationSegment) elements() []element.DataElement {
41 return []element.DataElement{
42 i.BankId,
43 i.ClientId,
44 i.ClientSystemId,
45 i.ClientSystemStatus,
46 }
47 }