=== Bex Courier Integration ===
Contributors: aarsenoviicc
Tags: woocommerce, courier, shipping, bex, serbia
Requires at least: 5.0
Requires PHP: 7.4
Tested up to: 7.0
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Schedule BexExpress courier pickups directly from the WooCommerce order screen.

== Description ==

Bex Courier Integration adds a "Schedule Courier" action to WooCommerce orders, allowing you to dispatch shipments to BexExpress directly from the WordPress admin — no need to log in to a separate courier portal.

**Features:**

* Schedule a courier pickup from any WooCommerce order
* Cancel shipments directly from the order screen
* Print shipping labels
* View shipment tracking history per order
* Browse all active shipments and their statuses
* Configurable sender details, parcel shop, payment type, package weight, and more
* Developer mode with API request/response log for support and diagnostics

== External Services ==

This plugin communicates with the BexExpress courier API. Data is only transmitted when a site administrator explicitly performs an action (scheduling, cancelling, or looking up a shipment). No data is sent automatically or without user interaction.

= Shipment Creation and Cancellation =
Used when scheduling or cancelling a courier pickup from the order screen.
* Endpoint: https://api.bex.rs:62503/ship/api/Ship/postShipments
* Endpoint: https://api.bex.rs:62503/ship/api/Ship/deleteShipments
* Data sent: receiver name, address, phone number, package details, payment type, order reference, API credentials

= Parcel Shop Lookup =
Used to display the list of BexExpress pickup locations in the settings screen.
* Endpoint: https://api.bex.rs:62503/ship/api/Ship/listParcelShop
* Data sent: API credentials

= API Key Validation and Label Printing =
Used to verify your API key from the settings screen and to generate printable shipping labels.
* Endpoint: https://integrations.bexexpress.rs/api/Addresses/Municipalities
* Endpoint: https://integrations.bexexpress.rs/api/Shipments/getLabelWithProperties
* Data sent: API credentials (for key validation); shipment ID (for label printing)

= Shipment History =
Used to display tracking history for individual shipments in the admin.
* Endpoint: https://integrations.bexexpress.rs/api/Shipments/shipmentHistory
* Data sent: shipment tracking number, API credentials

This service is provided by BexExpress: Terms of Service (Serbian), Privacy Policy (Serbian), publicly available API documentation (Serbian).
* Terms of Service: https://bexexpress.rs/assets/BEX_Opsti_uslovi--i8uOTMY.pdf
* Privacy Policy: https://www.bex.rs/doc/OBAVESTENJE_O_OBRADI_PODATAKA_O_LICNOSTI.pdf
* API documentation: https://bexexpress.rs/DevDocumentation

== Installation ==

1. Download the zip file and unzip it
2. Upload the `bex-courier-integration` folder to `wp-content/plugins/`
3. Activate the plugin through the **Plugins** menu in WordPress
4. Go to **BexExpress → Settings** and enter your API Key and Client ID
5. Configure your sender details (phone number, contact person, bank account number)
6. You are ready to schedule shipments from any WooCommerce order

== Frequently Asked Questions ==

= Where do I get my API Key and Client ID? =

Contact BexExpress directly to obtain your API credentials.

= Does this plugin store any customer data? =

The plugin stores a log of API requests and responses in your WordPress database for diagnostic purposes. This log includes shipment details such as receiver name, address, and phone number. The log is only accessible to administrators and can be cleared at any time from the Log page (visible when developer mode is enabled).

= What is developer mode? =

Developer mode reveals additional pages and options useful for troubleshooting — primarily an API request/response log. It is protected by a password that you set yourself in BexExpress → Settings.

== Changelog ==

= 1.1.0 =
* Added Client ID field and X-Client-ID header support
* Modular class-based structure
* Shipment status display page
* Shipping label print support
* Developer mode with API log viewer
* Configurable parcel shop, payment type, and package weight

= 1.0.0 =
* Initial release with settings page and order action

== Upgrade Notice ==

= 1.1.0 =
After updating, make sure to enter your Client ID and API Key values in BexExpress → Settings.