| 1 |
package segment |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/mitch000001/go-hbci/domain" |
| 5 |
"github.com/mitch000001/go-hbci/element" |
| 6 |
) |
| 7 |
|
| 8 |
const AccountInformationID string = "HIUPD" |
| 9 |
|
| 10 |
type AccountInformation interface { |
| 11 |
BankSegment |
| 12 |
Account() domain.AccountInformation |
| 13 |
} |
| 14 |
|
| 15 |
//go:generate go run ../cmd/unmarshaler/unmarshaler_generator.go -segment AccountInformationSegment -segment_interface accountInformationSegment -segment_versions="AccountInformationV4:4:Segment,AccountInformationV5:5:Segment,AccountInformationV6:6:Segment,AccountInformationV7:7:Segment" |
| 16 |
|
| 17 |
type AccountInformationSegment struct { |
| 18 |
accountInformationSegment |
| 19 |
} |
| 20 |
|
| 21 |
type accountInformationSegment interface { |
| 22 |
BankSegment |
| 23 |
Account() domain.AccountInformation |
| 24 |
} |
| 25 |
|
| 26 |
type AccountInformationV4 struct { |
| 27 |
Segment |
| 28 |
AccountConnection *element.AccountConnectionDataElement |
| 29 |
UserID *element.IdentificationDataElement |
| 30 |
AccountCurrency *element.CurrencyDataElement |
| 31 |
Name1 *element.AlphaNumericDataElement |
| 32 |
Name2 *element.AlphaNumericDataElement |
| 33 |
AccountProductID *element.AlphaNumericDataElement |
| 34 |
AccountLimit *element.AccountLimitDataElement |
| 35 |
AllowedBusinessTransactions *element.AllowedBusinessTransactionsDataElement |
| 36 |
} |
| 37 |
|
| 38 |
func (a *AccountInformationV4) Version() int { return 4 } |
| 39 |
func (a *AccountInformationV4) ID() string { return AccountInformationID } |
| 40 |
func (a *AccountInformationV4) referencedId() string { return ProcessingPreparationID } |
| 41 |
func (a *AccountInformationV4) sender() string { return senderBank } |
| 42 |
|
| 43 |
func (a *AccountInformationV4) Account() domain.AccountInformation { |
| 44 |
accountConnection := a.AccountConnection.Val() |
| 45 |
info := domain.AccountInformation{ |
| 46 |
AccountConnection: accountConnection, |
| 47 |
UserID: a.UserID.Val(), |
| 48 |
Currency: a.AccountCurrency.Val(), |
| 49 |
Name1: a.Name1.Val(), |
| 50 |
} |
| 51 |
if a.Name2 != nil { |
| 52 |
info.Name2 = a.Name2.Val() |
| 53 |
} |
| 54 |
if a.AccountProductID != nil { |
| 55 |
info.ProductID = a.AccountProductID.Val() |
| 56 |
} |
| 57 |
if a.AccountLimit != nil { |
| 58 |
limit := a.AccountLimit.Val() |
| 59 |
info.Limit = &limit |
| 60 |
} |
| 61 |
if a.AllowedBusinessTransactions != nil { |
| 62 |
info.AllowedBusinessTransactions = a.AllowedBusinessTransactions.AllowedBusinessTransactions() |
| 63 |
} |
| 64 |
return info |
| 65 |
} |
| 66 |
|
| 67 |
func (a *AccountInformationV4) elements() []element.DataElement { |
| 68 |
return []element.DataElement{ |
| 69 |
a.AccountConnection, |
| 70 |
a.UserID, |
| 71 |
a.AccountCurrency, |
| 72 |
a.Name1, |
| 73 |
a.Name2, |
| 74 |
a.AccountProductID, |
| 75 |
a.AccountLimit, |
| 76 |
a.AllowedBusinessTransactions, |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
type AccountInformationV5 struct { |
| 81 |
Segment |
| 82 |
AccountConnection *element.AccountConnectionDataElement |
| 83 |
UserID *element.IdentificationDataElement |
| 84 |
AccountType *element.NumberDataElement |
| 85 |
AccountCurrency *element.CurrencyDataElement |
| 86 |
Name1 *element.AlphaNumericDataElement |
| 87 |
Name2 *element.AlphaNumericDataElement |
| 88 |
AccountProductID *element.AlphaNumericDataElement |
| 89 |
AccountLimit *element.AccountLimitDataElement |
| 90 |
AllowedBusinessTransactions *element.AllowedBusinessTransactionsDataElement |
| 91 |
} |
| 92 |
|
| 93 |
func (a *AccountInformationV5) Version() int { return 5 } |
| 94 |
func (a *AccountInformationV5) ID() string { return AccountInformationID } |
| 95 |
func (a *AccountInformationV5) referencedId() string { return ProcessingPreparationID } |
| 96 |
func (a *AccountInformationV5) sender() string { return senderBank } |
| 97 |
|
| 98 |
func (a *AccountInformationV5) Account() domain.AccountInformation { |
| 99 |
info := domain.AccountInformation{ |
| 100 |
UserID: a.UserID.Val(), |
| 101 |
Name1: a.Name1.Val(), |
| 102 |
} |
| 103 |
if a.AccountConnection != nil { |
| 104 |
info.AccountConnection = a.AccountConnection.Val() |
| 105 |
} |
| 106 |
if a.AccountCurrency != nil { |
| 107 |
info.Currency = a.AccountCurrency.Val() |
| 108 |
} |
| 109 |
if a.Name2 != nil { |
| 110 |
info.Name2 = a.Name2.Val() |
| 111 |
} |
| 112 |
if a.AccountProductID != nil { |
| 113 |
info.ProductID = a.AccountProductID.Val() |
| 114 |
} |
| 115 |
if a.AccountLimit != nil { |
| 116 |
limit := a.AccountLimit.Val() |
| 117 |
info.Limit = &limit |
| 118 |
} |
| 119 |
if a.AllowedBusinessTransactions != nil { |
| 120 |
info.AllowedBusinessTransactions = a.AllowedBusinessTransactions.AllowedBusinessTransactions() |
| 121 |
} |
| 122 |
return info |
| 123 |
} |
| 124 |
|
| 125 |
func (a *AccountInformationV5) elements() []element.DataElement { |
| 126 |
return []element.DataElement{ |
| 127 |
a.AccountConnection, |
| 128 |
a.UserID, |
| 129 |
a.AccountType, |
| 130 |
a.AccountCurrency, |
| 131 |
a.Name1, |
| 132 |
a.Name2, |
| 133 |
a.AccountProductID, |
| 134 |
a.AccountLimit, |
| 135 |
a.AllowedBusinessTransactions, |
| 136 |
} |
| 137 |
} |
| 138 |
|
| 139 |
type AccountInformationV6 struct { |
| 140 |
Segment |
| 141 |
AccountConnection *element.AccountConnectionDataElement |
| 142 |
IBAN *element.AlphaNumericDataElement |
| 143 |
UserID *element.IdentificationDataElement |
| 144 |
AccountType *element.NumberDataElement |
| 145 |
AccountCurrency *element.CurrencyDataElement |
| 146 |
Name1 *element.AlphaNumericDataElement |
| 147 |
Name2 *element.AlphaNumericDataElement |
| 148 |
AccountProductID *element.AlphaNumericDataElement |
| 149 |
AccountLimit *element.AccountLimitDataElement |
| 150 |
AllowedBusinessTransactions *element.AllowedBusinessTransactionsDataElement |
| 151 |
AccountExtensions *element.AlphaNumericDataElement |
| 152 |
} |
| 153 |
|
| 154 |
func (a *AccountInformationV6) Version() int { return 6 } |
| 155 |
func (a *AccountInformationV6) ID() string { return AccountInformationID } |
| 156 |
func (a *AccountInformationV6) referencedId() string { return ProcessingPreparationID } |
| 157 |
func (a *AccountInformationV6) sender() string { return senderBank } |
| 158 |
|
| 159 |
func (a *AccountInformationV6) Account() domain.AccountInformation { |
| 160 |
info := domain.AccountInformation{ |
| 161 |
UserID: a.UserID.Val(), |
| 162 |
Name1: a.Name1.Val(), |
| 163 |
} |
| 164 |
if a.AccountConnection != nil { |
| 165 |
info.AccountConnection = a.AccountConnection.Val() |
| 166 |
} |
| 167 |
if a.AccountCurrency != nil { |
| 168 |
info.Currency = a.AccountCurrency.Val() |
| 169 |
} |
| 170 |
if a.Name2 != nil { |
| 171 |
info.Name2 = a.Name2.Val() |
| 172 |
} |
| 173 |
if a.AccountProductID != nil { |
| 174 |
info.ProductID = a.AccountProductID.Val() |
| 175 |
} |
| 176 |
if a.AccountLimit != nil { |
| 177 |
limit := a.AccountLimit.Val() |
| 178 |
info.Limit = &limit |
| 179 |
} |
| 180 |
if a.AllowedBusinessTransactions != nil { |
| 181 |
info.AllowedBusinessTransactions = a.AllowedBusinessTransactions.AllowedBusinessTransactions() |
| 182 |
} |
| 183 |
return info |
| 184 |
} |
| 185 |
|
| 186 |
func (a *AccountInformationV6) elements() []element.DataElement { |
| 187 |
return []element.DataElement{ |
| 188 |
a.AccountConnection, |
| 189 |
a.IBAN, |
| 190 |
a.UserID, |
| 191 |
a.AccountType, |
| 192 |
a.AccountCurrency, |
| 193 |
a.Name1, |
| 194 |
a.Name2, |
| 195 |
a.AccountProductID, |
| 196 |
a.AccountLimit, |
| 197 |
a.AllowedBusinessTransactions, |
| 198 |
a.AccountExtensions, |
| 199 |
} |
| 200 |
} |
| 201 |
|
| 202 |
type AccountInformationV7 struct { |
| 203 |
Segment |
| 204 |
AccountConnection *element.AccountConnectionDataElement |
| 205 |
IBAN *element.AlphaNumericDataElement |
| 206 |
UserID *element.IdentificationDataElement |
| 207 |
AccountType *element.NumberDataElement |
| 208 |
AccountCurrency *element.CurrencyDataElement |
| 209 |
Name1 *element.AlphaNumericDataElement |
| 210 |
Name2 *element.AlphaNumericDataElement |
| 211 |
AccountProductID *element.AlphaNumericDataElement |
| 212 |
AccountLimit *element.AccountLimitDataElement |
| 213 |
AllowedBusinessTransactions *element.AllowedBusinessTransactionsDataElement |
| 214 |
AccountExtensions *element.AlphaNumericDataElement |
| 215 |
} |
| 216 |
|
| 217 |
func (a *AccountInformationV7) Version() int { return 7 } |
| 218 |
func (a *AccountInformationV7) ID() string { return AccountInformationID } |
| 219 |
func (a *AccountInformationV7) referencedId() string { return ProcessingPreparationID } |
| 220 |
func (a *AccountInformationV7) sender() string { return senderBank } |
| 221 |
|
| 222 |
func (a *AccountInformationV7) Account() domain.AccountInformation { |
| 223 |
info := domain.AccountInformation{ |
| 224 |
UserID: a.UserID.Val(), |
| 225 |
Name1: a.Name1.Val(), |
| 226 |
} |
| 227 |
if a.AccountConnection != nil { |
| 228 |
info.AccountConnection = a.AccountConnection.Val() |
| 229 |
} |
| 230 |
if a.AccountCurrency != nil { |
| 231 |
info.Currency = a.AccountCurrency.Val() |
| 232 |
} |
| 233 |
if a.Name2 != nil { |
| 234 |
info.Name2 = a.Name2.Val() |
| 235 |
} |
| 236 |
if a.AccountProductID != nil { |
| 237 |
info.ProductID = a.AccountProductID.Val() |
| 238 |
} |
| 239 |
if a.AccountLimit != nil { |
| 240 |
limit := a.AccountLimit.Val() |
| 241 |
info.Limit = &limit |
| 242 |
} |
| 243 |
if a.AllowedBusinessTransactions != nil { |
| 244 |
info.AllowedBusinessTransactions = a.AllowedBusinessTransactions.AllowedBusinessTransactions() |
| 245 |
} |
| 246 |
return info |
| 247 |
} |
| 248 |
|
| 249 |
func (a *AccountInformationV7) elements() []element.DataElement { |
| 250 |
return []element.DataElement{ |
| 251 |
a.AccountConnection, |
| 252 |
a.IBAN, |
| 253 |
a.UserID, |
| 254 |
a.AccountType, |
| 255 |
a.AccountCurrency, |
| 256 |
a.Name1, |
| 257 |
a.Name2, |
| 258 |
a.AccountProductID, |
| 259 |
a.AccountLimit, |
| 260 |
a.AllowedBusinessTransactions, |
| 261 |
a.AccountExtensions, |
| 262 |
} |
| 263 |
} |