# Free 0.12.10 developer integration Package identity: `leanmerce-commerce-assistant/leanmerce-commerce-assistant.php`; text domain `leanmerce-commerce-assistant`. Existing `lmcc_*` options/tables, `Leanmerce\CommerceCompliance` namespaces and integration identifiers remain unchanged. Core API is **1.9.0**, not the package's 0.12.10. The published 0.12.7 Core API was 1.6.0. Do not infer compatibility solely from a package number. ## Runtime and lifecycle All runtime source is included; no build or Composer installation is required. See [BUILD-SOURCE.txt](../BUILD-SOURCE.txt). Load an integration as a normal WordPress add-on; do not include another Free bootstrap or load vendor copies of Core classes. `Bootstrap/Plugin.php` emits the existing extension points during boot: - `leanmerce_commerce_compliance_register_providers`: receives the provider registry. - `leanmerce_commerce_compliance_register_repositories`: receives the repository registry. - `leanmerce_commerce_compliance_register_extensions`: receives the extension registry. - `leanmerce_commerce_compliance_core_ready`: receives the booted extension registry and Core API version string (not the provider/repository registry). Inspect the corresponding registry class before registering an implementation; these are distinct registries, not interchangeable arrays. Do not use boot callbacks to render a PDF, send mail or write to an existing document. A safe observation example: ```php add_action('leanmerce_commerce_compliance_core_ready', static function ($registry, $api) { if (version_compare($api, '1.9.0', '<')) { return; } // Register your own later hook here; never replace Core's historical records. }, 10, 2); ``` Activation and deactivation emit `leanmerce_commerce_compliance_activated` and `leanmerce_commerce_compliance_deactivated`. Database migration runs through the existing runner, target schema **4**. From schema 3 it adds `{$wpdb->prefix}lmcc_confirmation_originals` and `{$wpdb->prefix}lmcc_document_dispatches`. Do not insert archive rows or drop/recreate these tables in an integration. A same-identity update is not an uninstall or legacy-folder migration. ## Authorization Core declares capabilities in `Core/Capabilities.php`: `lmcc_manage_settings`, `lmcc_manage_templates`, `lmcc_manage_integrations`, `lmcc_manage_license`, `lmcc_view_documents`, `lmcc_download_documents`, `lmcc_view_evidence`, `lmcc_create_correction`, `lmcc_retry_delivery`, `lmcc_run_diagnostics`, `lmcc_purge_data`. A capability name is not automatic permission for all users. Preserve the role assignments in code; shop managers do not receive every management capability. Order administration also checks WooCommerce's order-edit permissions. Customer download routes require the authenticated owner and an exact order-bound nonce. A nonce is not a substitute for authorization. Do not expose archive paths or make private storage publicly downloadable. Use strict scalar validation before `wp_unslash`, exact request methods, bounded input and output-context escaping in your own handlers. Do not weaken native request guards or assume that possession of a URL grants access. ## Original-confirmation contract `Application/Document/ConfirmationArchive` API **1.0.0** accepts explicitly frozen `BasicOrderDocument` facts via `prepare(array $payload, array $binding = [])`. A repeated prepare must match the payload and optional snapshot binding; different facts for an existing order are rejected. `find($order_id)`, `read($row)` and `payload($row)` preserve and verify the indexed original. File/payload hashes must not be recalculated to legitimize modified bytes. `BasicPdfRuntime::archive()` and `mail_ledger()` provide the existing runtime services. Do not treat internal ledger methods as an external resend API. Its accepted/uncertain submission semantics prevent blind duplicates. The existing `leanmerce_commerce_compliance_should_attach_free_basic_pdf` filter may restrict Free attachment behavior; it is not permission to fabricate an original or bypass recipient checks. `BasicPdfService::current_document()` reads current order facts for current printouts. Current extension blocks are transient and deliberately excluded from frozen serialization. No view, preview or late ERP/tracking update may mutate an original confirmation or a Pro historical contract. ## Typed operational PDF SDK and separate Pro execution Core includes the open registry, field definitions, DTOs, validators and read-only guard for interoperable add-ons. Definition-registration callbacks run lazily without a licence when an add-on requests `Registry::instance()`; registration alone does not resolve values or produce advanced output. The PHP entry points in `PdfExtension\Access`, `Settings` and `Projection` are compatibility facades. Their existing signatures and storage identifiers remain available, while the paid resolution, configuration, preview and account/email delivery implementation resides in the separately installed `Leanmerce\CommerceCompliance\Pro\OperationalPdf` classes. `PdfExtension\Access::allowed()` delegates to the loaded, registered and authorized Pro runtime. `leanmerce_commerce_assistant_operational_pdf_authorized_v1` can restrict, not grant, that prerequisite. Without entitled Pro, its advanced resolver callbacks and output do not run; Basic Free documents and lazy SDK definition registration remain available. Hook `leanmerce_commerce_assistant_register_pdf_extensions_v1` receives `PdfExtension\Registry`. Registry API version is **1.0.0**. A field definition includes a namespaced ID, provider/API versions, exact BS/HR/SR/EN labels/help, typed resolver, declared metadata keys, privacy, phase and document types. Registration is not selection or authorization to disclose data. The complete executable constructor example, eight return shapes, budgets, positions, link rules and privacy contract are maintained in [PDF-EXTENSION-DEVELOPER-API.md](PDF-EXTENSION-DEVELOPER-API.md). This guide deliberately does not maintain a second contradictory field signature. The example is inline in that file; no separate example plugin is distributed in the installation. The neutral current-document hook is `leanmerce_commerce_assistant_current_document_v1($current, $order, $audience)`. Its capability marker is `BasicPdfService::CURRENT_DOCUMENT_FILTER_API = '1.0.0'`, distinct from Core API 1.9.0 and package version 0.12.10. Trusted providers return a `BasicOrderDocument` for the same order and preserve request authorization, audience privacy and complete current facts. Pro hooks its own protected operational implementation here. The Free hook has no licence check and is never permission to mutate an archived original or contract. Resolvers receive a read-only `OrderProjection`, not a mutable WooCommerce order. Fetch only already stored, explicitly approved facts. Do not perform HTTP, mail, writes or per-item product queries. Guarded WordPress operations are blocked during resolution, but an installed PHP plugin remains trusted code, **not a security sandbox**. URI annotations support validated HTTPS links without fetching destinations. Advanced selection/preview, optional current-PDF account/email delivery, Pro Template Studio, FORMATION_SNAPSHOT tokens, fiscal/ERP REST services, licensing and private updating belong to the separate Pro add-on. They are neither bundled commercial modules nor entitlements supplied by Free. Tested release companion: Pro 0.14.3 candidate; older Pro versions are not thereby certified. ## Compatibility and maintenance Use Woo CRUD for orders and metadata; do not depend on posts tables when HPOS is authoritative. Preserve `lmcc_*` storage identifiers and active encryption material on code rollback. Do not restore an old database over newly accepted orders. Test an integration on both storage modes and on real mail transport; a mock callback alone proves neither delivery nor production compatibility. The Free SDK introduces no external connector service, license host or updater. Public product views should not register fields or query orders merely because an add-on has a definition. Keep work lazy and bounded. New incompatible public contracts require a versioned API rather than rewriting existing historical data. ## Operator-only synthetic document checks The existing `WooCommerce/Document/QaDocumentMode` supports an explicitly prepared synthetic checkout only when the operator defines `LMCC_QA_DOCUMENT_RECIPIENTS`. Without that configuration there is no QA control. Its admin-only POST/nonce action validates the exact allowlisted recipient and freezes a QA label into the new document; it is not an override for arbitrary customer delivery. Do not enable it for ordinary customer orders or use real personal data. See [INPUT-BOUNDARIES.txt](../INPUT-BOUNDARIES.txt) for the current route boundaries. This is test support, not a new legal or commercial document type.