-
Notifications
You must be signed in to change notification settings - Fork 39
/
main.go
300 lines (264 loc) · 10.3 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
// 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.FundsTransfer
tst.SubTypeCode = wire.BasicFundsTransfer
fwm.TypeSubType = tst
imad := wire.NewInputMessageAccountabilityData()
imad.InputCycleDate = time.Now().Format("20060102")
imad.InputSource = "Source08"
imad.InputSequenceNumber = "000001"
fwm.InputMessageAccountabilityData = imad
amt := wire.NewAmount()
amt.Amount = "000001234567"
fwm.Amount = amt
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.CustomerTransferPlus
bfc.TransactionTypeCode = " "
fwm.BusinessFunctionCode = bfc
// Other Transfer Information
sr := wire.NewSenderReference()
sr.SenderReference = "Sender Reference"
fwm.SenderReference = sr
pmi := wire.NewPreviousMessageIdentifier()
pmi.PreviousMessageIdentifier = "Previous Message Ident"
fwm.PreviousMessageIdentifier = pmi
li := wire.NewLocalInstrument()
li.LocalInstrumentCode = wire.SequenceBCoverPaymentStructured
li.ProprietaryCode = ""
fwm.LocalInstrument = li
pn := wire.NewPaymentNotification()
pn.PaymentNotificationIndicator = "1"
pn.ContactNotificationElectronicAddress = "http://moov.io"
pn.ContactName = "Contact Name"
pn.ContactPhoneNumber = "5555551212"
pn.ContactMobileNumber = "5551231212"
pn.ContactFaxNumber = "5554561212"
fwm.PaymentNotification = pn
// Beneficiary
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
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
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
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
oof := wire.NewOriginatorOptionF()
oof.PartyIdentifier = "TXID/123-45-6789"
oof.Name = "1/Name"
oof.LineOne = "1/1234"
oof.LineTwo = "2/1000 Colonial Farm Rd"
oof.LineThree = "5/Pottstown"
fwm.OriginatorOptionF = oof
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
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
ob := wire.NewOriginatorToBeneficiary()
ob.LineOne = "LineOne"
ob.LineTwo = "LineTwo"
ob.LineThree = "LineThree"
ob.LineFour = "LineFour"
fwm.OriginatorToBeneficiary = ob
// FI to FI
fiifi := wire.NewFIIntermediaryFI()
fiifi.FIToFI.LineOne = "Line One"
fiifi.FIToFI.LineOne = "Line Two"
fiifi.FIToFI.LineOne = "Line Three"
fiifi.FIToFI.LineOne = "Line Four"
fiifi.FIToFI.LineOne = "Line Five"
fiifi.FIToFI.LineOne = "Line Six"
fwm.FIIntermediaryFI = fiifi
fiifia := wire.NewFIIntermediaryFIAdvice()
fiifia.Advice.AdviceCode = wire.AdviceCodeLetter
fiifia.Advice.LineOne = "Line One"
fiifia.Advice.LineTwo = "Line Two"
fiifia.Advice.LineThree = "Line Three"
fiifia.Advice.LineFour = "Line Four"
fiifia.Advice.LineFive = "Line Five"
fiifia.Advice.LineSix = "Line Six"
fwm.FIIntermediaryFIAdvice = fiifia
fibfi := wire.NewFIBeneficiaryFI()
fibfi.FIToFI.LineOne = "Line One"
fibfi.FIToFI.LineTwo = "Line Two"
fibfi.FIToFI.LineThree = "Line Three"
fibfi.FIToFI.LineFour = "Line Four"
fibfi.FIToFI.LineFive = "Line Five"
fibfi.FIToFI.LineSix = "Line Six"
fwm.FIBeneficiaryFI = fibfi
fibfia := wire.NewFIBeneficiaryFIAdvice()
fibfia.Advice.AdviceCode = wire.AdviceCodeTelex
fibfia.Advice.LineOne = "Line One"
fibfia.Advice.LineTwo = "Line Two"
fibfia.Advice.LineThree = "Line Three"
fibfia.Advice.LineFour = "Line Four"
fibfia.Advice.LineFive = "Line Five"
fibfia.Advice.LineSix = "Line Six"
fwm.FIBeneficiaryFIAdvice = fibfia
fib := wire.NewFIBeneficiary()
fib.FIToFI.LineOne = "Line One"
fib.FIToFI.LineTwo = "Line Two"
fib.FIToFI.LineThree = "Line Three"
fib.FIToFI.LineFour = "Line Four"
fib.FIToFI.LineFive = "Line Five"
fib.FIToFI.LineSix = "Line Six"
fwm.FIBeneficiary = fib
fiba := wire.NewFIBeneficiaryAdvice()
fiba.Advice.AdviceCode = wire.AdviceCodeLetter
fiba.Advice.LineOne = "Line One"
fiba.Advice.LineTwo = "Line Two"
fiba.Advice.LineThree = "Line Three"
fiba.Advice.LineFour = "Line Four"
fiba.Advice.LineFive = "Line Five"
fiba.Advice.LineSix = "Line Six"
fwm.FIBeneficiaryAdvice = fiba
pm := wire.NewFIPaymentMethodToBeneficiary()
pm.AdditionalInformation = "Additional Information"
fwm.FIPaymentMethodToBeneficiary = pm
fifi := wire.NewFIAdditionalFIToFI()
fifi.AdditionalFIToFI.LineOne = "Line One"
fifi.AdditionalFIToFI.LineTwo = "Line Two"
fifi.AdditionalFIToFI.LineThree = "Line Three"
fifi.AdditionalFIToFI.LineFour = "Line Four"
fifi.AdditionalFIToFI.LineFive = "Line Five"
fifi.AdditionalFIToFI.LineSix = "Line Six"
fwm.FIAdditionalFIToFI = fifi
// Cover Payment Information
cia := wire.NewCurrencyInstructedAmount()
cia.SwiftFieldTag = "Swift Field Tag"
cia.Amount = "1500,49"
fwm.CurrencyInstructedAmount = cia
oc := wire.NewOrderingCustomer()
oc.CoverPayment.SwiftFieldTag = "Swift Field Tag"
oc.CoverPayment.SwiftLineOne = "Swift Line One"
oc.CoverPayment.SwiftLineTwo = "Swift Line Two"
oc.CoverPayment.SwiftLineThree = "Swift Line Three"
oc.CoverPayment.SwiftLineFour = "Swift Line Four"
oc.CoverPayment.SwiftLineFive = "Swift Line Five"
fwm.OrderingCustomer = oc
oi := wire.NewOrderingInstitution()
oi.CoverPayment.SwiftFieldTag = "Swift Field Tag"
oi.CoverPayment.SwiftLineOne = "Swift Line One"
oi.CoverPayment.SwiftLineTwo = "Swift Line Two"
oi.CoverPayment.SwiftLineThree = "Swift Line Three"
oi.CoverPayment.SwiftLineFour = "Swift Line Four"
oi.CoverPayment.SwiftLineFive = "Swift Line Five"
fwm.OrderingInstitution = oi
ii := wire.NewIntermediaryInstitution()
ii.CoverPayment.SwiftFieldTag = "Swift Field Tag"
ii.CoverPayment.SwiftLineOne = "Swift Line One"
ii.CoverPayment.SwiftLineTwo = "Swift Line Two"
ii.CoverPayment.SwiftLineThree = "Swift Line Three"
ii.CoverPayment.SwiftLineFour = "Swift Line Four"
ii.CoverPayment.SwiftLineFive = "Swift Line Five"
fwm.IntermediaryInstitution = ii
iAccount := wire.NewInstitutionAccount()
iAccount.CoverPayment.SwiftFieldTag = "Swift Field Tag"
iAccount.CoverPayment.SwiftLineOne = "Swift Line One"
iAccount.CoverPayment.SwiftLineTwo = "Swift Line Two"
iAccount.CoverPayment.SwiftLineThree = "Swift Line Three"
iAccount.CoverPayment.SwiftLineFour = "Swift Line Four"
iAccount.CoverPayment.SwiftLineFive = "Swift Line Five"
fwm.InstitutionAccount = iAccount
bc := wire.NewBeneficiaryCustomer()
bc.CoverPayment.SwiftFieldTag = "Swift Field Tag"
bc.CoverPayment.SwiftLineOne = "Swift Line One"
bc.CoverPayment.SwiftLineTwo = "Swift Line Two"
bc.CoverPayment.SwiftLineThree = "Swift Line Three"
bc.CoverPayment.SwiftLineFour = "Swift Line Four"
bc.CoverPayment.SwiftLineFive = "Swift Line Five"
fwm.BeneficiaryCustomer = bc
ri := wire.NewRemittance()
ri.CoverPayment.SwiftFieldTag = "Swift Field Tag"
ri.CoverPayment.SwiftLineOne = "Swift Line One"
ri.CoverPayment.SwiftLineTwo = "Swift Line Two"
ri.CoverPayment.SwiftLineThree = "Swift Line Three"
ri.CoverPayment.SwiftLineFour = "Swift Line Four"
fwm.Remittance = ri
str := wire.NewSenderToReceiver()
str.CoverPayment.SwiftFieldTag = "Swift Field Tag"
str.CoverPayment.SwiftLineOne = "Swift Line One"
str.CoverPayment.SwiftLineTwo = "Swift Line Two"
str.CoverPayment.SwiftLineThree = "Swift Line Three"
str.CoverPayment.SwiftLineFour = "Swift Line Four"
str.CoverPayment.SwiftLineFive = "Swift Line Five"
str.CoverPayment.SwiftLineSix = "Swift Line Six"
fwm.SenderToReceiver = str
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()
}