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