| @@ 45-59 (lines=15) @@ | ||
| 42 | * |
|
| 43 | * @return Model|ResponseInterface |
|
| 44 | */ |
|
| 45 | public function get(string $customer) |
|
| 46 | { |
|
| 47 | $response = $this->httpGet('/3/customers/'.$customer); |
|
| 48 | ||
| 49 | if (!$this->hydrator) { |
|
| 50 | return $response; |
|
| 51 | } |
|
| 52 | ||
| 53 | // Use any valid status code here |
|
| 54 | if (200 !== $response->getStatusCode()) { |
|
| 55 | $this->handleErrors($response); |
|
| 56 | } |
|
| 57 | ||
| 58 | return $this->hydrator->hydrate($response, Model::class); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * @throws \FAPI\Fortnox\Exception\DomainException |
|
| @@ 46-60 (lines=15) @@ | ||
| 43 | * |
|
| 44 | * @return Model|ResponseInterface |
|
| 45 | */ |
|
| 46 | public function get(int $invoice) |
|
| 47 | { |
|
| 48 | $response = $this->httpGet('/3/invoices/'.$invoice); |
|
| 49 | ||
| 50 | if (!$this->hydrator) { |
|
| 51 | return $response; |
|
| 52 | } |
|
| 53 | ||
| 54 | // Use any valid status code here |
|
| 55 | if (200 !== $response->getStatusCode()) { |
|
| 56 | $this->handleErrors($response); |
|
| 57 | } |
|
| 58 | ||
| 59 | return $this->hydrator->hydrate($response, Model::class); |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @throws \FAPI\Fortnox\Exception\DomainException |
|
| @@ 109-123 (lines=15) @@ | ||
| 106 | * |
|
| 107 | * @return ApiResponse|ResponseInterface |
|
| 108 | */ |
|
| 109 | public function email(int $invoice) |
|
| 110 | { |
|
| 111 | $response = $this->httpGet(sprintf('/3/invoices/%d/email', $invoice)); |
|
| 112 | ||
| 113 | if (!$this->hydrator) { |
|
| 114 | return $response; |
|
| 115 | } |
|
| 116 | ||
| 117 | // Use any valid status code here |
|
| 118 | if (200 !== $response->getStatusCode()) { |
|
| 119 | $this->handleErrors($response); |
|
| 120 | } |
|
| 121 | ||
| 122 | return $this->hydrator->hydrate($response, ApiResponse::class); |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * @throws \FAPI\Fortnox\Exception\DomainException |
|
| @@ 130-144 (lines=15) @@ | ||
| 127 | * |
|
| 128 | * @return ResponseInterface |
|
| 129 | */ |
|
| 130 | public function print(int $invoice) |
|
| 131 | { |
|
| 132 | $response = $this->httpGet(sprintf('/3/invoices/%d/print', $invoice)); |
|
| 133 | ||
| 134 | if (!$this->hydrator) { |
|
| 135 | return $response; |
|
| 136 | } |
|
| 137 | ||
| 138 | // Use any valid status code here |
|
| 139 | if (200 !== $response->getStatusCode()) { |
|
| 140 | $this->handleErrors($response); |
|
| 141 | } |
|
| 142 | ||
| 143 | return $response; |
|
| 144 | } |
|
| 145 | } |
|
| 146 | ||