=== ProfitGate for WooCommerce ===
Contributors: profitgate
Tags: woocommerce, cod, rto, anti-fraud, margin-protection
Requires at least: 5.8
Tested up to: 6.9
Stable tag: 1.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Intelligent margin protection for WooCommerce COD. Identifies high-risk orders and enforces commitment verification to stop RTO losses.

== Description ==

Stop losing money to RTO (Return to Origin). ProfitGate acts as an intelligent gatekeeper for your WooCommerce checkout, analyzing every order to ensure it meets your profitability and risk standards.

ProfitGate for WooCommerce is a middleware solution designed specifically for merchants dealing with Cash on Delivery (COD) risk. By leveraging real-time telemetry and historical behavioral data from the ProfitGate Intelligence Gateway, the plugin identifies "high-risk" shoppers—those with a history of fake orders or high RTO rates—before they complete their purchase.

**Why use ProfitGate?**

*   **Intelligent Risk Evaluation:** Analyzes customer IP, phone reputation, and order telemetry to flag suspicious activity.
*   **Commitment Verification:** For flagged orders, ProfitGate triggers a seamless "Commitment Gate" (such as a small pre-payment or OTP) to ensure only serious buyers proceed to fulfillment.
*   **Silent Handshake:** Rapid, secure setup using our token-based handshake system. No manual API key Copy-Pasting required.
*   **Dynamic Margin Protection:** Calculates the real-world impact of potential RTO in real-time to protect your shipping and fulfillment costs.
*   **Full Block Support:** Fully compatible with both the classic WooCommerce Checkout and the modern Block-based Checkout.
*   **Centralized Hub:** Manage multiple stores, adjust risk thresholds, and monitor performance from the [ProfitGate Merchant Hub](https://profitgate.ai).

== External Services ==

This plugin connects to the ProfitGate Intelligence Gateway (https://profitgate.ai) to evaluate order risk and synchronize order status.

The external service is required for the plugin’s risk evaluation and margin protection functionality.

Data transmitted may include:
- Customer first and last name
- Customer email address
- Customer phone number
- Billing city, state, postcode, and country
- Customer IP address
- Customer user agent
- Order total and currency
- Cart items (including SKU, quantity, and product categories)
- Payment method
- Order ID (for status synchronization)

All data is transmitted securely via HTTPS and authenticated using HMAC-SHA256 signatures. No remote code is executed on the WordPress site.

Privacy Policy:
https://profitgate.ai/privacy

== Installation ==

= Direct Upload =
1.  Download the `profitgate-for-woocommerce.zip` file.
2.  Login to your WordPress Admin.
3.  Go to `Plugins` > `Add New` > `Upload Plugin`.
4.  Choose the zip file and click `Install Now`.
5.  Activate the plugin.

= Setup & Connection =
1.  Navigate to **ProfitGate** in your WordPress admin sidebar.
2.  Click **Go to Dashboard** to initiate the Silent Handshake.
3.  You will be redirected to the ProfitGate Merchant Hub. Follow the prompts to authorize the connection.
4.  Once connected, you will be sent back to your WordPress site with your API keys automatically provisioned.
5.  (Optional) Adjust your **Operational Controls** to "Trial Mode" first to observe risk without blocking orders.

== Screenshots ==

1. ProfitGate Options: The primary configuration and authentication panel in the WordPress Admin.
2. Live Overview: Real-time margin intelligence tracker showing active observed orders and profit stabilization.
3. Store Portfolio: A centralized view of all linked WooCommerce stores inside the ProfitGate.ai Hub.
4. Profit Stabilization: Advanced analytics dashboard for monitoring RTO reduction and margin recovery.
5. Optimization Trends: Reputation audits and historical risk distribution data.
6. Operational Controls: Granular monitoring and active intervention settings for the ProfitGate shield.
7. Store Connection Verified: Confirmation of the successful Silent Handshake and secure API link.

== Changelog ==

= 1.1.0 =
* PREMIUM NOTICE: Replaced blocking checkout modal with a refined, monochrome non-blocking inline banner for high-risk orders.
* FAIL-OPEN RESILIENCE: Implemented 'Safe-Open' logic ensuring the checkout flow proceeds uninterrupted if the ProfitGate API is unreachable.
* ERROR SUPPRESSION: Automated removal of standard WooCommerce error boxes in favor of the custom Premium Notice UI to maintain a restrained aesthetic.
* UNIFIED NAMESPACE: Migrated all internal prefixes from `pg_` to `profitgate_` for consistency.
* SECURE HANDSHAKE: Resolved handshake callback issues and unified local development origins.
* DASHBOARD RESTORED: Fixed missing asset enrichment hooks and localized AJAX parameters.

= 1.0.0 =
* PRODUCTION RELEASE for WooCommerce Marketplace.
* Added High-Performance Order Storage (HPOS) compatibility.
* Integrated WordPress Privacy Policy content registration.
* Improved telemetry for modern Block-based checkouts.
* Enhanced Silent Handshake security with transient-based token validation.

= 0.5.0 =
* Hardened security for WordPress.org manual review compliance.
* Renamed all prefixes to `profitgate_` to ensure uniqueness.
* Moved inline scripts and styles to external files for better security.
* Optimized session handling using native WooCommerce sessions.
* Implemented Transient-based shared secret for secure unauthenticated handshakes.
* Improved nonce validation for standard and Block-based checkouts.

= 0.4.1 =
* Hardened security for manual review.
* Replaced direct error_log calls with WC_Logger.
* Added nonce verification to the handshake process.
* Cleaned up redundant nonce checks for WooCommerce Blocks.

= 0.4.0 =
* Initial release of the production-ready WooCommerce Adapter.
* Unified Domain architecture integration for improved performance.
* Enhanced Checkout Gates for standard and Block-based checkouts.
