=== TorobPay for WooCommerce ===
Contributors: torobpay, macse2
Tags: woocommerce, payment gateway, installments, torobpay, iran
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 4.7.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept TorobPay installment payments in your WooCommerce store.

== Description ==

TorobPay for WooCommerce connects your store to the [TorobPay](https://torobpay.com/) payment service so customers can pay in installments at checkout.

**Requires:**

* A WordPress site with [WooCommerce](https://woocommerce.com/) active
* A TorobPay merchant account and API credentials

**Features:**

* Classic and block-based WooCommerce checkout support
* High-Performance Order Storage (HPOS) compatibility
* Order status sync, refunds, and merchant admin tools
* Optional product badges / promotional display widgets

This plugin is an interface to the TorobPay online payment service. Payment processing happens on TorobPay’s servers after the customer is redirected (or otherwise handed off) to complete payment.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install the ZIP via **Plugins → Add New**.
2. Activate **TorobPay for WooCommerce**.
3. Ensure WooCommerce is installed and active.
4. Go to **WooCommerce → Settings → Payments**, enable TorobPay, and enter your merchant credentials (or use the in-plugin credential fetch if available for your account).
5. Place a test order to confirm checkout and return URLs work.

== Frequently Asked Questions ==

= Do I need a TorobPay account? =

Yes. You must register as a TorobPay merchant and obtain API credentials before the gateway can process payments.

= Does this plugin work with the WooCommerce block checkout? =

Yes. The plugin registers WooCommerce Blocks payment method support.

= Is High-Performance Order Storage (HPOS) supported? =

Yes. Compatibility with custom order tables is declared in the plugin.

= Where can I get support? =

Visit [torobpay.com](https://torobpay.com/) or use the support channels listed in your TorobPay merchant panel.

= What happened to the Custom CSS editor? =

As of 4.7.2 the Custom CSS tab under TorobPay visual settings was removed (WordPress.org plugins may not ship arbitrary CSS editors). If you had custom rules there, copy them before or after upgrading into your **child theme stylesheet**, or into **Appearance → Customize → Additional CSS**. Stored TorobPay Custom CSS options are cleared on upgrade; they are not migrated automatically.

== Privacy Policy ==

When a merchant configures and uses TorobPay, this plugin communicates with TorobPay APIs (default host: `cpg.torobpay.com`) to authenticate the merchant, create/update payments, check payment status, sync order details, and (when used) provision or refresh merchant credentials.

Depending on configuration and the checkout flow, data sent to TorobPay may include:

* Order identifiers, amounts, currency, line items, discounts, and status
* Customer contact fields required for payment (for example phone number and postal code)
* Merchant API credentials / tokens used only to authenticate TorobPay API requests
* Site / store context needed for callbacks and merchant provisioning (for example store URL), when that flow is used

TorobPay’s own privacy practices apply to data processed by their service. Review TorobPay’s policies on [torobpay.com](https://torobpay.com/).

This plugin does not sell personal data. Outbound TorobPay API calls are made to operate the payment gateway the merchant intentionally enabled.

== Third-party libraries ==

* [jalaliDatePicker](https://github.com/majidh1/jalaliDatePicker) (MIT) — Jalali date picker used in admin order filters. Readable JS/CSS and license are bundled under `assets/vendor/jalalidatepicker/`.

== Changelog ==

= 4.7.5 =
* Guest checkout now redirects straight to TorobPay instead of WooCommerce order-pay, so SEO plugins cannot strip the pay URL and drop guests back on checkout.
* Block Checkout / Store API payment errors return a message without queuing a session notice that could 409 the next checkout.
* Checkout always goes to the gateway. The “Redirect directly to gateway” setting is deprecated and only still affects the leftover receipt Pay button.
* Widget price threshold updated

= 4.7.4 =
* WordPress.org review follow-up: escape dynamic CSS at output, unify TOROBPAY_ constants, and keep a visible torobpay_ prefix on responsive options.

= 4.7.3 =
* WordPress.org review follow-up: escape generated HTML with wp_kses, declare plugin functions without function_exists wrappers, and remove unused Iranian amount filters plus the v2 settings copy on activation.
* Product page widget now calculates installment amounts from the selected quantity (simple and variable products).
* If WooCommerce does not mark a settled order as paid, the order is placed On hold instead of staying pending; pay-again is blocked only when a TorobPay transaction already exists (if Disable payment retry is enabled).

= 4.7.2 =
* WordPress.org review fixes: remove Custom CSS editor, harden provision-verify access key, enqueue scripts/styles, sanitize order-edit payloads, validate order-notice ownership, scope provision notices.
* Important: if you used the Custom CSS tab, move those rules to a child theme or Appearance → Customize → Additional CSS before upgrading (see FAQ).

= 4.7.1 =
* Merchant-triggered order sync only (removed request-driven reconcile that could overload shared hosting).
* Safer API timeouts, payment eligibility on order-pay/thank-you, and price-parity fee detection improvements.
* Remote-locked payment handling, HPOS-safe order queries, orders-table status cache, and variation widget AJAX hardening.
* Provisioning recognizes terminal error 1034; admin Action Needed UI simplified (probe-based, no manual recheck button).

= 4.7.0 =
* Packaging and WordPress.org compliance work: remove external updater, add GPL licensing and readme, bundle readable jalaliDatePicker assets.

== Upgrade Notice ==

= 4.7.5 =
Guest checkout now goes straight to TorobPay (no WooCommerce order-pay hop). Recommended for all stores.

= 4.7.4 =
WordPress.org review follow-up: late CSS escaping and a single TOROBPAY_ / torobpay_ prefix.

= 4.7.3 =
WordPress.org review follow-up, quantity-aware installment widget, and safer handling when WooCommerce does not mark a settled order as paid.

= 4.7.2 =
WordPress.org Plugin Directory compliance and security hardening. Custom CSS editor removed — move any custom rules to a child theme or Appearance → Customize → Additional CSS (see FAQ).

= 4.7.1 =
Stability and shared-host performance fixes backported from the merchant release line. Recommended for all stores.

= 4.7.0 =
WordPress.org preparation: external self-updater removed. Updates will come through WordPress.org. Re-activate the plugin as the main file name changed.
