feat: update BaaS flow example and connector OAuth implementation

- Updated 01_baas_flow.php example to properly initialize BaaS with auth credentials
- Removed unused GetTokenRequest import from AlfaBankConnector
- Removed OAuth2Api interface implementation from AlfaBankConnector
- Renamed resolveOauth2Config method to defaultOauthConfig in AlfaBankConnector

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-01-26 15:36:42 +03:00
parent e83bb5e7e7
commit 86f50eed6a
2 changed files with 15 additions and 12 deletions

View File

@@ -31,18 +31,23 @@ try {
// METHOD B: Authorization Code Flow (H2H) (REQUIRED for Nominal Accounts)
// See examples/13_h2h_auth_service.php for the full setup
$auth = \Apoloz\AlfaBank\AlfaBank::auth(
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
redirectUri: 'https://...',
// We re-initialize with auth credentials if we didn't pass them initially
$baas = AlfaBank::baas(
certificatePath: __DIR__ . '/certs/client.cer',
privateKeyPath: __DIR__ . '/certs/private.key',
environment: Environment::SANDBOX
environment: Environment::SANDBOX,
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
redirectUri: 'https://...'
);
// Assuming you have a saved refresh token:
// $auth->refreshToken('saved_refresh_token');
// Now you can use OAuth methods:
// $url = $baas->getAuthorizationUrl();
// or
// $baas->refreshAccessToken('saved_refresh_token');
echo "Authentication Successful!\n";
echo "Authentication Configured!\n";
// 2. Create a Beneficiary (Counterparty)
echo "Creating Beneficiary...\n";