This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Laravel package (apo-bozdag/isyerim-pos) that provides integration with the IsyerimPOS payment gateway API. IsyerimPOS is a Turkish payment gateway that supports:
- Virtual POS (Sanal POS) for online card payments with 3D Secure
- Physical POS device integration
- Marketplace/sub-merchant management (Pazaryeri)
- Wallet operations (Cüzdan)
The package follows Laravel package development best practices using Spatie's laravel-package-tools.
composer test # Run all tests with Pest
composer test-coverage # Run tests with coverage report
vendor/bin/pest # Direct Pest invocationcomposer analyse # Run PHPStan static analysis (level 5)
composer format # Format code with Laravel Pintcomposer run prepare # Discover packages (runs automatically after autoload dump)vendor/bin/pest tests/ExampleTest.php # Run specific test file
vendor/bin/pest --filter="test_name" # Run specific test by name- Namespace:
Abdullah\IsyerimPos - Interface:
IsyerimPosInterface- Contract for main service - Service Provider:
IsyerimPosServiceProvider- Registers interface binding and config - Facade:
IsyerimPosfacade available for static access - Main Class:
IsyerimPos implements IsyerimPosInterface- Factory for service instances - HTTP Client:
IsyerimPosClient- Handles authentication and HTTP requests - Services: Four service classes for different API modules
- Exceptions: Custom exception hierarchy for error handling
The package auto-registers via Laravel's package discovery:
- Config file:
config/isyerim-pos.php(publishable) - Interface binding:
IsyerimPosInterface::class→ singleton - Alias:
IsyerimPos::class→IsyerimPosInterface::class
Based on the Postman collection (postman_collection.json), the IsyerimPOS API has four main modules:
Key endpoints:
getInstallments- Get installment options for cardpayRequest3d- Initiate 3D Secure paymentpayComplete- Complete payment after 3D authpayResultCheck- Check payment resultcommissions- Get commission ratescancelRequest- Cancel transactionrefundRequest- Refund transactiontransactions- Get transaction reportcreatePayLink- Create payment link
terminals- List POS devicescreateCart- Create cart/basket for POSgetCarts- List carts- Cart deletion endpoint
addSubmerchant- Add/update sub-merchantspaymentStatus- Check payment statuspayments- List paymentscreateToken- Generate auth token
walletAccounts- List wallet accountswalletBalance- Check balancewalletTransactions- Transaction historycollectionRequest- Money transfer/collection
API uses header-based authentication:
MerchantId- Merchant identifierUserId- User identifierApiKey- API authentication key
Base URL: https://apitest.isyerimpos.com/v1/
- The main implementation should go in
src/IsyerimPos.php - Create dedicated service classes for each API module (e.g.,
VirtualPosService,MarketplaceService,WalletService) - Add configuration options to
config/isyerim-pos.phpfor credentials and environment settings - Use Pest for testing with the existing
TestCasebase class - Follow PSR-4 autoloading:
Abdullah\IsyerimPosnamespace maps tosrc/
- PHP 8.2+ required (supports PHP 8.2 and 8.3)
- Laravel 11.x or 12.x compatibility
- Use Laravel Pint for formatting (runs via
composer format) - PHPStan level 5 for static analysis (analyzes
src/anddatabase/, excludesconfig/) - Octane compatibility check enabled
- Framework: Pest PHP 3.x (v3.0 for PHP 8.2+ compatibility)
- Test namespace:
Abdullah\IsyerimPos\Tests - Base test case:
tests/TestCase.phpextends Orchestra Testbench - Test credentials pre-configured in
getEnvironmentSetUp()method - Architecture tests available via Pest Arch plugin in
tests/ArchTest.php - CI runs tests on PHP 8.2 & 8.3 with Laravel 11 & 12
When adding new config values:
- Update
config/isyerim-pos.php - Document in README
- Ensure publishable via
php artisan vendor:publish --tag="isyerim-pos-config"
The package uses interface-based dependency injection for flexibility and testability:
// In your service providers or controllers
use Abdullah\IsyerimPos\Contracts\IsyerimPosInterface;
public function __construct(
protected IsyerimPosInterface $isyerimPos
) {}
// Or use the concrete class (aliased to interface)
use Abdullah\IsyerimPos\IsyerimPos;
public function __construct(
protected IsyerimPos $isyerimPos
) {}The IsyerimPosInterface is bound as a singleton in the service container and aliased to the concrete IsyerimPos class for backward compatibility.
- Interface Contract (
src/Contracts/IsyerimPosInterface.php): Interface for dependency injection - HTTP Client (
src/Client/IsyerimPosClient.php): Authentication, retry mechanism, logging - Services (all implemented):
VirtualPosService: 9 endpoints for online paymentsPhysicalPosService: 4 endpoints for POS devicesMarketplaceService: 4 endpoints for sub-merchantsWalletService: 4 endpoints for wallet operations
- Exceptions: Complete hierarchy (
IsyerimPosException,AuthenticationException,PaymentException,ApiException) - Main Class (
IsyerimPos implements IsyerimPosInterface): Factory pattern with lazy-loaded services - Service Provider: Interface binding with singleton and alias for backward compatibility
- Testing: 7 tests with 11 assertions, all passing
- CI/CD: GitHub Actions with auto-update CHANGELOG
- Current Version: v1.0.3
- Published: https://packagist.org/packages/apo-bozdag/isyerim-pos
- Requirements: PHP ^8.2, Laravel ^11.0 || ^12.0
- Use descriptive variable names
- Service methods follow API endpoint naming (camelCase)
- Configuration keys use snake_case
- Class names use PascalCase
- Always throw specific exceptions from
src/Exceptions/ - Use
AuthenticationExceptionfor credential issues - Use
PaymentExceptionfor payment-specific errors - Use
ApiExceptionfor general API failures
- All public methods must have PHPDoc with parameter types
- Complex array parameters use PHPDoc shape syntax
- Include usage examples in method docblocks when helpful