Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/spacetab-io/uniteller-php-sdk

PHP (7.2+) SDK for integration internet-acquiring of the Uniteller (unofficial)
https://github.com/spacetab-io/uniteller-php-sdk

acquiring internet-acquiring payment payments payum php php7 processing sdk sdk-php uniteller uniteller-php-sdk

Last synced: 3 months ago
JSON representation

PHP (7.2+) SDK for integration internet-acquiring of the Uniteller (unofficial)

Awesome Lists containing this project

README

        

# Uniteller PHP SDK


















PHP (7.2+) SDK for integration internet-acquiring of the Uniteller (unofficial).
[This documentation is available in Russian language](README_RU.md).
Also, this SDK integrated with [Payum](https://github.com/Payum/Payum) library and you can use [gateway](https://github.com/tmconsulting/payum-uniteller-gateway).

Features:
* payment (method `pay`)
* recurrent (method `recurrent`)
* cancel (method `unblock`)
* receive results
* callback (method for verify incoming signature)
* general error handler for any request
* general statuses (In the requests/responses may to meet `canceled` or `cancelled` variants. They will be converted to general status like as `cancelled`.)

TODO:
* translate to English comments and system (error) messages
* validation
* implement method `card`
* implement method `confirm`

## Install

For install package follow this command:

`composer require tmconsulting/uniteller-php-sdk`

## Usage

A few usage example the current SDK your can found on the `examples` folder.
Just follow instruction on `README.md` file.

### Configure credentials

```php
setShopId('you_shop_id');
$uniteller->setLogin('you_login_number');
$uniteller->setPassword('you_password');
$uniteller->setBaseUri('https://wpay.uniteller.ru');
```

### Redirect to page payment

So, for redirect to page your enough to run `payment` method with parameters like as:

```php
setOrderIdp(mt_rand(10000, 99999))
->setSubtotalP(10)
->setCustomerIdp(mt_rand(10000, 99999))
->setUrlReturnOk('http://google.ru/?q=success')
->setUrlReturnNo('http://google.ru/?q=failure');

$uniteller->payment($builder)->go();
// if you don't need redirect
// $uniteller->payment($builder)->getUri();

```

or use plain array

```php
payment([
'Order_IDP' => mt_rand(10000, 99999),
// ... other parameters
])->go();
```

### Recurrent payment

```php
setOrderIdp(mt_rand(10000, 99999))
->setSubtotalP(15)
->setParentOrderIdp(00000) // order id of any past payment
->setParentShopIdp($uniteller->getShopId()); // optional

$results = $uniteller->recurrent($builder);
```

or use plain array

```php
recurrent([
'Order_IDP' => mt_rand(10000, 99999),
// ... other parameters
]);
```

### Cancel payment

```php
setBillNumber('RRN Number, (12 digits)');
$results = $uniteller->cancel($builder);
```

or

```php
cancel([
'Billnumber' => 'RRN Number, (12 digits)',
// ...
]);

foreach ($results as $payment) {
// see Tmconsulting\Uniteller\Order\Order for other methods.
if ($payment->getStatus() === Status::CANCELLED) {
// payment was cancelled
}
}
```

### Receive results

```php
results([
'ShopOrderNumber' => 'Order_IDP number'
]);

var_dump($results);

// $results[0]->getCardNumber();
```

### Callback (gateway notification)

Receive incoming parameters from gateway and verifying signature.

```php
verifyCallbackRequest(['all_parameters_from_post_with_signature'])) {
return 'invalid_signature';
}
```

## Tests

`vendor/bin/phpunit`

## License

MIT.