2017 © Pedro Peláez
 

library platon

Platon integration

image

wearesho-team/platon

Platon integration

  • Monday, July 30, 2018
  • by Horat1us
  • Repository
  • 3 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 23 Versions
  • 0 % Grown

The README.md

Platon Integration

PHP Composer Latest Stable Version Total Downloads codecov, (*1)

Platon SDK for PHP.
Changelog | Usage Examples, (*2)

API

Installation

Using composer:, (*3)

composer require wearesho-team/platon

Usage

Configuration

For configuration you have to use ConfigInterface. Available implementations: - Config - simple entity. Example:, (*4)

<?php

use Wearesho\Bobra\Platon;

$config = new Platon\Config("Key", "Pass", "PaymentType");
<?php

use Wearesho\Bobra\Platon;

$config = new Platon\EnvironmentConfig();

Environment configuration:, (*5)

Variable Required Default Description
PLATON_KEY yes public key
PLATON_PASS yes secret key
PLATON_URL no https://secure.platononline.com/ base url to make C2C requests
PLATON_PAYMENT no CC default payment type
PLATON_LANGUAGE no ua language: ru or ua

Generating payment configuration

Use Client to fetch payment config, (*6)

<?php

use Wearesho\Bobra\Platon;
use Wearesho\Bobra\Payments;

$config = new Platon\EnvironmentConfig();
$client = new Platon\Client($config);

$payment = $client->createPayment(
    new Payments\UrlPair(
        'http://redirect-url-on-success',
        'http://redirect-url-on-fail'
    ),
    new Platon\Transaction(
        $serviceId = 1,
        $amount = 500,
        $paymentType = 'paymentType',
        $description = 'description for payment',
        $ext = [
            0 => 'some-info'            
        ], // optional, will be returned in notification
        $currency = 'UAH', // optional 
        $formId = 'Form id for front-end' // optional
    )
);

Rendering form

<?php

$config = $payment->jsonSerialize(); // ['action' => 'URL', 'data' => 'url']

*You should send data to action url., (*7)

Notification

Use Notification\Server to create payment instance from platon`s request:, (*8)

<?php

use Wearesho\Bobra\Platon;

class PlatonController
{
    public function actionHandle()
    {
        // You can use several platon configs in different cases.
        // Handler will get that one that matches `key` param from platon`s request.
        // All platon configs should be passed into ConfigProvider.
        $configProvider = new Platon\Notification\ConfigProvider([
            new Platon\Config('First key', 'first pass', 'CC'),    
            new Platon\Config('Second key', 'second pass', 'CC'),    
        ]);

        $server = new Platon\Notification\Server($configProvider);

        try {
            $payment = $server->handle($_POST);   
        } catch (Platon\Notification\InvalidSignException $exception) {
            // handle invalid sign
        } catch (\InvalidArgumentException $exception) {
            // When received data is incorrect or some required fields are empty
        }

        // You can use returned Payment instance to save transaction data.
    }
}

Info

Fetching information about account balance. Use Info\ConfigInterface for configuration. EnvironmentConfig available:, (*9)

Variable Required Description
PLATON_INFO_PUBLIC_KEY yes Public Key for Info API
PLATON_INFO_PRIVATE_KEY yes Private Key for Info API
<?php

use Wearesho\Bobra\Platon;

$publicKey = readline("Public Key: ");
$privateKey = readline("Private Key: ");

$config = new Platon\Info\Config($publicKey, $privateKey);
$client = new GuzzleHttp\Client();

$repository = new Platon\Info\Repository($config, $client);

// All items can be converted to string and JSON formats
$responses = $repository->get();

See Info\Response for details., (*10)

Author

License

MIT, (*11)

The Versions

30/07 2018

dev-feature/credit-to-card

dev-feature/credit-to-card

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

18/07 2018

dev-master

9999999-dev

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

18/07 2018
10/07 2018
02/07 2018
25/06 2018
21/06 2018
20/06 2018
20/06 2018
20/06 2018
20/06 2018
20/06 2018
11/06 2018
29/05 2018

dev-feature/notification-server

dev-feature/notification-server

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

01/05 2018

1.2.0-BETA

1.2.0.0-beta

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

16/04 2018

1.1.0

1.1.0.0

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

13/04 2018

1.0.0

1.0.0.0

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

12/04 2018

1.0.0-RC6

1.0.0.0-RC6

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

12/04 2018

1.0.0-RC5

1.0.0.0-RC5

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

11/04 2018

1.0.0-RC4

1.0.0.0-RC4

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

11/04 2018

1.0.0-RC3

1.0.0.0-RC3

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

11/04 2018

1.0.0-RC2

1.0.0.0-RC2

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

11/04 2018

1.0.0-RC1

1.0.0.0-RC1

Platon integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow