From e8d39aab458d85ded4551059c854b2ab490a2b2e Mon Sep 17 00:00:00 2001
From: Oh My Felix
Date: Tue, 23 Jun 2026 15:38:14 +0000
Subject: [PATCH 1/2] Docs: move documentation to README
Co-authored-by: Felix
---
.docs/README.md | 86 ----------------------------------------------
README.md | 91 ++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 82 insertions(+), 95 deletions(-)
delete mode 100644 .docs/README.md
diff --git a/.docs/README.md b/.docs/README.md
deleted file mode 100644
index 931c548..0000000
--- a/.docs/README.md
+++ /dev/null
@@ -1,86 +0,0 @@
-# Contributte Comgate
-
-## Content
-
-- [Setup](#usage)
-- [Configuration](#configuration)
-
-## Setup
-
-```bash
-composer require contributte/comgate
-```
-
-```neon
-extensions:
- comgate: Contributte\Comgate\DI\ComgateExtension
-```
-
-## Configuration
-
-```neon
-comgate:
- merchant: "12345678"
- secret: foobar
- test: true/false
-```
-
-## Usage
-
-### Create payment
-
-```php
-use Brick\Money\Money;
-use Contributte\Comgate\Entity\Codes\PaymentMethodCode;
-use Contributte\Comgate\Entity\Payment;
-use Contributte\Comgate\Gateway\PaymentService;
-
-final class Payments
-{
-
- /** @var PaymentService */
- private $paymentService;
-
- public function createPayment(array $data): array
- {
- $payment = Payment::of(
- Money::of($data['price'] ?? 50, $data['currency'] ?? 'CZK'),
- $data['label'] ?? 'Test item',
- $data['refId'] ?? 'order101',
- $data['email'] ?? 'dev@contributte.org',
- $data['fullName'] ?? 'John Doe',
- PaymentMethodCode::ALL,
- );
-
- $res = $this->paymentService->create($payment);
-
- // $res->isOk();
- return $res->getData();
- }
-
-}
-```
-
-### Status
-
-```php
-use Contributte\Comgate\Entity\Codes\PaymentMethodCode;
-use Contributte\Comgate\Entity\PaymentStatus;
-use Contributte\Comgate\Gateway\PaymentService;
-
-final class Payments
-{
-
- /** @var PaymentService */
- private $paymentService;
-
- public function getStatus(string $transaction): array
- {
- $res = $this->paymentService->status(PaymentStatus::of($transaction));
-
- // $res->isOk();
- return $res->getData();
- }
-
-}
-```
diff --git a/README.md b/README.md
index fd2016b..d4576e4 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,17 @@
Website 🚀 contributte.org | Contact 👨🏻💻 f3l1x.io | Twitter 🐦 @contributte
-## Usage
+Comgate payment gateway integration for Nette applications.
+
+## Versions
+
+| State | Version | Branch | Nette | PHP |
+|--------|---------|----------|--------|---------|
+| dev | `^0.6` | `master` | `3.2+` | `>=8.2` |
+| stable | `^0.5` | `master` | `3.2+` | `>=8.1` |
+| stable | `^0.4` | `master` | `3.2+` | `>=8.1` |
+
+## Installation
To install latest version of `contributte/comgate` use [Composer](https://getcomposer.org).
@@ -26,17 +36,80 @@ To install latest version of `contributte/comgate` use [Composer](https://getcom
composer require contributte/comgate
```
-## Documentation
+Register the extension in your NEON configuration.
-For details on how to use this package, check out our [documentation](.docs).
+```neon
+extensions:
+ comgate: Contributte\Comgate\DI\ComgateExtension
+```
-## Versions
+## Configuration
-| State | Version | Branch | Nette | PHP |
-|--------|---------|----------|--------|---------|
-| dev | `^0.6` | `master` | `3.2+` | `>=8.2` |
-| stable | `^0.5` | `master` | `3.2+` | `>=8.1` |
-| stable | `^0.4` | `master` | `3.2+` | `>=8.1` |
+```neon
+comgate:
+ merchant: "12345678"
+ secret: foobar
+ test: true/false
+```
+
+## Usage
+
+### Create payment
+
+```php
+use Brick\Money\Money;
+use Contributte\Comgate\Entity\Codes\PaymentMethodCode;
+use Contributte\Comgate\Entity\Payment;
+use Contributte\Comgate\Gateway\PaymentService;
+
+final class Payments
+{
+
+ /** @var PaymentService */
+ private $paymentService;
+
+ public function createPayment(array $data): array
+ {
+ $payment = Payment::of(
+ Money::of($data['price'] ?? 50, $data['currency'] ?? 'CZK'),
+ $data['label'] ?? 'Test item',
+ $data['refId'] ?? 'order101',
+ $data['email'] ?? 'dev@contributte.org',
+ $data['fullName'] ?? 'John Doe',
+ PaymentMethodCode::ALL,
+ );
+
+ $res = $this->paymentService->create($payment);
+
+ // $res->isOk();
+ return $res->getData();
+ }
+
+}
+```
+
+### Status
+
+```php
+use Contributte\Comgate\Entity\PaymentStatus;
+use Contributte\Comgate\Gateway\PaymentService;
+
+final class Payments
+{
+
+ /** @var PaymentService */
+ private $paymentService;
+
+ public function getStatus(string $transaction): array
+ {
+ $res = $this->paymentService->status(PaymentStatus::of($transaction));
+
+ // $res->isOk();
+ return $res->getData();
+ }
+
+}
+```
## Development
From 4d07b4093dcdebe54f1608dd36977f1bcc3fd1a0 Mon Sep 17 00:00:00 2001
From: Oh My Felix
Date: Sun, 16 Aug 2026 08:26:16 +0000
Subject: [PATCH 2/2] Docs: complete library quick start
Co-authored-by: Milan Sulc
---
.docs/README.md | 11 ++++++++
README.md | 67 ++++++++++++++++---------------------------------
2 files changed, 33 insertions(+), 45 deletions(-)
create mode 100644 .docs/README.md
diff --git a/.docs/README.md b/.docs/README.md
new file mode 100644
index 0000000..04cb946
--- /dev/null
+++ b/.docs/README.md
@@ -0,0 +1,11 @@
+# Comgate reference
+
+The root README contains the first test-payment flow. Check a transaction with the existing status API:
+
+```php
+$response = $payments->status(PaymentStatus::of($transaction));
+
+if ($response->isOk()) {
+ $data = $response->getData();
+}
+```
diff --git a/README.md b/README.md
index d4576e4..650055f 100644
--- a/README.md
+++ b/README.md
@@ -43,19 +43,17 @@ extensions:
comgate: Contributte\Comgate\DI\ComgateExtension
```
-## Configuration
+## Quick start
+
+Configure **test-only development credentials** and inject `PaymentService` into an application service:
```neon
comgate:
- merchant: "12345678"
- secret: foobar
- test: true/false
+ merchant: 'test-merchant'
+ secret: test-secret
+ test: true
```
-## Usage
-
-### Create payment
-
```php
use Brick\Money\Money;
use Contributte\Comgate\Entity\Codes\PaymentMethodCode;
@@ -64,51 +62,30 @@ use Contributte\Comgate\Gateway\PaymentService;
final class Payments
{
-
- /** @var PaymentService */
- private $paymentService;
-
- public function createPayment(array $data): array
+ public function __construct(private PaymentService $payments)
{
- $payment = Payment::of(
- Money::of($data['price'] ?? 50, $data['currency'] ?? 'CZK'),
- $data['label'] ?? 'Test item',
- $data['refId'] ?? 'order101',
- $data['email'] ?? 'dev@contributte.org',
- $data['fullName'] ?? 'John Doe',
- PaymentMethodCode::ALL,
- );
-
- $res = $this->paymentService->create($payment);
-
- // $res->isOk();
- return $res->getData();
}
+ public function create(): string
+ {
+ $response = $this->payments->create(Payment::of(
+ Money::of(50, 'CZK'), 'Test item', 'test-001', 'dev@example.test', 'John Doe', PaymentMethodCode::ALL,
+ ));
+
+ return $response->getRedirect() ?? '';
+ }
}
```
-### Status
-
-```php
-use Contributte\Comgate\Entity\PaymentStatus;
-use Contributte\Comgate\Gateway\PaymentService;
+A successful response provides a transaction ID and may provide the payment redirect URL through `getRedirect()`. Use real credentials only outside development; see [the detailed usage reference](.docs/README.md) for status lookups.
-final class Payments
-{
-
- /** @var PaymentService */
- private $paymentService;
-
- public function getStatus(string $transaction): array
- {
- $res = $this->paymentService->status(PaymentStatus::of($transaction));
-
- // $res->isOk();
- return $res->getData();
- }
+## Configuration
-}
+```neon
+comgate:
+ merchant: "12345678"
+ secret: foobar
+ test: true/false
```
## Development