2017 © Pedro Peláez
 

library eet

API for EET (electronic sales record) client in PHP

image

scholtz/eet

API for EET (electronic sales record) client in PHP

  • Thursday, March 9, 2017
  • by Scholtz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

API for EET Client in PHP

This code is an implementation of the EET ("elektronická evidence tržeb") in a PHP. Be aware that this library is working even from your localhost, if you have an internet connection., (*1)

INSTALLATION

composer require "fritak/eet"

REQUIREMENTS

The minimum requirement is PHP 5.6 on your Web Server. Prerequisite are these libraries and php extensions: * robrichards/wse-php * robrichards/xmlseclibs * ramsey/uuid * Soap client. See http://php.net/manual/en/soap.setup.php * Open SSL. See http://php.net/manual/en/openssl.setup.php, (*2)

SETUP

Example of config:, (*3)

{
    "certificate": {
        "path": "./certificate/01000003.p12",
        "password": "eet"
    },
    "wsdlPath": "./soapFiles/EETServiceSOAP.wsdl",
    "defaultValues": {
        "dic_popl": "CZ1212121218",
        "id_provoz": "273",
        "id_pokl": "1"
    },
    "timeout": 10,
    "connectionTimeout": 3
}
  • Move certificate (PKCS#12) to your path. (See information on how to get one, or use the certificate from "/example/certificate" for playground - TEST only)
  • Set path to wsdl file for EET (you need to include XSD schema too).

Note: * Example file for playground (EETServiceSOAP.wsdl) is v3 from http://www.etrzby.cz and XSD from http://www.etrzby.cz, (*4)

BASIC USAGE

use Fritak\eet\Sender;

$sender = new Sender(__DIR__ . '/config.json'); // load Sender with configuration

$sender->addReceipt(['uuid_zpravy' => 'b3a09b52-7c87-4014-a496-4c7a53cf9125', 'porad_cis' => 68, 'celk_trzba' => 546]);

// You can let uuid_zpravy empty, it will be  automatically generated
$sender->addReceipt(['porad_cis' => 69, 'celk_trzba' => 748]);

foreach($sender->sendAllReceipts() AS $response)
{
    $response->Potvrzeni->fik; // Your FIK - Fiscal Identification Code ("Fiskální identifikační kód")
}     

Change certificate or defalut values later on

$sender->changeCertificate($certificate, $password);
$sender->changeDefaultValues($dic, $workshopId, $cashRegisterId);

ADVANCED USAGE - Receipt

use Fritak\eet\Sender;
use Fritak\eet\Receipt;

$sender = new Sender(__DIR__ . '/config.json'); // load Sender with configuration

$receipt = new Receipt();
$receipt->uuid_zpravy = 'b3a09b52-7c87-4014-a496-4c7a53cf9125'; // Or empty, it will be  automatically generated
$receipt->porad_cis   = '68';
$receipt->celk_trzba  = 546;

$receipt->dic_popl    = 'CZ1212121218';
$receipt->id_provoz   = '273';
$receipt->id_pokl     = '1';
$receipt->dat_trzby   = new \DateTime();

// Now we try dry run. Returns boolean TRUE/FALSE
if ($sender->dryRunSend($receipt))
{
    // Send receipt
    $fik = $sender->send($receipt)->Potvrzeni->fik;
}

Nette integration

Nette Framework is an open-source framework for creating web applications in PHP 5 and 7. There is basic integration into your application., (*5)

Include library to your project. Include config files to your parameters.neon:, (*6)

parameters:
    senderEetParameters:
        certificate:
            path: ''
            password: ''
        wsdlPath : ''
        defaultValues:
            dic_popl: ''
            id_provoz: ''
            id_pokl: ''
services:
    senderEet: Fritak\eet\Sender(%senderEetParameters%)

That's it! Now you can use it as noted above, for example action in presenter:, (*7)

$sender = $this->context->getService('senderEet');
$sender->addReceipt(['porad_cis' => 85, 'celk_trzba' => 9875]);

foreach($sender->sendAllReceipts() AS $response)
{
    $response->Potvrzeni->fik;
}

Information

The Versions

09/03 2017

dev-master

9999999-dev

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

09/03 2017

1.2.5

1.2.5.0

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

06/03 2017

dev-patch-5

dev-patch-5

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

30/01 2017

dev-patch-4

dev-patch-4

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

30/01 2017

dev-patch-3

dev-patch-3

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

23/01 2017

dev-patch-2

dev-patch-2

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

23/01 2017

dev-patch-1

dev-patch-1

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

20/01 2017

v1.2.4

1.2.4.0

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

16/12 2016

v1.2.3

1.2.3.0

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

13/10 2016

v1.1.1

1.1.1.0

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires

 

21/09 2016

v1.0.1

1.0.1.0

API for EET (electronic sales record) client in PHP

  Sources   Download

MIT

The Requires