mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-01 03:05:09 +00:00
Can now register with Bunq and get device server ID.
This commit is contained in:
@@ -13,6 +13,9 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Services\Bunq\Request;
|
||||
|
||||
use FireflyIII\Services\Bunq\Id\InstallationId;
|
||||
use FireflyIII\Services\Bunq\Object\ServerPublicKey;
|
||||
use FireflyIII\Services\Bunq\Token\InstallationToken;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class InstallationTokenRequest
|
||||
@@ -38,22 +41,17 @@ class InstallationTokenRequest extends BunqRequest
|
||||
$uri = '/v1/installation';
|
||||
$data = ['client_public_key' => $this->publicKey,];
|
||||
$headers = $this->getDefaultHeaders();
|
||||
$response = [];
|
||||
if ($this->fake) {
|
||||
$response = json_decode(
|
||||
'{"Response":[{"Id":{"id":875936}},{"Token":{"id":13172597,"created":"2017-08-05 11:46:07.061740","updated":"2017-08-05 11:46:07.061740","token":"35278fcc8b0615261fe23285e6d2e6ccd05ac4c93454981bd5e985ec453e5b5d"}},{"ServerPublicKey":{"server_public_key":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAon5y6OZGvTN8kIqPBdro\ndG8TWVw6sl34hAWI47NK6Pi7gmnTtd\/k9gfwq56iI4Er8uMM5e4QmjD++XrBIqcw\nHohDVK03li3xsyJPZ4EBSUOkv4VKXKL\/quqlSgDmPnxtT39BowUZl1um5QbTm0hW\npGI\/0bK7jQk7mbEan9yDOpXnczKgfNlo4o+zbFquPdUfA5LE8R8X057dB6ab7eqA\n9Aybo+I6xyrsOOztufg3Yfe5RA6a0Sikqe\/L8HCP+9TJByUI2pwydPou3KONfYhK\n1NQJZ+RCZ6V+jmcuzKe2vq0jhBZd26wNscl48Sm7etJeuBOpHE+MgO24JiTEYlLS\nVQIDAQAB\n-----END PUBLIC KEY-----\n"}}]}',
|
||||
true
|
||||
);
|
||||
}
|
||||
if (!$this->fake) {
|
||||
$response = $this->sendUnsignedBunqPost($uri, $data, $headers);
|
||||
}
|
||||
//echo '<hr><pre>' . json_encode($response) . '</pre><hr>';
|
||||
$response = $this->sendUnsignedBunqPost($uri, $data, $headers);
|
||||
Log::debug('Installation request response', $response);
|
||||
|
||||
$this->installationId = $this->extractInstallationId($response);
|
||||
$this->serverPublicKey = $this->extractServerPublicKey($response);
|
||||
$this->installationToken = $this->extractInstallationToken($response);
|
||||
|
||||
Log::debug(sprintf('Installation ID: %s', serialize($this->installationId)));
|
||||
Log::debug(sprintf('Installation token: %s', serialize($this->installationToken)));
|
||||
Log::debug(sprintf('server public key: %s', serialize($this->serverPublicKey)));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user