Skip to content

Commit

Permalink
Merge pull request #38 from rarespintea/master
Browse files Browse the repository at this point in the history
SPRO-33 Added support for Line Address 3
  • Loading branch information
graysonblanchard authored Aug 20, 2021
2 parents 075faf2 + 8927487 commit 0c0c840
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 5 deletions.
20 changes: 20 additions & 0 deletions src/SubscribePro/Service/Address/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Address extends DataObject implements AddressInterface
self::COMPANY => false,
self::STREET1 => false,
self::STREET2 => false,
self::STREET3 => false,
self::CITY => false,
self::REGION => false,
self::POSTCODE => false,
Expand All @@ -39,6 +40,7 @@ class Address extends DataObject implements AddressInterface
self::COMPANY => false,
self::STREET1 => false,
self::STREET2 => false,
self::STREET3 => false,
self::CITY => false,
self::REGION => false,
self::POSTCODE => false,
Expand All @@ -56,6 +58,7 @@ class Address extends DataObject implements AddressInterface
self::COMPANY => false,
self::STREET1 => false,
self::STREET2 => false,
self::STREET3 => false,
self::CITY => false,
self::REGION => false,
self::POSTCODE => false,
Expand Down Expand Up @@ -245,6 +248,23 @@ public function setStreet2($street2)
return $this->setData(self::STREET2, $street2);
}

/**
* @return string|null
*/
public function getStreet3()
{
return $this->getData(self::STREET3);
}

/**
* @param string|null $street3
* @return $this
*/
public function setStreet3($street3)
{
return $this->setData(self::STREET3, $street3);
}

/**
* @return string|null
*/
Expand Down
12 changes: 12 additions & 0 deletions src/SubscribePro/Service/Address/AddressInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface AddressInterface extends DataInterface
const COMPANY = 'company';
const STREET1 = 'street1';
const STREET2 = 'street2';
const STREET3 = 'street3';
const CITY = 'city';
const REGION = 'region';
const POSTCODE = 'postcode';
Expand Down Expand Up @@ -132,6 +133,17 @@ public function getStreet2();
*/
public function setStreet2($street2);

/**
* @return string|null
*/
public function getStreet3();

/**
* @param string|null $street3
* @return $this
*/
public function setStreet3($street3);

/**
* @return string|null
*/
Expand Down
9 changes: 8 additions & 1 deletion tests/Service/Address/AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function getFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
'expectedData' => [
AddressInterface::CITY => 'city',
Expand All @@ -62,6 +63,7 @@ public function getFormDataProvider()
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
],
'Not new address' => [
Expand All @@ -81,6 +83,7 @@ public function getFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
'expectedData' => [
AddressInterface::CITY => 'city',
Expand All @@ -94,6 +97,7 @@ public function getFormDataProvider()
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
],
];
Expand All @@ -117,8 +121,9 @@ public function testGetAsChildFormData($data)
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
];

$this->address->importData($data);
$this->assertEquals($expectedData, $this->address->getFormData());
}
Expand All @@ -144,6 +149,7 @@ public function getAsChildFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
],
'Not new address' => [
Expand All @@ -163,6 +169,7 @@ public function getAsChildFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
],
];
Expand Down
16 changes: 15 additions & 1 deletion tests/Service/PaymentProfile/PaymentProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public function getFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
'billingData' => [
Expand All @@ -247,6 +248,7 @@ public function getFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
'expectedData' => [
PaymentProfileInterface::CUSTOMER_ID => '123',
Expand Down Expand Up @@ -302,6 +304,7 @@ public function getFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
'billingData' => [
Expand All @@ -318,6 +321,7 @@ public function getFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
'expectedData' => [
PaymentProfileInterface::CREDITCARD_MONTH => '04',
Expand All @@ -334,6 +338,7 @@ public function getFormDataProvider()
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
'billingFormData' => [
Expand All @@ -347,7 +352,8 @@ public function getFormDataProvider()
AddressInterface::POSTCODE => 'postcode',
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2'
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
];
Expand Down Expand Up @@ -454,6 +460,7 @@ public function getTokenFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
'billingData' => [
Expand All @@ -470,6 +477,7 @@ public function getTokenFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
'expectedData' => [
PaymentProfileInterface::CUSTOMER_ID => '123',
Expand All @@ -488,6 +496,7 @@ public function getTokenFormDataProvider()
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
'billingFormData' => [
Expand All @@ -502,6 +511,7 @@ public function getTokenFormDataProvider()
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
];
Expand Down Expand Up @@ -638,6 +648,7 @@ public function getThirdPartyTokenFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
'billingData' => [
Expand All @@ -654,6 +665,7 @@ public function getThirdPartyTokenFormDataProvider()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
'expectedData' => [
PaymentProfileInterface::CUSTOMER_ID => '123',
Expand All @@ -676,6 +688,7 @@ public function getThirdPartyTokenFormDataProvider()
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
'billingFormData' => [
Expand All @@ -690,6 +703,7 @@ public function getThirdPartyTokenFormDataProvider()
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]
],
];
Expand Down
8 changes: 5 additions & 3 deletions tests/Service/Transaction/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testGetFormData()
$this->transaction->importData($data);
$this->assertEquals($expectedData, $this->transaction->getFormData());
}

public function testGetVerifyFormData()
{
$data = [
Expand Down Expand Up @@ -118,7 +118,7 @@ public function testGetVerifyFormData()
$this->transaction->importData($data);
$this->assertEquals($expectedData, $this->transaction->getVerifyFormData());
}

public function testGetServiceFormData()
{
$data = [
Expand Down Expand Up @@ -245,6 +245,7 @@ public function getTokenFormDataTest()
AddressInterface::CREATED => '2016-12-12',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
]),
'expectedData' => [
TransactionInterface::AMOUNT => 'amount',
Expand All @@ -267,9 +268,10 @@ public function getTokenFormDataTest()
AddressInterface::REGION => 'region',
AddressInterface::STREET1 => 'street1',
AddressInterface::STREET2 => 'street2',
AddressInterface::STREET3 => 'street3',
],
]
]
]
];
}
}

0 comments on commit 0c0c840

Please sign in to comment.