=== Payment Gateway for Paynet.am ===
Contributors: digitalbrainsam
Tags: woocommerce, payments, armenia, arca, idram
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 4.0
Stable tag: 1.6.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept payments in Armenia via Paynet.am (ARCA, Idram, Telcell, and partner banks) in WooCommerce.

== Description ==

Official WooCommerce plugin for the Paynet.am payment platform. Paynet.am is our own product, operated by Digital Brains LLC (https://digitalbrains.am). Connect your store to your Paynet.am account in one click - no API keys to copy - and accept card and wallet payments.

Includes:

* One-click Connect (no API keys typed by hand)
* Card and wallet processors (ARCA, Idram, Telcell, ACBA, Evocabank, Inecobank, Ameriabank, and more)
* Each connected processor appears as its own named choice at checkout - on both the classic and the block-based (Gutenberg) checkout
* Automatic order-status sync with pull-verification (a forged webhook can never mark an order paid)
* e-HDM fiscal receipts delivered to the customer
* Refunds from the WooCommerce order screen
* Compatible with High-Performance Order Storage (HPOS) and the Cart/Checkout Blocks

= External services =

This plugin connects your store to the Paynet payment platform (https://paynet.am). The connection is required for every payment this gateway processes - without a connected Paynet account the gateway does nothing.

What is sent, and when:

* When a customer pays: the order id, order total and currency (AMD), the order line items (product names, quantities, prices - used for the e-HDM fiscal receipt), the customer's email address, and your store domain are sent to paynet.am to create the payment.
* When an order is verified: the order id is sent to paynet.am to fetch the authoritative payment status (on the payment webhook, on the customer's thank-you page, and in a background reconcile task).
* When you connect the store: your store domain, store name, and the admin email address are sent to paynet.am to link (or create) your Paynet account.
* When you open the plugin settings: your connected processor list is fetched from paynet.am.

No card numbers ever touch your store - customers enter card details on the bank's own payment page.

Service terms: https://paynet.am/terms
Privacy policy: https://paynet.am/privacy

== Installation ==

1. Upload the plugin ZIP via Plugins > Add New > Upload Plugin, or copy the `payment-gateway-for-paynetam` folder to `wp-content/plugins/`.
2. Activate the plugin through the Plugins screen.
3. Go to WooCommerce > Settings > Payments > Paynet and click Connect to authorize your store.

== Frequently Asked Questions ==

= Do I need a Paynet account? =

Yes. Clicking Connect creates a free-tier account automatically if you do not have one; otherwise a login window links the store to your existing account at paynet.am.

= Which currencies are supported? =

Armenian Dram (AMD) only. The gateway refuses checkout in any other store currency to protect you from under-charged orders.

= Which payment processors can my customers use? =

Any processor connected to your Paynet account: ARCA and the ARCA member banks (ACBA, Evocabank, Converse Bank, AraratBank, IDBank, Ardshinbank and others), Ameriabank, Inecobank, and the Idram and Telcell wallets. Each one you enable appears as its own named option at checkout.

= Does it work with the new block-based (Gutenberg) checkout? =

Yes. The per-processor picker renders on both the classic shortcode checkout and the Cart/Checkout Blocks.

= Can a forged webhook mark an order as paid? =

No. The webhook is treated only as a hint to re-check an order; the plugin always fetches the authoritative payment status from your Paynet account (authenticated with your connect token) and additionally verifies the paid amount and currency against the order before completing it.

= Where are the fiscal (e-HDM) receipts? =

If e-HDM is configured on your Paynet account, the fiscal receipt QR is shown to the customer on the thank-you page and the receipt link is attached to the order notes.

== Screenshots ==

1. One-click Connect in the plugin settings.
2. Payment methods and per-language method names.
3. The per-processor picker at checkout.
4. e-HDM fiscal receipt QR on the thank-you page.

== Changelog ==

= 1.6.8 =
* Renamed the plugin to "Payment Gateway for Paynet.am" (slug payment-gateway-for-paynetam) per the WordPress.org plugin review guidelines.

= 1.6.7 =
* Updated the Idram method logo.

= 1.6.6 =
* Fixed the processor on/off switches overlapping their labels in the Payment methods list (WooCommerce fieldset CSS collision).

= 1.6.5 =
* Method logos are size-constrained on the classic checkout and Pay-for-order pages (a square logo rendered at full natural size).

= 1.6.4 =
* Abandoning payment on the Paynet page returns the customer to the "Pay for order" page - the order stays pending with its items and can be paid again (the 1.6.3 cancel-order flow cancelled the order and left an empty cart).

= 1.6.3 =
* Abandoning payment on the Paynet page now returns the customer to the store instead of stranding them (via a dedicated cancel URL).

= 1.6.2 =
* The payment method is hidden at checkout until the store is connected to Paynet and priced in AMD (previously an unconnected store showed the method and failed at submit on the classic checkout).
* Added a Settings link on the Plugins screen for quick access to the gateway settings.
* The API base URL is now fixed to paynet.am (no longer an editable setting), so requests can never be redirected.
* Until the store is connected, the settings page shows only the Connect step; the full settings appear after connecting.
* Fixed "Manage in dashboard" reloading the settings page instead of opening the Paynet dashboard.
* Translation-ready: text domain loads from languages/ (POT included), so translation plugins such as Loco Translate can translate every string.
* The checkout redirect notice is now disabled by default.
* The shopper's storefront language (hy/ru/en) is sent with each payment, so the Paynet checkout and the bank/wallet payment page open in the customer's language; the Connect popup follows the wp-admin user's language.
* Each connected processor now appears as its OWN payment method at checkout (classic and Blocks) - with the merchant's per-language name and the method's logo, exactly like the OpenCart plugin.
* Bundled logos for ArCa, Idram, Telcell, and all ARCA member banks (shipped inside the plugin, never loaded remotely), plus a "Method logos" switch to show or hide them at checkout.
* New "Payment page language" setting: Auto (customer's language) or a fixed hy/ru/en.
* Enable/Disable and the redirect notice are now on/off switches instead of checkboxes.
* Fixed the gateway showing as Inactive in the Payments list (with an Enable button) right after connecting, while the settings page showed it enabled.
* Method name and redirect message fields now match the store's actual languages (one field for a single-language shop; per-language fields only with Polylang/WPML).
* The settings page shows the installed plugin version and an update notice with a download link when a newer release exists (updates stay manual - nothing is ever pushed).

= 1.6.0 =
* Renamed to "Paynet.am Armenian Payments".
* All JavaScript is now enqueued via wp_enqueue_script/wp_add_inline_script (no inline script tags).
* Classes renamed to the Paynet_ prefix to avoid naming collisions.

= 1.5.0 =
* Block-based (Gutenberg) checkout support: the per-processor picker now renders on the Cart/Checkout Blocks, returning the chosen processor through the Store API - the same server path as the classic checkout.
* Declared compatibility with Cart/Checkout Blocks and High-Performance Order Storage (HPOS).

= 1.4.0 =
* Pull-verification: the webhook is now an untrusted nudge - the order status is pulled from your Paynet account and applied from there, never from the request body. No webhook secret is stored.
* Fallback settlement: the order also settles on the customer's thank-you page and via a background reconcile pass, so a missed webhook no longer leaves an order stuck pending.
* Per-processor checkout: each connected processor appears as its own choice at checkout, with the merchant's custom per-language name.
* Method names are stored only in your store (no longer synced to Paynet); only the processor selection is synced.
* One-click auto-connect (with the existing popup as the fallback for stores that already have a Paynet account).
* e-HDM fiscal receipt QR shown on the thank-you page.
* The gateway refuses non-AMD orders instead of risking a silently under-charged payment.

= 1.3.0 =
* Settings brought to parity with the OpenCart plugin: connection status (Connected + domain + token prefix) with Test connection and Manage-in-dashboard actions.
* Payment methods: choose which connected processors are offered on the Paynet checkout, fetched live from your account.
* Method names: per-processor, per-language (English / Հայերեն / Русский) display names.
* Sort Order field controls where Paynet appears among other checkout payment methods.
* Order-status mapping: Paynet completed/failed/refunded/expired outcomes map to WooCommerce order statuses.
* Redirect notice: show/hide toggle plus a per-language message shown at checkout before the customer is sent to Paynet.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.6.0 =
Plugin renamed to Payment Gateway for Paynet.am; internal classes re-prefixed and scripts moved to enqueues. No settings changes required.

= 1.5.0 =
Adds the per-processor picker to the block-based (Gutenberg) checkout and declares HPOS/Blocks compatibility. No settings changes required.

= 1.4.0 =
Payment verification switched to pull-based (more secure); re-save the plugin settings once after upgrading so the processor list is refreshed.
