This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
forked from ondrejnov/eet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3091f4
commit dcda107
Showing
25 changed files
with
919 additions
and
553 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nbproject/* | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Miloš Havlíček | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,52 @@ | ||
# Ukázka implementace EET v PHP. | ||
# Example implementation of EET in PHP | ||
|
||
## Installation | ||
Install Ondrejnov/eet using [Composer](http://getcomposer.org/): | ||
|
||
```sh | ||
$ composer require cothema/eet | ||
``` | ||
|
||
### Dependencies | ||
PHP >=5.6 | ||
robrichards/wse-php | ||
|
||
Attached WSDL, key and certificate are intended for non-production usage (Playground). | ||
|
||
## Example Usage | ||
Sample codes are located in examples/ folder | ||
|
||
### License | ||
MIT | ||
|
||
--- | ||
|
||
# Ukázka implementace EET v PHP | ||
|
||
## Instalace | ||
Install Ondrejnov/eet using [Composer](http://getcomposer.org/): | ||
|
||
```sh | ||
$ composer require cothema/eet | ||
``` | ||
|
||
### Závislosti | ||
Testováno na PHP 5.6 | ||
PHP >=5.6 | ||
robrichards/wse-php | ||
|
||
V adresáří vendor se očekává knihovna https://github.com/robrichards/wse-php | ||
Přiložené WSDL, klíč a certifikát jsou pro neprodukční prostředí (Playground). | ||
|
||
Přiložené WSDL, klíč a certifikát je pro neprodukční prostředí (Playground). | ||
## Ukázka použití | ||
Ukázky použití naleznete ve složce examples/ | ||
|
||
### Licence | ||
Kód je poskytován tak jak stojí a leží, můžete s ním dělat co chcete, klidně použít i pro EET. Za chyby nezodpovídám. | ||
MIT | ||
|
||
--- | ||
|
||
### Reklama | ||
Komu se nechce do implementace, tak může použít on-line službu <a href="https://www.eetapp.cz/?utm_source=git&utm_medium=link&utm_campaign=eet">EETApp.cz</a>, která má pokročilejší správu účtenek včetně tisku na tiskárnu. | ||
|
||
### Bitcoin Donate | ||
1LZuWFUHeVMrYvZWinxFjjkZtuq56TECot | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "ondrejnov/eet", | ||
"description": "EET (Electronic records of sales for Czech Ministry of Finance) Client for PHP", | ||
"type": "project", | ||
"license": ["MIT", "BSD-3-Clause", "GPL-2.0", "GPL-3.0"], | ||
"require": { | ||
"php": ">=5.6.0", | ||
"robrichards/wse-php": "*" | ||
}, | ||
"require-dev": { | ||
"nette/tester": "~1.4" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"autoload": { | ||
"classmap": ["src/"] | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
ini_set('display_errors', 1); | ||
define('DIR_ROOT', __DIR__ . '/..'); | ||
define('DIR_CERT', DIR_ROOT . '/_cert'); | ||
define('DIR_VENDOR', DIR_ROOT . '/vendor'); | ||
define('DIR_SRC', DIR_ROOT . '/src'); | ||
define('DIR_TEMP', DIR_ROOT . '/temp'); | ||
|
||
require_once DIR_VENDOR . "/autoload.php"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
require_once __DIR__ . "/../bootstrap.php"; | ||
|
||
use Ondrejnov\EET\Exceptions\ServerException; | ||
use Ondrejnov\EET\Dispatcher; | ||
use Ondrejnov\EET\Receipt; | ||
|
||
$dispatcher = new Dispatcher(DIR_CERT . '/eet.key', DIR_CERT . '/eet.pem'); | ||
|
||
// Example receipt | ||
$r = new Receipt(); | ||
$r->uuid_zpravy = 'b3a09b52-7c87-4014-a496-4c7a53cf9120'; | ||
$r->dic_popl = 'CZ72080043'; | ||
$r->id_provoz = '181'; | ||
$r->id_pokl = '1'; | ||
$r->porad_cis = '1'; | ||
$r->dat_trzby = new \DateTime(); | ||
$r->celk_trzba = 1000; | ||
|
||
// Valid response should be returned | ||
echo '<h2>---VALID REQUEST---</h2>'; | ||
try { | ||
$fik = $dispatcher->send($r); // Send request | ||
echo sprintf('Returned fik code: %s', $fik); // See response - should be returned | ||
} catch (ServerException $e) { | ||
var_dump($e); // See exception | ||
} catch (\Exception $e) { | ||
var_dump($e); // Fatal error | ||
} | ||
|
||
// Example of error message | ||
$r->dic_popl = 'x'; | ||
|
||
// ServerException should be returned | ||
echo '<h2>---ERROR REQUEST---</h2>'; | ||
try { | ||
$fik = $dispatcher->send($r); // Send request | ||
var_dump($fik); // See response | ||
} catch (ServerException $e) { | ||
echo sprintf('Error from server of Ministry of Finance: %s', $e->getMessage()); // See exception - should be returned | ||
} catch (\Exception $e) { | ||
var_dump($e); // Fatal error | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.