=== CatCode Fiskalizacija HR for WooCommerce ===
Contributors: catcode
Tags: fiskalizacija, fiscalization, croatia, cis, woocommerce
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Croatian fiscalisation of receipts for WooCommerce: ZKI, signed delivery to the Tax Administration CIS service, JIR and the QR code on every receipt.

== Description ==

In Croatia every receipt issued to an end customer must be fiscalised, whatever the payment method — since 1 January 2026 that includes payments to the transaction account. The shop computes the protective code (ZKI), sends the signed receipt to the Tax Administration fiscalisation service (CIS) and prints the unique receipt identifier (JIR) and a QR code on the receipt.

This plugin does that for WooCommerce orders, directly against CIS, with your own application certificate — no third-party invoicing service in between. It follows the Tax Administration "Tehnička specifikacija za korisnike" version 2.7 (21.07.2026) and FiskalizacijaSchema / WSDL 1.10.

Free:

* A fiscal receipt for every order when it reaches the status you choose (Processing or Completed).
* Gapless receipt numbers per business premises or per device (number/premises/device), restarted every 1 January if you like; continue a sequence started in other software.
* ZKI exactly as in chapter 12 of the specification (RSA-SHA256 signature, MD5).
* Request signed as an enveloped XML signature (Exclusive C14N, RSA-SHA256, SHA-256) with your FINA (or other trusted provider) application certificate. RSA-SHA1 is not used: the test service refuses it since 1 July 2026 and production from 1 January 2027.
* VAT grouped by rate (0, 5, 13, 25 %) from the WooCommerce tax lines; untaxed lines as exempt, not taxable or 0 %; the deposit fee ("povratna naknada") as Naknade.
* Payment method per gateway: G cash, K card, T transaction account, O other.
* JIR on the order; the CIS answer signature is verified against the fiskalcis certificate.
* If CIS cannot be reached, the receipt stays valid with its ZKI and is delivered automatically later (NakDost), with a new message id each time (legal deadline: two working days after the outage, Zakon o fiskalizaciji čl. 21; CIS refuses receipts older than 30 days).
* Receipt number, date and time, payment method, operator, ZKI, JIR and the QR code (porezna.gov.hr/rn) on the order page, the thank-you page and in customer e-mails.
* Receipt register with the last request and answer, "send again" after fixing a refused receipt, and the test-only "provjera" check of a receipt.
* Test (cistest.apis-it.hr, DEMO certificate) and production environments with separate certificates and counters; "Check connection" via the CIS echo method.
* The private key is kept in the database, encrypted; or point to a .p12 outside the web root from wp-config.php.
* HPOS and block checkout compatible. Translations: Croatian.

Pro (licence from catcode.com.ua):

* Storno receipts for refunds — full, partial and amount-only.
* Buyer OIB at checkout (classic and block checkout) for B2B sales paid in cash or by card.
* Fiscal data and QR in "PDF Invoices & Packing Slips" documents.
* CSV export of the receipt register.
* E-mail alerts when CIS refuses a receipt or cannot be reached.

What the plugin does not do: e-invoices between businesses (eRačun, Fiskalizacija 2.0 B2B) and eIzvještavanje; registering business premises (done in ePorezna).

== Installation ==

1. Upload and activate the plugin (WooCommerce must be active). Shop currency: EUR.
2. Register the web shop as business premises in ePorezna and note its label.
3. WooCommerce → Fiskalizacija → Settings: issuer OIB, VAT system, premises label, device number, payment methods.
4. Get a DEMO application certificate for the test environment and upload the .p12 with its password; press "Check connection to CIS".
5. Place test orders, check receipts in the register (and with "Check at CIS test").
6. Switch to Production and upload the production application certificate.

== Frequently Asked Questions ==

= What if CIS is down when the customer pays? =

The receipt is issued with its ZKI (shown to the customer and in the QR code) and delivered automatically as soon as CIS answers, marked as late delivery. The law gives two working days from the outage to deliver such receipts (Zakon o fiskalizaciji NN 89/2025, čl. 21 st. 2); CIS technically refuses receipts older than 30 days (restrictive error 176).

= Which certificate do I need? =

An application certificate for fiscalisation issued to your OIB by a trusted provider (e.g. FINA). The test environment accepts only DEMO certificates, production only production ones.

= Can I test without a certificate? =

Define `CCFH_CIS_MOCK` as `ok` (or `down`, `s002`, `s004`, `s006`, `s013`) in wp-config.php to simulate CIS answers in the test environment. A real test still needs a DEMO certificate.

== Changelog ==

= 1.0.0 =
* First release. Updates of this build arrive from catcode.com.ua in Dashboard → Updates (licence with updates, activated on the site).
