giorgigrdzelidze/laravel-rsge

Laravel 12 client for Georgian Revenue Service (rs.ge) e-services: cash register Z-reports today, waybills and invoices next.

Maintainers

Package info

github.com/GiorgiGrdzelidze/laravel-rsge

pkg:composer/giorgigrdzelidze/laravel-rsge

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-20 14:08 UTC

This package is auto-updated.

Last update: 2026-04-20 14:30:42 UTC


README

Latest Version PHP Version License CI

πŸ‡¬πŸ‡ͺ Laravel RSGE

A production-grade Laravel package for the Georgian Revenue Service (rs.ge) SOAP API. Fetch cash register Z-reports today β€” waybills, taxpayer info, and more coming soon.

✨ Features

  • 🧾 Cash Register Z-Reports β€” fetch daily Z-report details & sums
  • πŸ” Basic Auth β€” username/password authentication out of the box
  • πŸ”„ Retry with Backoff β€” automatic retry on transient rs.ge system errors
  • πŸ§ͺ FakeTransport β€” deterministic unit testing without hitting rs.ge
  • πŸ—οΈ Extensible Architecture β€” add new rs.ge services in minutes
  • πŸ›‘οΈ Typed Exceptions β€” RsgeAuthenticationException, RsgeNotFoundException, RsgeSystemException, RsgeTransportException
  • πŸ“¦ Zero Config β€” Laravel auto-discovery, sensible defaults

πŸ“‹ Requirements

Requirement Version
PHP 8.2+
Laravel 12.x / 13.x
Extensions ext-soap, ext-simplexml

πŸš€ Installation

composer require giorgigrdzelidze/laravel-rsge

Publish the config file (optional):

php artisan vendor:publish --tag=rsge-config

βš™οΈ Configuration

Add to your .env:

RSGE_USERNAME=your_username
RSGE_PASSWORD=your_password
πŸ”§ Optional settings
RSGE_CASH_REGISTER_WSDL=https://services.rs.ge/taxservice/taxpayerservice.asmx?WSDL
RSGE_LOGGING_ENABLED=true
RSGE_LOG_CHANNEL=stack

πŸ“– Usage

🧾 Fetch Z-Report Details

use Rsge\Laravel\Facades\Rsge;

$reports = Rsge::cashRegister()->getZReportDetails(
    startDate: '2025-01-01',
    endDate: '2025-01-31',
);

foreach ($reports as $report) {
    echo "{$report->deviceNumber}: {$report->paidAmount} GEL ({$report->quantity} receipts)\n";
}

πŸ“… Using Carbon Dates

use Carbon\CarbonImmutable;
use Rsge\Laravel\Facades\Rsge;

$start = CarbonImmutable::now()->startOfMonth();
$end = CarbonImmutable::now()->endOfMonth();

$reports = Rsge::cashRegister()->getZReportDetails($start, $end);

πŸ›‘οΈ Exception Handling

use Rsge\Laravel\Exceptions\RsgeAuthenticationException;
use Rsge\Laravel\Exceptions\RsgeNotFoundException;
use Rsge\Laravel\Exceptions\RsgeSystemException;
use Rsge\Laravel\Exceptions\RsgeTransportException;
use Rsge\Laravel\Facades\Rsge;

try {
    $reports = Rsge::cashRegister()->getZReportDetails('2025-01-01', '2025-01-31');
} catch (RsgeAuthenticationException $e) {
    // ❌ Invalid username or password
} catch (RsgeNotFoundException $e) {
    // πŸ“­ No data for the given date range
} catch (RsgeSystemException $e) {
    // ⚠️ Transient rs.ge system error
} catch (RsgeTransportException $e) {
    // 🌐 Network or SOAP protocol failure
}

πŸ”„ Retry on Transient Errors

use Rsge\Laravel\Facades\Rsge;
use Rsge\Laravel\Support\Retry;

$reports = Retry::onSystemError(
    operation: fn () => Rsge::cashRegister()->getZReportDetails('2025-01-01', '2025-01-31'),
    attempts: 3,
    baseDelayMs: 200,
);

πŸ—οΈ Architecture

src/
β”œβ”€β”€ Contracts/            # πŸ“œ Interfaces (Transport, Credentials, Service)
β”œβ”€β”€ Auth/                 # πŸ” Authentication (BasicCredentials)
β”œβ”€β”€ Transport/            # πŸš› SoapTransport + FakeTransport for testing
β”œβ”€β”€ Exceptions/           # πŸ’₯ Typed exceptions mapped from rs.ge error codes
β”œβ”€β”€ Support/              # πŸ› οΈ ErrorMapper, Retry helper
β”œβ”€β”€ Services/
β”‚   β”œβ”€β”€ AbstractService   # 🧩 Base class for all services
β”‚   └── CashRegister/     # 🧾 Z-Report service, DTOs, request objects
β”œβ”€β”€ Facades/              # 🎭 Rsge facade
β”œβ”€β”€ Rsge.php              # 🏭 Manager (service factory)
└── RsgeServiceProvider   # πŸ“¦ Laravel service provider

πŸ—ΊοΈ Roadmap

Service SOAP Method Status
Cash Register Z-Report Details Get_Z_Report_Details βœ… Done
Cash Register Z-Report Sum Get_Z_Report_Sum πŸ”œ Planned
Taxpayer Public Info GetTPInfoPublic πŸ”œ Planned
Taxpayer Public Contacts GetTPInfoPublicContacts πŸ”œ Planned
Payer Info Get_Payer_Info πŸ”œ Planned
Legal Person Info Get_LegalPerson_Info πŸ”œ Planned
Waybill Month Amount Get_Waybill_Month_Amount πŸ”œ Planned
Income Amount Get_Income_Amount πŸ”œ Planned
Comparison Act Get_comp_act_new πŸ”œ Planned
Payer NACE Info Get_Payer_Nace_Info πŸ”œ Planned
QuickCash Info Get_QuickCash_Info πŸ”œ Planned

🧩 Adding a New Service

  1. Create DTOs in src/Services/YourService/DTOs/ with fromSoap() method
  2. Create Requests in src/Services/YourService/Requests/ with toSoap() method
  3. Create a Service class extending AbstractService
  4. Register in RsgeServiceProvider as a singleton
  5. Add accessor to Rsge manager + update facade PHPDoc
  6. Write tests using FakeTransport

πŸ§ͺ Testing & QA

# πŸš€ Full QA pipeline (lint + static analysis + tests)
composer qa

# Individual commands
composer pint:test    # ✏️ Code style (Pint)
composer stan         # πŸ” Static analysis (PHPStan level max)
composer test         # βœ… Tests (PHPUnit)

πŸ“„ License

MIT β€” see LICENSE file.

Made with ❀️ in Georgia πŸ‡¬πŸ‡ͺ