Skip to content

Commit c0c743b

Browse files
committed
Merge pull request #71 from collizo4sky/master
Added phone extension support to CreditCard object
2 parents bf1ff1f + f7331a5 commit c0c743b

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

src/Omnipay/Common/CreditCard.php

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
* * state
5050
* * country
5151
* * phone
52+
* * phoneExtension
5253
* * fax
5354
* * number
5455
* * expiryMonth
@@ -821,6 +822,27 @@ public function setBillingPhone($value)
821822
return $this->setParameter('billingPhone', $value);
822823
}
823824

825+
/**
826+
* Get the billing phone number extension.
827+
*
828+
* @return string
829+
*/
830+
public function getBillingPhoneExtension()
831+
{
832+
return $this->getParameter('billingPhoneExtension');
833+
}
834+
835+
/**
836+
* Sets the billing phone number extension.
837+
*
838+
* @param string $value
839+
* @return CreditCard provides a fluent interface.
840+
*/
841+
public function setBillingPhoneExtension($value)
842+
{
843+
return $this->setParameter('billingPhoneExtension', $value);
844+
}
845+
824846
/**
825847
* Get the billing fax number.
826848
*
@@ -1098,6 +1120,27 @@ public function setShippingPhone($value)
10981120
return $this->setParameter('shippingPhone', $value);
10991121
}
11001122

1123+
/**
1124+
* Get the shipping phone number extension.
1125+
*
1126+
* @return string
1127+
*/
1128+
public function getShippingPhoneExtension()
1129+
{
1130+
return $this->getParameter('shippingPhoneExtension');
1131+
}
1132+
1133+
/**
1134+
* Sets the shipping phone number extension.
1135+
*
1136+
* @param string $value
1137+
* @return CreditCard provides a fluent interface.
1138+
*/
1139+
public function setShippingPhoneExtension($value)
1140+
{
1141+
return $this->setParameter('shippingPhoneExtension', $value);
1142+
}
1143+
11011144
/**
11021145
* Get the shipping fax number.
11031146
*
@@ -1287,6 +1330,30 @@ public function setPhone($value)
12871330
return $this;
12881331
}
12891332

1333+
/**
1334+
* Get the billing phone number extension.
1335+
*
1336+
* @return string
1337+
*/
1338+
public function getPhoneExtension()
1339+
{
1340+
return $this->getParameter('billingPhoneExtension');
1341+
}
1342+
1343+
/**
1344+
* Sets the billing and shipping phone number extension.
1345+
*
1346+
* @param string $value
1347+
* @return CreditCard provides a fluent interface.
1348+
*/
1349+
public function setPhoneExtension($value)
1350+
{
1351+
$this->setParameter('billingPhoneExtension', $value);
1352+
$this->setParameter('shippingPhoneExtension', $value);
1353+
1354+
return $this;
1355+
}
1356+
12901357
/**
12911358
* Get the billing fax number..
12921359
*

tests/Omnipay/Common/CreditCardTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,13 @@ public function testBillingPhone()
403403
$this->assertSame('12345', $this->card->getPhone());
404404
}
405405

406+
public function testBillingPhoneExtension()
407+
{
408+
$this->card->setBillingPhoneExtension('001');
409+
$this->assertSame('001', $this->card->getBillingPhoneExtension());
410+
$this->assertSame('001', $this->card->getPhoneExtension());
411+
}
412+
406413
public function testBillingFax()
407414
{
408415
$this->card->setBillingFax('54321');
@@ -487,6 +494,12 @@ public function testShippingPhone()
487494
$this->assertEquals('12345', $this->card->getShippingPhone());
488495
}
489496

497+
public function testShippingPhoneExtension()
498+
{
499+
$this->card->setShippingPhoneExtension('001');
500+
$this->assertEquals('001', $this->card->getShippingPhoneExtension());
501+
}
502+
490503
public function testShippingFax()
491504
{
492505
$this->card->setShippingFax('54321');
@@ -557,6 +570,14 @@ public function testPhone()
557570
$this->assertEquals('12345', $this->card->getShippingPhone());
558571
}
559572

573+
public function testPhoneExtension()
574+
{
575+
$this->card->setPhoneExtension('001');
576+
$this->assertEquals('001', $this->card->getPhoneExtension());
577+
$this->assertEquals('001', $this->card->getBillingPhoneExtension());
578+
$this->assertEquals('001', $this->card->getShippingPhoneExtension());
579+
}
580+
560581
public function testFax()
561582
{
562583
$this->card->setFax('54321');

0 commit comments

Comments
 (0)