Skip to content

Commit

Permalink
FedWireMessage
Browse files Browse the repository at this point in the history
FedWireMessage
  • Loading branch information
bkmoovio committed Apr 10, 2019
1 parent f752a0b commit 8ebb708
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion file.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package wire
// File contains the structures of a parsed WIRE File.
type File struct {
ID string `json:"id"`
FedWireMessages []FedWireMessage `json:"fedWireMessage"`
FedWireMessage FedWireMessage `json:"fedWireMessage"`
}

// Create will tabulate and assemble an WIRE file into a valid state.
Expand Down
2 changes: 1 addition & 1 deletion reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (r *Reader) parseLine() error {
if err := r.parseFIPaymentMethodToBeneficiary(); err != nil {
return err
}
case TagFIAdditionalFiToFi:
case TagFIAdditionalFIToFI:
if err := r.parseFIAdditionalFiToFi(); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions senderSupplied.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ type SenderSupplied struct {
}

// NewSenderSupplied returns a new SenderSupplied
func NewSenderSupplied() SenderSupplied {
ss := SenderSupplied{
func NewSenderSupplied() *SenderSupplied {
ss := &SenderSupplied{
tag: TagSenderSupplied,
FormatVersion: FormatVersion,
TestProductionCode: EnvironmentTest,
Expand Down
11 changes: 11 additions & 0 deletions senderSupplied_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package wire

// mockSenderSupplied creates a SenderSupplied
func mockSenderSupplied() *SenderSupplied {
ss := NewSenderSupplied()
ss.tag = TagSenderSupplied
ss.FormatVersion = FormatVersion
ss.TestProductionCode = EnvironmentTest
ss.MessageDuplicationCode = MessageDuplicationOriginal
return ss
}
4 changes: 1 addition & 3 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ func (w *Writer) Flush() {
}

func (w *Writer) writeFedWireMessage(file *File) error {
// ToDo: More than 1?
for _, fwm := range file.FedWireMessages {
fwm := file.FedWireMessage
if err := w.writeMandatory(fwm); err != nil {
return err
}
Expand Down Expand Up @@ -78,7 +77,6 @@ func (w *Writer) writeFedWireMessage(file *File) error {
if _, err := w.w.WriteString(fwm.GetServiceMessage().String() + "\n"); err != nil {
return err
}
}
return nil
}

Expand Down

0 comments on commit 8ebb708

Please sign in to comment.