Skip to content

Commit

Permalink
Merge branch 'fix-batch-footer'
Browse files Browse the repository at this point in the history
  • Loading branch information
jdforsythe committed Mar 28, 2016
2 parents 4a20d2c + 4c54ace commit efff6ac
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Nacha/Record/BatchFooter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function setTotalCreditAmount($totalCreditAmount)

public function setCompanyIdNumber($companyIdNumber)
{
$this->companyIdNumber = new Number($companyIdNumber, 10);
$this->companyIdNumber = new String($companyIdNumber, 10);
return $this;
}

Expand Down
14 changes: 14 additions & 0 deletions test/Nacha/Record/BatchFooterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,18 @@ public function testBatchFooter_OptionalFields()
$this->assertEquals('820000000000091012980000000000000000000000001419871234 099912340000001', (string)$batchFooter);
}

public function testBatchFooter_LongCompanyId()
{
// given
$batchFooter = (new BatchFooter)
->setServiceClassCode(200)
->setEntryHash('9101298')
->setCompanyIdNumber('9059999997')
->setOriginatingDfiId('09991234')
->setBatchNumber(1);

$this->assertEquals(94, strlen($batchFooter));
$this->assertEquals('820000000000091012980000000000000000000000009059999997 099912340000001', (string)$batchFooter);
}

}
18 changes: 18 additions & 0 deletions test/Nacha/Record/BatchHeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,22 @@ public function testBatchHeader_OptionalFields()
$this->assertEquals('5200MY BEST COMP 1419871234PPDPAYROLL 0112 2010212340000001', (string)$batchHeader);
}

public function testBatchHeader_LongCompanyId()
{
// given
$batchHeader = (new BatchHeader)
->setServiceClassCode(200)
->setCompanyName('MY BEST COMP')
->setCompanyId('9059999997')
->setStandardEntryClassCode(StandardEntryClass::PPD)
->setCompanyEntryDescription('PAYROLL')
->setEffectiveEntryDate('0112')
->setOriginatorStatusCode('2')
->setOriginatingDFiId('01021234')
->setBatchNumber(1);

$this->assertEquals(94, strlen($batchHeader));
$this->assertEquals('5200MY BEST COMP 9059999997PPDPAYROLL 0112 2010212340000001', (string)$batchHeader);
}

}

0 comments on commit efff6ac

Please sign in to comment.