-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
4 changed files
with
145 additions
and
1 deletion.
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
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,65 @@ | ||
<?php | ||
|
||
namespace Bluerock\Sellsy\Api; | ||
|
||
use Bluerock\Sellsy\Entities\Invoice; | ||
use Bluerock\Sellsy\Collections\InvoiceCollection; | ||
use Bluerock\Sellsy\Core\Response; | ||
|
||
/** | ||
* The API client for the `rate-categories` namespace. | ||
* | ||
* @package bluerock/sellsy-client | ||
* @author Thomas <thomas@bluerocktel.com> | ||
* @version 1.1 | ||
* @access public | ||
* @see https://api.sellsy.com/doc/v2/#tag/Invoices | ||
*/ | ||
class InvoicesApi extends AbstractApi | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
$this->entity = Invoice::class; | ||
$this->collection = InvoiceCollection::class; | ||
} | ||
|
||
/** | ||
* List all invoices. | ||
* | ||
* @param array $query Query parameters. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/get-invoice | ||
*/ | ||
public function index(array $query = []): Response | ||
{ | ||
$response = $this->connection | ||
->request('invoices') | ||
->get($query); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
|
||
/** | ||
* Show a single invoice by id. | ||
* | ||
* @param string $id The invoice id to retrieve. | ||
* @param array $query Query parameters. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/get-invoice | ||
*/ | ||
public function show(string $id, array $query = []): Response | ||
{ | ||
$response = $this->connection | ||
->request("invoices/{$id}") | ||
->get($query); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
} |
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,52 @@ | ||
<?php | ||
|
||
namespace Bluerock\Sellsy\Entities; | ||
|
||
use Bluerock\Sellsy\Entities\Entity; | ||
use Bluerock\Sellsy\Entities\InvoiceAmounts; | ||
|
||
/** | ||
* The Invoice Entity. | ||
* | ||
* @package bluerock/sellsy-client | ||
* @author Thomas <thomas@bluerocktel.com> | ||
* @version 1.1 | ||
* @access public | ||
*/ | ||
class Invoice extends Entity | ||
{ | ||
/** | ||
* <READONLY> Invoice ID from Sellsy. | ||
*/ | ||
public ?int $id; | ||
|
||
/** | ||
* <READONLY> Invoice number from Sellsy. | ||
*/ | ||
public ?string $number; | ||
|
||
/** | ||
* Invoice status. | ||
*/ | ||
public ?string $status; | ||
|
||
/** | ||
* Invoice date. | ||
*/ | ||
public ?string $date; | ||
|
||
/** | ||
* Invoice due date. | ||
*/ | ||
public ?string $due_date; | ||
|
||
/** | ||
* Invoice amounts. | ||
*/ | ||
public ?InvoiceAmounts $amounts; | ||
|
||
/** | ||
* Rate category currency. | ||
*/ | ||
public string $currency = 'EUR'; | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Bluerock\Sellsy\Entities; | ||
|
||
use Bluerock\Sellsy\Entities\Entity; | ||
|
||
/** | ||
* The InvoiceAmounts Entity. | ||
* Numbers are formatted as a string to avoid floating point precision issues. | ||
* | ||
* @package bluerock/sellsy-client | ||
* @author Thomas <thomas@bluerocktel.com> | ||
* @version 1.1 | ||
* @access public | ||
*/ | ||
class InvoiceAmounts extends Entity | ||
{ | ||
public string $total_raw_excl_tax = "0"; | ||
public string $total_after_discount_excl_tax = "0"; | ||
public string $total_packaging = "0"; | ||
public string $total_shipping = "0"; | ||
public string $total_excl_tax = "0"; | ||
public string $total_incl_tax = "0"; | ||
public string $total_remaining_due_incl_tax = "0"; | ||
public string $total_primes_incl_tax = "0"; | ||
} |