| 1 |
package segment |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/mitch000001/go-hbci/domain" |
| 5 |
"github.com/mitch000001/go-hbci/element" |
| 6 |
) |
| 7 |
|
| 8 |
func NewCommunicationAccessRequestSegment(fromBank domain.BankID, toBank domain.BankID, maxEntries int, continuationReference string) *CommunicationAccessRequestSegment { |
| 9 |
c := &CommunicationAccessRequestSegment{ |
| 10 |
FromBankID: element.NewBankIdentification(fromBank), |
| 11 |
ToBankID: element.NewBankIdentification(toBank), |
| 12 |
MaxEntries: element.NewNumber(maxEntries, 4), |
| 13 |
} |
| 14 |
if continuationReference != "" { |
| 15 |
c.ContinuationReference = element.NewAlphaNumeric(continuationReference, 35) |
| 16 |
} |
| 17 |
c.ClientSegment = NewBasicSegment(2, c) |
| 18 |
return c |
| 19 |
} |
| 20 |
|
| 21 |
type CommunicationAccessRequestSegment struct { |
| 22 |
ClientSegment |
| 23 |
FromBankID *element.BankIdentificationDataElement |
| 24 |
ToBankID *element.BankIdentificationDataElement |
| 25 |
MaxEntries *element.NumberDataElement |
| 26 |
ContinuationReference *element.AlphaNumericDataElement |
| 27 |
} |
| 28 |
|
| 29 |
func (c *CommunicationAccessRequestSegment) Version() int { return 3 } |
| 30 |
func (c *CommunicationAccessRequestSegment) ID() string { return "HKKOM" } |
| 31 |
func (c *CommunicationAccessRequestSegment) referencedId() string { return "" } |
| 32 |
func (c *CommunicationAccessRequestSegment) sender() string { return senderUser } |
| 33 |
|
| 34 |
func (c *CommunicationAccessRequestSegment) elements() []element.DataElement { |
| 35 |
return []element.DataElement{ |
| 36 |
c.FromBankID, |
| 37 |
c.ToBankID, |
| 38 |
c.MaxEntries, |
| 39 |
c.ContinuationReference, |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
const HKKOMSegmentNumber = -1 |
| 44 |
|
| 45 |
func NewCommunicationAccessResponseSegment(bankId domain.BankID, language int, params domain.CommunicationParameter) *CommunicationAccessResponseSegment { |
| 46 |
c := &CommunicationAccessResponseSegment{ |
| 47 |
BankID: element.NewBankIdentification(bankId), |
| 48 |
StandardLanguage: element.NewNumber(language, 3), |
| 49 |
CommunicationParams: element.NewCommunicationParameter(params), |
| 50 |
} |
| 51 |
header := element.NewReferencingSegmentHeader("HIKOM", 4, 3, HKKOMSegmentNumber) |
| 52 |
c.Segment = NewBasicSegmentWithHeader(header, c) |
| 53 |
return c |
| 54 |
} |
| 55 |
|
| 56 |
//go:generate go run ../cmd/unmarshaler/unmarshaler_generator.go -segment CommunicationAccessResponseSegment |
| 57 |
|
| 58 |
type CommunicationAccessResponseSegment struct { |
| 59 |
Segment |
| 60 |
BankID *element.BankIdentificationDataElement |
| 61 |
StandardLanguage *element.NumberDataElement |
| 62 |
CommunicationParams *element.CommunicationParameterDataElement |
| 63 |
} |
| 64 |
|
| 65 |
func (c *CommunicationAccessResponseSegment) Version() int { return 3 } |
| 66 |
func (c *CommunicationAccessResponseSegment) ID() string { return "HIKOM" } |
| 67 |
func (c *CommunicationAccessResponseSegment) referencedId() string { return "HKKOM" } |
| 68 |
func (c *CommunicationAccessResponseSegment) sender() string { return senderBank } |
| 69 |
|
| 70 |
func (c *CommunicationAccessResponseSegment) elements() []element.DataElement { |
| 71 |
return []element.DataElement{ |
| 72 |
c.BankID, |
| 73 |
c.StandardLanguage, |
| 74 |
c.CommunicationParams, |
| 75 |
} |
| 76 |
} |