=== Formipay ===
Contributors: dwindown
Tags: e-commerce, checkout, payment, customer portal
Requires at least: 6.2
Tested up to: 6.8
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Formipay is a flexible plugin for building customizable checkout forms to sell products, accept multiple payments options, and manage customers.

== Description ==

Formipay lets you create powerful, customizable checkout forms for selling digital and physical products on your WordPress site. Easily integrate with manual transfer, Cash on Delivery (COD), PayPal, and a wide range of third-party payment gateways. Manage products, grant digital access, and provide a customer portal for order tracking and downloads.

**Key Features:**
* Build custom checkout forms for any product or service
* Sell digital downloads, physical goods, or both
* Accept payments via manual transfer, COD, PayPal, and other gateways
* Product management with digital access control
* Customer portal for order history and downloads
* GDPR-compliant data handling and privacy tools
* (Planned) Subscription and donation forms with custom or suggested amounts

**Use Cases:**
* Sell e-books, software, or media files
* Sell physical products with shipping and inventory management
* Accept donations (one-time or recurring/subscription)
* Offer pay-what-you-want or buyer-set pricing
* Provide a branded customer dashboard

== Installation ==

1. Upload the `formipay` plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to "Formipay" in your WordPress dashboard to create your first form and configure payment gateways.
4. Add your form to any page or post using the provided shortcode.

== Frequently Asked Questions ==

= Can I use Formipay for both digital and physical products? =
Yes, Formipay supports both digital downloads and physical product sales.

= What payment gateways are supported? =
Manual transfer, COD, PayPal, and other third-party gateways. More integrations are planned.

= Is Formipay GDPR compliant? =
Yes, Formipay includes tools and templates to help you comply with GDPR and other privacy regulations.

= Can I accept donations or subscriptions? =
Donation and subscription forms are planned for future releases, including support for custom or suggested amounts.

== Screenshots ==

1. Customizable checkout form example
2. Product management interface
3. Customer portal dashboard

== Changelog ==

= 1.0.0 =
* Initial release: Custom checkout forms, product management, payment gateway integration, and customer portal.

== Upgrade Notice ==

= 1.0.0 =
First release. Upgrade safely.

== License ==

This plugin is licensed under the GPLv2 or later.

== Credits ==

Developed by Dwindi Ramadhana.

== Privacy ==

Formipay collects and processes user data in accordance with GDPR. Please review and customize the included privacy policy template for your site.

== Mermaid Multi-Currency Implementation ==

flowchart TD
  GS[Global Settings]
  GS -->|Toggle: Multi‑Currency ON/OFF| MODE{Mode}

  %% SINGLE-CURRENCY MODE
  MODE -->|OFF| SC[Single‑Currency Mode]
  SC -->|GS Default Currency only| FS1[Form Settings]
  SC -->|GS Default Currency only| PS1[Product Settings]
  FS1 --> CO1[Checkout]
  PS1 --> CO1
  CO1 --> ORD1[Order Stored :: currency = GS default]
  ORD1 --> RPT1[Reports for single currency]

  %% MULTI-CURRENCY MODE
  MODE -->|ON| MC[Multi‑Currency Mode]
  GS -->|Enabled Currencies + Rates| FS[Form Settings]
  GS -->|Enabled Currencies + Rates| PS[Product Settings xN]

  FS -->|FS.allowed ⊆ GS.enabled\nFS.default ∈ FS.allowed| CK[Checkout]
  PS -->|Per Product:\nBase currency default GS\nManual overrides optional\nDerive from base via GS toggle| CK

  CK -->|Compute CheckoutAllowed =\nFS.allowed ∩ as ProductSupported p| ALLOWED{CheckoutAllowed empty?}
  ALLOWED -->|Yes| BLOCK[Block checkout + Admin diagnostic:\nEnable derive / add manual prices /\nadjust FS.allowed / remove product]
  ALLOWED -->|No| CUR[Buyer selects currency ∈ CheckoutAllowed]

  CUR --> PAY[Filter payment gateways by selected currency]
  PAY --> TOT[Compute totals:\nManual price → else derive via GS]
  TOT --> ORD[Persist Order:\norder_currency, total_in_order_currency,\nfx_rate_used, report_total_in_GS_base]
  ORD --> RPT[Reports:\nSum in GS base with per‑currency breakdown option]

  %% CATALOG (when MC=ON)
  MC --> CAT[Catalog]
  CAT -->|Query: currency=USD,IDR,AUTO| RESOLVE[Resolve display currency AUTO→pref/GS default]
  RESOLVE --> FILT[Filter products strictly:\nshow only products supporting the display currency\n derive ok if product toggle is ON]