1 | <?php |
||
17 | class InvoiceManager implements InvoiceManagerInterface |
||
18 | { |
||
19 | /** @var ObjectServiceInterface */ |
||
20 | private $objectManager; |
||
21 | /** @var string */ |
||
22 | private $reqRoute; |
||
23 | /** @var Invoice */ |
||
24 | private $objectType; |
||
25 | |||
26 | /** |
||
27 | * InvoiceManager constructor. |
||
28 | * |
||
29 | * @param ObjectServiceInterface $objectManager |
||
30 | */ |
||
31 | 16 | public function __construct(ObjectServiceInterface $objectManager) |
|
37 | |||
38 | /** |
||
39 | * @param InvoiceInterface $invoice |
||
40 | * |
||
41 | * @return InvoiceInterface |
||
42 | * @throws \InvoiceNinjaModule\Exception\ApiException |
||
43 | * @throws \InvoiceNinjaModule\Exception\EmptyResponseException |
||
44 | * @throws InvalidResultException |
||
45 | */ |
||
46 | 1 | public function createInvoice(InvoiceInterface $invoice) :InvoiceInterface |
|
50 | |||
51 | /** |
||
52 | * @param InvoiceInterface $invoice |
||
53 | * |
||
54 | * @return InvoiceInterface |
||
55 | * @throws \InvoiceNinjaModule\Exception\ApiException |
||
56 | * @throws \InvoiceNinjaModule\Exception\EmptyResponseException |
||
57 | * @throws InvalidResultException |
||
58 | */ |
||
59 | 1 | public function delete(InvoiceInterface $invoice) :InvoiceInterface |
|
63 | |||
64 | /** |
||
65 | * @param InvoiceInterface $invoice |
||
66 | * |
||
67 | * @return InvoiceInterface |
||
68 | * @throws \InvoiceNinjaModule\Exception\ApiException |
||
69 | * @throws \InvoiceNinjaModule\Exception\EmptyResponseException |
||
70 | * @throws InvalidResultException |
||
71 | */ |
||
72 | 1 | public function update(InvoiceInterface $invoice) :InvoiceInterface |
|
76 | |||
77 | /** |
||
78 | * @param InvoiceInterface $invoice |
||
79 | * |
||
80 | * @return InvoiceInterface |
||
81 | * @throws \InvoiceNinjaModule\Exception\ApiException |
||
82 | * @throws \InvoiceNinjaModule\Exception\EmptyResponseException |
||
83 | * @throws InvalidResultException |
||
84 | */ |
||
85 | 1 | public function restore(InvoiceInterface $invoice) :InvoiceInterface |
|
89 | |||
90 | /** |
||
91 | * @param InvoiceInterface $invoice |
||
92 | * |
||
93 | * @return InvoiceInterface |
||
94 | * @throws \InvoiceNinjaModule\Exception\ApiException |
||
95 | * @throws \InvoiceNinjaModule\Exception\EmptyResponseException |
||
96 | * @throws InvalidResultException |
||
97 | */ |
||
98 | 1 | public function archive(InvoiceInterface $invoice) :InvoiceInterface |
|
102 | |||
103 | /** |
||
104 | * @param int $id |
||
105 | * |
||
106 | * @return InvoiceInterface |
||
107 | * @throws NotFoundException |
||
108 | * @throws \InvoiceNinjaModule\Exception\EmptyResponseException |
||
109 | * @throws InvalidResultException |
||
110 | */ |
||
111 | 2 | public function getInvoiceById(int $id) :InvoiceInterface |
|
115 | |||
116 | /** |
||
117 | * @param string $invoiceNumber |
||
118 | * |
||
119 | * @return InvoiceInterface |
||
120 | * @throws InvalidResultException |
||
121 | * @throws NotFoundException |
||
122 | * @throws \InvoiceNinjaModule\Exception\ApiException |
||
123 | * @throws \InvoiceNinjaModule\Exception\InvalidParameterException |
||
124 | */ |
||
125 | 3 | public function getInvoiceByNumber(string $invoiceNumber) :InvoiceInterface |
|
142 | |||
143 | /** |
||
144 | * @param int $page |
||
145 | * @param int $pageSize |
||
146 | * |
||
147 | * @return array |
||
148 | * @throws InvalidResultException |
||
149 | * @throws \InvoiceNinjaModule\Exception\ApiException |
||
150 | * @throws \InvoiceNinjaModule\Exception\EmptyResponseException |
||
151 | */ |
||
152 | 3 | public function getAllInvoices(int $page = 1, int $pageSize = 0) :array |
|
160 | |||
161 | /** |
||
162 | * @param int $invoiceId |
||
163 | * |
||
164 | * @return array |
||
165 | * @throws \InvoiceNinjaModule\Exception\ApiException |
||
166 | * @throws \InvoiceNinjaModule\Exception\EmptyResponseException |
||
167 | */ |
||
168 | 1 | public function downloadInvoice(int $invoiceId) :array |
|
172 | |||
173 | /** |
||
174 | * @param BaseInterface $invoice |
||
175 | * |
||
176 | * @return InvoiceInterface |
||
177 | * @throws InvalidResultException |
||
178 | */ |
||
179 | 8 | private function checkResult(BaseInterface $invoice) :InvoiceInterface |
|
186 | } |
||
187 |