2017 © Pedro Peláez
 

library phpsdk

Platron payment SDK

image

payprocessing/phpsdk

Platron payment SDK

  • Thursday, June 7, 2018
  • by cto
  • Repository
  • 3 Watchers
  • 1 Stars
  • 1,217 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 52 % Grown

The README.md

Platron PHP SDK

Установка

Проект предполагает через установку с использованием composer., (*1)

composer require payprocessing/phpsdk

, (*2)

Тесты

Для работы тестов необходим PHPUnit, для установки необходимо выполнить команду, (*3)

composer require phpunit/phpunit

Запустить unit тесты можно выполнив команду из корня проекта, (*4)

vendor/bin/phpunit tests/unit

Для того, чтобы запустить интеграционные тесты нужно скопировать файл tests/integration/MerchantSettingsSample.php удалив из названия Sample и вставив настройки магазина. После выполнить команду из корня проекта, (*5)

vendor/bin/phpunit tests/integration

Примеры использования

1. Создание транзакции

$client = new Platron\PhpSdk\request\clients\PostClient('82', 'sdvsfdvsfdvsdv');
try {
    $requestBuilder = new Platron\PhpSdk\request\request_builders\InitPaymentBuilder('10.00', 'Test transaction');
    $requestBuilder->addTestingMode()
        ->addUserEmail('test@test.ru')
        ->addUserPhone('79055770000')
        ->addPaymentSystem('TEST');
    $response = $client->request($requestBuilder);
}
catch (Platron\PhpSdk\Exception\Exception $e){
    var_dump($e);
    die();
}

2. Запрос реестра

$client = new Platron\PhpSdk\request\clients\PostClient('82', 'sdvsfdvsfdvsdv');
try {
    $requestBuilder = new Platron\PhpSdk\request\request_builders\GetRegistryBuilder(new DateTime('now - 1 day'));
    $response = $client->request($requestBuilder);
} catch (Platron\PhpSdk\Exception $e) {
    var_dump($e);
    die();
}

3. Проведение клиринга

$client = new Platron\PhpSdk\request\clients\PostClient('82', 'sdvsfdvsfdvsdv');
try {
    $requestBuilder = new Platron\PhpSdk\request\request_builders\DoCaptureBuilder(323334422);
    $response = $client->request($requestBuilder);
} catch (Exception $e) {
    var_dump($e);
    die();
}

4. Обработка запроса от Platron (check)

$order_available = 1;
$callback = new platron_sdk\callback\Callback('platron_dispatch.php', 'sdvsfdvsfdvsdv');
if ($callback->validateSig($request)) {
    try {
        if ($order_available) {
            echo $callback->responseOk($request);
        } elseif ($callback->canReject($request)) {
            echo $callback->responseRejected($request, 'Заказ недоступен');
        } else {
            echo $callback->responseOk($request);
            /*
             * Вернуть транзакцию через манибек систему или через заявку на возврат
             */
        }
    } catch (Platron\PhpSdk\samples $e) {
        echo $callback->responseError($request, 'Невозможно принять запрос. Повторите еще раз');
    }
}

$order_available - вместо переменной долже быть метод, проверящий - доступен ли для оплаты заказ, (*6)

The Versions

07/06 2018

dev-master

9999999-dev

Platron payment SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

24/04 2018

v1.1.5

1.1.5.0

Platron payment SDK

  Sources   Download

The Requires

 

The Development Requires

22/01 2018

v1.1.4

1.1.4.0

Platron payment SDK

  Sources   Download

The Requires

 

The Development Requires

26/12 2017

v1.1.3

1.1.3.0

Platron payment SDK

  Sources   Download

The Requires

 

The Development Requires

25/12 2017

v1.1.2

1.1.2.0

Platron payment SDK

  Sources   Download

The Requires

 

The Development Requires

16/10 2017

v1.1.1

1.1.1.0

Platron payment SDK

  Sources   Download

The Requires

 

The Development Requires

27/07 2017

v1.1.0

1.1.0.0

Platron payment SDK

  Sources   Download

The Requires

 

The Development Requires

02/06 2017

dev-hotfix/ofd

dev-hotfix/ofd

Platron payment SDK

  Sources   Download

The Requires

 

The Development Requires

28/03 2017

dev-refactoring

dev-refactoring

Platron payment SDK

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires