Skip to content

Commit 0ee3cc4

Browse files
committed
Allow setting of track data on credit card model
1 parent 1635924 commit 0ee3cc4

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/Omnipay/Common/CreditCard.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* * startMonth
5757
* * startYear
5858
* * cvv
59+
* * tracks
5960
* * issueNumber
6061
* * billingTitle
6162
* * billingName
@@ -544,6 +545,28 @@ public function setCvv($value)
544545
return $this->setParameter('cvv', $value);
545546
}
546547

548+
/**
549+
* Get raw data for all tracks on the credit card magnetic strip.
550+
*
551+
* @return string
552+
*/
553+
public function getTracks()
554+
{
555+
return $this->getParameter('tracks');
556+
}
557+
558+
/**
559+
* Sets raw data from all tracks on the credit card magnetic strip. Used by gateways that support card-present
560+
* transactions.
561+
*
562+
* @param $value
563+
* @return CreditCard
564+
*/
565+
public function setTracks($value)
566+
{
567+
return $this->setParameter('tracks', $value);
568+
}
569+
547570
/**
548571
* Get the card issue number.
549572
*

tests/Omnipay/Common/CreditCardTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ public function testCvv()
309309
$this->assertEquals('456', $this->card->getCvv());
310310
}
311311

312+
public function testTracks()
313+
{
314+
$this->card->setTracks('%25B4242424242424242%5ETESTLAST%2FTESTFIRST%5E1505201425400714000000%3F%3B4242424242424242%3D150520142547140130%3F');
315+
$this->assertSame('%25B4242424242424242%5ETESTLAST%2FTESTFIRST%5E1505201425400714000000%3F%3B4242424242424242%3D150520142547140130%3F', $this->card->getTracks());
316+
}
317+
312318
public function testIssueNumber()
313319
{
314320
$this->card->setIssueNumber('12');

0 commit comments

Comments
 (0)