diff --git a/.travis.yml b/.travis.yml index efae4f2d..4d7a3c9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ php: - '5.6' - '7.0' - '7.3' -- hhvm-3.18 +- hhvm-3.24 cache: directories: - $HOME/.composer/cache diff --git a/CHANGELOG.md b/CHANGELOG.md index a2558c6c..2cc0858a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ChangeLog ========= + +2.1.0 +------------------- +- Added header data to the requests (user-agent, sdk version etc) +- Added Business Stakeholders status transitions +- Added Transfer status transitions - get, list + 2.0.0 ------------------- - Updated the methods to point to V4 Rest APIs diff --git a/README.md b/README.md index b25b21aa..7137460a 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Installation $ composer require hyperwallet/sdk ``` - Documentation ------------- diff --git a/src/Hyperwallet/Hyperwallet.php b/src/Hyperwallet/Hyperwallet.php index e189f141..c9ce01d5 100644 --- a/src/Hyperwallet/Hyperwallet.php +++ b/src/Hyperwallet/Hyperwallet.php @@ -11,6 +11,7 @@ use Hyperwallet\Model\BankCard; use Hyperwallet\Model\BankCardStatusTransition; use Hyperwallet\Model\BusinessStakeholder; +use Hyperwallet\Model\BusinessStakeholderStatusTransition; use Hyperwallet\Model\IProgramAware; use Hyperwallet\Model\PaperCheck; use Hyperwallet\Model\PaperCheckStatusTransition; @@ -560,6 +561,54 @@ public function createTransferStatusTransition($transferToken, TransferStatusTra return new TransferStatusTransition($body); } + /** + * Get a transfer status transition + * + * @param string $transferToken The transfer token + * @param string $statusTransitionToken The status transition token + * @return TransferStatusTransition + * + * @throws HyperwalletArgumentException + * @throws HyperwalletApiException + */ + public function getTransferStatusTransition($transferToken, $statusTransitionToken) { + if (empty($transferToken)) { + throw new HyperwalletArgumentException('transferToken is required!'); + } + if (empty($statusTransitionToken)) { + throw new HyperwalletArgumentException('statusTransitionToken is required!'); + } + + $body = $this->client->doGet('/rest/v4/transfers/{transfer-token}/status-transitions/{status-transition-token}', array( + 'transfer-token' => $transferToken, + 'status-transition-token' => $statusTransitionToken + ), array()); + return new TransferStatusTransition($body); + } + + /** + * List all transfer status transitions + * + * @param string $transferToken The transfer token + * @param array $options The query parameters + * @return ListResponse + * + * @throws HyperwalletArgumentException + * @throws HyperwalletApiException + */ + public function listTransferStatusTransitions($transferToken, array $options = array()) { + if (empty($transferToken)) { + throw new HyperwalletArgumentException('transfer token is required!'); + } + + $body = $this->client->doGet('/rest/v4/transfers/{transfer-token}/status-transitions', array( + 'transfer-token' => $transferToken + ), $options); + return new ListResponse($body, function ($entry) { + return new TransferStatusTransition($entry); + }); + } + //-------------------------------------- // PayPal Accounts //-------------------------------------- @@ -2029,7 +2078,7 @@ public function createUserStatusTransition($userToken, UserStatusTransition $tra } /** - * Activate an User + * Activate a User * * @param string $userToken The user token * @return UserStatusTransition @@ -2417,6 +2466,130 @@ public function listBusinessStakeholders($userToken , $options) { }); } + /** + * Create a Business Stakeholder status transition + * + * @param string $userToken The user token + * @param string $businessToken The Business Token + * @param BusinessStakeholderStatusTransition $transition The status transition + * @return BusinessStakeholderStatusTransition + * + * @throws HyperwalletArgumentException + * @throws HyperwalletApiException + */ + public function createBusinessStakeholderStatusTransition($userToken, $businessToken, BusinessStakeholderStatusTransition $transition) { + if (empty($userToken)) { + throw new HyperwalletArgumentException('userToken is required!'); + } + if (empty($businessToken)) { + throw new HyperwalletArgumentException('businessToken is required!'); + } + + $body = $this->client->doPost('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array( + 'user-token' => $userToken, + 'business-token' => $businessToken + ), $transition, array()); + return new BusinessStakeholderStatusTransition($body); + } + + /** + * activate a Business Stakeholder + * + * @param string $userToken The user token + * @param string $businessToken The Business Token + * @return BusinessStakeholderStatusTransition + * + * @throws HyperwalletArgumentException + * @throws HyperwalletApiException + */ + public function activateBusinessStakeholder($userToken, $businessToken) { + $transition = new BusinessStakeholderStatusTransition(); + $transition->setTransition(BusinessStakeholderStatusTransition::TRANSITION_ACTIVATED); + + return $this->createBusinessStakeholderStatusTransition($userToken, $businessToken, $transition); + } + + /** + * Deactivate a Business Stakeholder + * + * @param string $userToken The user token + * @param string $businessToken The Business Token + * @return BusinessStakeholderStatusTransition + * + * @throws HyperwalletArgumentException + * @throws HyperwalletApiException + */ + public function deactivateBusinessStakeholder($userToken, $businessToken) { + $transition = new BusinessStakeholderStatusTransition(); + $transition->setTransition(BusinessStakeholderStatusTransition::TRANSITION_DE_ACTIVATED); + + return $this->createBusinessStakeholderStatusTransition($userToken, $businessToken, $transition); + } + + /** + * Get a Business Stakeholder status transition + * + * @param string $userToken The user token + * @param string $businessToken The Business Token + * @param string $statusTransitionToken The status transition token + * @return BusinessStakeholderStatusTransition + * + * @throws HyperwalletArgumentException + * @throws HyperwalletApiException + */ + public function getBusinessStakeholderStatusTransition($userToken, $businessToken, $statusTransitionToken) { + if (empty($userToken)) { + throw new HyperwalletArgumentException('userToken is required!'); + } + if (empty($businessToken)) { + throw new HyperwalletArgumentException('businessToken is required!'); + } + if (empty($statusTransitionToken)) { + throw new HyperwalletArgumentException('statusTransitionToken is required!'); + } + + $body = $this->client->doGet('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions/{status-transition-token}', array( + 'user-token' => $userToken, + 'business-token' => $businessToken, + 'status-transition-token' => $statusTransitionToken + ), array()); + return new BusinessStakeholderStatusTransition($body); + } + + /** + * List all Business Stakeholder status transitions + * + * @param string $userToken The user token + * @param string $businessToken The Business Token + * @param array $options The query parameters + * @return ListResponse + * + * @throws HyperwalletArgumentException + * @throws HyperwalletApiException + */ + public function listBusinessStakeholderStatusTransitions($userToken, $businessToken, array $options = array()) { + if (empty($userToken)) { + throw new HyperwalletArgumentException('userToken is required!'); + } + if (empty($businessToken)) { + throw new HyperwalletArgumentException('businessToken is required!'); + } + if (!empty($options)) { + $filteredArr = array_diff_key($options, array_flip(StatusTransition::FILTERS_ARRAY())); + if (!empty($filteredArr)) { + throw new HyperwalletArgumentException('Invalid filter'); + } + } + + $body = $this->client->doGet('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array( + 'user-token' => $userToken, + 'business-token' => $businessToken + ), $options); + return new ListResponse($body, function ($entry) { + return new BusinessStakeholderStatusTransition($entry); + }); + } + /** * List all Transfer Methods * diff --git a/src/Hyperwallet/Model/BusinessStakeholderStatusTransition.php b/src/Hyperwallet/Model/BusinessStakeholderStatusTransition.php new file mode 100644 index 00000000..2276a397 --- /dev/null +++ b/src/Hyperwallet/Model/BusinessStakeholderStatusTransition.php @@ -0,0 +1,25 @@ +uuid = HyperwalletUUID::v4(); // Setup http client if not specified $this->client = new Client(array_merge_recursive(array( 'base_uri' => $server, 'auth' => array($username, $password), 'headers' => array( 'User-Agent' => 'Hyperwallet PHP SDK v' . self::VERSION, - 'Accept' => 'application/json' - ) + 'Accept' => 'application/json', + 'x-sdk-version' => self::VERSION, + 'x-sdk-type' => 'PHP', + 'x-sdk-contextId' => $this->uuid) ), $clientOptions)); if (!empty($encryptionData) && isset($encryptionData['clientPrivateKeySetLocation']) && isset($encryptionData['hyperwalletKeySetLocation'])) { diff --git a/src/Hyperwallet/Util/HyperwalletUUID.php b/src/Hyperwallet/Util/HyperwalletUUID.php new file mode 100644 index 00000000..8c803c7f --- /dev/null +++ b/src/Hyperwallet/Util/HyperwalletUUID.php @@ -0,0 +1,57 @@ +doPost('/rest/v4/transfers/{transfer-token}/status-transitions', array('transfer-token' => 'test-transfer-token'), $statusTransition, array()); } + public function testGetTransferStatusTransition_noTransferToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + + // Run test + try { + $client->getTransferStatusTransition('', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('transferToken is required!', $e->getMessage()); + } + } + + public function testGetTransferStatusTransition_noStatusTransitionToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + + // Run test + try { + $client->getTransferStatusTransition('test-transfer-token', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('statusTransitionToken is required!', $e->getMessage()); + } + } + + public function testGetTransferStatusTransition_allParameters() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + $apiClientMock = $this->createAndInjectApiClientMock($client); + + \Phake::when($apiClientMock)->doGet('/rest/v4/transfers/{transfer-token}/status-transitions/{status-transition-token}', array('transfer-token' => 'test-transfer-token', 'status-transition-token' => 'test-status-transition-token'), array())->thenReturn(array('success' => 'true')); + + // Run test + $statusTransition = $client->getTransferStatusTransition('test-transfer-token', 'test-status-transition-token'); + $this->assertNotNull($statusTransition); + $this->assertEquals(array('success' => 'true'), $statusTransition->getProperties()); + + // Validate mock + \Phake::verify($apiClientMock)->doGet('/rest/v4/transfers/{transfer-token}/status-transitions/{status-transition-token}', array('transfer-token' => 'test-transfer-token', 'status-transition-token' => 'test-status-transition-token'), array()); + } + + public function testListTransferStatusTransitions_noTransferToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + + // Run test + try { + $client->listTransferStatusTransitions(''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('transfer token is required!', $e->getMessage()); + } + } + + public function testListTransferStatusTransitions_withParameters() { + // Setup + $client = new Hyperwallet('test-username', 'test-password', 'test-program-token'); + $apiClientMock = $this->createAndInjectApiClientMock($client); + + \Phake::when($apiClientMock)->doGet('/rest/v4/transfers/{transfer-token}/status-transitions', array('transfer-token' => 'test-transfer-token'), array('test' => 'value'))->thenReturn(array('limit' => 1,'hasNextPage' => false ,'hasPreviousPage' => false,'links' => 'links', 'data' => array())); + + // Run test + $statusTransitionList = $client->listTransferStatusTransitions('test-transfer-token', array('test' => 'value')); + $this->assertNotNull($statusTransitionList); + $this->assertCount(0, $statusTransitionList); + $this->assertEquals(1, $statusTransitionList->getLimit()); + $this->assertEquals(false, $statusTransitionList->getHasNextPage()); + $this->assertEquals(false, $statusTransitionList->getHasPreviousPage()); + $this->assertEquals('links', $statusTransitionList->getLinks()); + + // Validate mock + \Phake::verify($apiClientMock)->doGet('/rest/v4/transfers/{transfer-token}/status-transitions', array('transfer-token' => 'test-transfer-token'), array('test' => 'value')); + } + //-------------------------------------- // PayPal Accounts //-------------------------------------- @@ -4966,6 +5043,260 @@ public function testListBusinessStakeholder_withInvalidFilter() { } } + public function testCreateBusinessStakeholderStatusTransition_noUserToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + $statusTransition = new BusinessStakeholderStatusTransition(); + + try { + $client->createBusinessStakeholderStatusTransition('', '', $statusTransition); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('userToken is required!', $e->getMessage()); + } + } + + public function testCreateBusinessStakeholderStatusTransition_noBusinessToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + $statusTransition = new BusinessStakeholderStatusTransition(); + + try { + $client->createBusinessStakeholderStatusTransition('test-user-token', '', $statusTransition); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('businessToken is required!', $e->getMessage()); + } + } + + public function testCreateBusinessStakeholderStatusTransition_allParameters() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + $apiClientMock = $this->createAndInjectApiClientMock($client); + $statusTransition = new BusinessStakeholderStatusTransition(array('transition' => 'test')); + + \Phake::when($apiClientMock)->doPost('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), $statusTransition, array())->thenReturn(array('success' => 'true')); + + // Run test + $newStatusTransition = $client->createBusinessStakeholderStatusTransition('test-user-token', 'test-business-token', $statusTransition); + $this->assertNotNull($newStatusTransition); + $this->assertEquals(array('success' => 'true'), $newStatusTransition->getProperties()); + + // Validate mock + \Phake::verify($apiClientMock)->doPost('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), $statusTransition, array()); + } + + public function testActivateBusinessStakeholder_noUserToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password', 'test-program-token'); + + // Run test + try { + $client->activateBusinessStakeholder('', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('userToken is required!', $e->getMessage()); + } + } + + public function testActivateBusinessStakeholder_noBusinessToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password', 'test-program-token'); + + // Run test + try { + $client->activateBusinessStakeholder('test-user-token', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('businessToken is required!', $e->getMessage()); + } + } + + public function testActivateBusinessStakeholder_allParameters() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + $apiClientMock = $this->createAndInjectApiClientMock($client); + + $statusTransition = new BusinessStakeholderStatusTransition(); + $statusTransition->setTransition(BusinessStakeholderStatusTransition::TRANSITION_ACTIVATED); + + \Phake::when($apiClientMock)->doPost('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), $statusTransition, array())->thenReturn(array('success' => 'true')); + + // Run test + $newStatusTransition = $client->activateBusinessStakeholder('test-user-token', 'test-business-token'); + $this->assertNotNull($newStatusTransition); + $this->assertEquals(array('success' => 'true'), $newStatusTransition->getProperties()); + + // Validate mock + \Phake::verify($apiClientMock)->doPost('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), $statusTransition, array()); + } + + public function testDeactivateBusinessStakeholder_noUserToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password', 'test-program-token'); + + // Run test + try { + $client->deactivateBusinessStakeholder('', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('userToken is required!', $e->getMessage()); + } + } + + public function testDeactivateBusinessStakeholder_noBusinessToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password', 'test-program-token'); + + // Run test + try { + $client->deactivateBusinessStakeholder('test-user-token', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('businessToken is required!', $e->getMessage()); + } + } + + public function testDeactivateBusinessStakeholder_allParameters() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + $apiClientMock = $this->createAndInjectApiClientMock($client); + + $statusTransition = new BusinessStakeholderStatusTransition(); + $statusTransition->setTransition(BusinessStakeholderStatusTransition::TRANSITION_DE_ACTIVATED); + + \Phake::when($apiClientMock)->doPost('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), $statusTransition, array())->thenReturn(array('success' => 'true')); + + // Run test + $newStatusTransition = $client->deactivateBusinessStakeholder('test-user-token', 'test-business-token'); + $this->assertNotNull($newStatusTransition); + $this->assertEquals(array('success' => 'true'), $newStatusTransition->getProperties()); + + // Validate mock + \Phake::verify($apiClientMock)->doPost('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), $statusTransition, array()); + } + + public function testGetBusinessStakeholderStatusTransition_noUserToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + + // Run test + try { + $client->getBusinessStakeholderStatusTransition('', '', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('userToken is required!', $e->getMessage()); + } + } + + public function testGetBusinessStakeholderStatusTransition_noBusinessToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + + // Run test + try { + $client->getBusinessStakeholderStatusTransition('test-user-token', '', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('businessToken is required!', $e->getMessage()); + } + } + + public function testGetBusinessStakeholderStatusTransition_noStatusTransitionToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + + // Run test + try { + $client->getBusinessStakeholderStatusTransition('test-user-token', 'test-business-token', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('statusTransitionToken is required!', $e->getMessage()); + } + } + + public function testGetBusinessStakeholderStatusTransition_allParameters() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + $apiClientMock = $this->createAndInjectApiClientMock($client); + + \Phake::when($apiClientMock)->doGet('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions/{status-transition-token}', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token', 'status-transition-token' => 'test-status-transition-token'), array())->thenReturn(array('success' => 'true')); + + // Run test + $statusTransition = $client->getBusinessStakeholderStatusTransition('test-user-token', 'test-business-token', 'test-status-transition-token'); + $this->assertNotNull($statusTransition); + $this->assertEquals(array('success' => 'true'), $statusTransition->getProperties()); + + // Validate mock + \Phake::verify($apiClientMock)->doGet('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions/{status-transition-token}', array('user-token' => "test-user-token", 'business-token' => 'test-business-token', 'status-transition-token' => 'test-status-transition-token'), array()); + } + + public function testListBusinessStakeholderStatusTransition_noUserToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + + // Run test + try { + $client->listBusinessStakeholderStatusTransitions('', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('userToken is required!', $e->getMessage()); + } + } + + public function testListBusinessStakeholderStatusTransitions_noBusinessToken() { + // Setup + $client = new Hyperwallet('test-username', 'test-password'); + + // Run test + try { + $client->listBusinessStakeholderStatusTransitions('test-user-token', ''); + $this->fail('HyperwalletArgumentException expected'); + } catch (HyperwalletArgumentException $e) { + $this->assertEquals('businessToken is required!', $e->getMessage()); + } + } + + public function testListBusinessStakeholderStatusTransitions_noParameters() { + // Setup + $client = new Hyperwallet('test-username', 'test-password', 'test-program-token'); + $apiClientMock = $this->createAndInjectApiClientMock($client); + + \Phake::when($apiClientMock)->doGet('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), array())->thenReturn(array('limit' => 1,'hasNextPage' => false ,'hasPreviousPage' => false,'links' => 'links', 'data' => array())); + + // Run test + $statusTransitionList = $client->listBusinessStakeholderStatusTransitions('test-user-token', 'test-business-token'); + $this->assertNotNull($statusTransitionList); + $this->assertCount(0, $statusTransitionList); + $this->assertEquals(1, $statusTransitionList->getLimit()); + $this->assertEquals(false, $statusTransitionList->getHasNextPage()); + $this->assertEquals(false, $statusTransitionList->getHasPreviousPage()); + $this->assertEquals('links', $statusTransitionList->getLinks()); + + // Validate mock + \Phake::verify($apiClientMock)->doGet('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), array()); + } + + public function testListBusinessStakeholderStatusTransitions_allParameters() { + // Setup + $client = new Hyperwallet('test-username', 'test-password', 'test-program-token'); + $apiClientMock = $this->createAndInjectApiClientMock($client); + + \Phake::when($apiClientMock)->doGet('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), array('transition' => PayPalAccountStatusTransition::TRANSITION_DE_ACTIVATED))->thenReturn(array('limit' => 1,'hasNextPage' => false ,'hasPreviousPage' => false,'links' => 'links', 'data' => array(array('success' => 'true')))); + + // Run test + $statusTransitionList = $client->listBusinessStakeholderStatusTransitions('test-user-token', 'test-business-token', array('transition' => PayPalAccountStatusTransition::TRANSITION_DE_ACTIVATED)); + $this->assertNotNull($statusTransitionList); + $this->assertCount(1, $statusTransitionList); + $this->assertEquals(1, $statusTransitionList->getLimit()); + $this->assertEquals(false, $statusTransitionList->getHasNextPage()); + $this->assertEquals(false, $statusTransitionList->getHasPreviousPage()); + $this->assertEquals('links', $statusTransitionList->getLinks()); + + // Validate mock + \Phake::verify($apiClientMock)->doGet('/rest/v4/users/{user-token}/business-stakeholders/{business-token}/status-transitions', array('user-token' => 'test-user-token', 'business-token' => 'test-business-token'), array('transition' => PayPalAccountStatusTransition::TRANSITION_DE_ACTIVATED)); + } + public function testuploadDocumentsForBusinessStakeholder_withoutUserToken() { // Setup $client = new Hyperwallet('test-username', 'test-password'); diff --git a/tests/Hyperwallet/Tests/Util/ApiClientTest.php b/tests/Hyperwallet/Tests/Util/ApiClientTest.php index 68feb627..2c890c80 100644 --- a/tests/Hyperwallet/Tests/Util/ApiClientTest.php +++ b/tests/Hyperwallet/Tests/Util/ApiClientTest.php @@ -929,7 +929,7 @@ private function validateRequest($method, $path, $query, array $body, $hasConten $request = $this->container[0]['request']; $this->assertEquals($method, $request->getMethod()); - $this->assertCount(($hasContentType ? 6 : 4) + count($headers), $request->getHeaders()); + $this->assertCount(($hasContentType ? 9 : 7) + count($headers), $request->getHeaders()); $this->assertArrayHasKeyAndValue('Accept', $isEncrypted ? 'application/jose+json' : 'application/json', $request->getHeaders()); if ($hasContentType) { $this->assertArrayHasKeyAndValue('Content-Type', $isEncrypted ? 'application/jose+json' : 'application/json', $request->getHeaders()); diff --git a/tests/Hyperwallet/Tests/Util/HyperwalletUUIDTest.php b/tests/Hyperwallet/Tests/Util/HyperwalletUUIDTest.php new file mode 100644 index 00000000..8241efe8 --- /dev/null +++ b/tests/Hyperwallet/Tests/Util/HyperwalletUUIDTest.php @@ -0,0 +1,23 @@ +v4(); + $uuid2 = $UUIDUtility->v4(); + $uuid3 = $UUIDUtility->v4(); + + // Validate result + $this->assertNotEquals($uuid1, $uuid2); + $this->assertNotEquals($uuid2, $uuid3); + $this->assertNotEquals($uuid3, $uuid1); + } +}