Skip to content

Commit

Permalink
additional mocks
Browse files Browse the repository at this point in the history
addiotnal mocks for writer and reader
  • Loading branch information
bkmoovio committed Apr 15, 2019
1 parent ffbe06f commit a0285da
Show file tree
Hide file tree
Showing 81 changed files with 704 additions and 230 deletions.
2 changes: 1 addition & 1 deletion accountCreditedDrawdown_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockAccountCreditedDrawdown creates a AccountCreditedDrawdown
// mockAccountCreditedDrawdown creates a AccountCreditedDrawdown
func mockAccountCreditedDrawdown() *AccountCreditedDrawdown {
creditDD := NewAccountCreditedDrawdown()
creditDD.DrawdownCreditAccountNumber = "123456789"
Expand Down
2 changes: 1 addition & 1 deletion accountDebitedDrawdown_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockAccountDebitedDrawdown creates a AccountDebitedDrawdown
// mockAccountDebitedDrawdown creates a AccountDebitedDrawdown
func mockAccountDebitedDrawdown() *AccountDebitedDrawdown {
debitDD := NewAccountDebitedDrawdown()
debitDD.IdentificationCode = "DemandDepositAccountNumber"
Expand Down
6 changes: 3 additions & 3 deletions actualAmountPaid.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type ActualAmountPaid struct {
// tag
tag string
// RemittanceAmount is remittance amounts
RemittanceAmount *RemittanceAmount `json:"remittanceAmount,omitempty"`
RemittanceAmount RemittanceAmount `json:"remittanceAmount,omitempty"`

// validator is composed for data validation
validator
Expand All @@ -20,8 +20,8 @@ type ActualAmountPaid struct {
}

// NewActualAmountPaid returns a new ActualAmountPaid
func NewActualAmountPaid() ActualAmountPaid {
aap := ActualAmountPaid{
func NewActualAmountPaid() *ActualAmountPaid {
aap := &ActualAmountPaid{
tag: TagActualAmountPaid,
}
return aap
Expand Down
9 changes: 9 additions & 0 deletions actualAmountPaid_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package wire

// ActualAmountPaid creates a ActualAmountPaid
func mockActualAmountPaid() *ActualAmountPaid {
aap := NewActualAmountPaid()
aap.RemittanceAmount.CurrencyCode = "USD"
aap.RemittanceAmount.Amount = "1234.56"
return aap
}
4 changes: 2 additions & 2 deletions adjustment.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ type Adjustment struct {
}

// NewAdjustment returns a new Adjustment
func NewAdjustment() Adjustment {
adj := Adjustment{
func NewAdjustment() *Adjustment {
adj := &Adjustment{
tag: TagAdjustment,
}
return adj
Expand Down
12 changes: 12 additions & 0 deletions adjustment_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package wire

// Adjustment creates a Adjustment
func mockAdjustment() *Adjustment {
adj := NewAdjustment()
adj.AdjustmentReasonCode = PricingError
adj.CreditDebitIndicator = CreditIndicator
adj.RemittanceAmount.CurrencyCode = "USD"
adj.RemittanceAmount.Amount = "1234.56"
adj.AdditionalInfo = " Adjustment Additional Information"
return adj
}
4 changes: 2 additions & 2 deletions amountNegotiatedDiscount.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type AmountNegotiatedDiscount struct {
}

// NewAmountNegotiatedDiscount returns a new AmountNegotiatedDiscount
func NewAmountNegotiatedDiscount() AmountNegotiatedDiscount {
nd := AmountNegotiatedDiscount{
func NewAmountNegotiatedDiscount() *AmountNegotiatedDiscount {
nd := &AmountNegotiatedDiscount{
tag: TagAmountNegotiatedDiscount,
}
return nd
Expand Down
9 changes: 9 additions & 0 deletions amountNegotiatedDiscount_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package wire

// AmountNegotiatedDiscount creates a AmountNegotiatedDiscount
func mockAmountNegotiatedDiscount() *AmountNegotiatedDiscount {
nd := NewAmountNegotiatedDiscount()
nd.RemittanceAmount.CurrencyCode = "USD"
nd.RemittanceAmount.Amount = "1234.56"
return nd
}
2 changes: 1 addition & 1 deletion amount_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockAmount creates an a Amount
// mockAmount creates an a Amount
func mockAmount() *Amount {
a := NewAmount()
a.Amount = "000001234567"
Expand Down
17 changes: 8 additions & 9 deletions beneficiaryCustomer_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package wire

// mockBeneficiaryCustomer creates a BeneficiaryCustomer
// 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 = ""
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"
return bc
}
}
2 changes: 1 addition & 1 deletion beneficiaryFI_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockBeneficiaryFI creates a BeneficiaryFI
// mockBeneficiaryFI creates a BeneficiaryFI
func mockBeneficiaryFI() *BeneficiaryFI {
bfi := NewBeneficiaryFI()
bfi.FinancialInstitution.IdentificationCode = DemandDepositAccountNumber
Expand Down
2 changes: 1 addition & 1 deletion beneficiaryReference_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockBeneficiaryReference creates a BeneficiaryReference
// mockBeneficiaryReference creates a BeneficiaryReference
func mockBeneficiaryReference() *BeneficiaryReference {
br:= NewBeneficiaryReference()
br.BeneficiaryReference = "Reference"
Expand Down
2 changes: 1 addition & 1 deletion beneficiary_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockBeneficiary creates a Beneficiary
// mockBeneficiary creates a Beneficiary
func mockBeneficiary() *Beneficiary {
ben := NewBeneficiary()
ben.Personal.IdentificationCode = DriversLicenseNumber
Expand Down
2 changes: 1 addition & 1 deletion businessFunctionCode_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockBusinessFunctionCode creates a BusinessFunctionCode
// mockBusinessFunctionCode creates a BusinessFunctionCode
func mockBusinessFunctionCode() *BusinessFunctionCode {
bfc := NewBusinessFunctionCode()
bfc.BusinessFunctionCode = BankTransfer
Expand Down
2 changes: 1 addition & 1 deletion charges_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockCharges creates a Charges
// mockCharges creates a Charges
func mockCharges() *Charges {
c := NewCharges()
c.ChargeDetails = "B"
Expand Down
4 changes: 2 additions & 2 deletions currencyInstructedAmount.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ type CurrencyInstructedAmount struct {
}

// NewCurrencyInstructedAmount returns a new CurrencyInstructedAmount
func NewCurrencyInstructedAmount() CurrencyInstructedAmount {
cia := CurrencyInstructedAmount{
func NewCurrencyInstructedAmount() *CurrencyInstructedAmount {
cia := &CurrencyInstructedAmount{
tag: TagCurrencyInstructedAmount,
}
return cia
Expand Down
10 changes: 10 additions & 0 deletions currencyInstructedAmount_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package wire

// CurrencyInstructedAmount creates a CurrencyInstructedAmount
func mockCurrencyInstructedAmount() *CurrencyInstructedAmount {
cia := NewCurrencyInstructedAmount()
cia.SwiftFieldTag = "Swift Field Tag"
cia.Amount = "1500,49"

return cia
}
8 changes: 4 additions & 4 deletions dateRemittanceDocument.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type DateRemittanceDocument struct {
}

// NewDateRemittanceDocument returns a new DateRemittanceDocument
func NewDateRemittanceDocument() DateRemittanceDocument {
drd := DateRemittanceDocument{
func NewDateRemittanceDocument() *DateRemittanceDocument {
drd := &DateRemittanceDocument{
tag: TagDateRemittanceDocument,
}
return drd
Expand All @@ -33,7 +33,7 @@ func NewDateRemittanceDocument() DateRemittanceDocument {
// successful parsing and data validity.
func (drd *DateRemittanceDocument) Parse(record string) {
drd.tag = record[:6]
drd.tag = drd.validateDate(record[6:14])
drd.DateRemittanceDocument = drd.parseStringField(record[6:14])
}

// String writes DateRemittanceDocument
Expand Down Expand Up @@ -65,5 +65,5 @@ func (drd *DateRemittanceDocument) fieldInclusion() error {

// DateRemittanceDocumentField gets a string of the DateRemittanceDocument field
func (drd *DateRemittanceDocument) DateRemittanceDocumentField() string {
return drd.validateDate(drd.DateRemittanceDocument)
return drd.alphaField(drd.DateRemittanceDocument,8)
}
9 changes: 9 additions & 0 deletions dateRemittanceDocument_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package wire

// DateRemittanceDocument creates a DateRemittanceDocument
func mockDateRemittanceDocument() *DateRemittanceDocument {
drd := NewDateRemittanceDocument()
// ToDo: Use date function
drd.DateRemittanceDocument = "20190415"
return drd
}
2 changes: 1 addition & 1 deletion exchangeRate_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockExchangeRate creates a ExchangeRate
// mockExchangeRate creates a ExchangeRate
func mockExchangeRate() *ExchangeRate {
eRate := NewExchangeRate()
eRate.ExchangeRate = "1,2345"
Expand Down
2 changes: 1 addition & 1 deletion fIBeneficiaryFIAdvice_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIBeneficiaryFIAdvice creates a FIBeneficiaryFIAdvice
// mockFIBeneficiaryFIAdvice creates a FIBeneficiaryFIAdvice
func mockFIBeneficiaryFIAdvice() *FIBeneficiaryFIAdvice {
fibfia := NewFIBeneficiaryFIAdvice()
fibfia.Advice.AdviceCode = AdviceCodeTelex
Expand Down
8 changes: 4 additions & 4 deletions fedWireMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ func (fwm *FedWireMessage) GetIntermediaryInstitution() *IntermediaryInstitution
}

// SetInstitutionAccount appends a InstitutionAccount to the FedWireMessage
func (fwm *FedWireMessage) SetInstitutionAccount(ia *InstitutionAccount) {
fwm.InstitutionAccount = ia
func (fwm *FedWireMessage) SetInstitutionAccount(iAccount *InstitutionAccount) {
fwm.InstitutionAccount = iAccount
}

// GetInstitutionAccount returns the current InstitutionAccount
Expand Down Expand Up @@ -596,8 +596,8 @@ func (fwm *FedWireMessage) GetRemittance() *Remittance {
}

// SetSenderToReceiver appends a SenderToReceiver to the FedWireMessage
func (fwm *FedWireMessage) SetSenderToReceiver(sr *SenderToReceiver) {
fwm.SenderToReceiver = sr
func (fwm *FedWireMessage) SetSenderToReceiver(str *SenderToReceiver) {
fwm.SenderToReceiver = str
}

// GetSenderToReceiver returns the current SenderToReceiver
Expand Down
2 changes: 1 addition & 1 deletion fiAdditionalFIToFI_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIAdditionalFIToFI creates a FIAdditionalFIToFI
// mockFIAdditionalFIToFI creates a FIAdditionalFIToFI
func mockFIAdditionalFIToFI() *FIAdditionalFIToFI {
fifi := NewFIAdditionalFIToFI()
fifi.AdditionalFIToFI.LineOne = "Line One"
Expand Down
2 changes: 1 addition & 1 deletion fiBeneficiaryAdvice_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIBeneficiaryAdvice creates a FIBeneficiaryAdvice
// mockFIBeneficiaryAdvice creates a FIBeneficiaryAdvice
func mockFIBeneficiaryAdvice() *FIBeneficiaryAdvice {
fiba := NewFIBeneficiaryAdvice()
fiba.Advice.AdviceCode = AdviceCodeLetter
Expand Down
2 changes: 1 addition & 1 deletion fiBeneficiaryFI_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIBeneficiaryFI creates a FIBeneficiaryFI
// mockFIBeneficiaryFI creates a FIBeneficiaryFI
func mockFIBeneficiaryFI() *FIBeneficiaryFI {
fibfi := NewFIBeneficiaryFI()
fibfi.FIToFI.LineOne = "Line One"
Expand Down
2 changes: 1 addition & 1 deletion fiBeneficiary_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIBeneficiary creates a FIBeneficiary
// mockFIBeneficiary creates a FIBeneficiary
func mockFIBeneficiary() *FIBeneficiary {
fib := NewFIBeneficiary()
fib.FIToFI.LineOne = "Line One"
Expand Down
2 changes: 1 addition & 1 deletion fiDrawdownDebitAccountAdvice_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIDrawdownDebitAccountAdvice creates a FIDrawdownDebitAccountAdvice
// mockFIDrawdownDebitAccountAdvice creates a FIDrawdownDebitAccountAdvice
func mockFIDrawdownDebitAccountAdvice() *FIDrawdownDebitAccountAdvice {
debitDDAdvice := NewFIDrawdownDebitAccountAdvice()
debitDDAdvice.Advice.AdviceCode = AdviceCodeLetter
Expand Down
2 changes: 1 addition & 1 deletion fiIntermediaryFIAdvice_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIIntermediaryFIAdvice creates a FIIntermediaryFIAdvice
// mockFIIntermediaryFIAdvice creates a FIIntermediaryFIAdvice
func mockFIIntermediaryFIAdvice() *FIIntermediaryFIAdvice {
fiifia := NewFIIntermediaryFIAdvice()
fiifia.Advice.AdviceCode = AdviceCodeLetter
Expand Down
2 changes: 1 addition & 1 deletion fiIntermediaryFI_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIIntermediaryFI creates a FIIntermediaryFI
// mockFIIntermediaryFI creates a FIIntermediaryFI
func mockFIIntermediaryFI() *FIIntermediaryFI {
fiifi := NewFIIntermediaryFI()
fiifi.FIToFI.LineOne = "Line One"
Expand Down
2 changes: 1 addition & 1 deletion fiPaymentMethodToBeneficiary_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIPaymentMethodToBeneficiary creates a FIPaymentMethodToBeneficiary
// mockFIPaymentMethodToBeneficiary creates a FIPaymentMethodToBeneficiary
func mockFIPaymentMethodToBeneficiary() *FIPaymentMethodToBeneficiary {
pm := NewFIPaymentMethodToBeneficiary()
pm.PaymentMethod = "CHECK"
Expand Down
2 changes: 1 addition & 1 deletion fiReceiverFI_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wire

// mockFIReceiverFI creates a FIReceiverFI
// mockFIReceiverFI creates a FIReceiverFI
func mockFIReceiverFI() *FIReceiverFI {
firfi := NewFIReceiverFI()
firfi.FIToFI.LineOne = "Line One"
Expand Down
2 changes: 2 additions & 0 deletions fieldErrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ var (
ErrValidYear = errors.New("is an invalid year")
// ErrValidCentury is returned for an invalid century
ErrValidCentury = errors.New("is an invalid century")
// ErrInvalidProperty is returned for an invalid type property
ErrInvalidProperty = errors.New("is an invalid property")

// SenderSupplied Tag {1500}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.12

require (
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6
github.com/moov-io/ach v1.0.0
github.com/moov-io/base v0.9.0
github.com/rickar/cal v1.0.1 // indirect
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421
Expand Down
Loading

0 comments on commit a0285da

Please sign in to comment.