=== Modulo Integration for Verifactu ===
Contributors: peki
Tags: woocommerce, ecommerce, spain, tax, invoice
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WooCommerce to Verifactu Modulo for Spanish tax compliance. Sandbox by default; upgrade in the app for live invoicing.

== Description ==

**Modulo Integration for Verifactu** connects your **WooCommerce** store to **Verifactu Módulo** for **Spanish tax compliance**: **Verifactu** (national electronic invoicing), **TicketBAI** (Basque Country), and related **AEAT** requirements. Sell in Spain or to Spanish B2B customers with fewer manual steps—orders can trigger **invoice registration** and customers receive **official QR codes** for verification.

= Important: Sandbox first, production after upgrade =

When you connect this plugin for the first time, your **Verifactu Módulo** account runs on the **Sandbox** plan: **test invoices only**, for integration checks. **You cannot issue official production invoices** until you **upgrade** your subscription inside **[app.verifactumodulo.com](https://app.verifactumodulo.com)** (Billing / Plans—Lite, Basic, Pro, Enterprise, etc.). The WordPress plugin does **not** change your plan or billing; you must complete that step in the web app. After upgrading, switch to **Production** / live mode there as guided by Verifactu Módulo.

The plugin is built for merchants who need **WooCommerce + Spain** workflows: online shops, marketplaces, and agencies managing **Spanish VAT (IVA)**, **NIF/CIF**, and **electronic invoice** rules without building a custom AEAT integration.

**Note:** Verifactu is a regulation-based electronic invoicing system from the **Spanish Tax Agency (AEAT)**. This plugin helps you meet those requirements through **Verifactu Módulo**; it does not replace legal or tax advice.

= Why use this plugin? =

* **WooCommerce + Verifactu / TicketBAI** in one flow: connect once, then automate eligible orders.
* **AEAT-oriented output**: invoice metadata and **QR codes** aligned with compliance workflows.
* **Hosted configuration**: company data, environment (production/sandbox), and regions are managed in **app.verifactumodulo.com**—WordPress stays lean.
* **HPOS compatible**: works with WooCommerce **High-Performance Order Storage**.

= Key features =

* **Automatic invoice registration** for configured order statuses (e.g. processing/completed)
* **QR code display** on thank-you page, customer order view, and relevant emails
* **One-click onboarding** with **Verifactu Módulo** (no heavy setup inside wp-admin)
* **Retry handling** for failed submissions (scheduled + manual retry from the order screen)
* **Sandbox by default** on first connect; **production invoicing** after you **upgrade the plan** in the web app (not in WordPress)

= Regions & tax systems =

* **Verifactu** (Spain – national)
* **TicketBAI** (Bizkaia, Gipuzkoa, Álava)
* **IGIC** context (Canary Islands) where applicable via your Módulo configuration

= Requirements =

* **WordPress** 5.8+
* **WooCommerce** 5.0+
* **PHP** 7.4+
* **HTTPS** (SSL) recommended for production
* Active **Verifactu Módulo** account — [verifactumodulo.com](https://verifactumodulo.com)

= Español (resumen) =

Integración **WooCommerce** con **Verifactu** y **TicketBAI**: cumplimiento fiscal en España, registro ante la **AEAT** y códigos QR para tus clientes. La configuración avanzada se gestiona en **app.verifactumodulo.com**. Las cuentas nuevas empiezan en **Sandbox**; para facturación real, mejora el plan en la aplicación web.

== Installation ==

= Automatic installation =

1. Log in to your WordPress admin.
2. Go to **Plugins → Add New**.
3. Search for **Modulo Integration for Verifactu** (or “Verifactu WooCommerce”).
4. Click **Install Now**, then **Activate**.

= Manual installation =

1. Download the plugin ZIP.
2. Go to **Plugins → Add New → Upload Plugin**.
3. Choose the ZIP and install, then **Activate**.

= Connect to Verifactu Módulo =

1. In wp-admin, open **WooCommerce → Verifactu Módulo**.
2. Click **Connect to Verifactu Módulo** and complete onboarding at **app.verifactumodulo.com**.
3. When you return to WordPress, confirm the connection status on the same screen.
4. Expect **Sandbox mode** until you **upgrade** at **app.verifactumodulo.com**. For real customer invoices, choose a paid plan (Lite, Basic, Pro, Enterprise, …) and enable **Production** there.

Detailed company, tax region, billing, and environment (Sandbox vs Production) are managed in the **Verifactu Módulo** web application—not inside WordPress.

== External services ==

This plugin relies on external services for compliance and QR rendering:

1. **Verifactu Módulo** (`app.verifactumodulo.com`, API on `ogjjcksexxbvguygexsk.supabase.co`)
   * **Purpose:** Store onboarding, invoice registration, and metadata for Verifactu/TicketBAI workflows.
   * **Data sent:** Order identifiers, totals, taxes, line items, billing fields (name, company, email, phone), and store identifiers when you connect or when orders are processed.
   * **When:** During onboarding and when eligible WooCommerce orders are sent for invoicing.
   * **Terms:** https://verifactumodulo.com/terms
   * **Privacy:** https://verifactumodulo.com/privacy

2. **QRServer** (`api.qrserver.com`)
   * **Purpose:** Generate QR images for AEAT verification links on the storefront and emails.
   * **Data sent:** The verification URL encoded in the image request.
   * **When:** When a page or email renders a Verifactu QR block.
   * **Terms:** https://goqr.me/legal/tos-api.html
   * **Privacy:** https://goqr.me/privacy-safety-security/

== Frequently Asked Questions ==

= Is this a WooCommerce Verifactu plugin for Spain? =

Yes. It is designed for **WooCommerce** stores that must align with **Spain** electronic invoicing rules (**Verifactu**, **TicketBAI**, AEAT) using **Verifactu Módulo** as the compliance backend.

= Do I need a Verifactu Módulo account? =

Yes. Register through the plugin’s connect flow or at [verifactumodulo.com](https://verifactumodulo.com).

= Where is the settings screen in WordPress? =

After activation, go to **WooCommerce → Verifactu Módulo**. Advanced settings live on **app.verifactumodulo.com**.

= Why is my store in Sandbox after connecting? =

**New connections always start on the free Sandbox plan** (test invoices, integration testing). This plugin **cannot** move you to production by itself. Open **[app.verifactumodulo.com](https://app.verifactumodulo.com)**, upgrade to a **paid plan** that fits your volume, and switch to **Production** / live invoicing there when your account is eligible.

= How do I issue real invoices (not test)? =

1. Log in to **app.verifactumodulo.com**.  
2. **Upgrade** from Sandbox to a plan (Lite, Basic, Pro, Enterprise, …).  
3. Configure **Production** mode and company data as required by Verifactu Módulo.  
Pricing and limits are defined only in the web app, not in this plugin.

= Which order statuses trigger processing? =

By default, **Processing** and **Completed** orders are handled automatically (configurable in plugin behaviour).

= What if an order fails? =

Failed attempts are stored on the order; the plugin can **retry** on a schedule and you can **retry manually** from the order screen.

= Can I test before production? =

Yes. **Sandbox is the default** after you connect. Use it to validate the integration. When you are ready for **live AEAT invoicing**, upgrade your plan and enable production in **app.verifactumodulo.com**—not in WordPress alone.

= Is data transmitted securely? =

API traffic uses **HTTPS**. API keys are stored in WordPress options and only partially shown in the admin UI.

= Where do customers see the QR code? =

On the **order received** page, **order details** in “My account”, and in supported **order emails** when a QR URL is available.

= Can I style the QR block? =

Yes. Target the `.verifactu-qr-container` class in your theme CSS.

== Screenshots ==

1. WooCommerce Verifactu Módulo screen: connection status and statistics
2. Connect to Verifactu Módulo (onboarding entry point)
3. QR code on the order thank-you page
4. Order edit screen: Verifactu invoice meta box
5. QR block in a customer email

== Changelog ==

= 1.0.9 =
* Readme and admin UI: clarify that **Sandbox is the default** after connect; **production invoicing** requires **upgrading the plan** at app.verifactumodulo.com (WordPress does not change billing).
* Dashboard: warning notice when environment is not Production; Getting Started step for Sandbox vs paid plans.

= 1.0.8 =
* Removed `load_plugin_textdomain()`; WordPress 4.6+ loads translations for plugins hosted on WordPress.org automatically (Plugin Check).
* Readme short description rewritten in standard English for the directory language check.

= 1.0.7 =
* Text domain aligned with plugin directory slug: `modulo-integration-for-verifactu-2` (PHPCS/WPCS TextDomainMismatch).
* Renamed translation files to `modulo-integration-for-verifactu-2-*.po` / `.pot`; added explicit `load_plugin_textdomain()` on `init`.
* PHPCS: broadened NonceVerification ignore for OAuth callback blocks (external redirect, no WP nonce).

= 1.0.2 =
* Rebranded plugin: renamed to "Modulo Integration for Verifactu" with slug modulo-integration-for-verifactu
* Updated text domain to "modulo-integration-for-verifactu" across all files
* Moved all admin CSS and JavaScript from inline output to properly enqueued files via wp_enqueue_style() and wp_enqueue_script() on admin_enqueue_scripts
* Removed all remaining inline style attributes from admin templates; moved to admin/css/admin.css
* Added external services documentation for Verifactu Modulo API and QRServer (api.qrserver.com) in readme.txt

= 1.0.1 =
* Branding update: Plugin name changed from "Verifactu Module for WooCommerce" to "Modulo Verifactu for WooCommerce"
* Updated text domain from "verifactu-module-for-woocommerce" to "modulo-verifactu-for-woocommerce"
* No functional changes

= 1.0.0 =
* Initial release
* One-click onboarding with app.verifactumodulo.com
* Automatic order processing (on completed and processing status)
* QR code display on thank you page, order details, and emails
* Admin dashboard with statistics and connection status
* Order meta box with invoice details and manual retry
* Multi-region support (Verifactu, TicketBAI, IGIC)
* Production and Sandbox environment support
* Automatic hourly retry for failed orders
* WooCommerce HPOS (High-Performance Order Storage) compatible

== Upgrade Notice ==

= 1.0.2 =
Addresses WordPress plugin review feedback: CSS/JS now properly enqueued; external service documentation added to readme.

= 1.0.0 =
Initial release of Modulo Integration for Verifactu.

== Privacy Policy ==

This plugin sends order data to the Verifactu Módulo API for tax compliance. Data can include:

* Order identifiers, totals, and tax amounts
* Billing name, company, email, phone
* Line item names, quantities, and prices

See the [Verifactu Módulo Privacy Policy](https://verifactumodulo.com/privacy) for details.

== Support ==

* [Documentation](https://verifactumodulo.com/docs)
* [WordPress.org support forum](https://wordpress.org/support/plugin/modulo-integration-for-verifactu/)
* [Contact](https://verifactumodulo.com/contact)

== Credits ==

Developed by PEKI AS.
