Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for a third address line parameter #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions src/Common/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* * company
* * address1
* * address2
* * address3
* * city
* * postcode
* * state
Expand All @@ -66,6 +67,7 @@
* * billingCompany
* * billingAddress1
* * billingAddress2
* * billingAddress3
* * billingCity
* * billingPostcode
* * billingState
Expand All @@ -79,6 +81,7 @@
* * shippingCompany
* * shippingAddress1
* * shippingAddress2
* * shippingAddress3
* * shippingCity
* * shippingPostcode
* * shippingState
Expand Down Expand Up @@ -791,6 +794,27 @@ public function setBillingAddress2($value)
return $this->setParameter('billingAddress2', $value);
}

/**
* Get the billing address, line 3.
*
* @return string
*/
public function getBillingAddress3()
{
return $this->getParameter('billingAddress3');
}

/**
* Sets the billing address, line 3.
*
* @param string $value
* @return $this
*/
public function setBillingAddress3($value)
{
return $this->setParameter('billingAddress3', $value);
}

/**
* Get the billing city.
*
Expand Down Expand Up @@ -1090,6 +1114,27 @@ public function setShippingAddress2($value)
return $this->setParameter('shippingAddress2', $value);
}

/**
* Get the shipping address, line 3.
*
* @return string
*/
public function getShippingAddress3()
{
return $this->getParameter('shippingAddress3');
}

/**
* Sets the shipping address, line 3.
*
* @param string $value
* @return $this
*/
public function setShippingAddress3($value)
{
return $this->setParameter('shippingAddress3', $value);
}

/**
* Get the shipping city.
*
Expand Down Expand Up @@ -1285,6 +1330,30 @@ public function setAddress2($value)
return $this;
}

/**
* Get the billing address, line 3.
*
* @return string
*/
public function getAddress3()
{
return $this->getParameter('billingAddress3');
}

/**
* Sets the billing and shipping address, line 3.
*
* @param string $value
* @return $this
*/
public function setAddress3($value)
{
$this->setParameter('billingAddress3', $value);
$this->setParameter('shippingAddress3', $value);

return $this;
}

/**
* Get the billing city.
*
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 @@ -428,6 +428,13 @@ public function testBillingAddress2()
$this->assertEquals('Suburb', $this->card->getAddress2());
}

public function testBillingAddress3()
{
$this->card->setBillingAddress3('Building C, Room 308');
$this->assertEquals('Building C, Room 308', $this->card->getBillingAddress3());
$this->assertEquals('Building C, Room 308', $this->card->getAddress3());
}

public function testBillingCity()
{
$this->card->setBillingCity('Quahog');
Expand Down Expand Up @@ -524,6 +531,12 @@ public function testShippingAddress2()
$this->assertEquals('Suburb', $this->card->getShippingAddress2());
}

public function testShippingAddress3()
{
$this->card->setShippingAddress3('Building C, Room 308');
$this->assertEquals('Building C, Room 308', $this->card->getShippingAddress3());
}

public function testShippingCity()
{
$this->card->setShippingCity('Quahog');
Expand Down Expand Up @@ -590,6 +603,14 @@ public function testAddress2()
$this->assertEquals('Suburb', $this->card->getShippingAddress2());
}

public function testAddress3()
{
$this->card->setAddress3('Building C, Room 308');
$this->assertEquals('Building C, Room 308', $this->card->getAddress3());
$this->assertEquals('Building C, Room 308', $this->card->getBillingAddress3());
$this->assertEquals('Building C, Room 308', $this->card->getShippingAddress3());
}

public function testCity()
{
$this->card->setCity('Quahog');
Expand Down