=== NetDebit for WooCommerce ===
Contributors: netdebitdev
Tags: woocommerce, payment-gateway, netdebit, adult-entertainment, high-risk
Requires at least: 6.0
Tested up to: 7.1
Stable tag: 1.0.5
Requires PHP: 8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

NetDebit® Payments for WooCommerce: Reliable payments for Europe, specialized in adult entertainment and high-risk industries.

== Description ==

**NetDebit® is a professional payment solution for merchants in the adult entertainment industry and other high-risk sectors.**

This plugin integrates NetDebit directly into your WooCommerce store. Many payment providers refuse to work with merchants in industries they deem "high-risk." NetDebit is your reliable partner that understands the **adult entertainment** business model and offers fair, transparent conditions.

This gateway is ideal for selling **virtual products (videos, digital content) and subscriptions**.

**Why Choose NetDebit for WooCommerce?**

* **Built for Your Industry:** Specifically for sectors often underserved by other providers.
* **Full Subscription Support:** Fully compatible with "WooCommerce Subscriptions" and "YITH Subscriptions for WooCommerce".
* **Active Risk Management:** Automated user blocking after chargebacks.
* **Stable & Future-Proof:** Built on the official NetDebit SDK.

Currently, this plugin fully supports the **classic Shortcode-based Checkout**.

[Open a partner account @ NetDebit®](https://www.netdebit-payment.de/webmaster/registration)

== Installation ==

1. Upload the plugin directory to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **WooCommerce > Settings > Payments** and select "NetDebit Payment" to configure.

== Frequently Asked Questions ==

= Do I need a NetDebit partner account? =

Yes, an active partner account is mandatory to earn with our payment plugin. Please register at https://www.netdebit-payment.de/webmaster/registration.

= How does NetDebit for WooCommerce support Subscriptions? =

This plugin fully supports recurring payments. To enable this feature, you need to install either WooCommerce subscriptions or YITH subscriptions for WooCommerce.
NetDebit for WooCommerce will detect the presence of the installed plugin and show you its subscription related settings.

== Screenshots ==

1. The WooCommerce settings page for payment gateways. Click manage to access the plugin settings.
2. The plugin settings page part 1.
3. The plugin settings page part 2.
4. The plugin settings page part 3.
5. The checkout page showing NetDebit as a payment option.

== Changelog ==
= 1.0.5 =
* **Fix (Critical):** Guest checkout was completely broken — the "Hide billing address input" feature also removed the `billing_email` field, so WooCommerce could not create guest accounts and checkout was blocked.
* **Fix (Critical):** Legacy webhook API: the GatePass validation was bypassed due to `sanitize_key()` lowercasing/normalization — every request with the default GatePass was accepted.
* **Fix (Critical):** Renewal orders in `on-hold` status (created by YITH) could never be completed by payment webhooks — `on-hold` is now processed (also enables re-activation after chargeback).
* **Fix:** Improved settlement behaviour for YITH subscriptions.
* **Fix:** WooCommerce Subscriptions 9.x: the main subscription has its own order ID — settlement and access-end webhooks now find it via `wcs_get_subscriptions_for_order()`.
* **Fix:** YITH: subscription re-activation on activation webhooks now uses `$from='administrator'` so cancelled subscriptions are re-activated correctly; replaced undefined `add_note()` call with `add_order_note()` (fatal error fix).
* **Fix:** YITH renewal cron: the payment redirect (`wp_redirect()` + `exit`) now aborts cleanly in cron context instead of killing the whole renewal run.
* **Fix:** Deprecated `WC_Subscriptions_Order::order_contains_subscription()` replaced with `wcs_order_contains_subscription()` (WordPress 7.1 / WooCommerce 11).
* **Feature:** Extended Webhook Logging setting (logs full webhook payloads to WooCommerce logs).
* **Test:** Tested with WordPress 7.1, WooCommerce 11.0.1, WooCommerce Subscriptions 9.1.0 and YITH WooCommerce Subscription 4.21.0 (full E2E suite: checkout, webhooks, lifecycle, e-mails).

= 1.0.4 =
* **Test:** Tested with WordPress 7.2 and the newest WooCommerce, WooCommerce Subscriptions and YITH Subscriptions for WooCommerce plugins.
= 1.0.3 =
* **Fix:** Improved YITH subscription identification for Renewal Orders to ensure subscriptions are correctly cancelled on chargebacks.

= 1.0.2 =
* **Docs:** Updated FAQ section with improved answers and links.
* **Docs:** Fixed screenshot numbering and added descriptions for all 5 screenshots.

= 1.0.1 =
* **Fix** YITH subscriptions are now correctly paused on chargebacks. (WooCommerce Subscriptions were always working correctly.) Checkout blocking for chargeback users was already active - this fix extends the behavior to YITH subscriptions.

= 1.0.0 =
* **Release:** Official public release on WordPress.org plugin repository.

=0.3.2=
* **Fix** Distinction between YITH subscriptions and cart products restored.

=0.3.1=
* **Fix** Sanitation issues resolved.

=0.3.0=
* **Feature** Using the clients language as default for the NetDebit paytour (English). German is used only if the browser is set to German
* **Feature** Support for YITH woocommerce subscription free and paid version too.

= 0.2.9 =
* **Security:** Hardened all admin settings and legacy API endpoints with strict nonce verification and sanitized input handling.
* **Fix:** Resolved Plugin-Check warnings regarding translator comments and dynamic hook naming.
* **Refactor:** Improved Subscription renewal detection by utilizing order state instead of redundant request parameters.
* **Build:** Enhanced build script to recursively exclude system-specific metadata and development binaries (composer.phar).
* **Fix:** Standardized script registration for admin order views to prevent caching issues.

= 0.2.8 =
* **Fix:** Resolved critical Case-Sensitivity issues in the vendor directory for Linux-based environments.
* **Fix:** Corrected REST API parameter validation for the 'Thank You' redirect (added mandatory ndVar2 and order_key).
* **Fix:** Hardened permission_callback in REST hooks to support guest checkouts via Order Key validation.
* **Build:** Implemented LF (Line Feed) normalization in the build script to prevent CRLF conflicts.

= 0.2.7 =
* **Security:** Hardened the build process to strictly exclude development artifacts.
* **Security:** Enhanced REST API Webhook security by moving authentication logic into permission_callback.
* **Performance:** Optimized loading of installation scripts.
* **Fix:** Improved sanitization and output escaping for WordPress Coding Standards compliance.

= 0.2.6 =
* **Compatibility:** Enforced Classic Shortcode Checkout for correct tax calculation.
* **Feature:** Added admin notice for Checkout Block detection with "One-Click-Fix".
* **Fix:** Refactored VAT exclusion logic to use safe JavaScript injection.

= 0.2.5 =
* **Feature:** Automated user blocking after chargebacks.
* **Feature:** Support for WooCommerce Subscriptions.
* **Feature:** Option to suppress duplicate WooCommerce order emails.
* **Tweak:** Refactored payment transactions to use the official NetDebit SDK.

= 0.1.0 =
* Initial public release.

== Upgrade Notice ==

= 1.0.0 =
Official public release. All users can safely upgrade.

= 0.2.8 =
Critical fix for Linux server compatibility (Case-Sensitivity) and REST API redirect permissions. All users should update immediately.

== For Developers ==

This plugin is built with extensibility in mind.

* **Action Hooks:**
    * `NetDebit\WooCommerce\Events\ChargebackReceivedEvent::HOOK`
    * `NetDebit\WooCommerce\Events\SettlementReceivedEvent::HOOK`

Example usage:
```php
add_action( 'netdebit_chargeback_received', function( $event ) {
    $order = $event->getOrder();
    error_log( 'Chargeback for order: ' . $order->get_id() );
}, 10, 1 );