From e8d39aab458d85ded4551059c854b2ab490a2b2e Mon Sep 17 00:00:00 2001 From: Oh My Felix Date: Tue, 23 Jun 2026 15:38:14 +0000 Subject: [PATCH] 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