- How do I install and set up the ATOL client in a Laravel project?
- Run `composer require anripuankare/atol-client` to install. For Laravel integration, use the factory class (`AtolApiFactory`) to create v3 or v4 clients with Guzzle HTTP and configure base URLs, API keys, and group codes. Bind the client to Laravel’s service container in `AppServiceProvider` for dependency injection.
- Does this package support both ATOL API v3 and v4? How do I switch between them?
- Yes, the package supports both v3 and v4. Use `AtolApiFactory::createV3()` for v3 and `AtolApiFactory::createV4()` for v4. Check ATOL’s API docs for breaking changes between versions, as your application may need conditional logic or separate service classes for each version.
- Can I use Laravel’s HTTP client instead of Guzzle with this package?
- The package relies on Guzzle internally, but you can wrap it in a Laravel service class to use Laravel’s HTTP client for consistency. Alternatively, replace Guzzle with Laravel’s client by extending the factory or creating a custom adapter layer.
- What Laravel versions are compatible with this package?
- The package is likely compatible with Laravel 7+ (PHP 7.4+). Test thoroughly with your target Laravel version, especially if using features like Laravel Cashier or queue workers, which may require additional configuration.
- How should I handle authentication (API keys, certificates) securely in Laravel?
- Store API keys and certificates in Laravel’s `.env` file or use the `config/services.php` file. For certificate-based authentication, ensure OpenSSL is enabled in your PHP environment. Avoid hardcoding credentials in your codebase.
- Does this package support ATOL webhooks for payment confirmations?
- The package itself doesn’t include webhook handling, but you can integrate it with Laravel’s route model binding and queue workers. Create a dedicated route (e.g., `POST /atol/webhook`) and use Laravel’s queue system to process async events like payment confirmations.
- What’s the best way to test this package in a Laravel application?
- Use Pest or PHPUnit to mock the ATOL client’s API calls during unit tests. For integration tests, use ATOL’s sandbox environment to simulate transactions. Test critical flows like refunds, chargebacks, and webhook processing to ensure reliability.
- Are there Laravel-specific helpers (e.g., Eloquent models) for storing ATOL transactions?
- The package doesn’t include Laravel-specific models, but you can create custom Eloquent models to store transaction data. Use Laravel migrations to define the schema, and integrate the ATOL client’s responses into your models for seamless data management.
- What should I do if the package fails or becomes outdated?
- As a fallback, use Guzzle directly to call ATOL’s API endpoints. Monitor the package’s GitHub for updates, and consider forking or contributing to maintain compatibility. If ATOL introduces breaking changes, update your wrapper layer or service class to handle them.
- Does ATOL require IP whitelisting or additional security layers that affect Laravel deployments?
- ATOL may require IP whitelisting or specific security configurations (e.g., VPC, proxies). Check ATOL’s documentation for deployment requirements and ensure your Laravel server’s IP is whitelisted. Use Laravel’s deployment tools (e.g., Forge, Envoyer) to manage infrastructure changes.