=== Mobility Infotech Logistics ===
Contributors: togopool
Tags: woocommerce, logistics, delivery, shipping, last-mile
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect your WooCommerce store with Mobility Infotech Logistics for last-mile and long-haul delivery management.

== Description ==

Mobility Infotech Logistics for WooCommerce automatically syncs your orders with the Mobility Infotech Logistics platform for seamless delivery management.

= Features =

* Automatic order sync when payment is confirmed
* Real-time delivery status updates back to WooCommerce
* Order cancellation and refund sync
* Logistics order ID and tracking info displayed on order page
* Test Connection button to verify setup
* HPOS compatible

= How it works =

1. Merchant requests a demo at mobilityinfotechlogistics.com to start onboarding and receive API credentials
2. Merchant installs this plugin and enters their API key
3. When a customer places an order, it is automatically sent to Mobility Infotech Logistics
4. Drivers pick up and deliver the order
5. Delivery status updates automatically reflect in WooCommerce

== Installation ==

1. Upload the plugin folder to /wp-content/plugins/
2. Activate the plugin through the Plugins menu in WordPress
3. Go to WooCommerce > Settings > Mobility Infotech Logistics
4. Enter your API Key and API Base URL
5. Enter your pickup/hub location details
6. Click Save Changes
7. Use the Test Connection button to verify everything is working

== External services ==

This plugin relies on the Mobility Infotech Logistics API, a third-party service provided by Mobility Infotech, to create and manage delivery orders. The plugin cannot function without sending order data to this service.

**Service used:** Mobility Infotech Logistics API
**Domain contacted:** prod-opr-lg.mobilityinfotech.com
**Purpose:** Create delivery orders, send cancellation/refund notifications, and verify connection.

**Note:** The Mobility Infotech Logistics product is operated by Mobility Infotech. Production API traffic is routed through `prod-opr-lg.mobilityinfotech.com` (parent company infrastructure), while marketing and legal documents live at `www.mobilityinfotechlogistics.com`. Account onboarding and API credentials are issued by the Mobility Infotech team after a merchant requests a demo via the marketing site.

**When data is sent:**

* When a WooCommerce order transitions to the "Processing" status, the plugin sends the order details to `https://prod-opr-lg.mobilityinfotech.com/integrations/woocommerce/create-order`.
* When a WooCommerce order is cancelled, the plugin sends a cancellation notification to `https://prod-opr-lg.mobilityinfotech.com/integrations/woocommerce/cancel-order`.
* When a refund is recorded on a WooCommerce order, the plugin sends a refund notification to `https://prod-opr-lg.mobilityinfotech.com/integrations/woocommerce/refund-order`.
* When the merchant clicks the "Test Connection" button on the settings page, the plugin sends a health-check request to `https://prod-opr-lg.mobilityinfotech.com/integrations/woocommerce/health`.

The plugin does not contact any other endpoint or transmit any data outside of the four requests listed above. No telemetry, analytics, or background pings.

**Data sent to the service:**

* WooCommerce order ID, status, currency, and date created
* Order totals: grand total, shipping total, discount total, and tax total
* Customer billing details (name, address, city, state, postcode, country, email, phone)
* Customer shipping details (name, address, city, state, postcode, country, phone)
* Order line items (product ID, name, SKU, quantity, total, weight)
* Payment method, payment method title, transaction ID, and paid date
* Customer note (if provided at checkout)
* The configured pickup/hub business name, address, and phone
* The merchant's API key, in the `Authorization: Bearer` header, for authentication
* The store's site URL, in the `X-WC-Webhook-Source` header

The plugin also exposes a REST endpoint (`/wp-json/mobility-infotech-logistics/v1/webhook`) that the Mobility Infotech Logistics service calls to push delivery status updates back to WooCommerce. Inbound webhook requests are authenticated with an HMAC-SHA256 signature using a per-store webhook secret generated on plugin activation.

**Service provider:** Mobility Infotech

* Website: [https://www.mobilityinfotechlogistics.com](https://www.mobilityinfotechlogistics.com)
* Privacy Policy: [https://www.mobilityinfotechlogistics.com/privacy-policy](https://www.mobilityinfotechlogistics.com/privacy-policy)
* Terms of Service: [https://www.mobilityinfotechlogistics.com/privacy-policy?tab=conditions](https://www.mobilityinfotechlogistics.com/privacy-policy?tab=conditions)

By installing and configuring this plugin with a valid API key, the merchant agrees to the Mobility Infotech Privacy Policy and Terms of Service linked above.

== Frequently Asked Questions ==

= How do I get a Mobility Infotech account and API key? =
Visit mobilityinfotechlogistics.com and click "Request a Demo". The Mobility Infotech team will reach out to begin onboarding and issue your API credentials.

= Which WooCommerce version is supported? =
WooCommerce 7.0 and above. Fully compatible with High Performance Order Storage (HPOS).

= What happens if the API is unreachable when an order is placed? =
The plugin logs the error and adds an order note. You can retry manually.

= Does this plugin support multiple pickup locations? =
Not in this version. Multi-location support is planned for a future release.

= Where is order data sent? =
All order data is sent to the Mobility Infotech Logistics API at prod-opr-lg.mobilityinfotech.com. See the "External services" section above for full details.

== Screenshots ==

1. Plugin settings page showing API configuration and pickup location fields
2. WooCommerce order detail page showing Mobility Infotech Logistics sync status and tracking info
3. Test Connection button confirming successful API connection

== Changelog ==

= 1.0.2 =
* Fixed duplicate stylesheet registration that could trigger a "Style already registered" notice under WP_DEBUG
* Updated the production API endpoint to prod-opr-lg.mobilityinfotech.com
* Expanded the "External services" section to document every field sent in the payload (totals breakdown, paid date, pickup location, custom headers) and explicitly state that no other endpoints are contacted
* Clarified onboarding process: API credentials are issued by Mobility Infotech after a merchant requests a demo on the marketing website
* Adjusted "Tested up to" header to reflect a currently released WordPress version

= 1.0.1 =
* Renamed all internal function/option prefixes from `mil_` to `milogistics_` for better namespace isolation
* Moved inline JavaScript and CSS into separately enqueued asset files (admin.js, admin.css)
* Added explicit external service domain and full data-flow disclosure to readme
* Fixed refund hook to use the correct WooCommerce action (`woocommerce_order_refunded`)
* Removed signature value from log output on webhook verification failures
* Added capability check (`manage_woocommerce`) to Test Connection AJAX handler
* All user-facing strings are now translation-ready
* Renamed inbound webhook header from `X-MIL-Signature` to `X-Milogistics-Signature`
* Added uninstall.php to clean up plugin options on deletion

= 1.0.0 =
* Initial release
* Automatic order sync on processing status
* Delivery status webhook receiver
* Order cancellation and refund sync
* HPOS compatibility
* Test Connection button

== Upgrade Notice ==

= 1.0.2 =
Bug fix, documentation update, and production API endpoint change. Safe to upgrade with no configuration changes needed for end users.

= 1.0.1 =
Internal refactor and WordPress.org compliance fixes. If you are upgrading, you must re-enter your API Key and pickup details (the option names changed). The inbound webhook header is now `X-Milogistics-Signature` — Mobility Infotech backend has been updated accordingly.

= 1.0.0 =
Initial release.