Skip to content

Commit b214a28

Browse files
committed
Add third address line support
1 parent 83552de commit b214a28

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

src/Common/CreditCard.php

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* * company
4545
* * address1
4646
* * address2
47+
* * address3
4748
* * city
4849
* * postcode
4950
* * state
@@ -66,6 +67,7 @@
6667
* * billingCompany
6768
* * billingAddress1
6869
* * billingAddress2
70+
* * billingAddress3
6971
* * billingCity
7072
* * billingPostcode
7173
* * billingState
@@ -79,6 +81,7 @@
7981
* * shippingCompany
8082
* * shippingAddress1
8183
* * shippingAddress2
84+
* * shippingAddress3
8285
* * shippingCity
8386
* * shippingPostcode
8487
* * shippingState
@@ -259,6 +262,7 @@ public function validate()
259262
throw new InvalidCreditCardException('Card number should have 12 to 19 digits');
260263
}
261264
}
265+
262266
/**
263267
* Get Card Title.
264268
*
@@ -793,6 +797,27 @@ public function setBillingAddress2($value)
793797
return $this->setParameter('billingAddress2', $value);
794798
}
795799

800+
/**
801+
* Get the billing address, line 3.
802+
*
803+
* @return string
804+
*/
805+
public function getBillingAddress3()
806+
{
807+
return $this->getParameter('billingAddress3');
808+
}
809+
810+
/**
811+
* Sets the billing address, line 3.
812+
*
813+
* @param string $value
814+
* @return $this
815+
*/
816+
public function setBillingAddress3($value)
817+
{
818+
return $this->setParameter('billingAddress3', $value);
819+
}
820+
796821
/**
797822
* Get the billing city.
798823
*
@@ -1092,6 +1117,27 @@ public function setShippingAddress2($value)
10921117
return $this->setParameter('shippingAddress2', $value);
10931118
}
10941119

1120+
/**
1121+
* Get the shipping address, line 3.
1122+
*
1123+
* @return string
1124+
*/
1125+
public function getShippingAddress3()
1126+
{
1127+
return $this->getParameter('shippingAddress3');
1128+
}
1129+
1130+
/**
1131+
* Sets the shipping address, line 3.
1132+
*
1133+
* @param string $value
1134+
* @return $this
1135+
*/
1136+
public function setShippingAddress3($value)
1137+
{
1138+
return $this->setParameter('shippingAddress3', $value);
1139+
}
1140+
10951141
/**
10961142
* Get the shipping city.
10971143
*
@@ -1287,6 +1333,30 @@ public function setAddress2($value)
12871333
return $this;
12881334
}
12891335

1336+
/**
1337+
* Get the billing address, line 3.
1338+
*
1339+
* @return string
1340+
*/
1341+
public function getAddress3()
1342+
{
1343+
return $this->getParameter('billingAddress3');
1344+
}
1345+
1346+
/**
1347+
* Sets the billing and shipping address, line 3.
1348+
*
1349+
* @param string $value
1350+
* @return $this
1351+
*/
1352+
public function setAddress3($value)
1353+
{
1354+
$this->setParameter('billingAddress3', $value);
1355+
$this->setParameter('shippingAddress3', $value);
1356+
1357+
return $this;
1358+
}
1359+
12901360
/**
12911361
* Get the billing city.
12921362
*

tests/Common/CreditCardTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,13 @@ public function testBillingAddress2()
423423
$this->assertEquals('Suburb', $this->card->getAddress2());
424424
}
425425

426+
public function testBillingAddress3()
427+
{
428+
$this->card->setBillingAddress3('Building C, Room 308');
429+
$this->assertEquals('Building C, Room 308', $this->card->getBillingAddress3());
430+
$this->assertEquals('Building C, Room 308', $this->card->getAddress3());
431+
}
432+
426433
public function testBillingCity()
427434
{
428435
$this->card->setBillingCity('Quahog');
@@ -519,6 +526,12 @@ public function testShippingAddress2()
519526
$this->assertEquals('Suburb', $this->card->getShippingAddress2());
520527
}
521528

529+
public function testShippingAddress3()
530+
{
531+
$this->card->setShippingAddress3('Building C, Room 308');
532+
$this->assertEquals('Building C, Room 308', $this->card->getShippingAddress3());
533+
}
534+
522535
public function testShippingCity()
523536
{
524537
$this->card->setShippingCity('Quahog');
@@ -585,6 +598,14 @@ public function testAddress2()
585598
$this->assertEquals('Suburb', $this->card->getShippingAddress2());
586599
}
587600

601+
public function testAddress3()
602+
{
603+
$this->card->setAddress3('Building C, Room 308');
604+
$this->assertEquals('Building C, Room 308', $this->card->getAddress3());
605+
$this->assertEquals('Building C, Room 308', $this->card->getBillingAddress3());
606+
$this->assertEquals('Building C, Room 308', $this->card->getShippingAddress3());
607+
}
608+
588609
public function testCity()
589610
{
590611
$this->card->setCity('Quahog');

0 commit comments

Comments
 (0)