Skip to content

Commit

Permalink
Merge pull request #71 from collizo4sky/master
Browse files Browse the repository at this point in the history
Added phone extension support to CreditCard object
  • Loading branch information
delatbabel committed Jan 26, 2016
2 parents bf1ff1f + f7331a5 commit c0c743b
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
67 changes: 67 additions & 0 deletions src/Omnipay/Common/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* * state
* * country
* * phone
* * phoneExtension
* * fax
* * number
* * expiryMonth
Expand Down Expand Up @@ -821,6 +822,27 @@ public function setBillingPhone($value)
return $this->setParameter('billingPhone', $value);
}

/**
* Get the billing phone number extension.
*
* @return string
*/
public function getBillingPhoneExtension()
{
return $this->getParameter('billingPhoneExtension');
}

/**
* Sets the billing phone number extension.
*
* @param string $value
* @return CreditCard provides a fluent interface.
*/
public function setBillingPhoneExtension($value)
{
return $this->setParameter('billingPhoneExtension', $value);
}

/**
* Get the billing fax number.
*
Expand Down Expand Up @@ -1098,6 +1120,27 @@ public function setShippingPhone($value)
return $this->setParameter('shippingPhone', $value);
}

/**
* Get the shipping phone number extension.
*
* @return string
*/
public function getShippingPhoneExtension()
{
return $this->getParameter('shippingPhoneExtension');
}

/**
* Sets the shipping phone number extension.
*
* @param string $value
* @return CreditCard provides a fluent interface.
*/
public function setShippingPhoneExtension($value)
{
return $this->setParameter('shippingPhoneExtension', $value);
}

/**
* Get the shipping fax number.
*
Expand Down Expand Up @@ -1287,6 +1330,30 @@ public function setPhone($value)
return $this;
}

/**
* Get the billing phone number extension.
*
* @return string
*/
public function getPhoneExtension()
{
return $this->getParameter('billingPhoneExtension');
}

/**
* Sets the billing and shipping phone number extension.
*
* @param string $value
* @return CreditCard provides a fluent interface.
*/
public function setPhoneExtension($value)
{
$this->setParameter('billingPhoneExtension', $value);
$this->setParameter('shippingPhoneExtension', $value);

return $this;
}

/**
* Get the billing fax number..
*
Expand Down
21 changes: 21 additions & 0 deletions tests/Omnipay/Common/CreditCardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,13 @@ public function testBillingPhone()
$this->assertSame('12345', $this->card->getPhone());
}

public function testBillingPhoneExtension()
{
$this->card->setBillingPhoneExtension('001');
$this->assertSame('001', $this->card->getBillingPhoneExtension());
$this->assertSame('001', $this->card->getPhoneExtension());
}

public function testBillingFax()
{
$this->card->setBillingFax('54321');
Expand Down Expand Up @@ -487,6 +494,12 @@ public function testShippingPhone()
$this->assertEquals('12345', $this->card->getShippingPhone());
}

public function testShippingPhoneExtension()
{
$this->card->setShippingPhoneExtension('001');
$this->assertEquals('001', $this->card->getShippingPhoneExtension());
}

public function testShippingFax()
{
$this->card->setShippingFax('54321');
Expand Down Expand Up @@ -557,6 +570,14 @@ public function testPhone()
$this->assertEquals('12345', $this->card->getShippingPhone());
}

public function testPhoneExtension()
{
$this->card->setPhoneExtension('001');
$this->assertEquals('001', $this->card->getPhoneExtension());
$this->assertEquals('001', $this->card->getBillingPhoneExtension());
$this->assertEquals('001', $this->card->getShippingPhoneExtension());
}

public function testFax()
{
$this->card->setFax('54321');
Expand Down

0 comments on commit c0c743b

Please sign in to comment.