=== APITMS - Facturación Perú (RUC y DNI) ===
Contributors: apitms
Tags: ruc, dni, sunat, peru, facturacion, boleta, factura, checkout, ecommerce
Requires at least: 5.6
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

Real-time RUC and DNI auto-fill and validation during checkout for online stores in Peru, with support for Sales Receipt (Boleta) and Invoice (Factura).

== Description ==

**APITMS - Facturación Perú** is the definitive checkout solution for online stores operating in Peru. It allows automatic completion and real-time validation of **RUC** and **DNI** customer information during checkout, speeding up sales and preventing invalid electronic receipts.

Connect directly to the high-speed infrastructure of **APITMS** (https://apifacturacion.com/) with responses in milliseconds.

### Key Features:
* **Dynamic Receipt Selector:** Allows buyers to choose between **Boleta de Venta** (DNI) or **Factura** (RUC).
* **DNI Auto-Completion:** Automatically fills First and Last Names in 1 second by entering an 8-digit DNI number.
* **RUC Auto-Completion:** Automatically populates Company Name (Razón Social) and Fiscal Address by entering an 11-digit RUC number.
* **SUNAT Status & Condition Verification:** Confirms that the RUC is **ACTIVO** (Active) and **HABIDO** (Located), avoiding tax penalties for invalid vouchers.
* **Full Order Integration:** Saves voucher type, document number, company name, and fiscal status directly in order details, admin panel, and notification emails.
* **HPOS Compatible:** Fully prepared for High-Performance Order Storage in modern eCommerce stores.

### Descripción en Español

**APITMS - Facturación Perú** permite autocompletar y validar en tiempo real los datos de **RUC** y **DNI** en el proceso de pago para tiendas virtuales en Perú.

* **Selector de Comprobante:** Permite a tus clientes elegir entre Boleta de Venta (DNI) o Factura (RUC).
* **Autocompletado en 1 segundo:** Llena nombres, apellidos, razón social y domicilio fiscal al instante.
* **Validación SUNAT en Vivo:** Verifica que el RUC esté ACTIVO y HABIDO para evitar multas tributarias.
* **Compatibilidad HPOS:** Totalmente optimizado para High-Performance Order Storage de WooCommerce.

== Installation ==

1. Download the `apitms.zip` file.
2. In your WordPress admin dashboard, navigate to **Plugins > Add New > Upload Plugin**.
3. Select `apitms.zip` and click **Install Now**.
4. Activate the plugin through the **Plugins** menu in WordPress.
5. Go to **WooCommerce > Settings > Facturación Perú (API SUNAT)**.
6. Enter your **APITMS API Token** (available at https://apifacturacion.com/).
7. Click **Probar Conexión con el Token** to verify connectivity and save changes.

== Frequently Asked Questions ==

= Where do I obtain my API Token? =
You can register and acquire or renew your API Token directly on our official website: https://apifacturacion.com/  
Available plans:
* **Monthly Plan:** S/ 10.00 / month.
* **Annual Plan:** S/ 50.00 / year (special discount).

= What happens if the customer enters an invalid or inactive RUC? =
If strict validation is enabled in plugin settings, the checkout will display a notice preventing the order from proceeding until a valid and active RUC is entered.

= Does the plugin automatically fill the company's fiscal address? =
Yes. When querying a valid RUC, the billing address field is automatically filled with the fiscal address registered with SUNAT.

= Is it compatible with the latest WordPress and WooCommerce releases? =
Yes, it is built following modern WordPress coding standards, including full compatibility with HPOS (High-Performance Order Storage).

= Where can I get support? =
You can contact our support team via WhatsApp at +51 992 627 943 or by visiting https://apifacturacion.com/.

== Changelog ==

= 1.0.0 =
* Initial official release.
* Real-time RUC and DNI lookup via official APITMS API.
* Dynamic receipt selector (Boleta / Factura) in checkout.
* SUNAT ACTIVO and HABIDO condition validation.
* Integration with order meta, admin panel, and emails.
* Full compatibility with HPOS and PHP 7.4 - 8.3+.