=== Fiscomm PURS E-Fiscalisation === Contributors: fiscomm Tags: woocommerce, fiskalizacija, racuni, srbija Requires at least: 5.8 Tested up to: 7.0 Stable tag: 1.4.0 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html WooCommerce connector for the Fiscomm E-Fiscalization API — automatically fiscalise Serbian Tax Authority (PURS) invoices on order completion. == Description == Fiscomm PURS E-Fiscalisation connects your WooCommerce store to the [Fiscomm E-Fiscalization API](https://fiscomm.rs/) and automatically submits fiscal invoices to the Serbian Tax Authority (Poreska Uprava Republike Srbije — PURS) when orders are completed or refunded. = Key features = * Automatic fiscalization on WooCommerce order completion and refund * Support for standard, advance, and proforma invoices * Support for B2B invoices (taxpayer identification number — PIB) * Configurable buyer ID fields (individual / company) * Per-product tax labels with support for variable products * Product SKU prefix / suffix support * Training mode for sandbox testing * Detailed fiscalization log per order * Serbian (sr_RS) and English (en_US) translations included * WooCommerce HPOS (High Performance Order Storage) compatible = Third-party services = This plugin connects to the **Fiscomm E-Fiscalization API** (https://fiscomm.rs/) to submit fiscal invoices to the Serbian Tax Authority. By using this plugin you agree to send order data (amounts, tax rates, buyer information) to that service on every fiscalized order. * Fiscomm service: https://fiscomm.rs/ * Fiscomm terms of use: https://fiscomm.rs/uslovi-koriscenja/ * Fiscomm privacy policy: https://fiscomm.rs/politika-privatnosti/ An active Fiscomm API key is required. You can obtain one at https://fiscomm.rs/. = Developer extensibility = The plugin exposes documented WordPress action and filter hooks so that developers can customise fiscalization behaviour without modifying plugin files. See `docs/HOOKS_REFERENCE.md` in the plugin folder for the full reference. Bundled third-party libraries and their licenses are documented in `THIRD_PARTY_LICENSES.md`. == Installation == 1. Upload the `fiscomm-purs-e-fiscalisation` folder to the `/wp-content/plugins/` directory, or install the plugin through the **Plugins > Add New** screen in WordPress. 2. Activate the plugin through the **Plugins** screen in WordPress. 3. Make sure WooCommerce is installed and active — this plugin requires WooCommerce. 4. Navigate to **WooCommerce > Settings > Fiscomm** and enter your Fiscomm API key. 5. Configure the desired invoice type, tax labels, and other options. 6. Use **Training Mode** to test the integration against the Fiscomm sandbox before going live. == Frequently Asked Questions == = Does this plugin work without WooCommerce? = No. This plugin requires WooCommerce to function. It will not initialise if WooCommerce is not active. = Where do I get a Fiscomm API key? = You can obtain an API key by registering at https://fiscomm.rs/. = Does the plugin support refunds? = Yes. Refund invoices are automatically submitted to PURS when a WooCommerce refund is processed (configurable). = Is WooCommerce HPOS supported? = Yes. The plugin is compatible with WooCommerce High Performance Order Storage (HPOS / custom order tables). = What data is sent to the Fiscomm API? = Order amounts, tax rates, and optionally buyer identification data (name, PIB, address) are sent to the Fiscomm API to generate a fiscal invoice. No payment card data is ever transmitted. = Can I test without submitting real invoices? = Yes. Enable **Training Mode** in the plugin settings to send all invoices to the Fiscomm sandbox environment instead of the live PURS system. == Changelog == = 1.4.0 = - Added automatic daily exchange rate synchronization from the NBS (National Bank of Serbia): rates for enabled currencies are fetched once per day (around 08:00) and applied to invoices, removing the need to enter them manually. - Added a per-currency "last updated" timestamp and source (auto/manual) shown in the exchange settings. - Added an "Auto-update rates daily" toggle so stores can switch to fully manual rate management, plus a "Sync rates now" button to fetch the latest rates on demand. - Manual rate edits are preserved for the day they are made; the next day's automatic sync refreshes them. - Fixed misleading help text for the Receipt Header/Footer toggles: the actual header and footer text is entered per order (in the Fiscalization Information box on the order page), not in a separate dashboard. - Fixed the PURS payment type help text to list all supported types (Cash, Credit Card, Voucher, Check, Bank Transfer, Instant Payment, Other Non-Cash) instead of only five. - Duplicate "already being processed / already issued" fiscalization responses (which happen on accidental double-sends — e.g. a double click or a retry) are now logged and skipped silently with a neutral order note, instead of showing a confusing error. These are harmless system-level races and need no action. = 1.3.5 = - Fixed advance invoice `dateTimeOfIssue` being sent without timezone information; the full ISO 8601 datetime with offset (e.g. `+02:00`) is now forwarded to the API so the backend parses the correct local time instead of interpreting it as UTC. = 1.3.4 = - Fixed rounding mode incorrectly rounding line-item amounts to whole dinars instead of 2 decimal places; "Enable two decimal rounding" now correctly rounds to 2 decimals as labeled. - Applied rounding mode consistently to refund invoices (previously only applied to normal invoices). = 1.3.3 = - Fixed items with zero total amount (including shipping) being incorrectly sent to the fiscalization API; they are now skipped before submission. - Fixed items with an empty name being sent to the API; they are now skipped alongside zero-amount items. - Fixed PIB auto-fill not working on order open: buyer ID code (type 10) and value are now correctly populated from the configured PIB meta key when the meta box renders. = 1.3.2 = - Fixed unnecessary /auth/verify-api-token HTTP call on every WordPress page load; API key validation is now triggered only on demand (admin verify action, fiscal requests), reducing server load for all connected sites. - Fixed proforma-fiscalized order being incorrectly blocked from further fiscalization ("Order already fiscalized"): shared meta keys (_referent_document_number, _referent_document_dt) are no longer written for proforma invoices; invoiceExists() now uses per-type suffixed journal/URL as the primary signal. = 1.3.1 = - Fixed duplicate order error (ERR_00603) on second fiscalization attempt caused by WordPress meta cache race condition. - Added explicit cache invalidation after order and refund meta save to ensure subsequent invoiceExists() checks always see updated markers. - Cache clearing now works on both HPOS (High-Performance Order Storage) and classic post-based WooCommerce systems. - Added info logging for meta persistence tracking to help diagnose fiscalization issues. - Enhanced invoiceExists() documentation to clarify cache behavior. = 1.3.0 = - Fixed order list fiscalization column to show all actually created documents (proforma, all advance invoices, final invoice, and refund invoices). - Refund invoices are now visually highlighted in red in the orders list for faster identification. - Fixed false proforma display in orders list: proforma is now shown only when proforma URLs/PDF are present. - Fixed advance finalization request payload: finalize now sends payment entries in finalize format (`amount=0` + `advanceAmount`) to avoid double-payment interpretation while preserving backend finalize logic. - Fixed finalize response parsing when backend returns wrapped payloads (`finalReceipt`), so created final receipts are correctly persisted to order meta. - Advance invoice datetime is now auto-filled and sent only for advance sale flow; other invoice types no longer send `dateTimeOfIssue`. = 1.2.3 = - Added "Order number under receipt" setting (Receipt Header/Footer section): follow the shop setting from the Fiscomm platform (default), always show, or always hide the WooCommerce order number printed below fiscal receipts. = 1.2.2 = - Fixed fatal error ("syntax error, unexpected '|'") on PHP 7.4 that prevented the plugin from initializing — the plugin now runs on PHP 7.4 as declared. - Translated all remaining hardcoded admin strings; complete Serbian (Cyrillic) and English translations with updated language files. - Fixed plugin directory listing metadata (tags and contributors) not displaying on WordPress.org. = 1.2.1 = - Added API key info card in plugin settings showing account details fetched from Fiscomm. - Added debug logging for API key verification request and response when debug logging is enabled. - Fixed QR code rendering in fiscalization confirmation emails (restored default renderer). - Fixed double-fiscalization of refunds when multiple refunds exist on the same order. - Fixed advance invoice finalization so a failed meta save cannot trigger a duplicate API call on retry. - Fixed buyer ID fields not being recognized when values contain leading/trailing whitespace. - Meta box fields on fiscalized orders are now editable so buyer identification can be added before processing a refund. - Added warning notice in the meta box when refund fiscalization is enabled but buyer ID is not set. - Updated WordPress compatibility to 6.8. = 1.2.0 = - Removed third-party CDN loading for admin assets; now uses bundled local assets only. - Aligned plugin version metadata across plugin header, core constant, and readme stable tag. = 1.1.1 = - Added public extensibility hooks for receipt lifecycle and metadata persistence. - Added hook reference and WordPress hook audit documentation. - Improved CI quality gates and strengthened initial test coverage. = 1.1.0 = - Added support for default values for all settings - Refactored fiscalization settings and added logging functionality - Removed unused AddSettingsTab trait and related settings tab. - Introduced new system settings section for logging configuration. - Added custom logging functionality to track fiscalization processes. - Updated various methods to handle new logging and settings features. - Enhanced order refund handling with automatic fiscalization on status change. - Added new language files for English and Serbian translations. - Cleaned up deprecated code and improved overall structure. = 1.0.0 = - Initial release = 0.3.22 = - Call to undefined method WC_Order_Item_Fee::get_product() fix = 0.3.21 = - When country is empty, defaults to Serbia - Added more information about fiscalization under Shipping details in order = 0.3.20 = - Fixed exclude from fiscalization for variation products - Added new way of using SKU with Product Name (SKU - Product Name) = 0.3.19 = - API Key change support with saved settings = 0.3.18 = - Advance invoices order warning fix = 0.3.17 = - Fix labels not showing per product = 0.3.16 = - Product SKU prefix & suffix support = 0.3.15 = - Reasons for not fiscalizable orders = 0.3.14 = - Option for hiding Tax Label section on Product page - Disable fiscalization for orders outside of Serbia - Synchronized Buyer IDS with documentation - Refund show fix = 0.3.13 = - Adjusted timeout for API requests to 30 seconds = 0.3.12 = - WooCommerce HPOS compatibility - Tax labels caching = 0.3.11 = - Added settings for using product SKU instead of product name in receipts = 0.3.10 = - Added number format for rounding on 2 decimals for Shipping = 0.3.9 = - Admin notice when Woocommerce is not installed - Fixed buyerId sending without buyerId value = 0.3.8 = - Header and Footer text on receipts - Buyer ID is now optional fields for Refunds - Buyer ID is now shown even if only "Refunds" are enabled, and not "PIB" = 0.3.7 = - Fixed get_product returning bool instead of product object = 0.3.6 = - Switched GuzzleHttp to wp_remote_post & wp_remote_get for better compatibility = 0.3.5 = - Now supports disabling shipping item per payment method = 0.3.4 = - Added buyer cost center field in orders page = 0.3.3 = - Moved product specific tax labels to advanced tab - Added support for specific tax label for variable products = 0.3.2 = - Patched error on finalizing advance invoices (createInvoice method error) = 0.3.1 = - Removed sessions from the plugin = 0.3.0 = - Added support for advance invoices = 0.2.12 = - Fixed bug with woocommerce not saving Sell to specific countries setting = 0.2.11 = - Now supports only fee orders if Woocommerce Specific Fees are included in the settings = 0.2.10 = - Supports enabling of two decimals rounding in Woocommerce Specific Settings = 0.2.9 = - Added support for overriding default/foreign tax labels for shipping invoice item = 0.2.8 = - Added support for adjusting exchange rate for foreign currencies = 0.2.1 = - Supports advance invoices - Added support for B2B invoices by adding additional Taxpayer Identification Number field. - Separated settings into sections for better readability = 0.2.0 = - Now supports multiple emails for training invoices - Added exclusive training mode = 0.1.4 = - Feature for setting the name of the invoice item for shipping. = 0.1.3 = - Added excluding shipping costs = 0.1.1 = - Fix for dropdown = 0.1.0 = - Released: March 4, 2022