Skip to content

Commit

Permalink
removed overwriting data
Browse files Browse the repository at this point in the history
  • Loading branch information
mfdeveloper508 committed Jun 9, 2022
1 parent d404a3a commit d8ee14a
Show file tree
Hide file tree
Showing 56 changed files with 878 additions and 463 deletions.
7 changes: 3 additions & 4 deletions accountCreditedDrawdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ func (creditDD *AccountCreditedDrawdown) Parse(record string) error {
}

creditDD.tag = record[:6]

var err error
length := 6
read := 0

if creditDD.DrawdownCreditAccountNumber, read, err = creditDD.parseVariableStringField(record[length:], 9); err != nil {
value, read, err := creditDD.parseVariableStringField(record[length:], 9)
if err != nil {
return fieldError("DrawdownCreditAccountNumber", err)
}
creditDD.DrawdownCreditAccountNumber = value
length += read

if len(record) != length {
Expand Down
23 changes: 15 additions & 8 deletions accountDebitedDrawdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,41 @@ func (debitDD *AccountDebitedDrawdown) Parse(record string) error {

debitDD.tag = record[:6]
debitDD.IdentificationCode = record[6:7]

var err error
length := 7
read := 0

if debitDD.Identifier, read, err = debitDD.parseVariableStringField(record[length:], 34); err != nil {
value, read, err := debitDD.parseVariableStringField(record[length:], 34)
if err != nil {
return fieldError("Identifier", err)
}
debitDD.Identifier = value
length += read

if debitDD.Name, read, err = debitDD.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = debitDD.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("Name", err)
}
debitDD.Name = value
length += read

if debitDD.Address.AddressLineOne, read, err = debitDD.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = debitDD.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineOne", err)
}
debitDD.Address.AddressLineOne = value
length += read

if debitDD.Address.AddressLineTwo, read, err = debitDD.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = debitDD.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineTwo", err)
}
debitDD.Address.AddressLineTwo = value
length += read

if debitDD.Address.AddressLineThree, read, err = debitDD.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = debitDD.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineThree", err)
}
debitDD.Address.AddressLineThree = value
length += read

if len(record) != length {
Expand Down
11 changes: 6 additions & 5 deletions actualAmountPaid.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ func (aap *ActualAmountPaid) Parse(record string) error {
}

aap.tag = record[:6]

var err error
length := 6
read := 0

if aap.RemittanceAmount.CurrencyCode, read, err = aap.parseVariableStringField(record[length:], 3); err != nil {
value, read, err := aap.parseVariableStringField(record[length:], 3)
if err != nil {
return fieldError("CurrencyCode", err)
}
aap.RemittanceAmount.CurrencyCode = value
length += read

if aap.RemittanceAmount.Amount, read, err = aap.parseVariableStringField(record[length:], 19); err != nil {
value, read, err = aap.parseVariableStringField(record[length:], 19)
if err != nil {
return fieldError("Amount", err)
}
aap.RemittanceAmount.Amount = value
length += read

if len(record) != length {
Expand Down
25 changes: 16 additions & 9 deletions adjustment.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,41 @@ func (adj *Adjustment) Parse(record string) error {
}

adj.tag = record[:6]

var err error
length := 6
read := 0

if adj.AdjustmentReasonCode, read, err = adj.parseVariableStringField(record[length:], 2); err != nil {
value, read, err := adj.parseVariableStringField(record[length:], 2)
if err != nil {
return fieldError("AdjustmentReasonCode", err)
}
adj.AdjustmentReasonCode = value
length += read

if adj.CreditDebitIndicator, read, err = adj.parseVariableStringField(record[length:], 4); err != nil {
value, read, err = adj.parseVariableStringField(record[length:], 4)
if err != nil {
return fieldError("CreditDebitIndicator", err)
}
adj.CreditDebitIndicator = value
length += read

if adj.RemittanceAmount.CurrencyCode, read, err = adj.parseVariableStringField(record[length:], 3); err != nil {
value, read, err = adj.parseVariableStringField(record[length:], 3)
if err != nil {
return fieldError("CurrencyCode", err)
}
adj.RemittanceAmount.CurrencyCode = value
length += read

if adj.RemittanceAmount.Amount, read, err = adj.parseVariableStringField(record[length:], 19); err != nil {
return fieldError("Amount", err)
value, read, err = adj.parseVariableStringField(record[length:], 19)
if err != nil {
return fieldError("CurrencyCode", err)
}
adj.RemittanceAmount.Amount = value
length += read

if adj.AdditionalInfo, read, err = adj.parseVariableStringField(record[length:], 140); err != nil {
value, read, err = adj.parseVariableStringField(record[length:], 140)
if err != nil {
return fieldError("AdditionalInfo", err)
}
adj.AdditionalInfo = value
length += read

if len(record) != length {
Expand Down
11 changes: 6 additions & 5 deletions amountNegotiatedDiscount.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ func (nd *AmountNegotiatedDiscount) Parse(record string) error {
}

nd.tag = record[:6]

var err error
length := 6
read := 0

if nd.RemittanceAmount.CurrencyCode, read, err = nd.parseVariableStringField(record[length:], 3); err != nil {
value, read, err := nd.parseVariableStringField(record[length:], 3)
if err != nil {
return fieldError("CurrencyCode", err)
}
nd.RemittanceAmount.CurrencyCode = value
length += read

if nd.RemittanceAmount.Amount, read, err = nd.parseVariableStringField(record[length:], 19); err != nil {
value, read, err = nd.parseVariableStringField(record[length:], 19)
if err != nil {
return fieldError("Amount", err)
}
nd.RemittanceAmount.Amount = value
length += read

if len(record) != length {
Expand Down
23 changes: 15 additions & 8 deletions beneficiary.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,41 @@ func (ben *Beneficiary) Parse(record string) error {

ben.tag = record[:6]
ben.Personal.IdentificationCode = ben.parseStringField(record[6:7])

var err error
length := 7
read := 0

if ben.Personal.Identifier, read, err = ben.parseVariableStringField(record[length:], 34); err != nil {
value, read, err := ben.parseVariableStringField(record[length:], 34)
if err != nil {
return fieldError("Identifier", err)
}
ben.Personal.Identifier = value
length += read

if ben.Personal.Name, read, err = ben.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = ben.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("Name", err)
}
ben.Personal.Name = value
length += read

if ben.Personal.Address.AddressLineOne, read, err = ben.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = ben.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineOne", err)
}
ben.Personal.Address.AddressLineOne = value
length += read

if ben.Personal.Address.AddressLineTwo, read, err = ben.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = ben.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineTwo", err)
}
ben.Personal.Address.AddressLineTwo = value
length += read

if ben.Personal.Address.AddressLineThree, read, err = ben.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = ben.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineThree", err)
}
ben.Personal.Address.AddressLineThree = value
length += read

if len(record) != length {
Expand Down
27 changes: 18 additions & 9 deletions beneficiaryCustomer.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,48 @@ func (bc *BeneficiaryCustomer) Parse(record string) error {
}

bc.tag = record[:6]

var err error
length := 6
read := 0

if bc.CoverPayment.SwiftFieldTag, read, err = bc.parseVariableStringField(record[length:], 5); err != nil {
value, read, err := bc.parseVariableStringField(record[length:], 5)
if err != nil {
return fieldError("SwiftFieldTag", err)
}
bc.CoverPayment.SwiftFieldTag = value
length += read

if bc.CoverPayment.SwiftLineOne, read, err = bc.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bc.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("SwiftLineOne", err)
}
bc.CoverPayment.SwiftLineOne = value
length += read

if bc.CoverPayment.SwiftLineTwo, read, err = bc.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bc.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("SwiftLineTwo", err)
}
bc.CoverPayment.SwiftLineTwo = value
length += read

if bc.CoverPayment.SwiftLineThree, read, err = bc.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bc.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("SwiftLineThree", err)
}
bc.CoverPayment.SwiftLineThree = value
length += read

if bc.CoverPayment.SwiftLineFour, read, err = bc.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bc.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("SwiftLineFour", err)
}
bc.CoverPayment.SwiftLineFour = value
length += read

if bc.CoverPayment.SwiftLineFive, read, err = bc.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bc.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("SwiftLineFive", err)
}
bc.CoverPayment.SwiftLineFive = value
length += read

if len(record) != length {
Expand Down
23 changes: 15 additions & 8 deletions beneficiaryFI.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,41 @@ func (bfi *BeneficiaryFI) Parse(record string) error {

bfi.tag = record[:6]
bfi.FinancialInstitution.IdentificationCode = bfi.parseStringField(record[6:7])

var err error
length := 7
read := 0

if bfi.FinancialInstitution.Identifier, read, err = bfi.parseVariableStringField(record[length:], 34); err != nil {
value, read, err := bfi.parseVariableStringField(record[length:], 34)
if err != nil {
return fieldError("Identifier", err)
}
bfi.FinancialInstitution.Identifier = value
length += read

if bfi.FinancialInstitution.Name, read, err = bfi.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bfi.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("Name", err)
}
bfi.FinancialInstitution.Name = value
length += read

if bfi.FinancialInstitution.Address.AddressLineOne, read, err = bfi.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bfi.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineOne", err)
}
bfi.FinancialInstitution.Address.AddressLineOne = value
length += read

if bfi.FinancialInstitution.Address.AddressLineTwo, read, err = bfi.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bfi.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineTwo", err)
}
bfi.FinancialInstitution.Address.AddressLineTwo = value
length += read

if bfi.FinancialInstitution.Address.AddressLineThree, read, err = bfi.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bfi.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineThree", err)
}
bfi.FinancialInstitution.Address.AddressLineThree = value
length += read

if len(record) != length {
Expand Down
23 changes: 15 additions & 8 deletions beneficiaryIntermediaryFI.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,41 @@ func (bifi *BeneficiaryIntermediaryFI) Parse(record string) error {

bifi.tag = record[:6]
bifi.FinancialInstitution.IdentificationCode = bifi.parseStringField(record[6:7])

var err error
length := 7
read := 0

if bifi.FinancialInstitution.Identifier, read, err = bifi.parseVariableStringField(record[length:], 34); err != nil {
value, read, err := bifi.parseVariableStringField(record[length:], 34)
if err != nil {
return fieldError("Identifier", err)
}
bifi.FinancialInstitution.Identifier = value
length += read

if bifi.FinancialInstitution.Name, read, err = bifi.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bifi.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("Name", err)
}
bifi.FinancialInstitution.Name = value
length += read

if bifi.FinancialInstitution.Address.AddressLineOne, read, err = bifi.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bifi.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineOne", err)
}
bifi.FinancialInstitution.Address.AddressLineOne = value
length += read

if bifi.FinancialInstitution.Address.AddressLineTwo, read, err = bifi.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bifi.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineTwo", err)
}
bifi.FinancialInstitution.Address.AddressLineTwo = value
length += read

if bifi.FinancialInstitution.Address.AddressLineThree, read, err = bifi.parseVariableStringField(record[length:], 35); err != nil {
value, read, err = bifi.parseVariableStringField(record[length:], 35)
if err != nil {
return fieldError("AddressLineThree", err)
}
bifi.FinancialInstitution.Address.AddressLineThree = value
length += read

if len(record) != length {
Expand Down
7 changes: 3 additions & 4 deletions beneficiaryReference.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ func (br *BeneficiaryReference) Parse(record string) error {
}

br.tag = record[:6]

var err error
length := 6
read := 0

if br.BeneficiaryReference, read, err = br.parseVariableStringField(record[length:], 16); err != nil {
value, read, err := br.parseVariableStringField(record[length:], 16)
if err != nil {
return fieldError("BeneficiaryReference", err)
}
br.BeneficiaryReference = value
length += read

if len(record) != length {
Expand Down
Loading

0 comments on commit d8ee14a

Please sign in to comment.