=== DPD SK for WooCommerce ===
Contributors: webikon
Tags: shipping, woocommerce, dpd
Donate link: https://platobnebrany.sk/
Requires at least: 6.5
Tested up to: 7.0.4
Requires PHP: 8.1
Stable tag: 9.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Plugin spoločnosti Direct Parcel Distribution SK, s. r. o. poskytuje jednoduché a rýchle riešenie na prenos údajov o objednaných prepravných službách s doručením na adresu príjemcu a do odberných miest.

== Description ==
Plugin spoločnosti **Direct Parcel Distribution SK, s. r. o.** poskytuje jednoduché a rýchle riešenie na prenos údajov o objednaných prepravných službách s doručením na adresu príjemcu a do odberných miest.

Pomocou pluginu si môžete vo svojich **Woocommerce objednávkach** vyberať zo širokého portfólia produktov a služieb DPD, ako sú napríklad **DPD Home, DPD Classic, DPD 10:00, DPD 12:00, DPD 18:00 /DPD Guarantee** s doručením na adresu príjemcu a do odberných miest v rámci Slovenska a do 230 krajín sveta.

Plugin je prepojený cez API riešenie k [www.dpdshipper.sk](https://www.dpdshipper.sk). Všetky objednávky vytvorené týmto pluginom si budete môcť prezerať aj v prehľade objednávok v online aplikácii [DPD Shipper](https://www.dpdshipper.sk/login).

Plugin je **zadarmo v plnej verzii** pre zmluvných zákazníkov DPD SK.

= FUNKCIE PLUGINU =

* Jednoduché a rýchle vytváranie objednávok prepravy
* Nastavenie predvoleného produktu na každú objednávku, napr. DPD Home
* Tri možnosti exportovania objednávok do DPD
* Úprava objednávky pred exportovaním do DPD
* Tlač prepravných štítkov vo formáte A4 alebo A6
* Vytváranie objednávok doručenia do odberných miest Pickup a Pickup Station (samoobslužného boxu)
* Možnosť pridania ďalších ID bankových účtov a zvozových adries
* Použitie dvoch referencii na úrovni objednávky
* Možnosť nastavenia dopravy zdarma
* Možnosť nastavenia ceny dopravy podľa hmotností produktov v košíku.

== Installation ==
1. Stiahnite si plugin z WordPress.org
2. Nainštalujte a aktivujte si plugin

= Nastavenie pluginu =

1. Prejdite do nastavení **WooCommerce** -> **Doprava** -> **DPD nastavenia exportu**
2. Vyplňte **požadované údaje** pre pripojenie na API DPD Shipper
  * **ID delis**
  * **E-mail (Login) posielaný spolu s API kľúčom**
  * **API Kľúč**
3. Vyplňte **informácie pre doručenie** - štandardné nastavenia
  * **ID bankového účtu** - z [www.dpdshipper.sk](https://www.dpdshipper.sk) -> Nastavenia -> Bankové účty -> hodnota z **ID účtu**
  * **ID adresy pre zber** - z [www.dpdshipper.sk](https://www.dpdshipper.sk) ->  Nastavenia -> Zvozové adresy -> hodnota z **ID adresy**
  * **Doprava** - produkt, ktorý štandardne používate pre odosielanie balíkov
  * **Notifikácie** - Zapnutie/Vypnutie oznámení pri vybraných produktoch prepravy
4. Spôsob odosielania objednávok do portálu DPD Shipper
  * **Z detailu objednávky:** V detaile objednávky v bočnom paneli máte možnosť odoslať objednávku do API. Máte tam tiež možnosť zmeniť štandardné nastavenia pre aktuálnu objednávku (napr. zmena produktu)
  * **Hromadné odoslanie objednávok do DPD Shipper portálu:** V zozname objednávok si označíte objednávky na odoslanie a v hromadných akciách si vyberiete možnosť **DPD Hromadný Export**.
5. Funkčnosť prepojenia si môžete **overiť vytvorením testovacej objednávky** a následným exportom

== Screenshots ==
1. Nastavenia pluginu
2. Zobrazenie stĺpca pre export do DPD v zozname WooCommerce objednávok
3. Zobrazenie možnosti hromadného exportu do DPD v zozname WooCommerce objednávok
4. Zobrazenie možnosti exportu do DPD v detaile WooCommerce produktu

== Changelog ==

= 9.0.0 =
* Security: Added capability checks (`manage_dpd_export`, `manage_woocommerce`) on all admin export entry points
* Security: New filter `wc_dpd_export_data_validate` lets third-party code abort export after data mutation
* Security: Masked `dpd_api_key` and `dpd_map_api_key` fields with reveal toggle in settings
* Security: Redacted `api_key` / `ClientKey` / `map_api_key` / `password` in debug logs via new `wc_dpd_log()` wrapper around `wc_get_logger` (source `wc-dpd`)
* Security: ISO3166 alpha-2 validation + per-IP rate limit on parcelshop search
* Security: Strict `mpsid` / `package_number` format validation in `Client::export()`
* Security: Stricter PDF detection (header + `%%EOF` trailer) in `Client::bulkDownloadLabels()`
* Compatibility: WordPress 7.0.4, WooCommerce 11.0.1, PHP 8.1+
* Compatibility: Migrated repeater settings (`dpd_bank_id`, `dpd_address_id`) from `serialize()` to JSON with one-shot in-place migration
* Compatibility: Added `#[\AllowDynamicProperties]` to `DpdExport` for PHP 8.2+ compatibility
* Feature: Automatic order export on configurable status transition (default `processing`), gated by `wc_dpd_auto_export_*` settings
* Feature: Auto-export only fires for orders shipped with a DPD shipping method — other carriers never hit the DPD API
* Feature: WP-CLI: `wp dpd auto-export --status=processing --dry-run`, `wp dpd migrate-serialized-settings`, `wp dpd verify`
* Feature: New filter `wc_dpd_bulk_labels_max_batch` (default 100) caps bulk label API calls
* Fix: Bulk/single export no longer fatals on hosts without the PHP `calendar` extension — Easter date is now computed in pure PHP (Butcher/Meeus algorithm).
* Fix: Orders with Parcel Shop shipping but no selected pickup point now fail fast with a clear admin notice before calling the DPD API (previously a cryptic "PUDO detail is missing." API error).
* Tweak: `wc_dpd_log()` now writes to the WooCommerce log file with `source=wc-dpd` and a redacted context
* Security: Nonce protection on single-order and bulk export row actions
* Security: Capability check on the admin export redirect (bulk export URL)
* Feature: New filters `wc_dpd_export_customer_full_name` / `wc_dpd_export_customer_company` let shops override the customer/company name before the 35-char DPD length validation
* Dev: New `uninstall.php` removes the `manage_dpd_export` capability and caps-version marker on plugin deletion
* Dev: Composer dev stubs (WP 7.0 / WC 11.0) aligned with the CI PHPStan setup

= 8.5.1 =
* Specified allowed countries based on the map widget, which also fixed the display of available pickup points

= 8.5.0 =
* Added `wc_dpd_before_order_export` action hook fired before order export (passes $order and $data)
* Added `wc_dpd_after_order_export` action hook fired after successful order export (passes $order and $response)
* Added `wc_dpd_order_export_error` action hook fired on export error (passes $order and $exception)

= 8.4.0 =
* Added free shipping threshold option for weight-based shipping rates

= 8.3.0 =
* Extended locker filtering to support Z-Box (Packeta)
* Added admin validation to ensure at least one pickup point type (shops or lockers) remains enabled
* Improved shipping method configuration safety with client-side and server-side validation

= 8.2.1 =
* Fixed Czech Republic country code mapping (WooCommerce 'cs' to ISO3166 'CZ')

= 8.2.0 =
* Added language selection option for DPD map widget (Slovak, English, Hungarian, German, French)
* Slovak is set as the default language

= 8.1.1 =
* Fixed free shipping threshold logic - empty field now properly disables free shipping

= 8.1.0 =
* Fixed parcel shop validation for WooCommerce Blocks checkout
* Added filter 'wc_dpd_is_cart_or_checkout_page' for custom checkout page detection
* Improved WooCommerce Blocks compatibility for parcel shop selection validation
* Updated free shipping description hint

= 8.0.2 =
* Fixed export metabox method

= 8.0.1 =
* Fixed parcel weight calculation

= 8.0.0 =
* Added support for WooCommerce Blocks
* Added ability to set exact parcel weight before export

= 7.0.2 =
* Added validation for name and company name length

= 7.0.1 =
* Standardize weight unit to kg for parcelshop filtering

= 7.0.0 =
* Add ability to hide parcelshops from interactive map

= 6.0.1 =
* Handle dynamic map elements

= 6.0.0 =
* Added an option to enable a map widget that allows users to choose a parcelshop from an interactive map.
* Changed the `wc_dpd_cod_id` filter to accept an array of payment method IDs instead of a single method string.
* Added a new filter `wc_dpd_card_payment_ids` to specify an array of card payment method IDs.

= 5.0.3 =
* Fix pickup date that is not a Saturday, Sunday, or a holiday in Slovakia.
* Disable card payment for cash on delivery (COD) orders to countries other than Slovakia.
* Fixed deprecated warnings in the DpdExport class.

= 5.0.2 =
* Fixed tax for free shipping

= 5.0.1 =
* Added multisite support

= 5.0.0 =
* Added support for WooCommerce HPOS
* Added WooCommerce version check and updated the minimum required WC version
* Added filter for COD payment method ID wc_dpd_cod_id

= 4.0.4 =
* Replace package ID with international PUS ID

= 4.0.3 =
* Add reset button to order metabox

= 4.0.2 =
* Updated compatibility with PHP 7.4

= 4.0.1 =
* Add functionality to check for free shipping coupon

= 4.0.0 =
* Added parcelbox packages validation by weight or dimensions
* Added Alzabox packages validation by weight or dimensions
* Added Slovenska Posta packages validation by weight or dimensions
* Allow credit card payment for cod

= 3.0.2 =
* Added action wc_dpd_order_exported

= 3.0.1 =
* Added filter to modify export data
* Added filter to prevent export
* Fixed cod amount rounding that caused discrepancies in some transactions

= 3.0.0 =
* Added an option to set a value for free shipping
* Added an option to set shipping cost based on the weight of products in the cart
* Added an option to choose A4 or A6 labels format
* Fixed a decimal numbers error in shipping cost calculation
* Fixed a critical error in WordPress site health
* Pop-up can be now closed by pressing ESC or clicking outside
* Order number is included in variable symbol.
* Updated user manual

= 2.0.1 =
* Updated plugin description

= 2.0.0 =
* Added support for parcelshops, bulk download of labels, multiple addresses and bank accounts, adding reference texts to the order export and displaying the parcel number in the order list and order detail.

= 1.0.1 =
* Update readme.txt.

= 1.0.0 =
* First implementation.
