=== Express AI - Barkod Yazdırma ===
Contributors: expressai
Tags: woocommerce, expressai, shipping, barcode, printing
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fetches Express AI shipping barcodes of your WooCommerce orders as PDF and opens them in a new tab, ready to print from the browser.

== Description ==

This plugin retrieves your order barcodes as PDF through the Express AI External Barcode API:

* **Single print:** with one click from the "Express AI Barkod" box on the order edit screen.
* **Bulk print:** select orders on the orders list and use the "Express AI - Barkodları Yazdır" bulk action (up to 500 orders per request, merged into a single PDF).

The PDF opens in a new tab with `Content-Disposition: inline`; you can print it directly using the browser print command (Ctrl/Cmd+P).

= What needs to be done on the Express AI side? =

1. Sign in to your account at https://expressai.com.tr.
2. In the panel, go to Settings → External API and create a new API connection.
3. Copy the displayed Account ID (accountId), API Key (`EAC_...`) and API Secret (the Secret is shown only once).
4. In WordPress, enter these credentials on the WooCommerce → Express AI Barkod page and verify them with "Test Connection".

= Technical flow =

* `POST {baseUrl}/api/external-barcodes/{accountId}` — body: `{ apiKey, apiSecret, referenceCodes[], type: "pdf" }`
* The `downloadUrl` in the response is valid for 1 hour; the plugin downloads the PDF server-side and streams it inline to the browser.
* Express AI reference codes of orders are read from the `_expressai_reference_code` order meta by default (the "Express AI - Sipariş Entegrasyonu" plugin writes this meta automatically). The meta key can be changed in the settings.
* The first print of each order consumes 1 Express AI credit; re-printing does not consume credits.
* Compatible with WooCommerce HPOS (High-Performance Order Storage).

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the WordPress admin panel (WooCommerce must be installed).
3. Enter your API credentials on the WooCommerce → Express AI Barkod page.

== Frequently Asked Questions ==

= I get a "Reference Code Not Found" error =

The Express AI reference code for that order has not been created yet. The reference code is written to the order meta automatically by the Express AI status feed while the "Express AI - Sipariş Entegrasyonu" plugin is installed. You can print once the order has been transferred to Express AI and its barcode has been generated.

= INSUFFICIENT_CREDITS error =

Your Express AI account does not have enough credits. Purchase credits from the panel (My Packages).

== External services ==

This plugin connects to the Express AI External Barcode API (the `baseUrl` you configure in the settings, e.g. https://expressai.com.tr) to retrieve barcode PDFs.

* **What is sent:** the Account ID, API Key and API Secret stored in the settings, together with the Express AI reference codes (`referenceCodes[]`) of the orders to be printed. No customer personal data is sent.
* **When it is sent:** only when an administrator starts the "Print Barcode" action on the order detail page or the orders list.
* **Service provider:** Express AI (https://expressai.com.tr)
* [Privacy Policy](https://expressai.com.tr/gizlilik-politikasi)

== Changelog ==

= 1.0.1 =
* Text domain aligned with the plugin slug (express-ai-barkod-yazdirma) — WordPress.org directory requirement.
* readme rewritten in English; added "External services" statement.
* Sanitization of bulk print query parameters improved.
* Tested with WordPress 7.0.

= 1.0.0 =
* Initial release.
