From 45de1b0f2e12b18b36c66d943d3d9b7eec0a426b Mon Sep 17 00:00:00 2001 From: Leith Caldwell Date: Thu, 10 Dec 2020 11:05:03 +1300 Subject: [PATCH] Add support for a third address line parameter --- src/Common/CreditCard.php | 69 +++++++++++++++++++++++++++++++++ tests/Common/CreditCardTest.php | 21 ++++++++++ 2 files changed, 90 insertions(+) diff --git a/src/Common/CreditCard.php b/src/Common/CreditCard.php index a1f97d0..0f119fc 100644 --- a/src/Common/CreditCard.php +++ b/src/Common/CreditCard.php @@ -44,6 +44,7 @@ * * company * * address1 * * address2 + * * address3 * * city * * postcode * * state @@ -66,6 +67,7 @@ * * billingCompany * * billingAddress1 * * billingAddress2 + * * billingAddress3 * * billingCity * * billingPostcode * * billingState @@ -79,6 +81,7 @@ * * shippingCompany * * shippingAddress1 * * shippingAddress2 + * * shippingAddress3 * * shippingCity * * shippingPostcode * * shippingState @@ -793,6 +796,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. * @@ -1092,6 +1116,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. * @@ -1287,6 +1332,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. * diff --git a/tests/Common/CreditCardTest.php b/tests/Common/CreditCardTest.php index bc643e4..9e598ed 100644 --- a/tests/Common/CreditCardTest.php +++ b/tests/Common/CreditCardTest.php @@ -423,6 +423,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'); @@ -519,6 +526,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'); @@ -585,6 +598,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');