=== StockPro 360 Connect for WooCommerce ===
Contributors: arnolis87, stockpro360
Tags: woocommerce, inventory, synchronization, stock management, ecommerce
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
WC requires at least: 8.5
Stable tag: 0.5.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WooCommerce to StockPro 360 to synchronize products, inventory, customers, and orders through a secure HMAC integration.

== Description ==

StockPro 360 Connect links a WooCommerce store to a StockPro 360 account. StockPro
remains the source of truth for products, prices, and inventory while WooCommerce
keeps its checkout and public storefront experience.

The connection is optional. It is enabled only after an administrator pairs both
systems with a short-lived, one-time code. The plugin does not sell a license or
process payments by itself.

= Security =

* Pairing uses a short-lived, one-time code.
* Two independent HMAC-SHA256 keys protect each direction.
* Timestamps and single-use nonces prevent replay attacks.
* Secrets are encrypted with the WordPress security keys.
* Synchronization remains disabled after pairing until an administrator enables it.
* Compatible with WooCommerce High-Performance Order Storage (HPOS).
* Only validated, cached public exchange rates are exposed to themes; provider tokens remain in the SaaS.

= Data flow =

During initial onboarding, an administrator can preview and import an existing
WooCommerce catalog into StockPro 360. Simple products are linked by their stable
WooCommerce ID and unique SKU, while variable, grouped, external, and unknown
types are reported and skipped instead of being silently flattened.

After that one-time import, StockPro 360 supplies products, prices, and inventory. Published products retain
their category tree, brand, tags, model, images, unit, and availability. StockPro
descriptions are converted to safe standard HTML before they are stored in
WooCommerce, so they do not depend on a specific theme.

WooCommerce supplies checkout data, customers, and order status changes. Orders
are imported into the existing StockPro online-store workflow, where reservations,
sales, inventory movements, notifications, balances, and refunds are managed.

== Installation ==

1. Install and activate the plugin.
2. In StockPro, open Online Store > Connections.
3. Select a warehouse and create a temporary code for the WordPress HTTPS URL.
4. In WooCommerce > StockPro 360 Connect, enter the service URL and temporary code.
5. Run the read-only connection test in both directions from StockPro.
6. Enable synchronization in StockPro and then in WordPress.

== External services ==

The plugin contacts the configured StockPro 360 service when an authorized
WooCommerce administrator submits the pairing form. This request sends the
one-time pairing code, the store URL and currency, and the WordPress,
WooCommerce, PHP, and plugin versions. Product, order, and customer
synchronization is enabled separately by an administrator after pairing.

During pairing and synchronization, the plugin may send:

* The public site URL and the WordPress, WooCommerce, and plugin versions.
* Signed connection and warehouse identifiers.
* Product, category, price, availability, and inventory data required for synchronization.
* WooCommerce order and checkout data, including name, email, phone, address, items, amounts, and statuses.
* Linked customer data and balance transactions when the customer wallet is enabled.

Operational requests are signed with HMAC-SHA256. Secrets are not displayed again
after pairing. The service is required only for synchronization; WooCommerce keeps
working when StockPro 360 Connect is not paired or is disabled.

Service: https://stockpro360.com/

Terms: https://stockpro360.com/terms

Privacy policy: https://stockpro360.com/privacy

== Privacy ==

Pairing and connection tests can contact the service before synchronization
is enabled. Automatic synchronization is opt-in. The site owner should
describe the applicable transfers in the store privacy policy.

== Customer wallet ==

* Registered WooCommerce users can be linked to StockPro 360 shop customers.
* StockPro 360 keeps the authoritative ledger and balance.
* Customers can pay an entire purchase with balance when it is sufficient.
* A paid WooCommerce order that is later cancelled can credit its amount once.
* Customers can request a manual withdrawal from My Account.
* Administrative balance adjustments are recorded in the remote ledger.
* The My Wallet endpoint uses WooCommerce hooks and works with any compatible theme.
* Without an active connection, WooCommerce and My Account continue working without simulated remote balances.

== Safe limits in version 0.5 ==

Automatic synchronization creates and updates simple products. Fractional stock
is stopped with an explicit error unless WooCommerce has a compatible measurement
extension. Variations require an explicit mapping and are never silently converted
into simple products.

== Changelog ==

= 0.5.5 =
* Synchronize the featured photo and product gallery, reusing images already imported from StockPro.

= 0.5.4 =
* Keeps the tested WordPress version in the readme.
* Prepares database table identifiers and sanitizes notices displayed after redirects.

= 0.5.3 =
* Shows shipment and delivery status in the WooCommerce order details, including tracking when available.
* Sends cancellations to StockPro 360 when WooCommerce saves them and keeps a scheduled retry for failed deliveries.
* Skips duplicate or outdated order events to keep shipment and delivery states current.
* Queues orders from both classic checkout and WooCommerce Checkout Blocks for synchronization.

= 0.5.0 =
* Adds a signed, paginated preview of the existing WooCommerce catalog.
* Adds a one-time, idempotent simple-product import into StockPro 360.
* Links both systems before synchronization resumes to prevent duplicate products.
* Reports unsupported variable, grouped, external, and custom product types without modifying them.
* Keeps imports disabled after completion so WooCommerce cannot overwrite the authoritative StockPro catalog later.

= 0.4.3 =
* Adds a dedicated My Wallet section to the customer account.
* Shows the authoritative StockPro balance and supports manual withdrawal requests.
* Keeps the theme decoupled when Connect is not active.
* Credits eligible paid orders that are later cancelled, with idempotency protection.

= 0.4.1 =
* Exposes a server-validated exchange-rate snapshot to themes and payment gateways.
* Preserves the public rate name, symbol, source, and effective date.
* Includes the frozen quote in order events sent to StockPro 360.

= 0.4.0 =
* Adds customer-wallet synchronization with StockPro 360.
* Adds full-balance payments for classic and block checkout.
* Adds explicit refunds, auditable adjustments, and manual withdrawal requests.
* Keeps order cancellation separate from money movements.

= 0.3.6 =
* Sends empty JSON request bodies as objects to preserve the canonical HMAC signature.
