=== Romania Couriers for WooCommerce – FAN Courier, Sameday easybox, Cargus ===
Contributors: catcodestudio
Tags: fan courier, sameday, easybox, cargus, awb
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

FAN Courier, Sameday and Cargus in one plugin: home delivery and pickup points (FANbox, easybox, Ship & Go) at checkout, AWBs, labels and tracking.

== Description ==

Three Romanian couriers in one WooCommerce plugin, each with delivery to the buyer's address and delivery to its own pickup point network.

**Free**

* Six shipping methods for your shipping zones: FAN Courier and FANbox, Sameday and easybox, Cargus and Cargus Ship & Go. Shown for Romanian addresses only.
* Fixed price, free from an order amount (counted the way the cart shows it), free-shipping coupons, weight limit per method.
* Pickup point picker on the classic and on the block checkout: search by city, street or point name; the list starts in the buyer's city.
* The picker appears only while a pickup-point method is chosen. The buyer's address fields are never rewritten in the browser, so switching to delivery to the address keeps the buyer's own address.
* The order is refused on the server when a pickup-point method has no point, or the point closed since — for any checkout. Other shipping methods are never blocked, and a point picked earlier never lands in an order shipped otherwise.
* The point is stored on the order (HPOS compatible), optionally written into the shipping address, and shown on the thank-you page, in the account and in e-mails, with tracking links.
* AWB from the order screen: weight, cash on delivery (ramburs) for the payment methods you choose, PDF label, status refresh, cancel. Orders shipped with another method can be sent too — pick the courier in the box.
* Pickup points downloaded from each courier into your database and refreshed daily: the checkout never waits for a courier while the buyer types.
* Passwords and keys stored encrypted. English and Romanian.

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

* Live delivery price from the courier tariff at checkout (FAN Courier internal tariff, Sameday estimate-cost, Cargus ShippingCalculation), with a markup in % and a fixed amount, rounding, and the fixed price as a fallback when the courier is slow.
* AWBs created automatically when an order reaches the status you choose.
* Bulk actions in the orders list: create AWBs, print all labels at once.
* Several parcels per AWB.
* Hourly AWB status sync with order notes, and "Completed" once the courier reports the delivery.

You need a business account with each courier you use.

== External services ==

This plugin connects to the couriers you configure, only with the credentials you enter:

* FAN Courier API (api.fancourier.ro) — sign in, list FANbox lockers, tariff, create / print / track / delete AWBs.
* Sameday API (api.sameday.ro, or the demo host sameday-api.demo.zitec.com) — sign in, pickup points and services, easybox lockers, estimate, create / print / track / delete AWBs.
* Cargus UrgentOnlineAPI (urgentcargus.azure-api.net, or the test host urgentcargusapitest.azure-api.net) — sign in, pickup locations, Ship & Go points, price calculation, create / print / track / delete AWBs.

Sent when you create an AWB (or Pro automation does it for you): the order number, weight, parcel size, cash on delivery amount, declared value if you enabled insurance, parcel contents, and the buyer's name, phone, e-mail and address or chosen pickup point. With the Pro live tariff on, the destination county and city, the weight and the cart value are sent while the buyer is at checkout. Tracking links open the couriers' public tracking pages.

Terms and privacy: https://www.fancourier.ro/, https://sameday.ro/, https://www.cargus.ro/

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 → Romania Couriers: fill in the account of each courier you use and save.
3. Click "Check the connection" (Sameday and Cargus then offer their pickup points and services) and "Download … points".
4. WooCommerce → Settings → Shipping → your Romania zone → Add shipping method → the methods marked "(Romania Couriers)".

== Frequently Asked Questions ==

= The pickup-point method does not appear at checkout =

It appears once the courier's points are downloaded (settings page) and for Romanian addresses only. Check also the weight limit of the method.

= FAN Courier refuses a FANbox AWB with cash on delivery =

A FANbox takes cash on delivery only by card. FAN Courier has to enable card payment (mPOS) for your account; the plugin adds the option automatically.

= The live tariff shows the fixed price =

The courier did not answer within a few seconds, or refused the request. Turn on the debug log (source romania-couriers) to see why. FAN Courier test accounts return 0 for sender-paid Standard shipments.

= Bucharest addresses =

Sameday works with sectors: the sector typed in the address is used ("sector 3", "sect. 3"), otherwise Sector 1. FAN Courier and Cargus take "Bucuresti".

== Changelog ==

= 1.0.4 =
* Fixed: on a phone the pickup point window was taller than the screen, so its close button and the end of the list were cut off. It now fits the screen.

= 1.0.3 =
* Fixed (Pro): the hourly status sync on the legacy order storage (HPOS off) took any 40 orders instead of the orders with an AWB still in transit, so open AWBs could wait without updates. It now checks only the orders with open AWBs on both order storages, and with more than 40 open AWBs every order gets its turn (the legacy storage kept checking the same 40).

= 1.0.2 =
* The Pro version activates next to an active free copy from WordPress.org without PHP warnings or loading its code from the free copy's folder: the free copy steps aside, the settings and pickup points stay.
* Deleting Pro while the free copy is installed keeps the shared settings and pickup points and removes only the licence.

= 1.0.1 =
* Fixed: on the block checkout the pickup point address overwrote the shipping address saved in the buyer's account. The point now goes only into the order; the account keeps the buyer's own address.
* Fixed (Pro): a live tariff of 0 from the courier made the delivery free. The fixed price is used instead.
* Fixed (Pro): a pickup-point method no longer asks the courier for a tariff before a point is chosen (it showed PHP warnings and waited for the courier on every cart refresh).
* Fixed (Pro): on the classic checkout the live tariff now follows the payment method — cash on delivery is part of the price request.
* Cargus Ship & Go points that do not take cash on delivery are marked in the list; an order with cash on delivery to such a point is refused with a clear message, and so is an AWB.

= 1.0.0 =
* First release: FAN Courier + FANbox, Sameday + easybox, Cargus + Ship & Go; pickup points on the classic and the block checkout; AWBs, labels, tracking, cash on delivery; Pro live tariff, automatic and bulk AWBs, bulk labels, several parcels, hourly status sync.
