39 lines
1.3 KiB
Markdown
39 lines
1.3 KiB
Markdown
# Alfa Bank SDK Examples
|
|
|
|
This directory contains executable PHP scripts demonstrating various features of the SDK.
|
|
|
|
## How to Run
|
|
|
|
### 1. Standalone (CLI)
|
|
You can run any script directly from the terminal if you have PHP installed.
|
|
Ensure you have run `composer install` in the SDK root first.
|
|
|
|
```bash
|
|
cd alfa-bank-sdk
|
|
php examples/01_baas_flow.php
|
|
```
|
|
|
|
### 2. Laravel Tinker
|
|
Most examples are designed to be copy-paste friendly for `php artisan tinker`.
|
|
|
|
**General Steps:**
|
|
1. Open your Laravel project terminal.
|
|
2. Run `php artisan tinker`.
|
|
3. Instead of the manual `AlfaBank::baas(...)` initialization, use the Laravel helper:
|
|
```php
|
|
$baas = app(\Apoloz\AlfaBank\Core\AlfaBankConnector::class);
|
|
$baas->login(); // Or refresh token
|
|
```
|
|
4. Copy the rest of the logic (DTO creation, signing, sending) from the example file.
|
|
|
|
**Dedicated Tinker Workflow:**
|
|
See `17_laravel_tinker_scoring_creation.php` for a complete, copy-paste ready workflow for creating beneficiaries.
|
|
|
|
## Key Examples
|
|
|
|
- **01_baas_flow.php**: Basic setup and connection check.
|
|
- **13_h2h_auth_service.php**: How to get your first OAuth token.
|
|
- **14_generate_client_secret.php**: If you lost your Client Secret.
|
|
- **15_nominal_accounts_list.php**: Fetching lists (Beneficiaries).
|
|
- **17_laravel_tinker_scoring_creation.php**: **START HERE** for Nominal Accounts integration.
|