Skip to content

Commit

Permalink
Merge branch 'release/0.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Mar 20, 2018
2 parents 2bf1329 + 5926378 commit 9004668
Show file tree
Hide file tree
Showing 215 changed files with 11,951 additions and 2,291 deletions.
15 changes: 12 additions & 3 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@
## What happens:
1.

## Logs
- Logs
## Traceback
[//]: # (If there is a traceback please share it in a quote! You can do this by pasting the traceback text, highlighting it and pressing the quote button.)

## SDK version and environment
- Tested on [0.12.4](https://github.com/bunq/sdk_php/releases/tag/0.12.4)
- [ ] Sandbox
- [ ] Production

## Response id
[//]: # (If this error has something to do with a request that fails, please provide the response id of the request.)
- Response id:

## Extra info:
- Tested on
[//]: # (Please provide any other relevant information here)
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[//]: # (Thanks for opening this pull request! Before you proceed please make sure that you have an issue that explains what this pull request will do.
Make sure that all your commits link to this issue e.g. "My commit. \(bunq/sdk_php#<issue nr>\)".
If this pull request is changing files that are located in "src/Model/Generated" then this pull request will be closed as these files must/can only be changed on bunq's side.)

## This PR closes/fixes the following issues:
[//]: # (If for some reason your pull request does not require a test case you can just mark this box as checked and explain why it does not require a test case.)
- Closes bunq/sdk_php#
- [ ] Tested
25 changes: 25 additions & 0 deletions .zappr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
autobranch:
pattern: 'bunq/sdk_php#{number}-{title}'
length: 100
commit:
message:
patterns:
- '([A-Za-z0-9 ]+)\. (\(bunq\/sdk_php#[0-9]+\))'
specification:
title:
minimum-length:
enabled: true
length: 8
body:
minimum-length:
enabled: true
length: 8
contains-url: true
contains-issue-number: true
template:
differs-from-body: true
pull-request:
labels:
additional: true
required:
- Can be merged
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Change Log

## [0.13.0](https://github.com/bunq/sdk_php/tree/0.13.0) (2018-03-20)

[Full Changelog](https://github.com/bunq/sdk_php/compare/0.12.4...0.13.0)

**Implemented enhancements:**

- Add zappr integration for better quality control  [\#91](https://github.com/bunq/sdk_php/issues/91)
- Add more information to templates [\#89](https://github.com/bunq/sdk_php/issues/89)
- Add response id to error messages from failed requests  [\#88](https://github.com/bunq/sdk_php/issues/88)

**Fixed bugs:**

- openssl\_pkey\_get\_details\(\) expects parameter 1 to be resource, boolean given [\#102](https://github.com/bunq/sdk_php/issues/102)
- Token request ideal is missing id attribute in response. [\#97](https://github.com/bunq/sdk_php/issues/97)
- "HTTP Response Code: 400 The request signature is invalid." [\#87](https://github.com/bunq/sdk_php/issues/87)
- Field ID is missing from MasterCardAction [\#81](https://github.com/bunq/sdk_php/issues/81)
- TokenQrRequestIdeal returns the wrong type [\#80](https://github.com/bunq/sdk_php/issues/80)

**Closed issues:**

- bunq update 7 [\#112](https://github.com/bunq/sdk_php/issues/112)
- Document conditions for Payment.description [\#108](https://github.com/bunq/sdk_php/issues/108)
- Simple way to create a iDeal request? [\#103](https://github.com/bunq/sdk_php/issues/103)
- DraftPayment create fails with superfluous field-errors [\#101](https://github.com/bunq/sdk_php/issues/101)

**Merged pull requests:**

- Bunq update 7 [\#113](https://github.com/bunq/sdk_php/pull/113) ([OGKevin](https://github.com/OGKevin))
- Regenerate code for release [\#111](https://github.com/bunq/sdk_php/pull/111) ([OGKevin](https://github.com/OGKevin))
- Removed unneeded doc block. \(bunq/sdk\_php\#80\) [\#110](https://github.com/bunq/sdk_php/pull/110) ([OGKevin](https://github.com/OGKevin))
- Token qr request ideal returns the wrong type. \(bunq/sdk\_php\#80\) [\#107](https://github.com/bunq/sdk_php/pull/107) ([OGKevin](https://github.com/OGKevin))
- 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))

## [0.12.4](https://github.com/bunq/sdk_php/tree/0.12.4) (2017-12-21)
[Full Changelog](https://github.com/bunq/sdk_php/compare/0.12.3...0.12.4)

Expand Down
12 changes: 11 additions & 1 deletion bin/bunq-install
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,14 @@ if (file_exists($filenameAutoloadLocal)) {
exit(1);
}

\bunq\Util\InstallationUtil::interactiveInstall();
$allOption = getopt('', ['environment:', 'config-file:', 'api-key:']);

if (empty($allOption)) {
\bunq\Util\InstallationUtil::interactiveInstall();
} else {
\bunq\Util\InstallationUtil::automaticInstall(
new \bunq\Util\BunqEnumApiEnvironmentType($allOption['environment']),
$allOption['config-file'],
$allOption['api-key'] ?? null
);
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"config": {
"sort-packages": true,
"platform": {
"php": "7.0"
"php": "7.0.13"
}
},
"scripts": {
Expand Down
30 changes: 19 additions & 11 deletions src/Context/ApiContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
namespace bunq\Context;

use bunq\Exception\BunqException;
use bunq\Model\Core\DeviceServerInternal;
use bunq\Model\Core\Installation;
use bunq\Model\Core\SandboxUserInternal;
use bunq\Model\Core\SessionServer;
use bunq\Model\Core\Token;
use bunq\Model\Generated\Endpoint\DeviceServer;
use bunq\Model\Generated\Endpoint\Session;
use bunq\Security\KeyPair;
use bunq\Util\BunqEnumApiEnvironmentType;
Expand Down Expand Up @@ -112,6 +113,14 @@ public static function create(
return $apiContext;
}

/**
*/
private function createSandboxUser()
{
$sandboxUser = SandboxUserInternal::create([], $this);
$this->apiKey = $sandboxUser->getValue()->getApiKey();
}

/**
* @param string $description
* @param string[] $permittedIps
Expand Down Expand Up @@ -145,13 +154,12 @@ private function initializeInstallationContext()
*/
private function registerDevice(string $description, array $permittedIps)
{
DeviceServer::create(
$this,
[
DeviceServer::FIELD_DESCRIPTION => $description,
DeviceServer::FIELD_PERMITTED_IPS => $permittedIps,
DeviceServer::FIELD_SECRET => $this->apiKey,
]
DeviceServerInternal::create(
$description,
$this->apiKey,
$permittedIps,
[],
$this
);
}

Expand Down Expand Up @@ -245,7 +253,7 @@ private function determineBaseUriString(): string
throw new BunqException(
self::ERROR_ENVIRONMENT_TYPE_UNEXPECTED,
[
$this->environmentType->getChoiceString()
$this->environmentType->getChoiceString(),
]
);
}
Expand All @@ -256,7 +264,7 @@ private function determineBaseUriString(): string
*/
public function closeSession()
{
Session::delete($this, self::SESSION_ID_DUMMY);
Session::delete(self::SESSION_ID_DUMMY);
$this->dropSessionContext();
}

Expand All @@ -283,7 +291,7 @@ public function ensureSessionActive()
*/
public function isSessionActive(): bool
{
if (is_null($this->sessionContext)){
if (is_null($this->sessionContext)) {
return false;
}

Expand Down
17 changes: 17 additions & 0 deletions src/Context/SessionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class SessionContext implements JsonSerializable
*/
const FIELD_TOKEN = 'token';
const FIELD_EXPIRY_TIME = 'expiry_time';
const FIELD_USER_ID = 'user_id';

/**
* Constants for manipulating expiry timestamp.
Expand All @@ -34,6 +35,11 @@ class SessionContext implements JsonSerializable
*/
protected $expiryTime;

/**
* @var int
*/
protected $userId;

/**
*/
private function __construct()
Expand All @@ -50,6 +56,7 @@ public static function create(SessionServer $sessionServer): SessionContext
$sessionContext = new static();
$sessionContext->sessionToken = $sessionServer->getSessionToken();
$sessionContext->expiryTime = static::calculateExpiryTime($sessionServer);
$sessionContext->userId = $sessionServer->getReferencedUser()->getId();

return $sessionContext;
}
Expand Down Expand Up @@ -107,6 +114,7 @@ public static function restore(array $sessionContextBody): SessionContext
self::FORMAT_MICROTIME,
$sessionContextBody[self::FIELD_EXPIRY_TIME]
);
$sessionContext->userId = $sessionContextBody[self::FIELD_USER_ID];

return $sessionContext;
}
Expand All @@ -119,6 +127,7 @@ public function jsonSerialize(): array
return [
self::FIELD_TOKEN => $this->getSessionToken()->getToken(),
self::FIELD_EXPIRY_TIME => $this->getExpiryTime()->format(self::FORMAT_MICROTIME),
self::FIELD_USER_ID => $this->getUserId(),
];
}

Expand All @@ -130,6 +139,14 @@ public function getSessionToken(): Token
return $this->sessionToken;
}

/**
* @return int
*/
public function getUserId(): int
{
return $this->userId;
}

/**
* @return DateTime
*/
Expand Down
Loading

0 comments on commit 9004668

Please sign in to comment.