-
Notifications
You must be signed in to change notification settings - Fork 8
/
DryRun.php
43 lines (35 loc) · 1019 Bytes
/
DryRun.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/php -f
<?php
declare(strict_types=1);
/**
* This file is part of the EaseCore package.
*
* (c) Vítězslav Dvořák <http://vitexsoftware.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Example\AbraFlexi;
include_once './config.php';
/**
* Instance of AbraFlexi Invoice in dry-run mode with random code.
*/
$invoice = new \AbraFlexi\FakturaVydana([
'kod' => 'DRY_RUN_TEST',
'typDokl' => 'code:FAKTURA',
'poznam' => 'Test '.time(),
'varSym' => time()], ['dry-run' => true]);
/**
* Save invoice to AbraFlexi.
*/
try {
$resultInsert = $invoice->insertToAbraFlexi();
} catch (\AbraFlexi\Exception $exc) {
echo $exc->getMessage();
// For example we can get here: "AbraFlexi\FakturaVydana: Pole 'Variabilní symbol' musí být vyplněno. [DRY_RUN_TEST]"
}
/**
* Save to AbraFlexi and load result.
*/
$resultSync = $invoice->sync();
echo $resultSync ? 'OK' : 'Failed';