-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from bunq/feature/fix_double_wrapped_objects
Fix decoding of double-wrapped objects. Updated OAuth endpoints.
- Loading branch information
Showing
4 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters