Skip to content

Commit

Permalink
Merge pull request #106 from adamdecaf/issue104-fixup
Browse files Browse the repository at this point in the history
all: populate record tag after JSON unmarshal
  • Loading branch information
adamdecaf authored Oct 28, 2020
2 parents 2c85ee9 + ec0d97d commit 134162f
Show file tree
Hide file tree
Showing 61 changed files with 959 additions and 3 deletions.
15 changes: 15 additions & 0 deletions accountCreditedDrawdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -43,6 +44,20 @@ func (creditDD *AccountCreditedDrawdown) Parse(record string) error {
return nil
}

func (creditDD *AccountCreditedDrawdown) UnmarshalJSON(data []byte) error {
type Alias AccountCreditedDrawdown
aux := struct {
*Alias
}{
(*Alias)(creditDD),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
creditDD.tag = TagAccountCreditedDrawdown
return nil
}

// String writes AccountCreditedDrawdown
func (creditDD *AccountCreditedDrawdown) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions accountDebitedDrawdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -53,6 +54,20 @@ func (debitDD *AccountDebitedDrawdown) Parse(record string) error {
return nil
}

func (debitDD *AccountDebitedDrawdown) UnmarshalJSON(data []byte) error {
type Alias AccountDebitedDrawdown
aux := struct {
*Alias
}{
(*Alias)(debitDD),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
debitDD.tag = TagAccountDebitedDrawdown
return nil
}

// String writes AccountDebitedDrawdown
func (debitDD *AccountDebitedDrawdown) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions actualAmountPaid.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -44,6 +45,20 @@ func (aap *ActualAmountPaid) Parse(record string) error {
return nil
}

func (aap *ActualAmountPaid) UnmarshalJSON(data []byte) error {
type Alias ActualAmountPaid
aux := struct {
*Alias
}{
(*Alias)(aap),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
aap.tag = TagActualAmountPaid
return nil
}

// String writes ActualAmountPaid
func (aap *ActualAmountPaid) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions adjustment.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -53,6 +54,20 @@ func (adj *Adjustment) Parse(record string) error {
return nil
}

func (adj *Adjustment) UnmarshalJSON(data []byte) error {
type Alias Adjustment
aux := struct {
*Alias
}{
(*Alias)(adj),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
adj.tag = TagAdjustment
return nil
}

// String writes Adjustment
func (adj *Adjustment) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions amount.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -43,6 +44,20 @@ func (a *Amount) Parse(record string) error {
return nil
}

func (a *Amount) UnmarshalJSON(data []byte) error {
type Alias Amount
aux := struct {
*Alias
}{
(*Alias)(a),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
a.tag = TagAmount
return nil
}

// String writes Amount
func (a *Amount) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions amountNegotiatedDiscount.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -44,6 +45,20 @@ func (nd *AmountNegotiatedDiscount) Parse(record string) error {
return nil
}

func (nd *AmountNegotiatedDiscount) UnmarshalJSON(data []byte) error {
type Alias AmountNegotiatedDiscount
aux := struct {
*Alias
}{
(*Alias)(nd),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
nd.tag = TagAmountNegotiatedDiscount
return nil
}

// String writes AmountNegotiatedDiscount
func (nd *AmountNegotiatedDiscount) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions beneficiary.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -48,6 +49,20 @@ func (ben *Beneficiary) Parse(record string) error {
return nil
}

func (ben *Beneficiary) UnmarshalJSON(data []byte) error {
type Alias Beneficiary
aux := struct {
*Alias
}{
(*Alias)(ben),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
ben.tag = TagBeneficiary
return nil
}

// String writes Beneficiary
func (ben *Beneficiary) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions beneficiaryCustomer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -48,6 +49,20 @@ func (bc *BeneficiaryCustomer) Parse(record string) error {
return nil
}

func (bc *BeneficiaryCustomer) UnmarshalJSON(data []byte) error {
type Alias BeneficiaryCustomer
aux := struct {
*Alias
}{
(*Alias)(bc),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
bc.tag = TagBeneficiaryCustomer
return nil
}

// String writes BeneficiaryCustomer
func (bc *BeneficiaryCustomer) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions beneficiaryFI.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -48,6 +49,20 @@ func (bfi *BeneficiaryFI) Parse(record string) error {
return nil
}

func (bfi *BeneficiaryFI) UnmarshalJSON(data []byte) error {
type Alias BeneficiaryFI
aux := struct {
*Alias
}{
(*Alias)(bfi),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
bfi.tag = TagBeneficiaryFI
return nil
}

// String writes BeneficiaryFI
func (bfi *BeneficiaryFI) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions beneficiaryIntermediaryFI.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -48,6 +49,20 @@ func (bifi *BeneficiaryIntermediaryFI) Parse(record string) error {
return nil
}

func (bifi *BeneficiaryIntermediaryFI) UnmarshalJSON(data []byte) error {
type Alias BeneficiaryIntermediaryFI
aux := struct {
*Alias
}{
(*Alias)(bifi),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
bifi.tag = TagBeneficiaryIntermediaryFI
return nil
}

// String writes BeneficiaryIntermediaryFI
func (bifi *BeneficiaryIntermediaryFI) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions beneficiaryReference.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -43,6 +44,20 @@ func (br *BeneficiaryReference) Parse(record string) error {
return nil
}

func (br *BeneficiaryReference) UnmarshalJSON(data []byte) error {
type Alias BeneficiaryReference
aux := struct {
*Alias
}{
(*Alias)(br),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
br.tag = TagBeneficiaryReference
return nil
}

// String writes BeneficiaryReference
func (br *BeneficiaryReference) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions businessFunctionCode.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -46,6 +47,20 @@ func (bfc *BusinessFunctionCode) Parse(record string) error {
return nil
}

func (bfc *BusinessFunctionCode) UnmarshalJSON(data []byte) error {
type Alias BusinessFunctionCode
aux := struct {
*Alias
}{
(*Alias)(bfc),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
bfc.tag = TagBusinessFunctionCode
return nil
}

// String writes BusinessFunctionCode
func (bfc *BusinessFunctionCode) String() string {
var buf strings.Builder
Expand Down
15 changes: 15 additions & 0 deletions charges.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package wire

import (
"encoding/json"
"strings"
"unicode/utf8"
)
Expand Down Expand Up @@ -62,6 +63,20 @@ func (c *Charges) Parse(record string) {
c.SendersChargesFour = c.parseStringField(record[52:67])
}

func (c *Charges) UnmarshalJSON(data []byte) error {
type Alias Charges
aux := struct {
*Alias
}{
(*Alias)(c),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
c.tag = TagCharges
return nil
}

// String writes Charges
func (c *Charges) String() string {
var buf strings.Builder
Expand Down
Loading

0 comments on commit 134162f

Please sign in to comment.