=== Easy Verifactu ===
Contributors: easyverifactu
Tags: verifactu, woocommerce, invoicing, aeat, spain
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 8.6
WC tested up to: 10.7
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Issue Verifactu-compliant invoices for your WooCommerce orders with Easy Verifactu, reported automatically to the Spanish Tax Agency (AEAT).

== Description ==

Easy Verifactu connects your WooCommerce store to your Easy Verifactu account so
that the invoices for your orders are generated, stored, and reported to the
Spanish Tax Agency (AEAT) under the Verifactu system, without you leaving WordPress.

The plugin does not generate or store invoices itself. WooCommerce sends each
confirmed order and refund to Easy Verifactu, and Easy Verifactu does the fiscal
work: it issues the invoice, signs it, keeps the immutable record required by
Verifactu, and submits it to AEAT.

**An active Easy Verifactu account is required.** You can create one at
https://easyverifactu.com. After installing the plugin you connect it to your
account with a pairing token from your Easy Verifactu dashboard.

= What the plugin does =

* **Sends orders and refunds to Easy Verifactu.** When an order is confirmed,
  updated, or refunded, the plugin notifies Easy Verifactu so the corresponding
  invoice or correction is issued and reported to AEAT.
* **Collects invoicing details at checkout.** Buyers can request a full invoice
  and enter their tax ID (NIF/CIF). Works on both the WooCommerce Blocks
  checkout and the classicann (shortcode) checkout.
* **Requires a tax ID for larger orders.** When an order total reaches the
  configured invoice threshold for euro-priced stores, the tax ID becomes
  required at checkout.
* **Validates tax IDs in real time.** The NIF/CIF entered at checkout is checked
  against Easy Verifactu so buyers get immediate feedback before they pay.

== External services ==

This plugin relies on the Easy Verifactu service to do its work, so it sends data
to Easy Verifactu (operated by the company behind https://easyverifactu.com). No
other third-party services are contacted.

It connects to two Easy Verifactu endpoints:

1. **Easy Verifactu API (`https://woo.easyverifactu.com`)**
   Used to verify your pairing token and to validate tax IDs entered at
   checkout.
   * **When:** when you connect the plugin in the settings page, and each time a
     buyer enters a tax ID (NIF/CIF) during checkout.
   * **Data sent:** your pairing token; and, for tax-ID validation, the buyer's
     tax ID (NIF/CIF), name or company name, and billing country.

2. **Easy Verifactu order ingest (`https://woo-ingest.easyverifactu.com`)**
   Used to notify Easy Verifactu of order and refund activity so invoices are
   issued and reported.
   * **When:** when an order is created, updated, status-changed, or refunded.
   * **Data sent:** your pairing token, the WooCommerce order ID, the order
     number, and the order's creation and last-modified timestamps. No customer
     names, addresses, line items, or payment data are sent in these events.

Easy Verifactu may also call your store back on an authenticated endpoint to
read the installed plugin version, so it can let you know when an update is
available. This requires your pairing token; the version is never exposed
publicly.

By connecting the plugin to your Easy Verifactu account you agree to the
Easy Verifactu Terms and Conditions and Privacy Policy:

* Terms and Conditions: https://www.easyverifactu.com/terminos-y-condiciones
* Privacy Policy: https://www.easyverifactu.com/politica-de-privacidad

== Installation ==

1. Make sure WooCommerce is installed and active (WooCommerce 8.6 or newer).
2. Install the Easy Verifactu plugin and activate it.
3. Create an account at https://easyverifactu.com if you do not have one, and
   copy your pairing token from the Easy Verifactu dashboard.
4. In WordPress, go to **WooCommerce → Easy Verifactu**, paste the pairing token,
   and save. The page confirms once the store is connected.

That's it. From then on, confirmed orders and refunds are sent to Easy Verifactu
and the matching invoices are issued and reported to AEAT.

== Frequently Asked Questions ==

= Do I need an Easy Verifactu account? =

Yes. The plugin is the bridge between your store and Easy Verifactu; the invoices
are issued, stored, and reported by Easy Verifactu, so an active account is
required.

= Does the plugin create or store invoices in WordPress? =

No. WordPress only sends order and refund events to Easy Verifactu. All invoice
generation, signing, the Verifactu immutable record, and the AEAT submission
happen on the Easy Verifactu side.

= Does it work with the new block-based checkout and the classic checkout? =

Yes. The invoice-intent checkbox and tax-ID field are added to both the
WooCommerce Blocks checkout and the classic shortcode checkout.

= When is the tax ID required at checkout? =

For euro-priced stores, once an order total reaches the invoice threshold
configured in the plugin settings, the tax ID (NIF/CIF) becomes mandatory.
Below that, buyers can still request a full invoice and enter a tax ID
optionally.

= What data leaves my store? =

See the "External services" section above for the exact endpoints, the data sent
to each, and when.

= Is my data safe if Easy Verifactu is unreachable? =

The plugin fails safe. If Easy Verifactu cannot be reached, checkout is not
blocked and the store keeps working; pending order events are reconciled once
the connection is healthy again.

== License ==

This plugin, all of its included libraries, and any other included assets are
licensed under the GNU General Public License version 2 or later (GPL-2.0-or-later),
or are under a GPL-compatible license.

The plugin's own code is GPL-2.0-or-later. Bundled JavaScript is built on the
WordPress and WooCommerce packages (GPL-2.0-or-later) provided by WordPress
core, together with first-party code and tooling under GPL-compatible licenses
(such as MIT). The distributed package contains no third-party PHP libraries.

A copy of the GPLv2 is included in license.txt and is available at
https://www.gnu.org/licenses/gpl-2.0.html.

== Source code and build process ==

This plugin ships with its complete, human-readable source code. The compiled
JavaScript in `assets/js/build/` is generated from the source in the `client/`
directory:

* `assets/js/build/settings-page.js` is built from `client/settings-page/index.jsx`
* `assets/js/build/legacy-checkout.js` is built from `client/legacy-checkout/index.js`

The build uses @wordpress/scripts (webpack and Babel). The configuration is in
the bundled `webpack.config.js`, `babel.config.js`, and `package.json`.

To rebuild the assets from source, from the plugin directory run:

1. Install dependencies: `npm install` (or `pnpm install`)
2. Build: `npm run build` (or `pnpm build`)

No third-party PHP libraries are bundled.

== Changelog ==

= 0.1.0 =
* Initial release.

== Upgrade Notice ==

= 0.1.0 =
Initial release.
