forked from apoloz/alfa-bank-sdk
feat: Add Laravel tinker examples and update nominal accounts functionality
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
38
examples/README.md
Normal file
38
examples/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# 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.
|
||||
Reference in New Issue
Block a user