Giter Site home page Giter Site logo

uctenkovka's Introduction

Uctenkovka

PHP library for communication with Uctenkovka (EET Czech Republic competition with receipts). See Uctenkovka.cz. PHP 7.1+ is required.

Authors:

Overview

Uctenkovka library can send receipts directly into Uctenkovka competition.

Installation (via composer)

Get composer and add this in your requires section of the composer.json:

{
    "require": {
        "xsuchy09/uctenkovka": "*"
    }
}

and then

composer install

or just

composer require xsuchy09/uctenkovka

Usage

You have to have own certificates to communicate with Uctenkovka. See etrzby for more info. In czech language there are two important documents:

This library covers specification but you have to fill all of the conditions.

Basic Example

You can see tests which are included in this repository. To run that tests you need own certs for communication with test server (see Conditions in Czech language). Save your test_crt.pem and test_key.pem into the /src/certs/ folder and then you can run the tests which will generate PhpUnit cover report too (100% btw).

How to send receipt/request into Uctenkovka

use xsuchy09\Uctenkovka\Request;
use xsuchy09\Uctenkovka\Uctenkovka;

$request = new Request();
$request->setEmail('[email protected]')
	->setPhone('777777777')
	->setBasicConsent(true)
	->setFik('B3A09B52-7C87-4014')
	->setBkp('01234567-89abcdef')
	->setDate('2018-03-17')
	->setTime('16:41')
	->setAmount(4570) // in hellers
	->setSimpleMode(false);

$uctenkovka = new Uctenkovka();
$uctenkovka->setMode(Uctenkovka::MODE_TESTING);
$uctenkovka->setSslCert(__DIR__ . '/../src/certs/test_crt.pem');
$uctenkovka->setSslKey(__DIR__ . '/../src/certs/test_key.pem');
$uctenkovka->send($request);

You can set date and time of receipt (request) at once with \DateTime object:

$request->setDateTime(DateTime::createFromFormat('Y-m-d H:i:s', $date)); // seconds are optional

You can set all of receipt/request values as array - not required param of Request constructor:

use xsuchy09\Uctenkovka\Request;

$request = new Request([
    'email' => '[email protected]',
    'phone' => '777777777',
    'basicConsent' => true,
    'fik' => 'B3A09B52-7C87-4014',
    'bkp' => '01234567-89abcdef',
    'date' => '2018-03-17',
    'time' => '16:41',
    'amount' => 4570,
    'simpleMode' => false
]);

More examples can be found in the /tests/ directory.

Usage is clear and easy. You can contact me if you need.

uctenkovka's People

Contributors

xsuchy09 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.