Update documentation and examples, add new nominal accounts features and authentication methods

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-01-24 17:18:59 +03:00
parent 2964c391b5
commit bb5f91d399
13 changed files with 290 additions and 157 deletions

View File

@@ -11,36 +11,10 @@ use Apoloz\AlfaBank\Core\AlfaConfig;
use Apoloz\AlfaBank\Enums\Environment;
use Apoloz\AlfaBank\Services\OpenSslCmsSigner;
use Apoloz\AlfaBank\Sbp\SbpConnector;
use Apoloz\AlfaBank\Services\H2HAuthService;
use Apoloz\AlfaBank\Requests\Accounts\GetAccountsRequest;
class AlfaBank
{
/**
* Creates a helper service for H2H Authorization (Authorization Code Flow).
*/
public static function auth(
string $clientId,
string $clientSecret,
string $redirectUri,
string $certificatePath,
string $privateKeyPath,
Environment $environment = Environment::SANDBOX
): H2HAuthService {
$config = new \Apoloz\AlfaBank\Core\AlfaConfig(
baseUrl: $environment->value,
certificatePath: $certificatePath,
privateKeyPath: $privateKeyPath,
clientId: $clientId,
clientSecret: $clientSecret
);
$signer = new \Apoloz\AlfaBank\Services\OpenSslCmsSigner($certificatePath, $privateKeyPath);
$connector = new \Apoloz\AlfaBank\Core\AlfaBankConnector($config, $signer);
return new H2HAuthService($connector, $clientId, $redirectUri, $environment);
}
/**
* Performs a health check on the connection.
* Throws an exception if authentication or account listing fails.
@@ -64,6 +38,9 @@ class AlfaBank
string $privateKeyPath,
Environment $environment = Environment::SANDBOX,
?string $caBundlePath = null,
?string $clientId = null,
?string $clientSecret = null,
?string $redirectUri = null,
?string $signingCertificatePath = null,
?string $signingPrivateKeyPath = null
): AlfaBankConnector {
@@ -72,6 +49,9 @@ class AlfaBank
certificatePath: $certificatePath,
privateKeyPath: $privateKeyPath,
caBundlePath: $caBundlePath,
clientId: $clientId,
clientSecret: $clientSecret,
redirectUri: $redirectUri,
signingCertificatePath: $signingCertificatePath,
signingPrivateKeyPath: $signingPrivateKeyPath
);