-
Notifications
You must be signed in to change notification settings - Fork 39
/
main.go
247 lines (214 loc) · 8.24 KB
/
main.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
// Copyright 2020 The Moov Authors
// Use of this source code is governed by an Apache License
// license that can be found in the LICENSE file.
package main
import (
"log"
"os"
"time"
"github.com/moov-io/wire"
)
func main() {
file := wire.NewFile()
fwm := wire.FEDWireMessage{}
// Mandatory Fields
ss := wire.NewSenderSupplied()
ss.UserRequestCorrelation = "User Req"
ss.MessageDuplicationCode = wire.MessageDuplicationOriginal
fwm.SenderSupplied = ss
tst := wire.NewTypeSubType()
tst.TypeCode = wire.SettlementTransfer
tst.SubTypeCode = wire.BasicFundsTransfer
fwm.TypeSubType = tst
// InputMessageAccountabilityData
imad := wire.NewInputMessageAccountabilityData()
imad.InputCycleDate = time.Now().Format("20060102")
imad.InputSource = "Source08"
imad.InputSequenceNumber = "000001"
fwm.InputMessageAccountabilityData = imad
// Amount
amt := wire.NewAmount()
amt.Amount = "000001234567"
fwm.Amount = amt
// SenderDepositoryInstitution
sdi := wire.NewSenderDepositoryInstitution()
sdi.SenderABANumber = "121042882"
sdi.SenderShortName = "Wells Fargo NA"
fwm.SenderDepositoryInstitution = sdi
rdi := wire.NewReceiverDepositoryInstitution()
rdi.ReceiverABANumber = "231380104"
rdi.ReceiverShortName = "Citadel"
fwm.ReceiverDepositoryInstitution = rdi
bfc := wire.NewBusinessFunctionCode()
bfc.BusinessFunctionCode = wire.DepositSendersAccount
bfc.TransactionTypeCode = " "
fwm.BusinessFunctionCode = bfc
// Other Transfer Information
// Sender Reference
sr := wire.NewSenderReference()
sr.SenderReference = "Sender Reference"
fwm.SenderReference = sr
// Previous Message Identifier
pmi := wire.NewPreviousMessageIdentifier()
pmi.PreviousMessageIdentifier = "Previous Message Ident"
fwm.PreviousMessageIdentifier = pmi
// Beneficiary
// Beneficiary Intermediary FI
bifi := wire.NewBeneficiaryIntermediaryFI()
bifi.FinancialInstitution.IdentificationCode = wire.DemandDepositAccountNumber
bifi.FinancialInstitution.Identifier = "123456789"
bifi.FinancialInstitution.Name = "FI Name"
bifi.FinancialInstitution.Address.AddressLineOne = "Address One"
bifi.FinancialInstitution.Address.AddressLineTwo = "Address Two"
bifi.FinancialInstitution.Address.AddressLineThree = "Address Three"
fwm.BeneficiaryIntermediaryFI = bifi
// Beneficiary FI
bfi := wire.NewBeneficiaryFI()
bfi.FinancialInstitution.IdentificationCode = wire.DemandDepositAccountNumber
bfi.FinancialInstitution.Identifier = "123456789"
bfi.FinancialInstitution.Name = "FI Name"
bfi.FinancialInstitution.Address.AddressLineOne = "Address One"
bfi.FinancialInstitution.Address.AddressLineTwo = "Address Two"
bfi.FinancialInstitution.Address.AddressLineThree = "Address Three"
fwm.BeneficiaryFI = bfi
// Beneficiary
ben := wire.NewBeneficiary()
ben.Personal.IdentificationCode = wire.DriversLicenseNumber
ben.Personal.Identifier = "1234"
ben.Personal.Name = "Name"
ben.Personal.Address.AddressLineOne = "Address One"
ben.Personal.Address.AddressLineTwo = "Address Two"
ben.Personal.Address.AddressLineThree = "Address Three"
fwm.Beneficiary = ben
// Beneficiary Reference
br := wire.NewBeneficiaryReference()
br.BeneficiaryReference = "Reference"
fwm.BeneficiaryReference = br
// Originator
o := wire.NewOriginator()
o.Personal.IdentificationCode = wire.PassportNumber
o.Personal.Identifier = "1234"
o.Personal.Name = "Name"
o.Personal.Address.AddressLineOne = "Address One"
o.Personal.Address.AddressLineTwo = "Address Two"
o.Personal.Address.AddressLineThree = "Address Three"
fwm.Originator = o
// Originator FI
ofi := wire.NewOriginatorFI()
ofi.FinancialInstitution.IdentificationCode = wire.DemandDepositAccountNumber
ofi.FinancialInstitution.Identifier = "123456789"
ofi.FinancialInstitution.Name = "FI Name"
ofi.FinancialInstitution.Address.AddressLineOne = "Address One"
ofi.FinancialInstitution.Address.AddressLineTwo = "Address Two"
ofi.FinancialInstitution.Address.AddressLineThree = "Address Three"
fwm.OriginatorFI = ofi
// Instructing FI
ifi := wire.NewInstructingFI()
ifi.FinancialInstitution.IdentificationCode = wire.DemandDepositAccountNumber
ifi.FinancialInstitution.Identifier = "123456789"
ifi.FinancialInstitution.Name = "FI Name"
ifi.FinancialInstitution.Address.AddressLineOne = "Address One"
ifi.FinancialInstitution.Address.AddressLineTwo = "Address Two"
ifi.FinancialInstitution.Address.AddressLineThree = "Address Three"
fwm.InstructingFI = ifi
// Originator To Beneficiary
ob := wire.NewOriginatorToBeneficiary()
ob.LineOne = "LineOne"
ob.LineTwo = "LineTwo"
ob.LineThree = "LineThree"
ob.LineFour = "LineFour"
fwm.OriginatorToBeneficiary = ob
// FI to FI
// FIReceiverFI
firfi := wire.NewFIReceiverFI()
firfi.FIToFI.LineOne = "FIToFI Line One"
firfi.FIToFI.LineOne = "FIToFI Line Two"
firfi.FIToFI.LineOne = "FIToFI Line Three"
firfi.FIToFI.LineOne = "FIToFI Line Four"
firfi.FIToFI.LineOne = "FIToFI Line Five"
firfi.FIToFI.LineOne = "FIToFI Line Six"
fwm.FIReceiverFI = firfi
// FIIntermediaryFI
fiifi := wire.NewFIIntermediaryFI()
fiifi.FIToFI.LineOne = "FIIntermediaryFI Line One"
fiifi.FIToFI.LineOne = "FIIntermediaryFI Line Two"
fiifi.FIToFI.LineOne = "FIIntermediaryFI Line Three"
fiifi.FIToFI.LineOne = "FIIntermediaryFI Line Four"
fiifi.FIToFI.LineOne = "FIIntermediaryFI Line Five"
fiifi.FIToFI.LineOne = "FIIntermediaryFI Line Six"
fwm.FIIntermediaryFI = fiifi
// FIIntermediaryFIAdvice
fiifia := wire.NewFIIntermediaryFIAdvice()
fiifia.Advice.AdviceCode = wire.AdviceCodeLetter
fiifia.Advice.LineOne = "FIInterFIAdvice Line One"
fiifia.Advice.LineTwo = "FIInterFIAdvice Line Two"
fiifia.Advice.LineThree = "FIInterFIAdvice Line Three"
fiifia.Advice.LineFour = "FIInterFIAdvice Line Four"
fiifia.Advice.LineFive = "FIInterFIAdvice Line Five"
fiifia.Advice.LineSix = "FIInterFIAdvice Line Six"
fwm.FIIntermediaryFIAdvice = fiifia
// FIBeneficiaryFI
fibfi := wire.NewFIBeneficiaryFI()
fibfi.FIToFI.LineOne = "FIBenFI Line One"
fibfi.FIToFI.LineTwo = "FIBenFI Line Two"
fibfi.FIToFI.LineThree = "FIBenFI Line Three"
fibfi.FIToFI.LineFour = "FIBenFI Line Four"
fibfi.FIToFI.LineFive = "FIBenFI Line Five"
fibfi.FIToFI.LineSix = "FIBenFI Line Six"
fwm.FIBeneficiaryFI = fibfi
// FIBeneficiaryFIAdvice
fibfia := wire.NewFIBeneficiaryFIAdvice()
fibfia.Advice.AdviceCode = wire.AdviceCodeTelex
fibfia.Advice.LineOne = "FIBenFIAdvice Line One"
fibfia.Advice.LineTwo = "FIBenFIAdvice Line Two"
fibfia.Advice.LineThree = "FIBenFIAdvice Line Three"
fibfia.Advice.LineFour = "FIBenFIAdvice Line Four"
fibfia.Advice.LineFive = "FIBenFIAdvice Line Five"
fibfia.Advice.LineSix = "FIBenFIAdvice Line Six"
fwm.FIBeneficiaryFIAdvice = fibfia
// FIBeneficiary
fib := wire.NewFIBeneficiary()
fib.FIToFI.LineOne = "FIBen Line One"
fib.FIToFI.LineTwo = "FIBen Line Two"
fib.FIToFI.LineThree = "FIBen Line Three"
fib.FIToFI.LineFour = "FIBen Line Four"
fib.FIToFI.LineFive = "FIBen Line Five"
fib.FIToFI.LineSix = "FIBen Line Six"
fwm.FIBeneficiary = fib
// FIBeneficiaryAdvice
fiba := wire.NewFIBeneficiaryAdvice()
fiba.Advice.AdviceCode = wire.AdviceCodeLetter
fiba.Advice.LineOne = "FIBenAdvice Line One"
fiba.Advice.LineTwo = "FIBenAdvice Line Two"
fiba.Advice.LineThree = "FIBenAdvice Line Three"
fiba.Advice.LineFour = "FIBenAdvice Line Four"
fiba.Advice.LineFive = "FIBenAdvice Line Five"
fiba.Advice.LineSix = "FIBenAdvice Line Six"
fwm.FIBeneficiaryAdvice = fiba
// FIPaymentMethodToBeneficiary
pm := wire.NewFIPaymentMethodToBeneficiary()
pm.PaymentMethod = "CHECK"
pm.AdditionalInformation = "Additional Information"
fwm.FIPaymentMethodToBeneficiary = pm
// FIAdditionalFIToFI
fifi := wire.NewFIAdditionalFIToFI()
fifi.AdditionalFIToFI.LineOne = "FIAddFI Line One"
fifi.AdditionalFIToFI.LineTwo = "FIAddFI Line Two"
fifi.AdditionalFIToFI.LineThree = "FIAddFI Line Three"
fifi.AdditionalFIToFI.LineFour = "FIAddFI Line Four"
fifi.AdditionalFIToFI.LineFive = "FIAddFI Line Five"
fifi.AdditionalFIToFI.LineSix = "FIAddFI Line Six"
fwm.FIAdditionalFIToFI = fifi
file.AddFEDWireMessage(fwm)
if err := file.Create(); err != nil {
log.Fatalf("Could not create FEDWireMessage: %s\n", err)
}
if err := file.Validate(); err != nil {
log.Fatalf("Could not validate FEDWireMessage: %s\n", err)
}
w := wire.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
w.Flush()
}