Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 0 additions & 86 deletions .docs/README.md

This file was deleted.

91 changes: 82 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,98 @@
Website 🚀 <a href="https://contributte.org">contributte.org</a> | Contact 👨🏻‍💻 <a href="https://f3l1x.io">f3l1x.io</a> | Twitter 🐦 <a href="https://twitter.com/contributte">@contributte</a>
</p>

## 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).

```bash
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

Expand Down