=== Koombiyo Delivery ===
Contributors: itdp7788
Tags: woocommerce, shipping, delivery, courier, sri lanka
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 8.0
WC tested up to: 9.0
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Dispatch, track, and manage WooCommerce order deliveries through the Koombiyo Delivery courier network.

== Description ==

Koombiyo Delivery connects your WooCommerce store to the Koombiyo Delivery courier network (Sri Lanka): assign waybills and dispatch orders in bulk, track shipment status and Proof of Delivery, and request courier pickups — all from your WordPress admin.

The plugin works as a standalone WooCommerce extension (one site-level Koombiyo account), or in multi-vendor mode with WCFM or Dokan, where each vendor connects and uses their own independent Koombiyo merchant account.

= Requires =

* WooCommerce (required)
* WCFM Marketplace or Dokan (optional — enables multi-vendor mode; neither is required for standalone use)
* A Koombiyo Delivery merchant account (contact Koombiyo Delivery to obtain API credentials)

== External services ==

This plugin connects to the Koombiyo Delivery courier service, provided by Koombiyo Delivery (Pvt) Ltd in Sri Lanka. A Koombiyo Delivery account is required. Nothing is sent until a store owner or vendor connects their account.

**Koombiyo Delivery API (https://client.koombiyodelivery.lk)** is used to dispatch and track orders.

* Your API key and password are sent when you connect an account, and when the plugin has to sign in again.
* Customer name, phone numbers, delivery address, city and postal code, order number, order description, cash on delivery amount, product value and your notes are sent when you dispatch an order.
* A waybill number is sent when you open shipment details, a timeline or a Proof of Delivery, print waybills or delete a shipment.
* Pickup address, phone number, map location, quantity, remark and vehicle type are sent when you request a pickup.
* Your account login token is sent with these requests and when the plugin loads the Dashboard, the notices banner, active waybills or the order and pickup lists.
* A waybill or pickup is looked up when Koombiyo sends this site a status update, so the plugin can confirm the update before changing anything. If delivery updates are off on a single-vendor account, no lookup is made.

**Koombiyo notice images:** a notice from Koombiyo may include an image, which your browser then loads from the address Koombiyo gave, on the plugin's admin pages.

**Koombiyo tracking page (https://koombiyodelivery.lk):** the "Order dispatched" customer email links to Koombiyo's tracking page. When a customer opens the link, the waybill number and phone number in it are sent to Koombiyo.

**Status updates from Koombiyo:** Koombiyo sends status updates to this site's REST API addresses shown under API Settings, once you save them in the Koombiyo portal. They contain a waybill or pickup ID and its status.

Koombiyo Delivery terms of service: https://koombiyodelivery.lk/about (select "Terms & Conditions" at the bottom of the page)
Koombiyo Delivery privacy policy: https://koombiyodelivery.lk/privacy_policy

**OpenStreetMap** is used for the map where you choose a pickup location on the Pickup Requests screen. While that map is showing, your browser loads map images from OpenStreetMap's servers (https://tile.openstreetmap.org), which receive your IP address and the map area being viewed. No order or customer details are sent. The service is provided by the OpenStreetMap Foundation.

OpenStreetMap terms of use: https://osmfoundation.org/wiki/Terms_of_Use
OpenStreetMap tile usage policy: https://operations.osmfoundation.org/policies/tiles/
OpenStreetMap privacy policy: https://osmfoundation.org/wiki/Privacy_Policy

== Source code ==

The human-readable source of the compiled JavaScript and CSS in `build/` is included in this plugin, in the `src/` folder, with `package.json` and `webpack.config.js`.

To rebuild it, run `npm install` and then `npm run build` in the plugin folder. This needs Node.js and uses `@wordpress/scripts`.

The Pickup Requests map uses Leaflet 1.9.4 (BSD-2-Clause license), which is bundled into `build/`, along with its marker images. Its source is at https://github.com/Leaflet/Leaflet.

== Changelog ==

= 1.1.2 =
* Security: a status update sent to this site is now confirmed with Koombiyo before anything changes, and the reply no longer shows any order details.
* WooCommerce order list: a new Koombiyo column shows "Not dispatched", or the waybill and latest delivery status. Dokan parent orders show how many sub-orders are dispatched.
* The "Order dispatched" email now links to Koombiyo's current tracking page.
* Track Orders: the timeline always shows the latest status first, and each phone number stays on one line.
* Ship Orders, Track Orders and Pickup Requests: tables fit the screen, so the sideways scrollbar is always in reach.
* Admin scripts now load as files through WordPress, and the WordPress.org download no longer includes Word copies of the guides.
* Dispatching no longer marks an order Completed. It stays Processing until Koombiyo reports Delivered, or until you complete it yourself.
* Only Koombiyo's Delivered status completes an order.
* New "Order dispatched" customer email with the waybill number and a tracking link (single-vendor accounts). Manage it under WooCommerce > Settings > Emails.
* Ship Orders: add an optional second phone number with the + button.
* Phone numbers must now be 0 followed by 9 digits before an order can be dispatched.
* Phone numbers display as 077-123 4567 on Ship Orders and Track Orders.
* Active waybills load highest number first, to match the newest-first order list. Orders are given the lowest free waybills first, with the highest of those on the newest order.
* Ship Orders: click the Order No heading to show the newest or the oldest orders first.
* Ship Orders: pages with Prev/Next and 20, 50 or 100 orders per page, so orders beyond the first 20 can be reached.
* Ship Orders: a Columns button to hide columns you don't need.
* Fixed: the Ship Orders search found nothing on stores that do not use WooCommerce's order tables (HPOS). It now finds orders by number, name, email, phone, address or city.

= 1.1.1 =
* Replaces the earlier Koombiyo Delivery plugin (v1.1.x): orders it already shipped are not offered for shipping again, and can be imported with their waybills.
* Cash on delivery vs prepaid payments: each payment method is detected as COD or prepaid, with an override per method.
* Koombiyo notices and alerts are shown as a banner on the plugin pages.
* Optional "Delivered" updates from Koombiyo for single-store accounts.
* Webhook URLs no longer contain the API key. Clients who saved the old URL in the Koombiyo portal must save the new one.

= 0.1.0 =
* First public release.
* Full admin UI: Dashboard, Ship Orders (bulk dispatch with auto-assigned waybills), Track Orders (filters, column chooser, print formats, live timeline), Pickup Requests (map-based location picker).
* Full Koombiyo API client, dispatch/tracking business logic, multi-row dispatch audit log, HPOS compatibility.
* GDPR-style personal data export/erase, and an uninstall data-retention setting.

= Internal development milestone (pre-release) =
* Initial repository scaffold (Phase 1: directory structure, autoloader, plugin bootstrap, dev tooling). No functional features yet.
* Phase 2: WooCommerce dependency check (blocks activation, and goes inert with a notice if WooCommerce is deactivated later), Store_Context/Context_Resolver tenancy detection for standalone WooCommerce / WCFM / Dokan (including the fail-closed both-active-and-unresolved case), capability + default-option registration on activation. No admin screens, credential storage, or Koombiyo API calls yet.
* Phase 3: API Settings page (native admin UI) to connect/disconnect a Koombiyo Delivery account; encrypted (AES-256-GCM) credential storage in a new wp_koombiyo_clients table; a minimal Koombiyo_Client seed (login/logout only — full API surface arrives in Phase 4).
