| 1 |
package segment |
| 2 |
|
| 3 |
import "github.com/mitch000001/go-hbci/element" |
| 4 |
|
| 5 |
type SignatureEnd interface { |
| 6 |
SetControlReference(controlReference string) |
| 7 |
SetSignature(signature []byte) |
| 8 |
SetPinTan(pin, tan string) |
| 9 |
} |
| 10 |
|
| 11 |
func NewSignatureEndSegmentV1() *SignatureEndSegment { |
| 12 |
s := &SignatureEndV1{} |
| 13 |
s.ClientSegment = NewBasicSegment(-1, s) |
| 14 |
|
| 15 |
segment := &SignatureEndSegment{ |
| 16 |
signatureEndSegment: s, |
| 17 |
} |
| 18 |
return segment |
| 19 |
} |
| 20 |
|
| 21 |
type signatureEndSegment interface { |
| 22 |
ClientSegment |
| 23 |
SignatureEnd |
| 24 |
Unmarshaler |
| 25 |
} |
| 26 |
|
| 27 |
//go:generate go run ../cmd/unmarshaler/unmarshaler_generator.go -segment SignatureEndSegment -segment_interface signatureEndSegment -segment_versions="SignatureEndV1:1:ClientSegment,SignatureEndV2:2:ClientSegment" |
| 28 |
|
| 29 |
type SignatureEndSegment struct { |
| 30 |
signatureEndSegment |
| 31 |
} |
| 32 |
|
| 33 |
type SignatureEndV1 struct { |
| 34 |
ClientSegment |
| 35 |
SecurityControlRef *element.AlphaNumericDataElement |
| 36 |
Signature *element.BinaryDataElement |
| 37 |
PinTan *element.PinTanDataElement |
| 38 |
} |
| 39 |
|
| 40 |
func (s *SignatureEndV1) Version() int { return 1 } |
| 41 |
func (s *SignatureEndV1) ID() string { return "HNSHA" } |
| 42 |
func (s *SignatureEndV1) referencedId() string { return "" } |
| 43 |
func (s *SignatureEndV1) sender() string { return senderBoth } |
| 44 |
|
| 45 |
func (s *SignatureEndV1) elements() []element.DataElement { |
| 46 |
return []element.DataElement{ |
| 47 |
s.SecurityControlRef, |
| 48 |
s.Signature, |
| 49 |
s.PinTan, |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
func (s *SignatureEndV1) SetControlReference(controlReference string) { |
| 54 |
s.SecurityControlRef = element.NewAlphaNumeric(controlReference, 14) |
| 55 |
} |
| 56 |
|
| 57 |
func (s *SignatureEndV1) SetSignature(signature []byte) { |
| 58 |
s.Signature = element.NewBinary(signature, 512) |
| 59 |
} |
| 60 |
|
| 61 |
func (s *SignatureEndV1) SetPinTan(pin, tan string) { |
| 62 |
s.PinTan = element.NewPinTan(pin, tan) |
| 63 |
} |
| 64 |
func NewSignatureEndSegmentV2() *SignatureEndSegment { |
| 65 |
s := &SignatureEndV2{} |
| 66 |
s.ClientSegment = NewBasicSegment(-1, s) |
| 67 |
|
| 68 |
segment := &SignatureEndSegment{ |
| 69 |
signatureEndSegment: s, |
| 70 |
} |
| 71 |
return segment |
| 72 |
} |
| 73 |
|
| 74 |
type SignatureEndV2 struct { |
| 75 |
ClientSegment |
| 76 |
SecurityControlRef *element.AlphaNumericDataElement |
| 77 |
Signature *element.BinaryDataElement |
| 78 |
CustomSignature *element.CustomSignatureDataElement |
| 79 |
} |
| 80 |
|
| 81 |
func (s *SignatureEndV2) Version() int { return 2 } |
| 82 |
func (s *SignatureEndV2) ID() string { return "HNSHA" } |
| 83 |
func (s *SignatureEndV2) referencedId() string { return "" } |
| 84 |
func (s *SignatureEndV2) sender() string { return senderBoth } |
| 85 |
|
| 86 |
func (s *SignatureEndV2) elements() []element.DataElement { |
| 87 |
return []element.DataElement{ |
| 88 |
s.SecurityControlRef, |
| 89 |
s.Signature, |
| 90 |
s.CustomSignature, |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
func (s *SignatureEndV2) SetControlReference(controlReference string) { |
| 95 |
s.SecurityControlRef = element.NewAlphaNumeric(controlReference, 14) |
| 96 |
} |
| 97 |
|
| 98 |
func (s *SignatureEndV2) SetSignature(signature []byte) { |
| 99 |
s.Signature = element.NewBinary(signature, 512) |
| 100 |
} |
| 101 |
|
| 102 |
func (s *SignatureEndV2) SetPinTan(pin, tan string) { |
| 103 |
s.CustomSignature = element.NewCustomSignature(pin, tan) |
| 104 |
} |