Metadata-Version: 2.4
Name: pretix-gpwebpay
Version: 7.1.0
Summary: GPWebPay payment provider for Pretix
Author-email: KrisIsNew <gpwebpay.pretix@krisisnew.xyz>
Maintainer-email: KrisIsNew <gpwebpay.pretix@krisisnew.xyz>
License-Expression: Apache-2.0
Project-URL: homepage, https://github.com/KrisIsNew/pretix-gpwebpay
Project-URL: repository, https://github.com/KrisIsNew/pretix-gpwebpay
Project-URL: issues, https://github.com/KrisIsNew/pretix-gpwebpay/issues
Keywords: pretix,payment,gpwebpay
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pretix>=2025.1.0
Requires-Dist: cryptography>=44.0.1
Requires-Dist: requests>=2.32.4
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-django; extra == "test"
Requires-Dist: responses; extra == "test"
Dynamic: license-file

# pretix-gpwebpay

GP webpay (Global Payments Europe) payment provider for pretix. It takes card and bank-button payments,
and refunds them automatically, including when customers cancel their own orders.

## How it works

- **Payment:** the customer is redirected to the GP webpay gateway (HTTP API). The signed answer on return
  is accepted only if:
  - `DIGEST1` verifies with GPE's public key (this signature covers your merchant number), and
  - it concerns this very payment (`ORDERNUMBER`, `MD`, `OPERATION`).
- **Customers who never come back:** the HTTP API has no server notification. A periodic task asks the WS API
  (`getPaymentStatus`) about open payments:
  - every few minutes in the first hour,
  - hourly for a day,
  - then every 6 hours for 8 days (bank-button payments can take up to 7 days).
- **Refunds:** these go through the WS API (`processRefund`), full or partial. A refund for a payment still
  in the day's open batch is sent automatically after the batch closes (around 22:00). A refund whose answer
  is lost is never sent twice: GP webpay's refunded total decides.
- **Refunds made in the GP webpay portal** appear in pretix as external refunds the next time the payment is
  refunded or checked.

## Requirements

- pretix 2025.1 or later, Python 3.11 or later
- A GP webpay merchant account. Your bank must also enable the WS API for your merchant number.
- Event currency CZK, EUR, USD, GBP or PLN (multicurrency depends on your bank)

## Configuration

Enable the plugin for the event, then open *Settings → Payment → GPWebPay*.

| Setting | |
|---|---|
| Merchant number | from your bank |
| Provider code | 4 digits identifying your bank, e.g. `0100` KB SmartPay, `0300` ČSOB, `0880` Global Payments CZ (WS API documentation, annex 5) |
| Private key | paste the PEM including the BEGIN/END lines; stored in the database |
| Private key password | if the key is encrypted |
| GPE public key | GP webpay's signing key or certificate for the environment (test and production differ) |
| Test environment | uses `test.3dsecure.gpwebpay.com` |

Keys uploaded as files by version 7.0 or older ended up in pretix's **public** media folder. The settings page
warns about this; pasting the key into the field deletes the file. If the file may have been reachable, ask your
bank for a new key pair.

Refunds are possible for 6 months after payment (13 months with UniCredit). After that pretix offers a manual
refund instead.

## Cancellations and automatic refunds

Event → Settings → Cancellation:
- allow customers to cancel paid orders,
- refund automatically to the original payment method.

## Development

```
pip install -e ".[test]"
pytest
flake8 pretix_gpwebpay tests && isort --check-only pretix_gpwebpay tests
```

The tests run against a real pretix with throwaway RSA keys and a fake WS API. Releasing: see `RELEASING.md`.

GP webpay's documentation is confidential (GPE's terms). Do not commit it to this repository.

## Licence

Apache License 2.0
