Skip to content

Commit

Permalink
Merge branch 'release/1.12.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvandegroes committed Sep 16, 2019
2 parents cfde75f + b56f2af commit 9f4ce9a
Show file tree
Hide file tree
Showing 78 changed files with 240 additions and 171 deletions.
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

## [Unreleased](https://github.com/bunq/sdk_php/tree/HEAD)

[Full Changelog](https://github.com/bunq/sdk_php/compare/1.10.16...HEAD)
[Full Changelog](https://github.com/bunq/sdk_php/compare/1.12.0...HEAD)

**Closed issues:**

- 123456 [\#180](https://github.com/bunq/sdk_php/issues/180)

**Merged pull requests:**

- Fix decoding of double-wrapped objects. Updated OAuth endpoints. [\#181](https://github.com/bunq/sdk_php/pull/181) ([NickvandeGroes](https://github.com/NickvandeGroes))

## [1.12.0](https://github.com/bunq/sdk_php/tree/1.12.0) (2019-09-10)
[Full Changelog](https://github.com/bunq/sdk_php/compare/1.10.16...1.12.0)

**Closed issues:**

Expand Down Expand Up @@ -145,6 +156,7 @@
**Merged pull requests:**

- Removed userContext.php \(bunq/sdk\_php\#114\) [\#116](https://github.com/bunq/sdk_php/pull/116) ([OGKevin](https://github.com/OGKevin))
- Add response id to request error. \(bunq/sdk\_php\#88\) [\#93](https://github.com/bunq/sdk_php/pull/93) ([OGKevin](https://github.com/OGKevin))
- Move to new sandbox bunq/sdk\_php\#149 [\#150](https://github.com/bunq/sdk_php/pull/150) ([OGKevin](https://github.com/OGKevin))

## [0.13.1](https://github.com/bunq/sdk_php/tree/0.13.1) (2018-03-21)
Expand Down Expand Up @@ -191,7 +203,6 @@
- Throw exception when private key generation fails. \(bunq/sdk\_php\#102\) [\#105](https://github.com/bunq/sdk_php/pull/105) ([OGKevin](https://github.com/OGKevin))
- Added missing field id for TokenQrRequestIdeal. \(bunq/sdk\_php\#97\) [\#100](https://github.com/bunq/sdk_php/pull/100) ([OGKevin](https://github.com/OGKevin))
- Regenerated code to add missing id field. \(bunq/sdk\_php\#81\) [\#95](https://github.com/bunq/sdk_php/pull/95) ([OGKevin](https://github.com/OGKevin))
- Add response id to request error. \(bunq/sdk\_php\#88\) [\#93](https://github.com/bunq/sdk_php/pull/93) ([OGKevin](https://github.com/OGKevin))
- Configure Zappr [\#92](https://github.com/bunq/sdk_php/pull/92) ([OGKevin](https://github.com/OGKevin))
- Add more info to templates. \(bunq/sdk\_php\#89\) [\#90](https://github.com/bunq/sdk_php/pull/90) ([OGKevin](https://github.com/OGKevin))
- Bunq update 7 [\#113](https://github.com/bunq/sdk_php/pull/113) ([OGKevin](https://github.com/OGKevin))
Expand Down Expand Up @@ -312,6 +323,7 @@
- \#33 bunq response [\#34](https://github.com/bunq/sdk_php/pull/34) ([dnl-blkv](https://github.com/dnl-blkv))
- \#5 Allow setting a proxy [\#27](https://github.com/bunq/sdk_php/pull/27) ([qurben](https://github.com/qurben))
- Introduction of Grumphp [\#24](https://github.com/bunq/sdk_php/pull/24) ([cafferata](https://github.com/cafferata))
- Restructure project [\#12](https://github.com/bunq/sdk_php/pull/12) ([LauLaman](https://github.com/LauLaman))

**Fixed bugs:**

Expand All @@ -330,7 +342,6 @@
- Changes the composer PHP requirement [\#19](https://github.com/bunq/sdk_php/pull/19) ([cafferata](https://github.com/cafferata))
- Removed the default PHPStorm constructor header\(s\) [\#18](https://github.com/bunq/sdk_php/pull/18) ([cafferata](https://github.com/cafferata))
- Add readme for tests. [\#16](https://github.com/bunq/sdk_php/pull/16) ([OGKevin](https://github.com/OGKevin))
- Restructure project [\#12](https://github.com/bunq/sdk_php/pull/12) ([LauLaman](https://github.com/LauLaman))
- Add PHP-CS and PHPStan dependencies and scripts to execute [\#3](https://github.com/bunq/sdk_php/pull/3) ([holtkamp](https://github.com/holtkamp))
- Add first series of unit-tests [\#1](https://github.com/bunq/sdk_php/pull/1) ([OGKevin](https://github.com/OGKevin))

Expand Down
2 changes: 1 addition & 1 deletion src/Http/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ApiClient
/**
* User agent constants.
*/
const HEADER_USER_AGENT_BUNQ_SDK_DEFAULT = 'bunq-sdk-php/1.12.0';
const HEADER_USER_AGENT_BUNQ_SDK_DEFAULT = 'bunq-sdk-php/1.12.1';

/**
* Binary request constants.
Expand Down
9 changes: 9 additions & 0 deletions src/Model/Core/BunqModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ private static function determineFieldContents(ReflectionProperty $property, $co
/** @var BunqModel $modelClassNameQualified */
$modelClassNameQualified = ModelUtil::determineModelClassNameQualified($fieldType);

$parentClassName = $property->getDeclaringClass()->getName();
$additionalWrappingKey = BunqModelWrapper::determineWrappingKey($parentClassName, $property->getName());

if (!is_null($additionalWrappingKey)) {
if (isset($contents[$additionalWrappingKey])) {
return $modelClassNameQualified::createFromResponseArray($contents[$additionalWrappingKey]);
}
}

return $modelClassNameQualified::createFromResponseArray($contents);
}
} else {
Expand Down
43 changes: 43 additions & 0 deletions src/Model/Core/BunqModelWrapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
namespace bunq\Model\Core;

use bunq\Model\Generated\Endpoint\BunqMeTabResultInquiry;
use bunq\Model\Generated\Endpoint\Payment;
use JsonSerializable;

/**
* Base class for all endpoints, responsible for parsing json received from the server.
*/
abstract class BunqModelWrapper implements JsonSerializable
{
/**
* Field constants.
*/
const FIELD_PAYMENT = 'payment';

/**
* The double wrapping map.
*/
const MODEL_WRAPPING_MAP = [
BunqMeTabResultInquiry::class => [
self::FIELD_PAYMENT => Payment::OBJECT_TYPE_GET
]
];

/**
* @param $className
* @param $propertyName
*
* @return string|null
*/
public static function determineWrappingKey($className, $propertyName)
{
if (isset(self::MODEL_WRAPPING_MAP[$className])) {
if (isset(self::MODEL_WRAPPING_MAP[$className][$propertyName])) {
return self::MODEL_WRAPPING_MAP[$className][$propertyName];
}
}

return null;
}
}
4 changes: 2 additions & 2 deletions src/Model/Core/OauthAccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class OauthAccessToken extends BunqModel
/**
* Token constants.
*/
const TOKEN_URI_FORMAT_SANDBOX = 'https://api.oauth.sandbox.bunq.com/v1/token?';
const TOKEN_URI_FORMAT_PRODUCTION = 'https://api.oauth.bunq.com/v1/token?';
const TOKEN_URI_FORMAT_SANDBOX = 'https://api.oauth.sandbox.bunq.com/v1/token?%s';
const TOKEN_URI_FORMAT_PRODUCTION = 'https://api.oauth.bunq.com/v1/token?%s';

/**
* Error constants.
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Core/OauthAuthorizationUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class OauthAuthorizationUri extends BunqModel
/**
* Uri constants.
*/
const AUTH_URI_FORMAT_PRODUCTION = 'https://oauth.bunq.com/auth?';
const AUTH_URI_FORMAT_SANDBOX = 'https://oauth.sandbox.bunq.com/auth?';
const AUTH_URI_FORMAT_PRODUCTION = 'https://oauth.bunq.com/auth?%s';
const AUTH_URI_FORMAT_SANDBOX = 'https://oauth.sandbox.bunq.com/auth?%s';

/**
* Field constants.
Expand Down
2 changes: 2 additions & 0 deletions src/Model/Generated/Endpoint/AttachmentPublic.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace bunq\Model\Generated\Endpoint;

use bunq\Context\ApiContext;
use bunq\Http\ApiClient;
use bunq\Http\BunqResponse;
use bunq\Model\Core\BunqModel;
use bunq\Model\Generated\Object\Attachment;

Expand Down
1 change: 1 addition & 0 deletions src/Model/Generated/Endpoint/AttachmentPublicContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace bunq\Model\Generated\Endpoint;

use bunq\Context\ApiContext;
use bunq\Http\ApiClient;
use bunq\Http\BunqResponse;
use bunq\Model\Core\BunqModel;
Expand Down
1 change: 1 addition & 0 deletions src/Model/Generated/Endpoint/AttachmentTabContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace bunq\Model\Generated\Endpoint;

use bunq\Context\ApiContext;
use bunq\Http\ApiClient;
use bunq\Http\BunqResponse;
use bunq\Model\Core\BunqModel;
Expand Down
1 change: 1 addition & 0 deletions src/Model/Generated/Endpoint/AttachmentUserContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace bunq\Model\Generated\Endpoint;

use bunq\Context\ApiContext;
use bunq\Http\ApiClient;
use bunq\Http\BunqResponse;
use bunq\Model\Core\BunqModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace bunq\Model\Generated\Endpoint;

use bunq\Context\ApiContext;
use bunq\Http\ApiClient;
use bunq\Http\BunqResponse;
use bunq\Model\Core\BunqModel;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Model/Generated/Endpoint/BunqMeFundraiserResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace bunq\Model\Generated\Endpoint;

use bunq\Context\ApiContext;
use bunq\Http\ApiClient;
use bunq\Http\BunqResponse;
use bunq\Model\Core\BunqModel;

/**
Expand Down
Loading

0 comments on commit 9f4ce9a

Please sign in to comment.