Skip to content

Commit

Permalink
Allow setting of track data on credit card model
Browse files Browse the repository at this point in the history
  • Loading branch information
anush committed Nov 16, 2015
1 parent 1635924 commit 0ee3cc4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Omnipay/Common/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
* * startMonth
* * startYear
* * cvv
* * tracks
* * issueNumber
* * billingTitle
* * billingName
Expand Down Expand Up @@ -544,6 +545,28 @@ public function setCvv($value)
return $this->setParameter('cvv', $value);
}

/**
* Get raw data for all tracks on the credit card magnetic strip.
*
* @return string
*/
public function getTracks()
{
return $this->getParameter('tracks');
}

/**
* Sets raw data from all tracks on the credit card magnetic strip. Used by gateways that support card-present
* transactions.
*
* @param $value
* @return CreditCard
*/
public function setTracks($value)
{
return $this->setParameter('tracks', $value);
}

/**
* Get the card issue number.
*
Expand Down
6 changes: 6 additions & 0 deletions tests/Omnipay/Common/CreditCardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ public function testCvv()
$this->assertEquals('456', $this->card->getCvv());
}

public function testTracks()
{
$this->card->setTracks('%25B4242424242424242%5ETESTLAST%2FTESTFIRST%5E1505201425400714000000%3F%3B4242424242424242%3D150520142547140130%3F');
$this->assertSame('%25B4242424242424242%5ETESTLAST%2FTESTFIRST%5E1505201425400714000000%3F%3B4242424242424242%3D150520142547140130%3F', $this->card->getTracks());
}

public function testIssueNumber()
{
$this->card->setIssueNumber('12');
Expand Down

0 comments on commit 0ee3cc4

Please sign in to comment.