Skip to content

Commit 9f4ce9a

Browse files
Merge branch 'release/1.12.1'
2 parents cfde75f + b56f2af commit 9f4ce9a

File tree

78 files changed

+240
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+240
-171
lines changed

CHANGELOG.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22

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

5-
[Full Changelog](https://github.com/bunq/sdk_php/compare/1.10.16...HEAD)
5+
[Full Changelog](https://github.com/bunq/sdk_php/compare/1.12.0...HEAD)
6+
7+
**Closed issues:**
8+
9+
- 123456 [\#180](https://github.com/bunq/sdk_php/issues/180)
10+
11+
**Merged pull requests:**
12+
13+
- Fix decoding of double-wrapped objects. Updated OAuth endpoints. [\#181](https://github.com/bunq/sdk_php/pull/181) ([NickvandeGroes](https://github.com/NickvandeGroes))
14+
15+
## [1.12.0](https://github.com/bunq/sdk_php/tree/1.12.0) (2019-09-10)
16+
[Full Changelog](https://github.com/bunq/sdk_php/compare/1.10.16...1.12.0)
617

718
**Closed issues:**
819

@@ -145,6 +156,7 @@
145156
**Merged pull requests:**
146157

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

150162
## [0.13.1](https://github.com/bunq/sdk_php/tree/0.13.1) (2018-03-21)
@@ -191,7 +203,6 @@
191203
- 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))
192204
- Added missing field id for TokenQrRequestIdeal. \(bunq/sdk\_php\#97\) [\#100](https://github.com/bunq/sdk_php/pull/100) ([OGKevin](https://github.com/OGKevin))
193205
- 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))
194-
- Add response id to request error. \(bunq/sdk\_php\#88\) [\#93](https://github.com/bunq/sdk_php/pull/93) ([OGKevin](https://github.com/OGKevin))
195206
- Configure Zappr [\#92](https://github.com/bunq/sdk_php/pull/92) ([OGKevin](https://github.com/OGKevin))
196207
- Add more info to templates. \(bunq/sdk\_php\#89\) [\#90](https://github.com/bunq/sdk_php/pull/90) ([OGKevin](https://github.com/OGKevin))
197208
- Bunq update 7 [\#113](https://github.com/bunq/sdk_php/pull/113) ([OGKevin](https://github.com/OGKevin))
@@ -312,6 +323,7 @@
312323
- \#33 bunq response [\#34](https://github.com/bunq/sdk_php/pull/34) ([dnl-blkv](https://github.com/dnl-blkv))
313324
- \#5 Allow setting a proxy [\#27](https://github.com/bunq/sdk_php/pull/27) ([qurben](https://github.com/qurben))
314325
- Introduction of Grumphp [\#24](https://github.com/bunq/sdk_php/pull/24) ([cafferata](https://github.com/cafferata))
326+
- Restructure project [\#12](https://github.com/bunq/sdk_php/pull/12) ([LauLaman](https://github.com/LauLaman))
315327

316328
**Fixed bugs:**
317329

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

src/Http/ApiClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class ApiClient
8787
/**
8888
* User agent constants.
8989
*/
90-
const HEADER_USER_AGENT_BUNQ_SDK_DEFAULT = 'bunq-sdk-php/1.12.0';
90+
const HEADER_USER_AGENT_BUNQ_SDK_DEFAULT = 'bunq-sdk-php/1.12.1';
9191

9292
/**
9393
* Binary request constants.

src/Model/Core/BunqModel.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ private static function determineFieldContents(ReflectionProperty $property, $co
210210
/** @var BunqModel $modelClassNameQualified */
211211
$modelClassNameQualified = ModelUtil::determineModelClassNameQualified($fieldType);
212212

213+
$parentClassName = $property->getDeclaringClass()->getName();
214+
$additionalWrappingKey = BunqModelWrapper::determineWrappingKey($parentClassName, $property->getName());
215+
216+
if (!is_null($additionalWrappingKey)) {
217+
if (isset($contents[$additionalWrappingKey])) {
218+
return $modelClassNameQualified::createFromResponseArray($contents[$additionalWrappingKey]);
219+
}
220+
}
221+
213222
return $modelClassNameQualified::createFromResponseArray($contents);
214223
}
215224
} else {
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
namespace bunq\Model\Core;
3+
4+
use bunq\Model\Generated\Endpoint\BunqMeTabResultInquiry;
5+
use bunq\Model\Generated\Endpoint\Payment;
6+
use JsonSerializable;
7+
8+
/**
9+
* Base class for all endpoints, responsible for parsing json received from the server.
10+
*/
11+
abstract class BunqModelWrapper implements JsonSerializable
12+
{
13+
/**
14+
* Field constants.
15+
*/
16+
const FIELD_PAYMENT = 'payment';
17+
18+
/**
19+
* The double wrapping map.
20+
*/
21+
const MODEL_WRAPPING_MAP = [
22+
BunqMeTabResultInquiry::class => [
23+
self::FIELD_PAYMENT => Payment::OBJECT_TYPE_GET
24+
]
25+
];
26+
27+
/**
28+
* @param $className
29+
* @param $propertyName
30+
*
31+
* @return string|null
32+
*/
33+
public static function determineWrappingKey($className, $propertyName)
34+
{
35+
if (isset(self::MODEL_WRAPPING_MAP[$className])) {
36+
if (isset(self::MODEL_WRAPPING_MAP[$className][$propertyName])) {
37+
return self::MODEL_WRAPPING_MAP[$className][$propertyName];
38+
}
39+
}
40+
41+
return null;
42+
}
43+
}

src/Model/Core/OauthAccessToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class OauthAccessToken extends BunqModel
2626
/**
2727
* Token constants.
2828
*/
29-
const TOKEN_URI_FORMAT_SANDBOX = 'https://api.oauth.sandbox.bunq.com/v1/token?';
30-
const TOKEN_URI_FORMAT_PRODUCTION = 'https://api.oauth.bunq.com/v1/token?';
29+
const TOKEN_URI_FORMAT_SANDBOX = 'https://api.oauth.sandbox.bunq.com/v1/token?%s';
30+
const TOKEN_URI_FORMAT_PRODUCTION = 'https://api.oauth.bunq.com/v1/token?%s';
3131

3232
/**
3333
* Error constants.

src/Model/Core/OauthAuthorizationUri.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class OauthAuthorizationUri extends BunqModel
1313
/**
1414
* Uri constants.
1515
*/
16-
const AUTH_URI_FORMAT_PRODUCTION = 'https://oauth.bunq.com/auth?';
17-
const AUTH_URI_FORMAT_SANDBOX = 'https://oauth.sandbox.bunq.com/auth?';
16+
const AUTH_URI_FORMAT_PRODUCTION = 'https://oauth.bunq.com/auth?%s';
17+
const AUTH_URI_FORMAT_SANDBOX = 'https://oauth.sandbox.bunq.com/auth?%s';
1818

1919
/**
2020
* Field constants.

src/Model/Generated/Endpoint/AttachmentPublic.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace bunq\Model\Generated\Endpoint;
44

5+
use bunq\Context\ApiContext;
56
use bunq\Http\ApiClient;
7+
use bunq\Http\BunqResponse;
68
use bunq\Model\Core\BunqModel;
79
use bunq\Model\Generated\Object\Attachment;
810

src/Model/Generated/Endpoint/AttachmentPublicContent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace bunq\Model\Generated\Endpoint;
44

5+
use bunq\Context\ApiContext;
56
use bunq\Http\ApiClient;
67
use bunq\Http\BunqResponse;
78
use bunq\Model\Core\BunqModel;

src/Model/Generated/Endpoint/AttachmentTabContent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace bunq\Model\Generated\Endpoint;
44

5+
use bunq\Context\ApiContext;
56
use bunq\Http\ApiClient;
67
use bunq\Http\BunqResponse;
78
use bunq\Model\Core\BunqModel;

src/Model/Generated/Endpoint/AttachmentUserContent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace bunq\Model\Generated\Endpoint;
44

5+
use bunq\Context\ApiContext;
56
use bunq\Http\ApiClient;
67
use bunq\Http\BunqResponse;
78
use bunq\Model\Core\BunqModel;

0 commit comments

Comments
 (0)