=== CatCode BOX NOW Lockers for WooCommerce ===
Contributors: catcodestudio
Tags: box now, parcel locker, shipping, greece, woocommerce
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

BOX NOW parcel lockers in Greece, Cyprus, Bulgaria and Croatia: locker map on any checkout, vouchers and labels from the order screen.

== Description ==

Delivery to BOX NOW lockers for WooCommerce shops in Greece, Cyprus, Bulgaria and Croatia.

**Free**

* "BOX NOW locker" shipping method for shipping zones: flat price, free from an order amount (coupons counted the way WooCommerce counts them), free-shipping coupons, weight limit.
* The method appears only for GR / CY / BG / HR addresses and only when the cart fits the lockers (60 × 45 cm, height up to 36 cm).
* BOX NOW map on the classic and on the block checkout. The map of the buyer's country opens (boxnow.gr, .cy, .bg, .hr).
* The order is refused on the server when no locker was picked, or when the locker is in another country — for any checkout and for express payment buttons. Other delivery methods are never blocked.
* The locker is stored on the order (HPOS compatible), written into the shipping address and shown on the thank-you page, in the account and in e-mails, with tracking links.
* Vouchers from the order screen: create, print the PDF label, cancel. Cash on delivery for the payment methods you choose.
* The locker can be changed by hand on the order.
* Clear messages for BOX NOW error codes (P401, P402, P405, P411, P466, P467…).
* Client secret stored encrypted; API calls only go to boxnow.* hosts.

**Pro** (7-day free trial from the settings page)

* Vouchers created automatically when an order reaches the status you choose.
* Bulk actions in the orders list: create vouchers, print all labels in one PDF (A6 or A4).
* Several parcels per order, packed by compartment size.
* Hourly parcel status sync with order notes, and automatic "Completed" once every parcel is collected.
* Prices per compartment size.
* Nearest locker by address when the buyer paid with an express button and skipped the map.

You need a BOX NOW business account: client ID, client secret and API host are issued by BOX NOW.

== External services ==

This plugin connects to BOX NOW services:

* The Partner API at the host you enter (for example api-production.boxnow.gr) — to sign in, list your warehouses, create and cancel deliveries, fetch labels and parcel states. Sent: your API credentials; the order number, value, cash on delivery amount, parcel sizes and weight; the buyer's name, phone and e-mail; the chosen locker. Only when you create a voucher or when Pro automation does it for you. With the Pro option "Express checkouts" on, the typed street, city and postcode are sent to find the nearest locker when the buyer skipped the map.
* The BOX NOW map (widget-v5.boxnow.gr / .cy / .bg / .hr) — loaded in the buyer's browser when they open the map. The map receives the postcode typed at checkout and, if enabled, asks for the buyer's location.
* Tracking pages t.boxnow.gr / .cy / .bg / .hr — linked from orders.

BOX NOW terms and privacy policy are published on https://boxnow.gr/ (and the .cy, .bg, .hr sites).

The Pro licence check connects to catcode.com.ua (licence key and site address), only after you enter a key or start the trial.

== Installation ==

1. Install and activate the plugin.
2. WooCommerce → BOX NOW: choose the API host, enter the client ID and secret, save, click "Check and load warehouses" and pick the warehouse.
3. WooCommerce → Settings → Shipping → your Greece (Cyprus, Bulgaria, Croatia) zone → Add shipping method → "BOX NOW locker (CatCode)".

== Frequently Asked Questions ==

= The map does not open on a stage account =

BOX NOW serves the map from production only. Lockers picked on it are real production lockers.

= Can I use it without API keys? =

Yes: the method and the map work without keys. Vouchers need the BOX NOW API account.

== Changelog ==

= 1.0.2 =
* Fixed (Pro): the hourly parcel status sync on the legacy order storage (HPOS off) took any 40 orders instead of the orders with a parcel still on its way, so open parcels could go without updates. It now checks only the orders with open parcels on both order storages, and with more than 40 open parcels every order gets its turn (the legacy storage kept checking the same 40).

= 1.0.1 =
* Stored API keys and passwords are encrypted with AES-256-CBC + HMAC instead of a character-by-character XOR loop. Hosting antivirus scanners flagged the XOR loop as obfuscated code and deleted the file, which took the whole plugin down. Values saved by 1.0.0 are still read; they are re-encrypted the next time the settings are saved.

= 1.0.0 =
* First release.
