mirror of
https://github.com/bitinflow/accounts.git
synced 2026-03-22 17:47:26 +00:00
Fix user registration
This commit is contained in:
@@ -90,8 +90,9 @@ class BitinflowAccounts
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal only for internal and debug purposes.
|
|
||||||
* @param string $baseUrl
|
* @param string $baseUrl
|
||||||
|
*
|
||||||
|
* @internal only for internal and debug purposes.
|
||||||
*/
|
*/
|
||||||
public static function setBaseUrl(string $baseUrl): void
|
public static function setBaseUrl(string $baseUrl): void
|
||||||
{
|
{
|
||||||
@@ -398,13 +399,13 @@ class BitinflowAccounts
|
|||||||
{
|
{
|
||||||
$headers = [
|
$headers = [
|
||||||
'Client-ID' => $this->getClientId(),
|
'Client-ID' => $this->getClientId(),
|
||||||
|
'Accept' => 'application/json',
|
||||||
];
|
];
|
||||||
if ($this->token) {
|
if ($this->token) {
|
||||||
$headers['Authorization'] = 'Bearer ' . $this->token;
|
$headers['Authorization'] = 'Bearer ' . $this->token;
|
||||||
}
|
}
|
||||||
if ($json) {
|
if ($json) {
|
||||||
$headers['Content-Type'] = 'application/json';
|
$headers['Content-Type'] = 'application/json';
|
||||||
$headers['Accept'] = 'application/json';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $headers;
|
return $headers;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace GhostZero\BitinflowAccounts;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use GhostZero\BitinflowAccounts\Helpers\Paginator;
|
use GhostZero\BitinflowAccounts\Helpers\Paginator;
|
||||||
use GuzzleHttp\Psr7\Response;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class Result
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Original Guzzle HTTP Response.
|
* Original Guzzle HTTP Response.
|
||||||
* @var Response|null
|
* @var ResponseInterface|null
|
||||||
*/
|
*/
|
||||||
public $response;
|
public $response;
|
||||||
|
|
||||||
@@ -73,11 +73,11 @@ class Result
|
|||||||
/**
|
/**
|
||||||
* Constructor,
|
* Constructor,
|
||||||
*
|
*
|
||||||
* @param Response|null $response HTTP response
|
* @param ResponseInterface|null $response HTTP response
|
||||||
* @param Exception|mixed $exception Exception, if present
|
* @param Exception|mixed $exception Exception, if present
|
||||||
* @param null|Paginator $paginator Paginator, if present
|
* @param null|Paginator $paginator Paginator, if present
|
||||||
*/
|
*/
|
||||||
public function __construct(?Response $response, Exception $exception = null, Paginator $paginator = null)
|
public function __construct(?ResponseInterface $response, Exception $exception = null, Paginator $paginator = null)
|
||||||
{
|
{
|
||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
$this->success = $exception === null;
|
$this->success = $exception === null;
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ trait UsersTrait
|
|||||||
*/
|
*/
|
||||||
public function createUser(array $parameters): Result
|
public function createUser(array $parameters): Result
|
||||||
{
|
{
|
||||||
return $this->post('users', $parameters);
|
return $this->post('v2/users', $parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ class ApiUsersTest extends ApiTestCase
|
|||||||
{
|
{
|
||||||
$this->getClient()->withToken($this->getToken());
|
$this->getClient()->withToken($this->getToken());
|
||||||
$this->registerResult($result = $this->getClient()->getAuthedUser());
|
$this->registerResult($result = $this->getClient()->getAuthedUser());
|
||||||
|
$this->assertTrue($result->success());
|
||||||
$this->assertEquals('rene@preuss.io', $result->data()->email);
|
$this->assertEquals('rene@preuss.io', $result->data()->email);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +30,9 @@ class ApiUsersTest extends ApiTestCase
|
|||||||
'first_name' => 'René',
|
'first_name' => 'René',
|
||||||
'last_name' => 'Preuß',
|
'last_name' => 'Preuß',
|
||||||
'email' => $testEmailAddress,
|
'email' => $testEmailAddress,
|
||||||
'terms_accepted_at' => now()->toDateTimeString(),
|
'password' => 'Password1',
|
||||||
|
'password_confirmation' => 'Password1',
|
||||||
|
'tos' => true,
|
||||||
]));
|
]));
|
||||||
$this->assertEquals($testEmailAddress, $result->data()->email);
|
$this->assertEquals($testEmailAddress, $result->data()->email);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user