forked from apoloz/alfa-bank-sdk
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a0d6ac03a | ||
|
|
95203efbad |
@@ -8,11 +8,17 @@ namespace Apoloz\AlfaBank\Core;
|
||||
// <BELIEF_STATE "Saloon's plugin architecture requires importing traits for features like retries and timeouts. Local contracts (SignerInterface) are imported for dependency injection.">
|
||||
use Apoloz\AlfaBank\Contracts\SignerInterface;
|
||||
use Apoloz\AlfaBank\Enums\Environment;
|
||||
use Apoloz\AlfaBank\Http\Middleware\LoggingRequestMiddleware;
|
||||
use Apoloz\AlfaBank\Http\Middleware\LoggingResponseMiddleware;
|
||||
use Apoloz\AlfaBank\Http\Middleware\RequestIdMiddleware;
|
||||
use Apoloz\AlfaBank\Http\Middleware\VerifyJwsResponseMiddleware;
|
||||
use Apoloz\AlfaBank\Http\Pagination\AlfaOffsetPaginator;
|
||||
use Apoloz\AlfaBank\Traits\HasAlfaErrorHandling;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Saloon\Helpers\OAuth2\OAuthConfig;
|
||||
use Saloon\Http\Connector;
|
||||
use Saloon\Http\OAuth2\GetClientCredentialsTokenRequest;
|
||||
use Saloon\Http\PendingRequest;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\PaginationPlugin\Contracts\HasPagination;
|
||||
use Saloon\PaginationPlugin\OffsetPaginator;
|
||||
@@ -42,7 +48,7 @@ class AlfaBankConnector extends Connector implements HasPagination
|
||||
return $this->alfaConfig->baseUrl;
|
||||
}
|
||||
|
||||
public function boot(\Saloon\Http\PendingRequest $pendingRequest): void
|
||||
public function boot(PendingRequest $pendingRequest): void
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -69,7 +75,7 @@ class AlfaBankConnector extends Connector implements HasPagination
|
||||
throw new \RuntimeException('Client ID/Secret not configured.');
|
||||
}
|
||||
|
||||
$request = new \Saloon\Http\OAuth2\GetClientCredentialsTokenRequest($oauthConfig, $scopes);
|
||||
$request = new GetClientCredentialsTokenRequest($oauthConfig, $scopes);
|
||||
|
||||
$response = $this->send($request);
|
||||
|
||||
@@ -97,10 +103,10 @@ class AlfaBankConnector extends Connector implements HasPagination
|
||||
|
||||
// <SECTION name="logging_mutator" intent="Allow attaching a PSR-3 logger to the connector for debugging.">
|
||||
// <BELIEF_STATE "Logging should be an optional, opt-in feature. This method provides a fluent interface to attach a logging middleware, which will automatically sanitize sensitive data before output.">
|
||||
public function withLogging(\Psr\Log\LoggerInterface $logger): static
|
||||
public function withLogging(LoggerInterface $logger): static
|
||||
{
|
||||
$this->middleware()->onRequest(new \Apoloz\AlfaBank\Http\Middleware\LoggingRequestMiddleware($logger));
|
||||
$this->middleware()->onResponse(new \Apoloz\AlfaBank\Http\Middleware\LoggingResponseMiddleware($logger));
|
||||
$this->middleware()->onRequest(new LoggingRequestMiddleware($logger));
|
||||
$this->middleware()->onResponse(new LoggingResponseMiddleware($logger));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -110,7 +116,7 @@ class AlfaBankConnector extends Connector implements HasPagination
|
||||
*/
|
||||
public function withJwsVerification(string $publicKeyPem): static
|
||||
{
|
||||
$this->middleware()->onResponse(new \Apoloz\AlfaBank\Http\Middleware\VerifyJwsResponseMiddleware($publicKeyPem));
|
||||
$this->middleware()->onResponse(new VerifyJwsResponseMiddleware($publicKeyPem));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -125,8 +131,9 @@ class AlfaBankConnector extends Connector implements HasPagination
|
||||
->setClientId($this->alfaConfig->clientId ?? '')
|
||||
->setClientSecret($this->alfaConfig->clientSecret ?? '')
|
||||
->setRedirectUri($this->alfaConfig->redirectUri ?? '')
|
||||
->setAuthorizeEndpoint($idUrl . '/oidc/authorize')
|
||||
->setTokenEndpoint('/oidc/token');
|
||||
->setAuthorizeEndpoint($idUrl.'/oidc/authorize')
|
||||
->setTokenEndpoint('/oidc/token')
|
||||
->setAllowBaseUrlOverride();
|
||||
}
|
||||
|
||||
protected function defaultConfig(): array
|
||||
|
||||
@@ -23,7 +23,7 @@ enum Environment: string
|
||||
|
||||
// <SECTION name="sbp_environments" intent="Define base URLs for SBP API environments.">
|
||||
// <BELIEF_STATE "These cases provide the base URLs for the SBP (Faster Payments System) API, distinguishing between production and sandbox endpoints. The sandbox URL specifically includes a port, which is common for testing environments requiring specific network configurations.">
|
||||
case SBP_PRODUCTION = 'https://pay.alfabank.ru/fsCryptoProxy';
|
||||
case SBP_PRODUCTION = 'https://217.12.103.146/fsCryptoProxy';
|
||||
case SBP_SANDBOX = 'https://217.12.103.132:2443/fsCryptoProxy';
|
||||
// </SECTION>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user