Skip to content

Commit

Permalink
Added Cobrand::publicKey()
Browse files Browse the repository at this point in the history
  • Loading branch information
kmanuzon committed Aug 13, 2016
1 parent 055717d commit 9d7e534
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/cobrand_public_key.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

if (! ini_get('date.timezone')) {
date_default_timezone_set('America/New_York');
}

require_once __DIR__ . '/../vendor/autoload.php';

$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();

$yodleeApi = new \YodleeApi\Client(getenv('YODLEEAPI_URL'));

$response = $yodleeApi->cobrand()->login(getenv('YODLEEAPI_COBRAND_LOGIN'), getenv('YODLEEAPI_COBRAND_PASSWORD'));
$response = $yodleeApi->cobrand()->publicKey();

print 'RESULT<pre>';
var_dump($response);
print '</pre>';
1 change: 1 addition & 0 deletions examples/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ul>
<li><a href="cobrand_login.php">Cobrand Login</a></li>
<li><a href="cobrand_logout.php">Cobrand Logout</a></li>
<li><a href="cobrand_public_key.php">Cobrand Public Key</a> (does not work on Yodlee's sandbox environment)</li>
<li><a href="user_login.php">User Login</a></li>
<li><a href="user_logout.php">User Logout</a></li>
<li><a href="user_register.php">User Register</a></li>
Expand Down
22 changes: 22 additions & 0 deletions src/Api/Cobrand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,26 @@ public function logout()
$this->sessionManager->setUserSessionToken('');
$this->sessionManager->setCobrandSessionToken('');
}

/**
* Get the public key.
*
* @see https://developer.yodlee.com/apidocs/index.php#Encryption
*
* @return \stdClass
*/
public function publicKey()
{
$url = $this->getEndpoint('/cobrand/publicKey');

$requestHeaders = [
$this->sessionManager->getAuthorizationHeaderString()
];

$response = $this->httpClient->get($url, $requestHeaders);

$response = json_decode($response);

return $response;
}
}

0 comments on commit 9d7e534

Please sign in to comment.