=== VDot Crypto Gateway for WooCommerce ===
Contributors: sipho213
Tags: cryptocurrency, bitcoin, ethereum, woocommerce, payment gateway
Requires at least: 5.8
Tested up to: 7.0
Stable tag: 1.1.2
Requires PHP: 8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept cryptocurrency payments directly to your wallet. Non-custodial, decentralized WooCommerce payment gateway.

== Description ==

VDot Crypto Gateway for WooCommerce allows you to accept cryptocurrency payments directly in your WooCommerce store. Payments go directly to your wallets - no intermediaries, no merchant fees, and no third-party processing.

= Features =

* Accept 11+ cryptocurrencies: Bitcoin, Ethereum, USDT, USDC, BNB, Litecoin, Dogecoin, Solana, Tron, Polygon (MATIC), Arbitrum, Optimism
* Direct wallet-to-wallet payments with zero merchant fees
* Automatic payment detection and confirmation monitoring
* Real-time price feeds from multiple sources
* QR code generation for easy mobile payments
* Payment page with live status updates and countdown timer
* Wallet rotation for enhanced privacy and security
* Support for WooCommerce High-Performance Order Storage (HPOS)
* Support for WooCommerce Cart & Checkout Blocks
* Partial payment detection and overpayment handling
* Automated order status updates on payment confirmation
* Email notifications for payment confirmation and expiry
* Comprehensive logging and debugging
* CSV/JSON wallet import and export
* Privacy/GDPR compliant - personal data export and erasure
* Translation-ready with full localization support

= External Services =

This plugin uses the following external services to provide cryptocurrency price data and transaction verification:

1. **CoinGecko API** - Fetch cryptocurrency prices. Data sent: crypto symbol only. When sent: when payment page loads and via scheduled cron. Terms: https://www.coingecko.com/en/api_terms Privacy: https://www.coingecko.com/en/privacy

2. **CoinCap API** - Fallback price feed. Data sent: crypto symbol only. When sent: when CoinGecko API fails. Terms: https://coincap.io/terms-of-service Privacy: https://static.coincap.io/documents/privacy_policy.pdf

3. **CryptoCompare API** - Secondary fallback price feed. Data sent: crypto symbol only. When sent: when CoinGecko and CoinCap APIs fail. Terms: https://www.cryptocompare.com/terms-conditions/ Privacy: https://www.cryptocompare.com/privacy-policy/

4. **ExchangeRate.host** - Fiat currency conversion rates. Data sent: currency codes only. When sent: when order currency differs from plugin fiat currency setting. Terms: https://exchangerate.host/terms Privacy: https://exchangerate.host/privacy

5. **Blockstream** - Bitcoin transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://github.com/Blockstream/ Privacy: https://blockstream.com/privacy/

6. **Blockchain.info** - Bitcoin transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron (fallback). Terms: https://www.blockchain.com/legal/terms Privacy: https://www.blockchain.com/legal/privacy

7. **Etherscan** - Ethereum, USDT, USDC transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://etherscan.io/terms Privacy: https://etherscan.io/privacy-policy

8. **BscScan** - BNB transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://bscscan.com/terms Privacy: https://bscscan.com/privacy-policy

9. **Arbiscan** - Arbitrum transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://arbiscan.io/terms Privacy: https://arbiscan.io/privacy-policy

10. **Optimistic Etherscan** - Optimism transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://optimistic.etherscan.io/terms Privacy: https://optimistic.etherscan.io/privacy-policy

11. **TronGrid** - Tron transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://developers.tron.network/page/terms-of-use Privacy: https://developers.tron.network/page/privacy-policy

12. **SoChain** - Litecoin and Dogecoin transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://www.block.io/terms Privacy: https://www.block.io/privacy

13. **Solana RPC** - Solana transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://solana.com/tos Privacy: https://solana.com/privacy

14. **PolygonScan** - Polygon (MATIC) transaction verification. Data sent: wallet address and transaction ID. When sent: during payment monitoring cron. Terms: https://polygonscan.com/terms Privacy: https://polygonscan.com/privacyPolicy

== Installation ==

1. Upload the `vdot-crypto-gateway` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to WooCommerce > Settings > Payments and enable "VDot Crypto Gateway"
4. Configure your settings in the VDot Crypto menu that appears in your admin sidebar
5. Add your wallet addresses in the Wallets section
6. Enable the coins you want to accept in the Coins section

== Frequently Asked Questions ==

= How does payment work? =

When a customer selects cryptocurrency at checkout, they are shown a payment page with the exact amount to send, the wallet address, and a QR code. The plugin monitors the blockchain for the transaction and automatically confirms the payment once enough network confirmations are detected.

= Are there any merchant fees? =

No. VDot Crypto Gateway processes payments directly from your customer to your wallet. There are no transaction fees, processing fees, or monthly charges.

= What cryptocurrencies are supported? =

Bitcoin, Ethereum, USDT, USDC, BNB, Litecoin, Dogecoin, Solana, Tron, Polygon (MATIC), Arbitrum, and Optimism.

== Screenshots ==

1. Payment page showing QR code, amount, and wallet address
2. Admin dashboard with transaction overview
3. Coin management settings
4. Wallet management interface
5. Manage Coins
6. Checkout Settings
7. Tools
8. Transactions

== Changelog ==

= 1.1.2 =
* SECURITY: Fixed false "PAYMENT DETECTED - CONFIRMING" showing when no real payment was sent — complete rewrite of blockchain transaction verification logic
* Fixed: Direction validation (ETH/BSC/Polygon/Arbitrum/Optimism) — now verifies the transaction `to` field matches the wallet address; previously ANY transaction on the address (including outgoing) triggered false payment detection
* Fixed: Time filtering (all coins) — transactions that occurred before the order was created are now skipped (with 5-minute grace for clock skew), preventing old/historic transactions from triggering false positives
* Fixed: Amount validation (all coins) — zero-value, dust, and clearly wrong amounts (below 50% of expected) are now rejected during verification
* Fixed: TXID uniqueness (all coins) — the same blockchain transaction can no longer be credited to multiple orders; duplicate txid reuse across orders is now blocked
* Fixed: Failed transaction rejection (ETH/TRON) — checks `isError`, `txreceipt_status`, and `contractRet` fields to skip failed/reverted blockchain transactions
* Fixed: BTC confirmation count — previously used raw `block_height` (800,000+) as the confirmation count, causing instant false completion; now correctly calculates confirmations as `current_height - tx_block_height + 1` via cached blockchain.info/blockstream API
* Fixed: Explorer response caching — changed from caching the parsed result (reused incorrectly across different orders on the same wallet) to caching raw API responses and re-parsing fresh per transaction
* Added: TRON destination validation with `tron_address_matches()` and `tron_hex_to_base58()` helpers to verify TRX/TRC20 transfer recipients across hex and Base58 address formats
* Added: Verified transaction logging — each confirmed match now logs coin type, txid, value, and confirmation count for audit trail
* Improved: TRC20 token transfer parsing — now decodes `a9059cbb` method data to extract recipient address and amount for proper validation

= 1.1.1 =
* Premium UI redesign — complete admin interface and frontend payment templates redesigned to commercial-quality appearance
* Modern design system with CSS custom properties, 8px spacing system, premium typography, and consistent color palette
* Premium card layouts with soft shadows, rounded corners (10–14px), hover animations, and proper spacing
* Redesigned dashboard with stat cards, hero section, quick actions, and system health indicators
* Premium coin management with slide-over panel, subtabs (General, Wallets, Networks, Fees, Advanced), and drag-and-drop reorder
* Premium wallet management with card-based layout, status chips, and inline actions
* Redesigned transactions table with sticky header, status pills, coin icons, filters, and bulk actions
* Premium checkout settings page with toggle switches and grouped settings cards
* Premium payment page inspired by Stripe and Coinbase Commerce with animated status bar and QR code
* Modern toast notification system with progress bars and auto-dismiss
* Command palette (Ctrl+K) for quick navigation between admin pages
* Modal system with backdrop blur, focus trapping, and confirmation dialogs
* Animated toggle switches replacing plain checkboxes
* Empty state illustrations with friendly text and action buttons
* Responsive design for desktop, laptop, tablet, and mobile
* Accessibility improvements: keyboard navigation, focus states, ARIA labels, WCAG AA compliance
* Fixed: Resume payment failing with "RESUME FAILED" when timer expired (transaction still pending in DB while cron hasn't run)
* Fixed: Resume payment API now auto-expires pending transactions when timeout has elapsed before creating new session
* Fixed: allow_resume_expired setting default mismatch — API treated unset value as disabled while UI defaulted to enabled
* Fixed: Transactions bulk actions calling non-existent update_status() method causing fatal PHP error (now uses update_status_atomic)
* Fixed: Transactions bulk selection using hidden inputs instead of checkboxes (all items always submitted)
* Fixed: Checkout settings "Display Mode" (method) field not saved to database
* Fixed: Checkout toggle settings (display_coin_logos, show_exchange_rate, show_countdown, auto_cancel, auto_complete, reduce_stock, allow_resume_expired) could never be turned off — unchecked checkboxes defaulted to "yes" instead of "no"
* Fixed: Price Feeds page broken HTML rendering due to duplicate closing table tag
* Fixed: Coin slide-over panel save could not disable coins or toggle test_mode — jQuery serializes boolean false as string "false" which PHP !empty() treats as truthy (now uses filter_var with FILTER_VALIDATE_BOOLEAN)
* Fixed: Duplicate bpCopy() function definition in payment.js
* Improved: Real blockchain verification confirmed — payment status only changes based on actual blockchain explorer API responses (blockchain.info, etherscan, bscscan, trongrid, etc.)
* Improved: VDot plugin icon SVG fixed (was corrupted with invalid characters)

= 1.1.0 =
* Performance optimization engine with multi-level caching, query batching, and background processing
* Security dashboard with threat monitoring and health checks
* Full import/export system with JSON backup and restore
* WooCommerce Subscriptions support (renewals, payment meta, method updates)
* Multi-vendor marketplace support (Dokan, WCFM, MVX) with vendor wallets and payouts
* Duplicate payment protection with idempotency keys and atomic status updates
* Database performance indexes on transactions, logs, and webhook logs
* AJAX lazy loading for wallet admin pages
* WordPress.org compliance: accessibility (ARIA labels), security hardening, uninstall cleanup
* 30+ admin interface improvements with design system
* Comprehensive test suite (unit, integration, WooCommerce)
* Detailed performance, security, and compatibility reports

= 1.0.0 =
* Initial release
* Support for 12+ cryptocurrencies
* Automatic payment detection and confirmation
* QR code generation
* Wallet rotation (sequential and random)
* WooCommerce Cart & Checkout Blocks support
* WooCommerce HPOS compatibility
* Comprehensive admin interface with analytics dashboard
* Secure REST API (v1 + v2)
* Email notifications (instructions, received, confirmed, expired)
* CSV/JSON wallet import/export
* Payment receipt downloads
* Translation ready

== Upgrade Notice ==

= 1.1.2 =
Critical security fix: prevents false payment detection from old, outgoing, zero-value, or reused blockchain transactions. Rewrites transaction verification for all supported coins (BTC, ETH, BSC, Polygon, TRON, Arbitrum, Optimism). Also fixes BTC confirmation miscalculation. No database changes — safe to update. Strongly recommended for all users.

= 1.1.1 =
Bug fixes for payment resume, transaction bulk actions, checkout settings saving, coin toggle panel, and price feeds rendering. Premium UI redesign with modern design system. No database changes — safe to update.

= 1.1.0 =
Database migration to v1.8.0 — adds composite indexes on transaction, log, and webhook tables for performance. Multi-vendor migration (v1.7.0) adds vendor_id column to wallets and payouts table. Duplicate payment protection migration (v1.6.0) adds unique index on txid. All migrations are automatic on plugin update.

= 1.0.0 =
Initial release.
