Debian Codegraph @

segment/dialog.go

raw
1 package segment
2
3 import (
4 "github.com/mitch000001/go-hbci"
5 "github.com/mitch000001/go-hbci/domain"
6 "github.com/mitch000001/go-hbci/element"
7 )
8
9 const productName = "5A624F86A785F4024DD914404"
10 const productVersion = hbci.Version
11
12 func NewDialogEndSegment(dialogId string) *DialogEndSegment {
13 d := &DialogEndSegment{
14 DialogID: element.NewIdentification(dialogId),
15 }
16 d.ClientSegment = NewBasicSegment(3, d)
17 return d
18 }
19
20 type DialogEndSegment struct {
21 ClientSegment
22 DialogID *element.IdentificationDataElement
23 }
24
25 func (d *DialogEndSegment) Version() int { return 1 }
26 func (d *DialogEndSegment) ID() string { return "HKEND" }
27 func (d *DialogEndSegment) referencedId() string { return "" }
28 func (d *DialogEndSegment) sender() string { return senderUser }
29
30 func (d *DialogEndSegment) elements() []element.DataElement {
31 return []element.DataElement{
32 d.DialogID,
33 }
34 }
35
36 const ProcessingPreparationID = "HKVVB"
37
38 func NewProcessingPreparationSegmentV2(bdpVersion int, udpVersion int, language domain.Language) *ProcessingPreparationSegmentV2 {
39 p := &ProcessingPreparationSegmentV2{
40 BPDVersion: element.NewNumber(bdpVersion, 3),
41 UPDVersion: element.NewNumber(udpVersion, 3),
42 DialogLanguage: element.NewNumber(int(language), 3),
43 ProductName: element.NewAlphaNumeric(productName, 25),
44 ProductVersion: element.NewAlphaNumeric(productVersion, 5),
45 }
46 p.ClientSegment = NewBasicSegment(4, p)
47 return p
48 }
49
50 func NewProcessingPreparationSegmentV3(bdpVersion int, udpVersion int, language domain.Language) *ProcessingPreparationSegmentV3 {
51 p := &ProcessingPreparationSegmentV3{
52 BPDVersion: element.NewNumber(bdpVersion, 3),
53 UPDVersion: element.NewNumber(udpVersion, 3),
54 DialogLanguage: element.NewNumber(int(language), 3),
55 ProductName: element.NewAlphaNumeric(productName, 25),
56 ProductVersion: element.NewAlphaNumeric(productVersion, 5),
57 }
58 p.ClientSegment = NewBasicSegment(4, p)
59 return p
60 }
61
62 type ProcessingPreparationSegmentV2 struct {
63 ClientSegment
64 BPDVersion *element.NumberDataElement
65 UPDVersion *element.NumberDataElement
66 // 0 for undefined
67 // Sprachkennzeichen | Bedeutung | Sprachencode ISO 639 | ISO 8859 Subset | ISO 8859- Codeset
68 // --------------------------------------------------------------------------------------------
69 // 1 | Deutsch | de (German)  | Deutsch   | 1 (Latin 1)
70 // 2 | Englisch | en (English) | Englisch | 1 (Latin 1)
71 // 3 | Französisch | fr (French) | Französisch  | 1 (Latin 1)
72 DialogLanguage *element.NumberDataElement
73 ProductName *element.AlphaNumericDataElement
74 ProductVersion *element.AlphaNumericDataElement
75 }
76
77 func (p *ProcessingPreparationSegmentV2) Version() int { return 2 }
78 func (p *ProcessingPreparationSegmentV2) ID() string { return ProcessingPreparationID }
79 func (p *ProcessingPreparationSegmentV2) referencedId() string { return "" }
80 func (p *ProcessingPreparationSegmentV2) sender() string { return senderUser }
81
82 func (p *ProcessingPreparationSegmentV2) elements() []element.DataElement {
83 return []element.DataElement{
84 p.BPDVersion,
85 p.UPDVersion,
86 p.DialogLanguage,
87 p.ProductName,
88 p.ProductVersion,
89 }
90 }
91
92 type ProcessingPreparationSegmentV3 struct {
93 ClientSegment
94 BPDVersion *element.NumberDataElement
95 UPDVersion *element.NumberDataElement
96 // 0 for Standard = Institute language
97 // Sprachkennzeichen | Bedeutung | Sprachencode ISO 639 | ISO 8859 Subset | ISO 8859- Codeset
98 // --------------------------------------------------------------------------------------------
99 // 1 | Deutsch | de (German)  | Deutsch   | 1 (Latin 1)
100 // 2 | Englisch | en (English) | Englisch | 1 (Latin 1)
101 // 3 | Französisch | fr (French) | Französisch  | 1 (Latin 1)
102 DialogLanguage *element.NumberDataElement
103 ProductName *element.AlphaNumericDataElement
104 ProductVersion *element.AlphaNumericDataElement
105 }
106
107 func (p *ProcessingPreparationSegmentV3) Version() int { return 3 }
108 func (p *ProcessingPreparationSegmentV3) ID() string { return ProcessingPreparationID }
109 func (p *ProcessingPreparationSegmentV3) referencedId() string { return "" }
110 func (p *ProcessingPreparationSegmentV3) sender() string { return senderUser }
111
112 func (p *ProcessingPreparationSegmentV3) elements() []element.DataElement {
113 return []element.DataElement{
114 p.BPDVersion,
115 p.UPDVersion,
116 p.DialogLanguage,
117 p.ProductName,
118 p.ProductVersion,
119 }
120 }