Skip to content

Commit

Permalink
Merge 2afee15 into 46dd458
Browse files Browse the repository at this point in the history
  • Loading branch information
ashkarpetin committed Mar 14, 2019
2 parents 46dd458 + 2afee15 commit 13bf586
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ _TBD_
- [x] Added new property to `PaymentCardToken`: `isUsed`
- [x] Added new blacklist types to `Blacklist`: `email-domain`, `bank-account`, `address`
- [x] Added new `taxCategory` to `Product`
- [x] Added new property to `Blacklist`: `expirationTime`.

### Changed
- [x] **Upgraded minimum PHP version to 7.1**

### Deprecated
- [x] Deprecated `Customer` entity methods: `getFirstName`, `setFirstName`, `getLastName`, `setLastName`, `getEmail`, `setEmail`
- [x] Deprecated `Blacklist` `expiredTime` property.

## [2.3.0] 2018-10-08

Expand Down
36 changes: 30 additions & 6 deletions src/Entities/Blacklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,44 +103,68 @@ public function setValue($value)

/**
* @deprecated The method is deprecated and will be removed in next version.
* @see Blacklist::getExpiredTime()
* @see Blacklist::getExpirationTime()
*
* @return mixed
*/
public function getExpireTime()
{
return $this->getAttribute('expireTime');
return $this->getExpirationTime();
}

/**
* @deprecated The method is deprecated and will be removed in next version.
* @see Blacklist::setExpiredTime()
* @see Blacklist::setExpirationTime()
*
* @param mixed $value
*
* @return $this
*/
public function setExpireTime($value)
{
return $this->setAttribute('expireTime', $value);
return $this->setExpirationTime($value);
}

/**
* @deprecated The method is deprecated and will be removed in next version.
* @see Blacklist::getExpirationTime()
*
* @return mixed
*/
public function getExpiredTime()
{
return $this->getAttribute('expiredTime');
return $this->getExpirationTime();
}

/**
* @deprecated The method is deprecated and will be removed in next version.
* @see Blacklist::setExpirationTime()
*
* @param mixed $value
*
* @return $this
*/
public function setExpiredTime($value)
{
return $this->setAttribute('expiredTime', $value);
return $this->setExpirationTime($value);
}

/**
* @return mixed
*/
public function getExpirationTime()
{
return $this->getAttribute('expirationTime');
}

/**
* @param mixed $value
*
* @return $this
*/
public function setExpirationTime($value)
{
return $this->setAttribute('expirationTime', $value);
}

/**
Expand Down
27 changes: 27 additions & 0 deletions tests/Api/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public function buildJson($class, $id = 'id')
$prefix = substr($method, 0, 3);
$attribute = lcfirst(substr($method, 3));

if ($this->isAttributeExcluded($class, $attribute)) {
continue;
}

if ($prefix === 'get') {
$getters[$attribute] = $method;
} elseif ($prefix === 'set') {
Expand Down Expand Up @@ -193,4 +197,27 @@ public function provideEntityClasses()
[Entities\GatewayAccountDowntime::class],
];
}

/**
* @return array
*/
public function excludeAttributes()
{
return [
Entities\Blacklist::class => ['expireTime', 'expiredTime'],
];
}

/**
* @param $class
* @param $attribute
* @return bool
*/
private function isAttributeExcluded($class, $attribute)
{
return
isset($this->excludeAttributes()[$class])
&& in_array($attribute, $this->excludeAttributes()[$class], true);
}

}
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function getFakeValue($attribute, $class)
return $faker->uuid;
case 'dueTime':
case 'expiredTime':
case 'expireTime': // TODO inconsistent name
case 'expirationTime':
case 'periodStartTime':
case 'renewalTime':
case 'periodEndTime':
Expand Down

0 comments on commit 13bf586

Please sign in to comment.