Skip to content

tkresic/croatian-fiscalization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Croatian Fiscalization

PHP package for Croatian fiscalization. Provides basic service for fiscalizing the invoices with Croatian tax PDV (25%).

Install the required package

  • composer require tonikresic/croatian-fiscalization

Example usage

You need to have a demo certificate with its password, the company UID and the user UID in order for fiscalization to work.

$userUID = 'USER_UID';
$companyUID = 'COMPANY_UID';
$certificatePath = 'CERTIFICATE_PATH';
$certificatePassword = 'CERTIFICATE_PASSWORD';

$cf = new tonikresic\CroatianFiscalization\CroatianFiscalization();

$certificate = new tonikresic\CroatianFiscalization\Company\Certificate($certificatePath, $certificatePassword);
$company = new tonikresic\CroatianFiscalization\Company\Company($companyUID, $certificate, true, true);

$cf->configure($company);

$invoiceObject = (object) [
    'userUID' => $userUID,
    'fiscal_abbreviation' => 'G',
    'company' => $company,
    'gross' => 12.5,
    'net' => 10,
    'number' => 1,
    'business_place_label' => 1,
    'cash_register_label' => 1,
    'fiscal_data' => (object) [
        'zki' => NULL,
        'jir' => NULL
    ],
    'created_at' =>  date('Y-m-d H:i:s'),
    'fiscal_at' => NULL,
];

$response = $cf->fiscalize($invoiceObject);

Running the tests

  • php vendor/phpunit/phpunit/phpunit