=== Hamidreza Order Notifier ===
Contributors: mrhamidreza
Tags: woocommerce, telegram, bale, notification, order
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send WooCommerce order notifications to Telegram or Bale.

== Description ==

Hamidreza Order Notifier sends WooCommerce order status notifications directly to your Telegram or Bale bot chat.

Features:
- Send notifications for selected WooCommerce order statuses
- Support for Telegram and Bale (Markdown formatting)
- Test connection button on the settings page
- Background delivery so checkout is not blocked
- Settings page under WooCommerce admin menu
- Translation-ready and RTL-friendly
- Requires WooCommerce as a hard dependency

== External services ==

This plugin connects to third-party messaging APIs to deliver WooCommerce order notifications to a chat configured by the site administrator.

= Telegram Bot API =

When Telegram is selected in the plugin settings, the plugin sends an HTTP POST request to the Telegram Bot API (`https://api.telegram.org/bot`) each time a WooCommerce order reaches one of the enabled order statuses.

The request includes the bot token and chat ID configured in the plugin settings, along with a notification message containing order details such as order number, status, customer name, phone number, payment method, order total, date, purchased items, and an admin order link.

This service is provided by Telegram: [Terms of Service](https://telegram.org/tos), [Privacy Policy](https://telegram.org/privacy).

= Bale Bot API =

When Bale is selected in the plugin settings, the plugin sends an HTTP POST request to the Bale Bot API (`https://tapi.bale.ai/bot`) each time a WooCommerce order reaches one of the enabled order statuses.

The request includes the bot token and chat ID configured in the plugin settings, along with a notification message containing order details such as order number, status, customer name, phone number, payment method, order total, date, purchased items, and an admin order link.

This service is provided by Bale: [Terms of Service](https://bale.ai/terms), [Privacy Policy](https://bale.ai/terms#s9).

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install through the WordPress admin Plugins screen.
2. Make sure WooCommerce is installed and active.
3. Activate the plugin through the "Plugins" menu in WordPress.
4. Go to `WooCommerce > Order Notifier`.
5. Choose Telegram or Bale, then enter your bot token and chat ID.
6. Click "Send test message" to verify the connection.
7. Enable notifications and choose the order statuses you want.
8. Click "Save settings".

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. WooCommerce must be installed and active. The plugin will not activate without WooCommerce.

= Where is the settings page? =

The settings page is available under **WooCommerce > Order Notifier**. A Settings link is also shown on the Plugins screen.

= Does it support Bale? =

Yes. You can choose Telegram or Bale from the plugin settings.

= Where do I find my Telegram bot token? =

Create a bot using @BotFather in Telegram. BotFather will give you an authentication token.

= Where do I find my chat ID? =

Message your bot, then read the chat ID from `getUpdates`, or use a helper bot such as @userinfobot. Group chat IDs are often negative. For Bale, use `getUpdates` on `tapi.bale.ai`.

= How can I check that it works? =

Use **Send test message** on the settings page. If the message arrives in your chat, live order notifications are ready.

== Screenshots ==

1. Plugin settings page under WooCommerce menu
2. Example order notification message

== Changelog ==

= 1.3.0 =
* Refined the dedicated WooCommerce settings page with a responsive two-column layout and configuration summary
* Added suggested privacy policy text for order data sent to Telegram or Bale
* Improved accessibility for test results and selected order status controls
* Prevented stale and duplicate background notification jobs
* Clear pending notification jobs when the plugin is deactivated
* Hardened bot token and chat ID sanitization
* Declared compatibility with WordPress 7.0 and WooCommerce 11.0

= 1.2.0 =
* Redesigned settings page with status badge, platform cards, and clearer grouping
* Added Send test message to verify Telegram or Bale credentials
* Bot token field is now hidden by default, with a show/hide toggle
* Notifications are queued in the background so checkout is not delayed
* Failed deliveries retry automatically and add an order note
* Telegram and Bale messages now use Markdown (with plain-text fallback)
* Message includes order number, payment method, and admin order link
* Removed API error log setting
* Shop managers with manage_woocommerce can open the settings page
* Added Settings link on the Plugins screen
* Validate credentials before notifications can be enabled

= 1.1.0 =
* Refactored codebase into modular class-based architecture
* Settings page moved to WooCommerce submenu (WooCommerce > Order Notifier)
* WooCommerce is now a hard dependency - plugin will not activate without it
* Added dedicated admin CSS for cleaner settings page
* Error logging now works when WP_DEBUG is enabled
* Updated WordPress and WooCommerce compatibility headers
* Improved code organization following WordPress coding standards

= 1.0.8 =
* Prefix plugin option and settings identifiers with hamidreza_ for WordPress.org compliance.
* Migrate stored settings from the legacy hrwcn_settings option key.

= 1.0.7 =
* Remove bundled translation files; translations are managed through translate.wordpress.org.
* Document Telegram and Bale external services in the readme.

= 1.0.6 =
* Initial release.

== Upgrade Notice ==

= 1.3.0 =
Improves compatibility, privacy disclosure, background delivery reliability, accessibility, and the WooCommerce settings experience.

= 1.2.0 =
Improved settings UI, test message, background delivery, and Markdown notifications for Telegram and Bale. Existing credentials are kept.
