asisteam/csob-bc

CSOB Business Connector - for download/upload files automation

dev-master 2019-03-25 10:29 UTC

README

Build Status Licence Downloads this Month Downloads total Latest stable PHPStan

Credits

The development is under AsisTeam s.r.o.. Feel free to use. Your contributions are very welcome. Feel free to publish pull requests.

Asisteam

Overview

This PHP API wrapper allows you to work with CSOB Business Connector PDF official implementation documentation.

This library follows the official docs and allows you to:

  • list and read files (AVIZO, VYPIS) from CEB
  • generate and upload payment orders to CEB

Please see the Business Connector API - usage documentation

Insolvencni rejstrik logo

Install

composer require asisteam/csob-bc

Versions

State Version Branch PHP
stable ^1.0 master >= 7.1

Tests

Check code quality and run tests

composer phpstan-install
composer ci

or separately

composer qa
composer phpstan-install
composer phpstan
composer tests

Note: integration tests are skipped as they do request to real api endpoints. The validity of assertions in integration tests may change too.

Example usage

// use factory to create CEB instance
// factory creates and registers file readers and generators so you don't have to do it manually
$options = new Options('path/to/bccert.pem', 'certPassPhrase', 'contractId', 'appGuid');
$factory = new CEBFactory($options, '/tmp/dir/path');
$ceb = $factory->create();

// returns API response with files listed in CEB API
$list = $ceb->listFiles();
Assert::count(2, $list->getFiles());

// You can read and parse files content

// first one is VYPIS type
$as = $ceb->downloadAndRead($list->getFiles()[0]);
Assert::true($as instanceof IReport);
// You can iterate entries and get details about each transaction
Assert::count(11, $as->getEntries());

// second one is AVIZO type
$adv = $ceb->downloadAndRead($list->getFiles()[1]);
Assert::true($adv instanceof IAdvice);
// You can iterate entries and get details about each transaction
Assert::count(3, $adv->getTransactions());

// generate and upload payment batch file to CEB
$payments = []; // create list of IPaymentOrder entities eg by: new InlandPayment(...)
$file = $ceb->generatePaymentFile($payments);
$ceb->upload([$file]);

Authors

3510893?s=460&v=4&s=150
Tomas Sedlacek

5030499?s=460&v=4&s=150
Tomas Holan