=== Givasso ===
Contributors: otmaaan91
Tags: donation, nonprofit, stripe, helloasso, fundraising
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Donation forms for French nonprofits: Stripe & HelloAsso payments, fundraising campaigns with progress bars, donor management, thank-you emails.

== Description ==

**Givasso** is the donation plugin built for **French nonprofits** (associations). In minutes, add an online donation form to your WordPress site, run fundraising campaigns and follow every donation from your dashboard.

= Features =

* **Donation form** via shortcode — 5 themes (Givasso, Classic, Ocean, Sunset, Minimal), 3 layouts (Card, Inline, Flat)
* **Your look** — main color, corner style and button style, with a live preview
* **Stripe** — secure card payments via Stripe Checkout, test mode included
* **HelloAsso** — the payment platform used by French nonprofits, with no commission taken on your donations
* **Fundraising campaigns** — goals, dates, progress bars, ready-made campaign block
* **Thank-you email** — sent automatically to the donor after each confirmed payment, with your own subject, message, logo and color
* **Donations and donors** — dashboard with statistics, full donation list, donor history and totals
* **Stripe refunds** from the WordPress admin; HelloAsso refunds are synced automatically
* **Theme-friendly** — inherits your theme typography; every template can be overridden in your theme

= Why Givasso? =

* Built for **French nonprofits**, with native HelloAsso support
* Lightweight — no external libraries, no Composer, no JS framework
* Secure — signed payment notifications, nonces, capability checks, prepared SQL queries, rate limiting on the payment form
* Privacy-friendly — donor data stays in your WordPress database, no tracking or telemetry

= Shortcodes =

**Donation form**
`[givasso_form]`

Available attributes:

| Attribute | Default | Values |
|---|---|---|
| `theme` | `givasso` | `givasso`, `classic`, `ocean`, `sunset`, `minimal` |
| `layout` | `card` | `card`, `inline`, `flat` |
| `amounts` | `10,25,50,100` | comma-separated integers |
| `currency` | `EUR` | `EUR`, `USD`, `GBP`, `MAD`, `CHF` |
| `campaign` | _(empty)_ | campaign slug |
| `title` | `Faire un don` | free text |
| `button_text` | `Donner maintenant` | free text |
| `show_title` | `yes` | `yes`, `no` |
| `gateway` | _(admin setting)_ | `stripe`, `helloasso` |

**Campaign progress bar**
`[givasso_total campaign="my-campaign" display="bar"]`

`display` accepts `amount`, `count` or `bar`.

**Full campaign (progress bar + form)**
`[givasso_campaign campaign="my-campaign"]`

= Customizing templates =

Copy any file from the plugin `templates/` folder into a `givasso/` folder in your theme, keeping the same path. For example:

* `templates/form/card.php` → `your-theme/givasso/form/card.php`
* `templates/campaign/campaign.php` → `your-theme/givasso/campaign/campaign.php`
* `templates/email/thank-you.php` → `your-theme/givasso/email/thank-you.php`

= Hooks for developers =

* `givasso_donation_completed` (action) — fired after a new confirmed donation is recorded. Arguments: donation ID, donation data.
* `givasso_send_thank_you_email` (filter) — return `false` to skip the thank-you email for a donation.
* `givasso_client_ip` (filter) — client IP used by rate limiting, for sites behind a reverse proxy.

= Compatibility =

* WordPress 6.0+
* PHP 8.1+
* Stripe API (Checkout Session)
* HelloAsso API v5
* Browsers: Chrome, Firefox, Safari, Edge (last 2 versions)

= Privacy (GDPR) =

Givasso stores donor personal data (first name, last name, email, donations) in the association's own WordPress database, solely to record donations, manage donors and send the thank-you email. The association is the data controller under GDPR.

Givasso sends no data to the plugin author and collects no telemetry. Data is only transmitted to the payment gateway chosen by the association (Stripe or HelloAsso) to process the payment.

When a donation is confirmed, Givasso sends a thank-you email to the donor through your site's email system (`wp_mail`). This email can be disabled in Givasso › Settings › Email.

== External Services ==

This plugin connects to the following third-party services. Their use is subject to their respective terms and conditions.

= Stripe =
Used for processing card payments, when Stripe is enabled.
* Service: https://stripe.com
* Terms of use: https://stripe.com/legal
* Privacy policy: https://stripe.com/privacy
Data transmitted when a donor starts a payment: the donation amount and currency, the donor's first name, last name and email, and the campaign name if any. Card data is entered on Stripe's page and never passes through your server.

= HelloAsso =
Used as an alternative payment gateway for French nonprofits, when HelloAsso is enabled.
* Service: https://www.helloasso.com
* Terms of use: https://www.helloasso.com/cgu
* Privacy policy: https://www.helloasso.com/confidentialite
Data transmitted when a donor starts a payment: the donation amount, your organization slug, and the donor's name and email to prefill the HelloAsso checkout page.

== Installation ==

1. In WordPress, go to **Plugins › Add New**, search for "Givasso", then install and activate it
2. Go to **Givasso › Settings** and configure:
   - Your Stripe API keys (test mode first, then live) and/or your HelloAsso credentials
   - Your association information (name, address, contact email)
   - The thank-you email (subject, message, logo, color)
3. Add the shortcode `[givasso_form]` to any page
4. Test with a Stripe test card (`4242 4242 4242 4242`)

= Stripe webhook setup =

To record donations in the database, configure a Stripe webhook pointing to:
`https://your-site.com/wp-json/givasso/v1/webhook`

Events to enable: `checkout.session.completed`, `charge.refunded`

= HelloAsso setup =

1. Get your API credentials (client ID and client secret) from your HelloAsso account
2. Enter your `client_id`, `client_secret` and organization slug in Givasso settings
3. Configure the HelloAsso notification URL: `https://your-site.com/wp-json/givasso/v1/helloasso-webhook`

== Frequently Asked Questions ==

= Is the plugin free? =

Yes. Givasso is free and licensed under the GPL. Only your payment gateway fees apply: Stripe's transaction fees if you use Stripe; HelloAsso takes no commission on donations.

= Does HelloAsso charge commissions? =

No. HelloAsso is free for French nonprofits. Donors may optionally leave a voluntary contribution to HelloAsso during payment.

= Does Givasso issue tax receipts? =

No. Givasso records donations and sends a thank-you email, which is not a tax receipt.

= Can I have multiple forms on the same page? =

Yes. Each shortcode generates an independent form with unique identifiers.

= Can I customize the form design? =

Yes. Choose from 5 built-in themes and 3 layouts, set your colors, corners and button style in Givasso › Settings › Appearance, or override the templates in your theme (see "Customizing templates"). The `flat` layout (no card, transparent background) blends into any design.

= Can I turn off the thank-you email? =

Yes, in Givasso › Settings › Email. You can also edit its subject and message, and use the tags `{prenom}`, `{nom}`, `{montant}`, `{association}`, `{campagne}` and `{date}`.

= The thank-you email does not arrive. What can I do? =

Givasso uses your site's email system. If your site's emails end up in spam or are not delivered, install an SMTP plugin to send emails through your email provider.

= Is the data secure? =

All SQL queries use `$wpdb->prepare()`. Output is escaped. Forms are protected by nonces and rate limiting. Stripe notifications are verified by HMAC-SHA256 signature, HelloAsso notifications by signature or IP address.

= Does it work with WooCommerce? =

Givasso is independent of WooCommerce. Both plugins can coexist without conflict.

== Screenshots ==

1. Donation form — Givasso theme, Card layout
2. Campaign block — progress bar, figures and integrated form
3. Admin dashboard — statistics and latest donations
4. Campaign management
5. Thank-you email settings with live preview
6. Appearance settings — color, corners and button style

== Changelog ==

= 1.0.1 =
* Added: thank-you email sent to the donor after each confirmed donation (subject, message, logo and color customizable, live preview in settings)
* Added: `givasso_donation_completed` action and `givasso_send_thank_you_email` filter
* Fixed: the form no longer inherits theme styles that broke its layout (borders, button colors, input backgrounds), e.g. with Twenty Twenty-One or GeneratePress
* Fixed: styles now load for every shortcode: `[givasso_total]` alone, `[givasso_campaign]` for an ended campaign or with `show_form="no"`, and forms inside page builders (Elementor)
* Fixed: styles load in the page head when the content contains a Givasso shortcode (no flash of unstyled form, cache/minify friendly)
* Fixed: `[givasso_campaign]` now uses the Givasso theme by default, like `[givasso_form]`
* Fixed: form templates can now be overridden in the theme, as documented (`your-theme/givasso/form/`)
* Improved: 16px input text to prevent automatic zoom on iPhone
* Fixed: uninstall now removes all Givasso data (campaigns table, HelloAsso, email and appearance settings)
* Fixed: plugin description and readme listed features that are not part of Givasso
* Removed: placeholder admin pages for features that are not available
* Tested with WordPress 7.1

= 1.0.0 =
* Added: `flat` layout — card-less form with transparent background
* Added: automatic theme typography inheritance (`font-family: inherit`)
* Improved: `[givasso_campaign]` — integrated form automatically uses `flat` layout
* Improved: dynamic CTA button — displays "Donate XX €" based on selected amount
* Improved: "100% secure payment" badge colored by gateway (purple Stripe, red HelloAsso)
* Fixed: `gateway` and `frequency` shortcode attributes silently ignored
* Fixed: default theme corrected to `givasso` (was `classic` in ShortcodeManager)
* Added: Stripe refund from admin + `charge.refunded` webhook
* Added: rate limiting 5 req/min/IP (dual backend: object cache or transients)

= 0.7.0 =
* Added: fundraising campaigns with goals, dates and progress gauges
* Added: `[givasso_campaign]` and `[givasso_total display="bar"]` shortcodes

= 0.4.0 =
* Added: HelloAsso gateway (OAuth2, checkout intent, HMAC webhook)
* Added: HelloAsso settings in admin
* Added: `gateway` shortcode attribute (`stripe`, `helloasso`)
* Fixed: WordPress user-agent blocked by Cloudflare — replaced with `Givasso/1.0`

= 0.1.0 =
* Initial release
* Donation form (shortcode, 4 themes, 2 layouts)
* Stripe gateway — Checkout Session + webhook
* Admin dashboard
* MySQL tables: donors, donations

== Upgrade Notice ==

= 1.0.1 =
New: automatic thank-you email to donors (enabled by default, can be turned off in Givasso › Settings › Email). Tested with WordPress 7.1.
