Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-wbz authored Sep 9, 2019
1 parent bb38da4 commit e3ce94d
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,37 @@ return [

## Examples

### Create Subject
### Create Subject, Create Invoice, Send Invoice

```php

\Fakturoid::createSubject(array('name' => 'Firma s.r.o.', 'email' => 'aloha@pokus.cz'));
use Fakturoid;
use Fakturoid\Exception;

try {
// create subject
$subject = Fakturoid::createSubject(array(
'name' => 'Firma s.r.o.',
'email' => 'aloha@pokus.cz'
));
if ($subject->getBody()) {
$subject = $subject->getBody();

// create invoice with lines
$lines = array(array(
'name' => 'Big sale',
'quantity' => 1,
'unit_price' => 1000
));
$invoice = Fakturoid::createInvoice(array('subject_id' => $subject->id, 'lines' => $lines));
$invoice = $invoice->getBody();

// send created invoice
Fakturoid::fireInvoice($invoice->id, 'deliver');
}
} catch (Exception $e) {
dd($e->getCode() . ": " . $e->getMessage());
}

```

Expand Down

0 comments on commit e3ce94d

Please sign in to comment.