Fiscalization for Croatian invoices.
Create new instance of Fiscalization
class and pass required certificate path and password.
import { Fiscalization } from '@ts.fina/fiscalization';
import { readFileSync } from 'fs';
const certificate = readFileSync('/path-to-certificate/cert.pfx');
const fiscalization = new Fiscalization(
certificate,
CERTIFICATE_PASSWORD,
);
Create and send invoice.
import { Invoice } from '@ts.fina/fiscalization';
const invoice: Invoice = { ... }
const xml = fiscalization.create(invoice);
axios.post(FINA_PRODUCTION_URL, xml, { headers: { 'Content-Type': 'text/xml' } })