-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodel.go
171 lines (162 loc) · 4.53 KB
/
model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
package main
import (
"encoding/xml"
"github.com/j03hanafi/bankiso/iso20022/head"
)
type BusMsg struct {
AppHdr *head.BusinessApplicationHeaderV01 `xml:"AppHdr"`
}
type Message interface {
String() (result string, ok bool)
}
type Document struct {
Namespaces map[string]string
BusMsg BusMsg `xml:"BusMsg"`
}
func (a *Document) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
a.Namespaces = map[string]string{}
for _, attr := range start.Attr {
if attr.Name.Space == "xmlns" {
a.Namespaces[attr.Name.Local] = attr.Value
}
}
// Go on with unmarshalling.
type app Document
aa := (*app)(a)
return d.DecodeElement(aa, &start)
}
type Admn1 struct {
XMLName xml.Name `xml:"BusMsg"`
Text string `xml:",chardata"`
Ns string `xml:"ns,attr"`
Ns1 string `xml:"ns1,attr"`
Ns2 string `xml:"ns2,attr"`
Xsi string `xml:"xsi,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
AppHdr struct {
Text string `xml:",chardata"`
Fr struct {
Text string `xml:",chardata"`
FIId struct {
Text string `xml:",chardata"`
FinInstnId struct {
Text string `xml:",chardata"`
Othr struct {
Text string `xml:",chardata"`
ID string `xml:"Id"`
} `xml:"Othr"`
} `xml:"FinInstnId"`
} `xml:"FIId"`
} `xml:"Fr"`
To struct {
Text string `xml:",chardata"`
FIId struct {
Text string `xml:",chardata"`
FinInstnId struct {
Text string `xml:",chardata"`
Othr struct {
Text string `xml:",chardata"`
ID string `xml:"Id"`
} `xml:"Othr"`
} `xml:"FinInstnId"`
} `xml:"FIId"`
} `xml:"To"`
BizMsgIdr string `xml:"BizMsgIdr"`
MsgDefIdr string `xml:"MsgDefIdr"`
CreDt string `xml:"CreDt"`
} `xml:"AppHdr"`
Document struct {
Text string `xml:",chardata"`
AdmnReq struct {
Text string `xml:",chardata"`
GrpHdr struct {
Text string `xml:",chardata"`
MsgId string `xml:"MsgId"`
CreDtTm string `xml:"CreDtTm"`
} `xml:"GrpHdr"`
AdmnTxInf struct {
Text string `xml:",chardata"`
FnctnCd string `xml:"FnctnCd"`
InstrId string `xml:"InstrId"`
InstgAgt struct {
Text string `xml:",chardata"`
FinInstnId struct {
Text string `xml:",chardata"`
Othr struct {
Text string `xml:",chardata"`
ID string `xml:"Id"`
} `xml:"Othr"`
} `xml:"FinInstnId"`
} `xml:"InstgAgt"`
} `xml:"AdmnTxInf"`
} `xml:"AdmnReq"`
} `xml:"Document"`
}
type Admn2 struct {
XMLName xml.Name `xml:"ns:BusMsg"`
Text string `xml:",chardata"`
Ns string `xml:"xmlns:ns,attr"`
Ns1 string `xml:"xmlns:ns1,attr"`
Ns2 string `xml:"xmlns:ns2,attr"`
Xsi string `xml:"xmlns:xsi,attr"`
SchemaLocation string `xml:"xsi:schemaLocation,attr"`
AppHdr struct {
Text string `xml:",chardata"`
Fr struct {
Text string `xml:",chardata"`
FIId struct {
Text string `xml:",chardata"`
FinInstnId struct {
Text string `xml:",chardata"`
Othr struct {
Text string `xml:",chardata"`
ID string `xml:"ns1:Id"`
} `xml:"ns1:Othr"`
} `xml:"ns1:FinInstnId"`
} `xml:"ns1:FIId"`
} `xml:"ns1:Fr"`
To struct {
Text string `xml:",chardata"`
FIId struct {
Text string `xml:",chardata"`
FinInstnId struct {
Text string `xml:",chardata"`
Othr struct {
Text string `xml:",chardata"`
ID string `xml:"ns1:Id"`
} `xml:"ns1:Othr"`
} `xml:"ns1:FinInstnId"`
} `xml:"ns1:FIId"`
} `xml:"ns1:To"`
BizMsgIdr string `xml:"ns1:BizMsgIdr"`
MsgDefIdr string `xml:"ns1:MsgDefIdr"`
CreDt string `xml:"ns1:CreDt"`
} `xml:"ns:AppHdr"`
Document struct {
Text string `xml:",chardata"`
AdmnResp struct {
Text string `xml:",chardata"`
GrpHdr struct {
Text string `xml:",chardata"`
MsgId string `xml:"ns2:MsgId"`
CreDtTm string `xml:"ns2:CreDtTm"`
} `xml:"ns2:GrpHdr"`
AdmnResponse struct {
Text string `xml:",chardata"`
InstgAgt struct {
Text string `xml:",chardata"`
FinInstnId struct {
Text string `xml:",chardata"`
Othr struct {
Text string `xml:",chardata"`
ID string `xml:"ns2:Id"`
} `xml:"ns2:Othr"`
} `xml:"ns2:FinInstnId"`
} `xml:"ns2:InstgAgt"`
OrgnlInstrId string `xml:"ns2:OrgnlInstrId"`
FnctnCd string `xml:"ns2:FnctnCd"`
TxSts string `xml:"ns2:TxSts"`
} `xml:"ns2:AdmnResponse"`
} `xml:"ns:AdmnResp"`
} `xml:"ns:Document"`
}