=== NeatGravity for WooCommerce ===
Contributors: neatgravity
Tags: woocommerce, cash on delivery, dobirka, cod, order management
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 8.0
WC tested up to: 11.0
Stable tag: 0.3.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connects WooCommerce stores with the NeatGravity service for submitting cases related to uncollected cash-on-delivery shipments.

== Description ==

NeatGravity for WooCommerce adds a "NeatGravity" box to the WooCommerce order detail screen. For orders paid by Cash on Delivery, the box calculates the amount to be claimed (shipping cost + recognized COD fee items), detects or lets you manually enter the shipment tracking number, and the "Send to NeatGravity" button submits the order to the NeatGravity API as an uncollected cash-on-delivery case (`claim_type: cash_on_delivery`).

The plugin does **not** transmit the price of the ordered goods - only the costs related to the uncollected cash-on-delivery shipment (shipping and COD fee).

Compatible with WooCommerce High-Performance Order Storage (HPOS).

= Currently supported case countries =

Czech Republic and Slovakia.

= Requirements =

* WordPress
* WooCommerce
* An active NeatGravity account
* A NeatGravity API key

= External service / Privacy =

This plugin is a client for the external service **NeatGravity** (https://www.neatgravity.com/), a SaaS platform for submitting and managing uncollected cash-on-delivery cases. It requires a NeatGravity account and API key to function.

Data is transmitted to the NeatGravity API **only when a store administrator explicitly clicks "Send to NeatGravity"** on a specific order (and, separately, when using the "Test connection" button on the settings page, which sends no order data). Nothing is sent automatically, on plugin activation, or in the background.

When an order is submitted, the following order data is sent to `https://www.neatgravity.com/api/v1/claims/import.php`, authenticated with your NeatGravity API key:

* Order number and order date
* Customer name, billing/shipping address, e-mail and phone number
* Shipping carrier and tracking number (if available)
* The claim amount (shipping cost + recognized COD fee, never the price of goods)
* Order metadata used for audit purposes (payment method, shop URL, WooCommerce order ID, individual fee and line item amounts)

This data is transmitted for the sole purpose of creating an uncollected cash-on-delivery case in your NeatGravity account, so NeatGravity can process the case on your behalf.

Relevant NeatGravity legal documents:

* Terms and Conditions: https://www.neatgravity.com/terms-and-conditions.php
* Data Processing Agreement: https://www.neatgravity.com/data-processing-agreement.php

== Installation ==

1. In your WordPress admin, go to Plugins -> Add New Plugin -> Upload Plugin.
2. Select the plugin ZIP file and click Install Now.
3. After installation, click Activate.
4. Go to WooCommerce -> NeatGravity and enter your NeatGravity API key.
5. Click Test connection to verify the connection.

== Usage ==

Go to WooCommerce -> Orders, open an order paid by Cash on Delivery, and click "Send to NeatGravity" in the NeatGravity box.

== Frequently Asked Questions ==

= Does this plugin work without a NeatGravity account? =

No. The plugin is a client for the NeatGravity SaaS service - you need an active NeatGravity account and API key for it to function.

= Which countries are supported? =

Cases for customers from the Czech Republic and Slovakia are currently supported.

= Does the plugin send the price of the ordered goods to NeatGravity? =

No. Only the shipping cost and recognized cash-on-delivery fee are sent as the claim amount - never the price of the goods themselves.

= Is data sent automatically? =

No. Order data is only sent to NeatGravity when a store administrator explicitly clicks "Send to NeatGravity" on a specific order.

= What happens if I click "Send to NeatGravity" twice on the same order? =

The plugin marks the order as sent after a successful submission and will not send it again - the button is replaced with a status notice showing the submission result.

= Is this plugin compatible with WooCommerce High-Performance Order Storage (HPOS)? =

Yes, the plugin declares HPOS compatibility and uses only the official WooCommerce order CRUD API.

== Screenshots ==

1. WooCommerce order detail - NeatGravity box with claim amount and Send to NeatGravity button.
2. NeatGravity plugin settings - API key and Test connection.
3. Order detail after successful submission to NeatGravity.

== Changelog ==

= 0.3.1 =
* The NeatGravity API URL is now fixed (https://www.neatgravity.com) and no longer a settings field - you only need to enter your API key.
* Existing stored API URL values (if any) are kept in the database for compatibility but are no longer read or displayed.

= 0.3.0 =
* Initial public release for distribution from NeatGravity.com and preparation for the WordPress.org Plugin Directory.
* Production logging - the WooCommerce log no longer stores customer personal data (name, address, e-mail, phone), only technical identifiers (external_id, amount, currency, HTTP status, import_id).
* Removed unused internal code and outdated comments from an early development phase (no functional change).
* Updated plugin description and readme (supported countries, integration purpose).

= 0.2.0 =
* Live submission to the NeatGravity API (NeatGravity_WC_Api::sendOrder()), storing _neatgravity_sent/_neatgravity_import_id/_neatgravity_sent_at/_neatgravity_external_id after a successful submission.
* Automatic tracking number detection (WooCommerce Shipment Tracking, Advanced Shipment Tracking, common meta keys) + manual fallback field in the box, stored in _neatgravity_tracking_number.
* Bumped asset version for cache-busting (admin.css/admin.js).

= 0.1.0 =
* First version: order detail box, claim_amount calculation, API URL/key settings, connection test, payload building and logging (without live submission).

== Upgrade Notice ==

= 0.3.1 =
The NeatGravity API URL is now fixed - you only need to re-enter your API key if it was not previously saved. No other action required.

= 0.3.0 =
Initial public release. Improves logging to exclude customer personal data. No action required after upgrading.
