2017 © Pedro Peláez
 

library fio

Basic operations over Fio API.

image

lightools/fio

Basic operations over Fio API.

  • Sunday, February 5, 2017
  • by janedbal
  • Repository
  • 1 Watchers
  • 0 Stars
  • 378 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 90 % Grown

The README.md

Introduction

Library providing basic operations with Fio API., (*1)

Installation

$ composer require lightools/fio

Usage

This library doesn't implement all functions of Fio API (e.g. Euro or International payments), it just provides simple interface for the most common use-cases. You can easily work with multiple Fio accounts or you can use FioClient directly., (*2)

Initialize

$httpClient = new Bitbang\Http\Clients\CurlClient();
$xmlLoader = new Lightools\Xml\XmlLoader();

$fio = new Lightools\Fio\FioClient($xmlLoader, $httpClient);
$account = new Lightools\Fio\FioAccount('12345678', 'token', $fio); // no problem with having more Fio accounts

Retrieving new payments

try {
    $transactions = $account->getNewTransactions();
    foreach ($transactions as $transaction) {
        echo $transaction->getVariableSymbol();
    }

} catch (Lightools\Fio\FioException $e) { // or catch specific exceptions
    $account->setBreakpointById($lastKnownMoveId);
    // further processing
}

Sending transaction orders

try {
    $amount = 100;
    $currency = 'CZK';
    $accountTo = '12345678';
    $bankCode = '6100';
    $order = new Lightools\Fio\TransactionOrder($amount, $currency, $accountTo, $bankCode);
    $order->setVariableSymbol('8888');

    $account->sendOrders([$order]);

} catch (Lightools\Fio\FioTemporaryUnavailableException $e) {
    // Fio is overheated, wait 30 seconds and repeat

} catch (Lightools\Fio\FioWarningException $e) {
    // in this case, Fio accepted orders, but detected something suspicious

} catch (Lightools\Fio\FioFailureException $e) {
    // e.g. HTTP request failed, Fio is down, ...
}

Logging traffic

It is very useful to store HTTP requests and responses when communicating with Fio API so you can easily determine all possible problems. Library lightools/bitbang-http-logger provides this functionality., (*3)

How to run tests

$ vendor/bin/tester -c tests/php.ini -d extension_dir=ext tests

The Versions

05/02 2017

dev-master

9999999-dev

Basic operations over Fio API.

  Sources   Download

MIT

The Requires

 

The Development Requires

30/03 2016

v1.0.0

1.0.0.0

Basic operations over Fio API.

  Sources   Download

MIT

The Requires

 

The Development Requires