Skip to content
Closed
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
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,46 @@ on:
- bugfix/**

jobs:
static-analysis:
name: Static-analysis
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ 'ubuntu-latest' ]
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]

steps:
- uses: actions/checkout@master

#sets up the PHP version
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug

#validate composer files
- name: Validate composer.json and composer.lock
run: composer validate

#get dependencies
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

#get static analysis tool
- name: Install static analysis tool
run: |
composer require --dev phpstan/phpstan

#evaluate the code
- name: Run static analysis tool
run: |
vendor/bin/phpstan analyse src/Hyperwallet tests

tests:
name: Tests
needs: [static-analysis]
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
Expand All @@ -28,6 +66,7 @@ jobs:
steps:
- uses: actions/checkout@master

#sets up the PHP version
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -47,6 +86,7 @@ jobs:

code-coverage:
name: Report code coverage
needs: [tests]
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
Expand Down
30 changes: 17 additions & 13 deletions src/Hyperwallet/Model/BusinessStakeholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* Represents a V4 BusinessStakeholder
*
* @property string $token The BusinessStakeholder token
* @property boolen $isBusinessContact The business contact
* @property boolen $isDirector The Director
* @property boolen $isUltimateBeneficialOwner The UltimateBeneficial Owner
* @property boolen $isSeniorManagingOfficial The Senior Managing Official
* @property bool $isBusinessContact The business contact
* @property bool $isDirector The Director
* @property bool $isUltimateBeneficialOwner The UltimateBeneficial Owner
* @property bool $isSeniorManagingOfficial The Senior Managing Official
* @property string $verificationStatus The status of Business user verification
* @property string $status The Business user status
* @property \DateTime $createdOn The Business user creation date
Expand Down Expand Up @@ -65,6 +65,10 @@ class BusinessStakeholder extends BaseModel {

const GOVERNMENT_ID_TYPE_PASSPORT = 'PASSPORT';
const GOVERNMENT_ID_TYPE_NATIONAL_ID_CARD = 'NATIONAL_ID_CARD';
/**
* @var mixed|null
*/
private $businessName;

public static function FILTERS_ARRAY() {
return array('status', 'createdBefore', 'createdAfter', 'sortBy', 'limit');
Expand Down Expand Up @@ -102,15 +106,15 @@ public function setToken($token) {
/**
* Get the BusinessStakeholder Contact
*
* @return Boolean
* @return bool
*/
public function getIsBusinessContact() {
return $this->isBusinessContact;
}
/**
* Set the BusinessStakeholder Contact
*
* @param Boolean $isBusinessContact
* @param bool $isBusinessContact

* @return BusinessStakeholder
*/
Expand All @@ -122,7 +126,7 @@ public function setIsBusinessContact($isBusinessContact) {
/**
* Get the BusinessStakeholder Director
*
* @return Boolean
* @return bool
*/
public function getIsDirector() {
return $this->isDirector;
Expand All @@ -131,7 +135,7 @@ public function getIsDirector() {
/**
* Set the BusinessStakeholder Director
*
* @param Boolean $isDirector
* @param bool $isDirector

* @return BusinessStakeholder
*/
Expand All @@ -143,7 +147,7 @@ public function setIsDirector($isDirector) {
/**
* Get the BusinessStakeholder Ultimate Beneficial Owner
*
* @return Boolean
* @return bool
*/
public function getIsUltimateBeneficialOwner() {
return $this->isUltimateBeneficialOwner;
Expand All @@ -152,7 +156,7 @@ public function getIsUltimateBeneficialOwner() {
/**
* Set the BusinessStakeholder Ultimate Beneficial Owner
*
* @param Boolean $isUltimateBeneficialOwner
* @param bool $isUltimateBeneficialOwner

* @return BusinessStakeholder
*/
Expand All @@ -164,7 +168,7 @@ public function setIsUltimateBeneficialOwner($isUltimateBeneficialOwner) {
/**
* Get the BusinessStakeholder Senior Managing Official
*
* @return Boolean
* @return bool
*/
public function getIsSeniorManagingOfficial() {
return $this->isSeniorManagingOfficial;
Expand All @@ -173,7 +177,7 @@ public function getIsSeniorManagingOfficial() {
/**
* Set the BusinessStakeholder Senior Managing Official
*
* @param Boolean $isSeniorManagingOfficial
* @param bool $isSeniorManagingOfficial

* @return BusinessStakeholder
*/
Expand Down Expand Up @@ -482,7 +486,7 @@ public function getGovernmentIdType() {
/**
* Set the business governmentIdType
*
* @param string $businessType
* @param string $governmentIdType
* @return BusinessStakeholder
*/
public function setGovernmentIdType($governmentIdType) {
Expand Down
23 changes: 21 additions & 2 deletions src/Hyperwallet/Response/ErrorResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ErrorResponse implements \Countable, \ArrayAccess {
public function __construct($statusCode, array $errors) {
$this->statusCode = $statusCode;
$this->errors = array_map(function ($error) {
if (!isset($relatedResources) && isset($error['relatedResources'])) {
if (!isset($this->relatedResources) && isset($error['relatedResources'])) {
$this->relatedResources = $error['relatedResources'];
}
return new Error($error);
Expand Down Expand Up @@ -84,7 +84,11 @@ public function getRelatedResources() {
* <p>
* The return value is cast to an integer.
* @since 5.1.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function count() {
return count($this->errors);
}
Expand All @@ -102,7 +106,11 @@ public function count() {
* <p>
* The return value will be casted to boolean if non-boolean was returned.
* @since 5.0.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
return isset($this->errors[$offset]);
}
Expand All @@ -117,7 +125,11 @@ public function offsetExists($offset) {
* </p>
* @return mixed Can return all value types.
* @since 5.0.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->errors[$offset];
}
Expand All @@ -135,7 +147,11 @@ public function offsetGet($offset) {
* </p>
* @return void
* @since 5.0.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
$this->errors[$offset] = $value;
}
Expand All @@ -150,9 +166,12 @@ public function offsetSet($offset, $value) {
* </p>
* @return void
* @since 5.0.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
unset($this->errors[$offset]);
}

}
26 changes: 23 additions & 3 deletions src/Hyperwallet/Response/ListResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function getData() {
/**
* Get the Total number of Model's
*
* @var int
* @return int
*/
public function getLimit() {
return $this->limit;
Expand All @@ -96,7 +96,7 @@ public function getLimit() {
/**
* Get Has Next Page of Model's
*
* @var boolean
* @return boolean
*/
public function getHasNextPage() {
return $this->hasNextPage;
Expand All @@ -105,7 +105,7 @@ public function getHasNextPage() {
/**
* Get Has Previous Page of Model's
*
* @var boolean
* @return boolean
*/
public function getHasPreviousPage() {
return $this->hasPreviousPage;
Expand All @@ -122,7 +122,11 @@ public function getHasPreviousPage() {
* <p>
* The return value is cast to an integer.
* @since 5.1.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function count() {
return count($this->data);
}
Expand All @@ -139,7 +143,11 @@ public function count() {
* <p>
* The return value will be casted to boolean if non-boolean was returned.
* @since 5.0.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
Expand All @@ -154,7 +162,11 @@ public function offsetExists($offset) {
* </p>
* @return mixed Can return all value types.
* @since 5.0.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->data[$offset];
}
Expand All @@ -172,7 +184,11 @@ public function offsetGet($offset) {
* </p>
* @return void
* @since 5.0.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
$this->data[$offset] = $value;
}
Expand All @@ -187,7 +203,11 @@ public function offsetSet($offset, $value) {
* </p>
* @return void
* @since 5.0.0
*
* Note: Temporarily suppress the required return type, to keep compatibility with PHP 5.6
* the #[\ReturnTypeWillChange] must be removed once 5.6
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
unset($this->data[$offset]);
}
Expand Down
4 changes: 3 additions & 1 deletion tests/Hyperwallet/Tests/HyperwalletTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ public function testListPaperChecks_noParameters() {
$client = new Hyperwallet('test-username', 'test-password', 'test-program-token');
$apiClientMock = $this->createAndInjectApiClientMock($client);

\Phake::when($apiClientMock)->doGet('/rest/v4/users/{user-token}/paper-checks', array('user-token' => 'test-user-token'), array())->thenReturn(array('limit' => 1,'limit' => 1,'hasNextPage' => false ,'hasPreviousPage' => false,'links' => 'links', 'data' => array()));
\Phake::when($apiClientMock)->doGet('/rest/v4/users/{user-token}/paper-checks', array('user-token' => 'test-user-token'), array())->thenReturn(array('limit' => 1,'hasNextPage' => false ,'hasPreviousPage' => false,'links' => 'links', 'data' => array()));

// Run test
$paperCheckList = $client->listPaperChecks('test-user-token');
Expand Down Expand Up @@ -4233,6 +4233,7 @@ public function testUpdateVerificationStatus_allParameters() {
\Phake::when($apiClientMock)->doPut('/rest/v4/users/{user-token}', array('user-token' => 'test-user-token'), $user, array())->thenReturn(array("status"=> User::STATUS_PRE_ACTIVATED, 'verificationStatus'=> User::VERIFICATION_STATUS_REQUIRED));
\Phake::when($apiClientMock)->doGet('/rest/v4/users/{user-token}', array('user-token' => 'test-user-token'), array())->thenReturn(array("status"=> User::STATUS_PRE_ACTIVATED, 'verificationStatus'=> User::VERIFICATION_STATUS_REQUIRED));

$responseUser = null;
// Run test
try {
$responseUser = $client->updateVerificationStatus('test-user-token', User::VERIFICATION_STATUS_REQUESTED);
Expand Down Expand Up @@ -5112,6 +5113,7 @@ public function testGetTransferRefund_successful() {
$uriParams, $queryParams)->thenReturn(array('token' => $refundToken));

// Run test
$transferRefund = null;
try {
$transferRefund = $client->getTransferRefund($transferToken, $refundToken);
} catch (HyperwalletArgumentException $e) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Hyperwallet/Tests/Model/ClientTokenTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Hyperwallet\Tests\Model;

class AuthenticationTokenTest extends ModelTestCase {
class ClientTokenTest extends ModelTestCase {

protected function getModelName() {
return 'AuthenticationToken';
Expand Down