Expand tests, do code cleanup.

This commit is contained in:
James Cole
2017-12-17 14:30:53 +01:00
parent b08af77c98
commit 78335e5814
141 changed files with 773 additions and 54 deletions

View File

@@ -25,6 +25,9 @@ namespace FireflyIII\Services\Bunq\Object;
use Carbon\Carbon;
use FireflyIII\Services\Bunq\Id\DeviceServerId;
/**
* Class DeviceServer
*/
class DeviceServer extends BunqObject
{
/** @var Carbon */
@@ -40,6 +43,11 @@ class DeviceServer extends BunqObject
/** @var Carbon */
private $updated;
/**
* DeviceServer constructor.
*
* @param array $data
*/
public function __construct(array $data)
{
$id = new DeviceServerId();

View File

@@ -31,7 +31,13 @@ class MonetaryAccountProfile extends BunqObject
private $profileActionRequired = '';
/** @var Amount */
private $profileAmountRequired;
/**
* @var null
*/
private $profileDrain;
/**
* @var null
*/
private $profileFill;
/**

View File

@@ -29,10 +29,19 @@ use Carbon\Carbon;
*/
class UserCompany extends BunqObject
{
/**
* @var
*/
private $addressMain;
/**
* @var
*/
private $addressPostal;
/** @var array */
private $aliases = [];
/**
* @var
*/
private $avatar;
/** @var string */
private $cocNumber = '';
@@ -40,7 +49,13 @@ class UserCompany extends BunqObject
private $counterBankIban = '';
/** @var Carbon */
private $created;
/**
* @var
*/
private $dailyLimit;
/**
* @var
*/
private $directorAlias;
/** @var string */
private $displayName = '';

View File

@@ -29,10 +29,19 @@ use Carbon\Carbon;
*/
class UserPerson extends BunqObject
{
/**
* @var
*/
private $addressMain;
/**
* @var
*/
private $addressPostal;
/** @var array */
private $aliases = [];
/**
* @var
*/
private $avatar;
/** @var array */
private $billingContracts = [];
@@ -40,8 +49,17 @@ class UserPerson extends BunqObject
private $countryOfBirth = '';
/** @var Carbon */
private $created;
/**
* @var
*/
private $customer;
/**
* @var
*/
private $customerLimit;
/**
* @var
*/
private $dailyLimit;
/** @var Carbon */
private $dateOfBirth;
@@ -77,6 +95,9 @@ class UserPerson extends BunqObject
private $publicNickName = '';
/** @var string */
private $publicUuid = '';
/**
* @var mixed
*/
private $region;
/** @var int */
private $sessionTimeout = 0;

View File

@@ -42,6 +42,9 @@ abstract class BunqRequest
private $privateKey = '';
/** @var string */
private $server = '';
/**
* @var array
*/
private $upperCaseHeaders
= [
'x-bunq-client-response-id' => 'X-Bunq-Client-Response-Id',
@@ -327,6 +330,7 @@ abstract class BunqRequest
* @param array $headers
*
* @return array
* @throws Exception
*/
protected function sendUnsignedBunqDelete(string $uri, array $headers): array
{
@@ -356,6 +360,7 @@ abstract class BunqRequest
* @param array $headers
*
* @return array
* @throws Exception
*/
protected function sendUnsignedBunqPost(string $uri, array $data, array $headers): array
{

View File

@@ -35,6 +35,7 @@ class DeleteDeviceSessionRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{

View File

@@ -41,6 +41,7 @@ class DeviceServerRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{

View File

@@ -47,6 +47,7 @@ class DeviceSessionRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{
@@ -115,6 +116,11 @@ class DeviceSessionRequest extends BunqRequest
return $deviceSessionId;
}
/**
* @param array $response
*
* @return SessionToken
*/
private function extractSessionToken(array $response): SessionToken
{
$data = $this->getKeyFromResponse('Token', $response);

View File

@@ -41,6 +41,7 @@ class InstallationTokenRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{

View File

@@ -44,6 +44,7 @@ class ListDeviceServerRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{

View File

@@ -40,6 +40,7 @@ class ListMonetaryAccountRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{

View File

@@ -43,6 +43,7 @@ class ListUserRequest extends BunqRequest
/**
*
* @throws \Exception
*/
public function call(): void
{

View File

@@ -27,6 +27,11 @@ use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\User;
/**
* Interface ExchangeRateInterface
*
* @package FireflyIII\Services\Currency
*/
interface ExchangeRateInterface
{
/**

View File

@@ -38,6 +38,13 @@ class FixerIO implements ExchangeRateInterface
/** @var User */
protected $user;
/**
* @param TransactionCurrency $fromCurrency
* @param TransactionCurrency $toCurrency
* @param Carbon $date
*
* @return CurrencyExchangeRate
*/
public function getRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): CurrencyExchangeRate
{
$uri = sprintf('https://api.fixer.io/%s?base=%s&symbols=%s', $date->format('Y-m-d'), $fromCurrency->code, $toCurrency->code);

View File

@@ -29,10 +29,14 @@ use Log;
*/
class ListProvidersRequest extends SpectreRequest
{
/**
* @var array
*/
protected $providers = [];
/**
*
* @throws \Exception
*/
public function call(): void
{

View File

@@ -38,6 +38,9 @@ abstract class SpectreRequest
{
/** @var string */
protected $clientId = '';
/**
* @var int
*/
protected $expiresAt = 0;
/** @var ServerPublicKey */
protected $serverPublicKey;
@@ -52,6 +55,10 @@ abstract class SpectreRequest
/**
* SpectreRequest constructor.
*
* @param User $user
*
* @throws \Illuminate\Container\EntryNotFoundException
*/
public function __construct(User $user)
{
@@ -279,11 +286,9 @@ abstract class SpectreRequest
/**
* @param string $uri
* @param array $data
* @param array $headers
*
* @return array
*
* @throws Exception
* @throws FireflyException
*/
protected function sendSignedSpectreGet(string $uri, array $data): array
{