mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-19 08:36:16 +00:00
Compare commits
2 Commits
1.0.0-rc.5
...
laravel-10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8232de4003 | ||
|
|
ac3e28f67f |
@@ -15,8 +15,8 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"illuminate/support": "^11.0|^12.0",
|
"illuminate/support": "^10.0|^11.0|^12.0",
|
||||||
"illuminate/console": "^11.0|^12.0",
|
"illuminate/console": "^10.0|^11.0|^12.0",
|
||||||
"guzzlehttp/guzzle": "^6.3|^7.0",
|
"guzzlehttp/guzzle": "^6.3|^7.0",
|
||||||
"socialiteproviders/manager": "^3.4|^4.0.1",
|
"socialiteproviders/manager": "^3.4|^4.0.1",
|
||||||
"firebase/php-jwt": "^6.0"
|
"firebase/php-jwt": "^6.0"
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
-----BEGIN PUBLIC KEY-----
|
|
||||||
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAi4Ta8r01zKaGSnGi1EiD
|
|
||||||
uMFWRXBlK4y/ZIfWBpElmS2ygv4mGeP3hT4Flm696Z2UMy56KC+c7CC/PQCiutLk
|
|
||||||
5NUphyX/t+0QS5Dqpw6FB33fLTNNY7GqSmGIUE4os8XYZRSyDQRgtOgq3R3vJkoV
|
|
||||||
7zoavTJmSCQlG5Qf0T//iMmzQ+b+6VZm1CJSz5nGx94u1DuXNyP5Epkk0wuHrtwy
|
|
||||||
kADR2lmydNodJzqpSD+8yQqnAhOZNtNF4qwQ3g13fRvHycBp3G2nlCfOn2g5PmYD
|
|
||||||
KYBKqvTq4PQH4E+K3pbbMz6zf/T6Dw7zTfksqHR4hqMgN6byRRxmwuBczIumcu9b
|
|
||||||
y7xbgoIGIVZXgJliALPFi+zTPTN7c8MedFs/xCBHCmzWYTCZfHgr8RPRewD19tCG
|
|
||||||
NSny5R0vlArpuZCTTgedPESDeGU4eNEddg4yXFzKlpE2nNuvzZ1Ohruc5ETOSU19
|
|
||||||
RTCBUBkjeL6ESZRd/yKGjbVx4dEYxZdIz4yBl+hZ2ZOIyG7L3zPrccAWrPpG56xr
|
|
||||||
E5IDBXxLFhaJ5LlyEAGQehB0ShEuCdkr88Xz7ba9PHpGqY83l4//ULrqPIZPAa4Z
|
|
||||||
E3AWHT1ZtXNPeA4SzZ9Y9Oij4M3chyHxqM0lL3kYP+dstZehTujStfElDIx2Ni10
|
|
||||||
73tILu4edYS0FxsL19m8gbsCAwEAAQ==
|
|
||||||
-----END PUBLIC KEY-----
|
|
||||||
@@ -110,7 +110,7 @@ class AnikeenId
|
|||||||
if ($redirectUri = config('services.anikeen.redirect')) {
|
if ($redirectUri = config('services.anikeen.redirect')) {
|
||||||
$this->setRedirectUri($redirectUri);
|
$this->setRedirectUri($redirectUri);
|
||||||
}
|
}
|
||||||
if (self::getMode() === 'staging') {
|
if (config('services.anikeen.mode') === 'staging') {
|
||||||
self::setBaseUrl(self::$stagingBaseUrl);
|
self::setBaseUrl(self::$stagingBaseUrl);
|
||||||
}
|
}
|
||||||
if ($baseUrl = config('services.anikeen.base_url')) {
|
if ($baseUrl = config('services.anikeen.base_url')) {
|
||||||
@@ -141,11 +141,6 @@ class AnikeenId
|
|||||||
return self::$accessTokenField;
|
return self::$accessTokenField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getMode(): string
|
|
||||||
{
|
|
||||||
return config('services.anikeen.mode') ?: 'production';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function useRefreshTokenField(string $refreshTokenField): void
|
public static function useRefreshTokenField(string $refreshTokenField): void
|
||||||
{
|
{
|
||||||
self::$refreshTokenField = $refreshTokenField;
|
self::$refreshTokenField = $refreshTokenField;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Anikeen\Id\Helpers;
|
namespace Anikeen\Id\Helpers;
|
||||||
|
|
||||||
use Anikeen\Id\AnikeenId;
|
|
||||||
use Firebase\JWT\JWT;
|
use Firebase\JWT\JWT;
|
||||||
use Firebase\JWT\Key;
|
use Firebase\JWT\Key;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
@@ -31,8 +30,6 @@ class JwtParser
|
|||||||
|
|
||||||
private function getOauthPublicKey(): bool|string
|
private function getOauthPublicKey(): bool|string
|
||||||
{
|
{
|
||||||
return AnikeenId::getMode() === 'staging'
|
return file_get_contents(dirname(__DIR__, 3) . '/oauth-public.key');
|
||||||
? file_get_contents(dirname(__DIR__, 3) . '/oauth-public.staging.key')
|
|
||||||
: file_get_contents(dirname(__DIR__, 3) . '/oauth-public.key');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,11 @@ trait OauthTrait
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result = new Result($response, null);
|
$result = new Result($response, null, $this);
|
||||||
} catch (RequestException $exception) {
|
} catch (RequestException $exception) {
|
||||||
$result = new Result($exception->getResponse(), $exception);
|
$result = new Result($exception->getResponse(), $exception, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result->anikeenId = $this;
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,6 @@ use Throwable;
|
|||||||
* @property Response $response
|
* @property Response $response
|
||||||
* @property null|Throwable $exception
|
* @property null|Throwable $exception
|
||||||
*/
|
*/
|
||||||
#[\AllowDynamicProperties]
|
|
||||||
abstract class BaseCollection implements JsonSerializable
|
abstract class BaseCollection implements JsonSerializable
|
||||||
{
|
{
|
||||||
private Closure $callable;
|
private Closure $callable;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use Anikeen\Id\Exceptions\ResourceException;
|
|||||||
use Anikeen\Id\Result;
|
use Anikeen\Id\Result;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
#[\AllowDynamicProperties]
|
|
||||||
abstract class BaseResource implements JsonSerializable
|
abstract class BaseResource implements JsonSerializable
|
||||||
{
|
{
|
||||||
public Result $result;
|
public Result $result;
|
||||||
|
|||||||
@@ -10,12 +10,25 @@ class Transactions extends BaseCollection
|
|||||||
{
|
{
|
||||||
use HasBillable;
|
use HasBillable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new transaction for the current user.
|
||||||
|
*
|
||||||
|
* @param array $attributes The attributes for the transaction.
|
||||||
|
* @throws Throwable
|
||||||
|
* @todo Add type hinting for the attributes array.
|
||||||
|
*/
|
||||||
|
public function create(array $attributes = []): Transaction
|
||||||
|
{
|
||||||
|
return (new Transaction($this->billable->request('POST', 'v1/transactions', $attributes)))
|
||||||
|
->setBillable($this->billable);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function find(string $id): ?Transaction
|
public function find(string $id): ?Transaction
|
||||||
{
|
{
|
||||||
return (new Transaction(fn() => $this->billable->request('GET', sprintf('v1/transactions/%s', $id))))
|
return (new Transaction(fn() => $this->billable->request('GET', sprintf('v1/transactions/%s', $id))))
|
||||||
->setBillable($this->billable);
|
->setBillable($this->billable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Anikeen\Id\Socialite;
|
namespace Anikeen\Id\Socialite;
|
||||||
|
|
||||||
use Anikeen\Id\AnikeenId;
|
|
||||||
use Anikeen\Id\Enums\Scope;
|
use Anikeen\Id\Enums\Scope;
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -33,7 +32,9 @@ class Provider extends AbstractProvider implements ProviderInterface
|
|||||||
*/
|
*/
|
||||||
protected function getBaseUrl(): string
|
protected function getBaseUrl(): string
|
||||||
{
|
{
|
||||||
return AnikeenId::getMode() === 'staging'
|
$mode = config('services.anikeen.mode') ?? 'production';
|
||||||
|
|
||||||
|
return $mode === 'staging'
|
||||||
? 'https://staging.id.anikeen.com'
|
? 'https://staging.id.anikeen.com'
|
||||||
: 'https://id.anikeen.com';
|
: 'https://id.anikeen.com';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user