diff --git a/accountCreditedDrawdown.go b/accountCreditedDrawdown.go index e2af417c..7e4044fe 100644 --- a/accountCreditedDrawdown.go +++ b/accountCreditedDrawdown.go @@ -20,8 +20,8 @@ type AccountCreditedDrawdown struct { } // NewAccountCreditedDrawdown returns a new AccountCreditedDrawdown -func NewAccountCreditedDrawdown() AccountCreditedDrawdown { - creditDD := AccountCreditedDrawdown{ +func NewAccountCreditedDrawdown() *AccountCreditedDrawdown { + creditDD := &AccountCreditedDrawdown{ tag: TagAccountCreditedDrawdown, } return creditDD diff --git a/accountCreditedDrawdown_test.go b/accountCreditedDrawdown_test.go new file mode 100644 index 00000000..b3fb37b3 --- /dev/null +++ b/accountCreditedDrawdown_test.go @@ -0,0 +1,8 @@ +package wire + +// mockAccountCreditedDrawdown creates a AccountCreditedDrawdown +func mockAccountCreditedDrawdown() *AccountCreditedDrawdown { + creditDD := NewAccountCreditedDrawdown() + creditDD.DrawdownCreditAccountNumber = "123456789" + return creditDD +} \ No newline at end of file diff --git a/accountDebitedDrawdown.go b/accountDebitedDrawdown.go index 0f4d5e0d..4bbd675e 100644 --- a/accountDebitedDrawdown.go +++ b/accountDebitedDrawdown.go @@ -25,8 +25,8 @@ type AccountDebitedDrawdown struct { } // NewAccountDebitedDrawdown returns a new AccountDebitedDrawdown -func NewAccountDebitedDrawdown() AccountDebitedDrawdown { - debitDD := AccountDebitedDrawdown{ +func NewAccountDebitedDrawdown() *AccountDebitedDrawdown { + debitDD := &AccountDebitedDrawdown{ tag: TagAccountDebitedDrawdown, } return debitDD diff --git a/accountDebitedDrawdown_test.go b/accountDebitedDrawdown_test.go new file mode 100644 index 00000000..3986bdb4 --- /dev/null +++ b/accountDebitedDrawdown_test.go @@ -0,0 +1,13 @@ +package wire + +// mockAccountDebitedDrawdown creates a AccountDebitedDrawdown +func mockAccountDebitedDrawdown() *AccountDebitedDrawdown { + debitDD := NewAccountDebitedDrawdown() + debitDD.IdentificationCode = "DemandDepositAccountNumber" + debitDD.Identifier = "123456789" + debitDD.Name = "debitDD Name" + debitDD.Address.AddressLineOne = "Address One" + debitDD.Address.AddressLineTwo = "Address Two" + debitDD.Address.AddressLineThree = "Address Three" + return debitDD +} \ No newline at end of file diff --git a/amount.go b/amount.go index 86d3ed76..a1b03cc5 100644 --- a/amount.go +++ b/amount.go @@ -20,8 +20,8 @@ type Amount struct { } // NewAmount returns a new Amount -func NewAmount() Amount { - a := Amount{ +func NewAmount() *Amount { + a := &Amount{ tag: TagAmount, } return a diff --git a/amount_test.go b/amount_test.go new file mode 100644 index 00000000..60f3f046 --- /dev/null +++ b/amount_test.go @@ -0,0 +1,8 @@ +package wire + +// mockAmount creates an a Amount +func mockAmount() *Amount { + a := NewAmount() + a.Amount = "000001234567" + return a +} \ No newline at end of file diff --git a/beneficiary.go b/beneficiary.go index f60c6862..05656ac1 100644 --- a/beneficiary.go +++ b/beneficiary.go @@ -20,8 +20,8 @@ type Beneficiary struct { } // NewBeneficiary returns a new Beneficiary -func NewBeneficiary() Beneficiary { - b := Beneficiary{ +func NewBeneficiary() *Beneficiary { + b := &Beneficiary{ tag: TagBeneficiary, } return b diff --git a/beneficiaryCustomer.go b/beneficiaryCustomer.go index 12d4e1cc..8a2e629f 100644 --- a/beneficiaryCustomer.go +++ b/beneficiaryCustomer.go @@ -20,8 +20,8 @@ type BeneficiaryCustomer struct { } // NewBeneficiaryCustomer returns a new BeneficiaryCustomer -func NewBeneficiaryCustomer() BeneficiaryCustomer { - bc := BeneficiaryCustomer{ +func NewBeneficiaryCustomer() *BeneficiaryCustomer { + bc := &BeneficiaryCustomer{ tag: TagBeneficiaryCustomer, } return bc diff --git a/beneficiaryCustomer_test.go b/beneficiaryCustomer_test.go new file mode 100644 index 00000000..71e62977 --- /dev/null +++ b/beneficiaryCustomer_test.go @@ -0,0 +1,14 @@ +package wire + +// mockBeneficiaryCustomer creates a BeneficiaryCustomer +func mockBeneficiaryCustomer() *BeneficiaryCustomer { + bc := NewBeneficiaryCustomer() + bc.CoverPayment.SwiftFieldTag = "" + bc.CoverPayment.SwiftLineOne = "" + bc.CoverPayment.SwiftLineTwo = "" + bc.CoverPayment.SwiftLineThree= "" + bc.CoverPayment.SwiftLineFour = "" + bc.CoverPayment.SwiftLineFive = "" + bc.CoverPayment.SwiftLineSix = "" + return bc +} \ No newline at end of file diff --git a/beneficiaryFI.go b/beneficiaryFI.go index 96c0acd3..8afff9de 100644 --- a/beneficiaryFI.go +++ b/beneficiaryFI.go @@ -20,8 +20,8 @@ type BeneficiaryFI struct { } // NewBeneficiaryFI returns a new BeneficiaryFI -func NewBeneficiaryFI() BeneficiaryFI { - bfi := BeneficiaryFI{ +func NewBeneficiaryFI() *BeneficiaryFI { + bfi := &BeneficiaryFI{ tag: TagBeneficiaryFI, } return bfi diff --git a/beneficiaryFI_test.go b/beneficiaryFI_test.go new file mode 100644 index 00000000..f2bbd61f --- /dev/null +++ b/beneficiaryFI_test.go @@ -0,0 +1,13 @@ +package wire + +// mockBeneficiaryFI creates a BeneficiaryFI +func mockBeneficiaryFI() *BeneficiaryFI { + bfi := NewBeneficiaryFI() + bfi.FinancialInstitution.IdentificationCode = 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" + return bfi +} \ No newline at end of file diff --git a/beneficiaryIntermediaryFI.go b/beneficiaryIntermediaryFI.go index 383f3cb3..841fc4fb 100644 --- a/beneficiaryIntermediaryFI.go +++ b/beneficiaryIntermediaryFI.go @@ -20,8 +20,8 @@ type BeneficiaryIntermediaryFI struct { } // NewBeneficiaryIntermediaryFI returns a new BeneficiaryIntermediaryFI -func NewBeneficiaryIntermediaryFI() BeneficiaryIntermediaryFI { - bifi := BeneficiaryIntermediaryFI{ +func NewBeneficiaryIntermediaryFI() *BeneficiaryIntermediaryFI { + bifi := &BeneficiaryIntermediaryFI{ tag: TagBeneficiaryIntermediaryFI, } return bifi diff --git a/beneficiaryIntermediaryFI_test.go b/beneficiaryIntermediaryFI_test.go new file mode 100644 index 00000000..5d0f0b06 --- /dev/null +++ b/beneficiaryIntermediaryFI_test.go @@ -0,0 +1,13 @@ +package wire + +// mockBeneficiaryIntermediaryFI creates a BeneficiaryIntermediaryFI +func mockBeneficiaryIntermediaryFI() *BeneficiaryIntermediaryFI { + bifi := NewBeneficiaryIntermediaryFI() + bifi.FinancialInstitution.IdentificationCode = 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" + return bifi +} \ No newline at end of file diff --git a/beneficiaryReference.go b/beneficiaryReference.go index cec27eef..521c07d4 100644 --- a/beneficiaryReference.go +++ b/beneficiaryReference.go @@ -20,8 +20,8 @@ type BeneficiaryReference struct { } // NewBeneficiaryReference returns a new BeneficiaryReference -func NewBeneficiaryReference() BeneficiaryReference { - br := BeneficiaryReference{ +func NewBeneficiaryReference() *BeneficiaryReference { + br := &BeneficiaryReference{ tag: TagBeneficiaryReference, } return br diff --git a/beneficiaryReference_test.go b/beneficiaryReference_test.go new file mode 100644 index 00000000..edabfe49 --- /dev/null +++ b/beneficiaryReference_test.go @@ -0,0 +1,8 @@ +package wire + +// mockBeneficiaryReference creates a BeneficiaryReference +func mockBeneficiaryReference() *BeneficiaryReference { + br:= NewBeneficiaryReference() + br.BeneficiaryReference = "Reference" + return br +} diff --git a/beneficiary_test.go b/beneficiary_test.go new file mode 100644 index 00000000..f460ed03 --- /dev/null +++ b/beneficiary_test.go @@ -0,0 +1,13 @@ +package wire + +// mockBeneficiary creates a Beneficiary +func mockBeneficiary() *Beneficiary { + b := NewBeneficiary() + b.Personal.IdentificationCode = DriversLicenseNumber + b.Personal.Identifier = "1234" + b.Personal.Name = "Name" + b.Personal.Address.AddressLineOne = "Address One" + b.Personal.Address.AddressLineTwo = "Address Two" + b.Personal.Address.AddressLineThree = "Address Three" + return b +} \ No newline at end of file diff --git a/businessFunctionCode.go b/businessFunctionCode.go index 935231fc..572d8ad5 100644 --- a/businessFunctionCode.go +++ b/businessFunctionCode.go @@ -23,8 +23,8 @@ type BusinessFunctionCode struct { } // NewBusinessFunctionCode returns a new BusinessFunctionCode -func NewBusinessFunctionCode() BusinessFunctionCode { - bfc := BusinessFunctionCode{ +func NewBusinessFunctionCode() *BusinessFunctionCode { + bfc := &BusinessFunctionCode{ tag: TagBusinessFunctionCode, } return bfc diff --git a/businessFunctionCode_test.go b/businessFunctionCode_test.go new file mode 100644 index 00000000..8036afdb --- /dev/null +++ b/businessFunctionCode_test.go @@ -0,0 +1,9 @@ +package wire + +// mockBusinessFunctionCode creates a BusinessFunctionCode +func mockBusinessFunctionCode() *BusinessFunctionCode { + bfc := NewBusinessFunctionCode() + bfc.BusinessFunctionCode = "BankTransfer" + bfc.TransactionTypeCode = "" + return bfc +} diff --git a/inputMessageAccountabilityData.go b/inputMessageAccountabilityData.go index 4455c50f..21c33717 100644 --- a/inputMessageAccountabilityData.go +++ b/inputMessageAccountabilityData.go @@ -24,8 +24,8 @@ type InputMessageAccountabilityData struct { } // NewInputMessageAccountabilityData returns a new InputMessageAccountabilityData -func NewInputMessageAccountabilityData() InputMessageAccountabilityData { - imad := InputMessageAccountabilityData{ +func NewInputMessageAccountabilityData() *InputMessageAccountabilityData { + imad := &InputMessageAccountabilityData{ tag: TagInputMessageAccountabilityData, } return imad diff --git a/inputMessageAccountabilityData_test.go b/inputMessageAccountabilityData_test.go new file mode 100644 index 00000000..0bbcf50b --- /dev/null +++ b/inputMessageAccountabilityData_test.go @@ -0,0 +1,10 @@ +package wire + +// mockInputMessageAccountabilityData creates a mockInputMessageAccountabilityData +func mockInputMessageAccountabilityData() *InputMessageAccountabilityData { + imad := NewInputMessageAccountabilityData() + imad.InputCycleDate = "20190410" + imad.InputSource = "Source" + imad.InputSequenceNumber = "000001" + return imad +} \ No newline at end of file diff --git a/instructingFI.go b/instructingFI.go index cdbd695d..7e57f319 100644 --- a/instructingFI.go +++ b/instructingFI.go @@ -20,8 +20,8 @@ type InstructingFI struct { } // NewInstructingFI returns a new InstructingFI -func NewInstructingFI() InstructingFI { - ifi := InstructingFI{ +func NewInstructingFI() *InstructingFI { + ifi := &InstructingFI{ tag: TagInstructingFI, } return ifi diff --git a/instructingFI_test.go b/instructingFI_test.go new file mode 100644 index 00000000..2b39343b --- /dev/null +++ b/instructingFI_test.go @@ -0,0 +1,13 @@ +package wire + +// mockInstructingFI creates a InstructingFI +func mockInstructingFI() *InstructingFI { + ifi := NewInstructingFI() + ifi.FinancialInstitution.IdentificationCode = 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" + return ifi +} \ No newline at end of file diff --git a/originator.go b/originator.go index 2cb25ba7..58e40cb4 100644 --- a/originator.go +++ b/originator.go @@ -20,8 +20,8 @@ type Originator struct { } // NewOriginator returns a new Originator -func NewOriginator() Originator { - o := Originator{ +func NewOriginator() *Originator { + o := &Originator{ tag: TagOriginator, } return o diff --git a/originatorFI.go b/originatorFI.go index 24a60559..c5116dcb 100644 --- a/originatorFI.go +++ b/originatorFI.go @@ -20,8 +20,8 @@ type OriginatorFI struct { } // NewOriginatorFI returns a new OriginatorFI -func NewOriginatorFI() OriginatorFI { - ofi := OriginatorFI{ +func NewOriginatorFI() *OriginatorFI { + ofi := &OriginatorFI{ tag: TagOriginatorFI, } return ofi diff --git a/originatorFI_test.go b/originatorFI_test.go new file mode 100644 index 00000000..7cea2da2 --- /dev/null +++ b/originatorFI_test.go @@ -0,0 +1,13 @@ +package wire + +// mockOriginatorFI creates a OriginatorFI +func mockOriginatorFI() *OriginatorFI { + ofi := NewOriginatorFI() + ofi.FinancialInstitution.IdentificationCode = PassportNumber + 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" + return ofi +} \ No newline at end of file diff --git a/originatorOptionF.go b/originatorOptionF.go index f71aaef4..d699bb23 100644 --- a/originatorOptionF.go +++ b/originatorOptionF.go @@ -80,8 +80,8 @@ type OriginatorOptionF struct { } // NewOriginatorOptionF returns a new OriginatorOptionF -func NewOriginatorOptionF() OriginatorOptionF { - oof := OriginatorOptionF{ +func NewOriginatorOptionF() *OriginatorOptionF { + oof := &OriginatorOptionF{ tag: TagOriginatorOptionF, } return oof @@ -120,6 +120,7 @@ func (oof *OriginatorOptionF) Validate() error { if err := oof.fieldInclusion(); err != nil { return err } + // ToDo; PartyIdentifier Validation if err := oof.isAlphanumeric(oof.Name); err != nil { return fieldError("Name", err, oof.Name) } diff --git a/originatorOptionF_test.go b/originatorOptionF_test.go new file mode 100644 index 00000000..fe500226 --- /dev/null +++ b/originatorOptionF_test.go @@ -0,0 +1,12 @@ +package wire + +// mockOriginatorOptionF creates a OriginatorOptionF +func mockOriginatorOptionF() *OriginatorOptionF { + oof := NewOriginatorOptionF() + oof.PartyIdentifier = "TXID/123-45-6789" + oof.Name = "Name" + oof.LineOne = "LineOne" + oof.LineTwo = "LineTwo" + oof.LineThree = "LineThree" + return oof +} \ No newline at end of file diff --git a/originatorToBeneficiary.go b/originatorToBeneficiary.go index 96092d86..7d950ec3 100644 --- a/originatorToBeneficiary.go +++ b/originatorToBeneficiary.go @@ -26,8 +26,8 @@ type OriginatorToBeneficiary struct { } // NewOriginatorToBeneficiary returns a new OriginatorToBeneficiary -func NewOriginatorToBeneficiary() OriginatorToBeneficiary { - ob := OriginatorToBeneficiary{ +func NewOriginatorToBeneficiary() *OriginatorToBeneficiary { + ob := &OriginatorToBeneficiary{ tag: TagOriginatorToBeneficiary, } return ob diff --git a/originatorToBeneficiary_test.go b/originatorToBeneficiary_test.go new file mode 100644 index 00000000..697d83d5 --- /dev/null +++ b/originatorToBeneficiary_test.go @@ -0,0 +1,11 @@ +package wire + +// mockOriginatorToBeneficiary creates a OriginatorToBeneficiary +func mockOriginatorToBeneficiary() *OriginatorToBeneficiary { + ob := NewOriginatorToBeneficiary() + ob.LineOne = "LineOne" + ob.LineTwo = "LineTwo" + ob.LineThree = "LineThree" + ob.LineFour = "LineFour" + return ob +} \ No newline at end of file diff --git a/originator_test.go b/originator_test.go new file mode 100644 index 00000000..1a58a3d5 --- /dev/null +++ b/originator_test.go @@ -0,0 +1,13 @@ +package wire + +// mockOriginator creates a Originator +func mockOriginator() *Originator { + o := NewOriginator() + o.Personal.IdentificationCode = 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" + return o +} \ No newline at end of file diff --git a/receiverDepositoryInstitution.go b/receiverDepositoryInstitution.go index a59f6ff2..f55e4ce4 100644 --- a/receiverDepositoryInstitution.go +++ b/receiverDepositoryInstitution.go @@ -22,8 +22,8 @@ type ReceiverDepositoryInstitution struct { } // NewReceiverDepositoryInstitution returns a new ReceiverDepositoryInstitution -func NewReceiverDepositoryInstitution() ReceiverDepositoryInstitution { - rdi := ReceiverDepositoryInstitution{ +func NewReceiverDepositoryInstitution() *ReceiverDepositoryInstitution { + rdi := &ReceiverDepositoryInstitution{ tag: TagReceiverDepositoryInstitution, } return rdi diff --git a/receiverDepositoryInstitution_test.go b/receiverDepositoryInstitution_test.go new file mode 100644 index 00000000..038d7e17 --- /dev/null +++ b/receiverDepositoryInstitution_test.go @@ -0,0 +1,9 @@ +package wire + +// mockReceiverDepositoryInstitution creates a ReceiverDepositoryInstitution +func mockReceiverDepositoryInstitution() *ReceiverDepositoryInstitution { + rdi := NewReceiverDepositoryInstitution() + rdi.ReceiverABANumber = "231380104" + rdi.ReceiverShortName = "Citadel" + return rdi +} \ No newline at end of file diff --git a/senderDepositoryInstitution.go b/senderDepositoryInstitution.go index 18011506..6167ec61 100644 --- a/senderDepositoryInstitution.go +++ b/senderDepositoryInstitution.go @@ -22,8 +22,8 @@ type SenderDepositoryInstitution struct { } // NewSenderDepositoryInstitution returns a new SenderDepositoryInstitution -func NewSenderDepositoryInstitution() SenderDepositoryInstitution { - sdi := SenderDepositoryInstitution{ +func NewSenderDepositoryInstitution() *SenderDepositoryInstitution { + sdi := &SenderDepositoryInstitution{ tag: TagSenderDepositoryInstitution, } return sdi diff --git a/senderDepositoryInstitution_test.go b/senderDepositoryInstitution_test.go new file mode 100644 index 00000000..7f2b2a89 --- /dev/null +++ b/senderDepositoryInstitution_test.go @@ -0,0 +1,9 @@ +package wire + +// mockSenderDepositoryInstitution creates a SenderDepositoryInstitution +func mockSenderDepositoryInstitution() *SenderDepositoryInstitution { + sdi := NewSenderDepositoryInstitution() + sdi.SenderABANumber = "121042882" + sdi.SenderShortName = "Wells Fargo NA" + return sdi +} diff --git a/senderSupplied_test.go b/senderSupplied_test.go index 20972052..cfbb5fa7 100644 --- a/senderSupplied_test.go +++ b/senderSupplied_test.go @@ -3,9 +3,5 @@ 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 } diff --git a/typeSubType.go b/typeSubType.go index 48da0cee..349b9dd7 100644 --- a/typeSubType.go +++ b/typeSubType.go @@ -22,8 +22,8 @@ type TypeSubType struct { } // NewTypeSubType returns a new TypeSubType -func NewTypeSubType() TypeSubType { - tst := TypeSubType{ +func NewTypeSubType() *TypeSubType { + tst := &TypeSubType{ tag: TagTypeSubType, } return tst diff --git a/typeSubType_test.go b/typeSubType_test.go new file mode 100644 index 00000000..00b463e2 --- /dev/null +++ b/typeSubType_test.go @@ -0,0 +1,10 @@ +package wire + +// mockTypeSubType creates a TypeSubType +func mockTypeSubType() *TypeSubType { + tst := NewTypeSubType() + tst.tag = TagTypeSubType + tst.TypeCode = FundsTransfer + tst.SubTypeCode = BasicFundsTransfer + return tst +} \ No newline at end of file