| 1 |
package segment |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/mitch000001/go-hbci/domain" |
| 5 |
"github.com/mitch000001/go-hbci/element" |
| 6 |
) |
| 7 |
|
| 8 |
const CommonUserParameterDataID string = "HIUPA" |
| 9 |
|
| 10 |
//go:generate go run ../cmd/unmarshaler/unmarshaler_generator.go -segment CommonUserParameterDataSegment -segment_interface commonUserParameterDataSegment -segment_versions="CommonUserParameterDataV2:2:Segment,CommonUserParameterDataV3:3:Segment,CommonUserParameterDataV4:4:Segment" |
| 11 |
|
| 12 |
type CommonUserParameterData interface { |
| 13 |
BankSegment |
| 14 |
UserParameterData() domain.UserParameterData |
| 15 |
} |
| 16 |
|
| 17 |
type CommonUserParameterDataSegment struct { |
| 18 |
commonUserParameterDataSegment |
| 19 |
} |
| 20 |
|
| 21 |
type commonUserParameterDataSegment interface { |
| 22 |
BankSegment |
| 23 |
UserParameterData() domain.UserParameterData |
| 24 |
} |
| 25 |
|
| 26 |
type CommonUserParameterDataV2 struct { |
| 27 |
Segment |
| 28 |
UserID *element.IdentificationDataElement |
| 29 |
UPDVersion *element.NumberDataElement |
| 30 |
// Status |Beschreibung |
| 31 |
// ----------------------------------------------------------------- |
| 32 |
// 0 | Die nicht aufgeführten Geschäftsvorfälle sind gesperrt |
| 33 |
// | (die aufgeführten Geschäftsvorfälle sind zugelassen). |
| 34 |
// 1   | Bei den nicht aufgeführten Geschäftsvorfällen ist anhand |
| 35 |
// | der UPD keine Aussage darüber möglich, ob diese erlaubt |
| 36 |
// | oder gesperrt sind. Diese Prüfung kann nur online vom |
| 37 |
// | Kreditinstitutssystem vorgenommen werden. |
| 38 |
UPDUsage *element.NumberDataElement |
| 39 |
} |
| 40 |
|
| 41 |
func (c *CommonUserParameterDataV2) Version() int { return 2 } |
| 42 |
func (c *CommonUserParameterDataV2) ID() string { return CommonUserParameterDataID } |
| 43 |
func (c *CommonUserParameterDataV2) referencedId() string { return ProcessingPreparationID } |
| 44 |
func (c *CommonUserParameterDataV2) sender() string { return senderBank } |
| 45 |
|
| 46 |
func (c *CommonUserParameterDataV2) elements() []element.DataElement { |
| 47 |
return []element.DataElement{ |
| 48 |
c.UserID, |
| 49 |
c.UPDVersion, |
| 50 |
c.UPDUsage, |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
func (c *CommonUserParameterDataV2) UserParameterData() domain.UserParameterData { |
| 55 |
return domain.UserParameterData{ |
| 56 |
UserID: c.UserID.Val(), |
| 57 |
Version: c.UPDVersion.Val(), |
| 58 |
Usage: c.UPDUsage.Val(), |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
type CommonUserParameterDataV3 struct { |
| 63 |
Segment |
| 64 |
UserID *element.IdentificationDataElement |
| 65 |
UPDVersion *element.NumberDataElement |
| 66 |
// Status |Beschreibung |
| 67 |
// ----------------------------------------------------------------- |
| 68 |
// 0 | Die nicht aufgeführten Geschäftsvorfälle sind gesperrt |
| 69 |
// | (die aufgeführten Geschäftsvorfälle sind zugelassen). |
| 70 |
// 1   | Bei den nicht aufgeführten Geschäftsvorfällen ist anhand |
| 71 |
// | der UPD keine Aussage darüber möglich, ob diese erlaubt |
| 72 |
// | oder gesperrt sind. Diese Prüfung kann nur online vom |
| 73 |
// | Kreditinstitutssystem vorgenommen werden. |
| 74 |
UPDUsage *element.NumberDataElement |
| 75 |
UserName *element.AlphaNumericDataElement |
| 76 |
CommonExtensions *element.AlphaNumericDataElement |
| 77 |
} |
| 78 |
|
| 79 |
func (c *CommonUserParameterDataV3) Version() int { return 3 } |
| 80 |
func (c *CommonUserParameterDataV3) ID() string { return CommonUserParameterDataID } |
| 81 |
func (c *CommonUserParameterDataV3) referencedId() string { return ProcessingPreparationID } |
| 82 |
func (c *CommonUserParameterDataV3) sender() string { return senderBank } |
| 83 |
|
| 84 |
func (c *CommonUserParameterDataV3) elements() []element.DataElement { |
| 85 |
return []element.DataElement{ |
| 86 |
c.UserID, |
| 87 |
c.UPDVersion, |
| 88 |
c.UPDUsage, |
| 89 |
c.UserName, |
| 90 |
c.CommonExtensions, |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
func (c *CommonUserParameterDataV3) UserParameterData() domain.UserParameterData { |
| 95 |
return domain.UserParameterData{ |
| 96 |
UserID: c.UserID.Val(), |
| 97 |
Version: c.UPDVersion.Val(), |
| 98 |
Usage: c.UPDUsage.Val(), |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
type CommonUserParameterDataV4 struct { |
| 103 |
Segment |
| 104 |
UserID *element.IdentificationDataElement |
| 105 |
UPDVersion *element.NumberDataElement |
| 106 |
// Status |Beschreibung |
| 107 |
// ----------------------------------------------------------------- |
| 108 |
// 0 | Die nicht aufgeführten Geschäftsvorfälle sind gesperrt |
| 109 |
// | (die aufgeführten Geschäftsvorfälle sind zugelassen). |
| 110 |
// 1   | Bei den nicht aufgeführten Geschäftsvorfällen ist anhand |
| 111 |
// | der UPD keine Aussage darüber möglich, ob diese erlaubt |
| 112 |
// | oder gesperrt sind. Diese Prüfung kann nur online vom |
| 113 |
// | Kreditinstitutssystem vorgenommen werden. |
| 114 |
UPDUsage *element.NumberDataElement |
| 115 |
UserName *element.AlphaNumericDataElement |
| 116 |
CommonExtensions *element.AlphaNumericDataElement |
| 117 |
} |
| 118 |
|
| 119 |
func (c *CommonUserParameterDataV4) Version() int { return 4 } |
| 120 |
func (c *CommonUserParameterDataV4) ID() string { return CommonUserParameterDataID } |
| 121 |
func (c *CommonUserParameterDataV4) referencedId() string { return ProcessingPreparationID } |
| 122 |
func (c *CommonUserParameterDataV4) sender() string { return senderBank } |
| 123 |
|
| 124 |
func (c *CommonUserParameterDataV4) elements() []element.DataElement { |
| 125 |
return []element.DataElement{ |
| 126 |
c.UserID, |
| 127 |
c.UPDVersion, |
| 128 |
c.UPDUsage, |
| 129 |
c.UserName, |
| 130 |
c.CommonExtensions, |
| 131 |
} |
| 132 |
} |
| 133 |
|
| 134 |
func (c *CommonUserParameterDataV4) UserParameterData() domain.UserParameterData { |
| 135 |
var username string |
| 136 |
if c.UserName != nil { |
| 137 |
username = c.UserName.Val() |
| 138 |
} |
| 139 |
var additions string |
| 140 |
if c.CommonExtensions != nil { |
| 141 |
additions = c.CommonExtensions.Val() |
| 142 |
} |
| 143 |
return domain.UserParameterData{ |
| 144 |
UserID: c.UserID.Val(), |
| 145 |
Version: c.UPDVersion.Val(), |
| 146 |
Usage: c.UPDUsage.Val(), |
| 147 |
UserName: username, |
| 148 |
Additions: additions, |
| 149 |
} |
| 150 |
} |