| @@ 48-60 (lines=13) @@ | ||
| 45 | * |
|
| 46 | * @see https://billogram.com/api/documentation#customers_fetch |
|
| 47 | */ |
|
| 48 | public function fetch(int $customerNo) |
|
| 49 | { |
|
| 50 | $response = $this->httpGet('/customer/'.$customerNo); |
|
| 51 | if (!$this->hydrator) { |
|
| 52 | return $response; |
|
| 53 | } |
|
| 54 | // Use any valid status code here |
|
| 55 | if ($response->getStatusCode() !== 200) { |
|
| 56 | $this->handleErrors($response); |
|
| 57 | } |
|
| 58 | ||
| 59 | return $this->hydrator->hydrate($response, Model::class); |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @param array $customer |
|
| @@ 71-83 (lines=13) @@ | ||
| 68 | * |
|
| 69 | * @see https://billogram.com/api/documentation#customers_create |
|
| 70 | */ |
|
| 71 | public function create(array $customer) |
|
| 72 | { |
|
| 73 | $response = $this->httpPost('/customer', $customer); |
|
| 74 | if (!$this->hydrator) { |
|
| 75 | return $response; |
|
| 76 | } |
|
| 77 | // Use any valid status code here |
|
| 78 | if ($response->getStatusCode() !== 200) { |
|
| 79 | $this->handleErrors($response); |
|
| 80 | } |
|
| 81 | ||
| 82 | return $this->hydrator->hydrate($response, Model::class); |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @param int $customerNo |
|
| @@ 96-108 (lines=13) @@ | ||
| 93 | * |
|
| 94 | * @see https://billogram.com/api/documentation#customers_edit |
|
| 95 | */ |
|
| 96 | public function update(int $customerNo, array $customer) |
|
| 97 | { |
|
| 98 | $response = $this->httpPut('/customer/'.$customerNo, $customer); |
|
| 99 | if (!$this->hydrator) { |
|
| 100 | return $response; |
|
| 101 | } |
|
| 102 | // Use any valid status code here |
|
| 103 | if ($response->getStatusCode() !== 200) { |
|
| 104 | $this->handleErrors($response); |
|
| 105 | } |
|
| 106 | ||
| 107 | return $this->hydrator->hydrate($response, Model::class); |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||
| @@ 47-59 (lines=13) @@ | ||
| 44 | * |
|
| 45 | * @see https://billogram.com/api/documentation#billogram_call_create |
|
| 46 | */ |
|
| 47 | public function fetch(string $invoiceId) |
|
| 48 | { |
|
| 49 | $response = $this->httpGet('/billogram/'.$invoiceId); |
|
| 50 | if (!$this->hydrator) { |
|
| 51 | return $response; |
|
| 52 | } |
|
| 53 | // Use any valid status code here |
|
| 54 | if ($response->getStatusCode() !== 200) { |
|
| 55 | $this->handleErrors($response); |
|
| 56 | } |
|
| 57 | ||
| 58 | return $this->hydrator->hydrate($response, Model::class); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * @param array $invoice |
|
| @@ 70-82 (lines=13) @@ | ||
| 67 | * |
|
| 68 | * @throws ValidationException |
|
| 69 | */ |
|
| 70 | public function create(array $invoice) |
|
| 71 | { |
|
| 72 | $response = $this->httpPost('/billogram', $invoice); |
|
| 73 | if (!$this->hydrator) { |
|
| 74 | return $response; |
|
| 75 | } |
|
| 76 | // Use any valid status code here |
|
| 77 | if ($response->getStatusCode() !== 200) { |
|
| 78 | $this->handleErrors($response); |
|
| 79 | } |
|
| 80 | ||
| 81 | return $this->hydrator->hydrate($response, Model::class); |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * @param string $invoiceId |
|
| @@ 94-106 (lines=13) @@ | ||
| 91 | * |
|
| 92 | * @throws ValidationException |
|
| 93 | */ |
|
| 94 | public function update(string $invoiceId, array $invoice) |
|
| 95 | { |
|
| 96 | $response = $this->httpPut('/billogram/'.$invoiceId, $invoice); |
|
| 97 | if (!$this->hydrator) { |
|
| 98 | return $response; |
|
| 99 | } |
|
| 100 | // Use any valid status code here |
|
| 101 | if ($response->getStatusCode() !== 200) { |
|
| 102 | $this->handleErrors($response); |
|
| 103 | } |
|
| 104 | ||
| 105 | return $this->hydrator->hydrate($response, Model::class); |
|
| 106 | } |
|
| 107 | } |
|
| 108 | ||
| @@ 46-58 (lines=13) @@ | ||
| 43 | * |
|
| 44 | * @see https://billogram.com/api/documentation#items_fetch |
|
| 45 | */ |
|
| 46 | public function fetch(string $itemNo) |
|
| 47 | { |
|
| 48 | $response = $this->httpGet('/item/'.$itemNo); |
|
| 49 | if (!$this->hydrator) { |
|
| 50 | return $response; |
|
| 51 | } |
|
| 52 | // Use any valid status code here |
|
| 53 | if ($response->getStatusCode() !== 200) { |
|
| 54 | $this->handleErrors($response); |
|
| 55 | } |
|
| 56 | ||
| 57 | return $this->hydrator->hydrate($response, Model::class); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * @param Model $item |
|
| @@ 69-81 (lines=13) @@ | ||
| 66 | * |
|
| 67 | * @see https://billogram.com/api/documentation#items_create |
|
| 68 | */ |
|
| 69 | public function create(array $item) |
|
| 70 | { |
|
| 71 | $response = $this->httpPost('/item', $item); |
|
| 72 | if (!$this->hydrator) { |
|
| 73 | return $response; |
|
| 74 | } |
|
| 75 | // Use any valid status code here |
|
| 76 | if ($response->getStatusCode() !== 200) { |
|
| 77 | $this->handleErrors($response); |
|
| 78 | } |
|
| 79 | ||
| 80 | return $this->hydrator->hydrate($response, Model::class); |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * @param string $itemNo |
|
| @@ 93-105 (lines=13) @@ | ||
| 90 | * |
|
| 91 | * @see https://billogram.com/api/documentation#items_edit |
|
| 92 | */ |
|
| 93 | public function update(string $itemNo, array $item) |
|
| 94 | { |
|
| 95 | $response = $this->httpPut('/item/'.$itemNo, $item); |
|
| 96 | if (!$this->hydrator) { |
|
| 97 | return $response; |
|
| 98 | } |
|
| 99 | // Use any valid status code here |
|
| 100 | if ($response->getStatusCode() !== 200) { |
|
| 101 | $this->handleErrors($response); |
|
| 102 | } |
|
| 103 | ||
| 104 | return $this->hydrator->hydrate($response, Model::class); |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * @param string $itemNo |
|
| @@ 116-128 (lines=13) @@ | ||
| 113 | * |
|
| 114 | * @see https://billogram.com/api/documentation#items_delete |
|
| 115 | */ |
|
| 116 | public function delete(string $itemNo) |
|
| 117 | { |
|
| 118 | $response = $this->httpDelete('/item/'.$itemNo); |
|
| 119 | if (!$this->hydrator) { |
|
| 120 | return $response; |
|
| 121 | } |
|
| 122 | // Use any valid status code here |
|
| 123 | if ($response->getStatusCode() !== 200) { |
|
| 124 | $this->handleErrors($response); |
|
| 125 | } |
|
| 126 | ||
| 127 | return $this->hydrator->hydrate($response, Model::class); |
|
| 128 | } |
|
| 129 | } |
|
| 130 | ||
| @@ 20-32 (lines=13) @@ | ||
| 17 | * |
|
| 18 | * @see https://billogram.com/api/documentation#logotype_calls |
|
| 19 | */ |
|
| 20 | public function get() |
|
| 21 | { |
|
| 22 | $response = $this->httpGet('/logotype'); |
|
| 23 | if (!$this->hydrator) { |
|
| 24 | return $response; |
|
| 25 | } |
|
| 26 | // Use any valid status code here |
|
| 27 | if ($response->getStatusCode() !== 200) { |
|
| 28 | $this->handleErrors($response); |
|
| 29 | } |
|
| 30 | ||
| 31 | return $this->hydrator->hydrate($response, Model::class); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param array $logoType |
|
| @@ 20-32 (lines=13) @@ | ||
| 17 | * |
|
| 18 | * @see https://billogram.com/api/documentation#reports |
|
| 19 | */ |
|
| 20 | public function fetch(string $fileName) |
|
| 21 | { |
|
| 22 | $response = $this->httpGet('/report/'.$fileName); |
|
| 23 | if (!$this->hydrator) { |
|
| 24 | return $response; |
|
| 25 | } |
|
| 26 | // Use any valid status code here |
|
| 27 | if ($response->getStatusCode() !== 200) { |
|
| 28 | $this->handleErrors($response); |
|
| 29 | } |
|
| 30 | ||
| 31 | return $this->hydrator->hydrate($response, Model::class); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param array $param |
|
| @@ 20-32 (lines=13) @@ | ||
| 17 | * |
|
| 18 | * @see https://billogram.com/api/documentation#settings_fetch |
|
| 19 | */ |
|
| 20 | public function fetch() |
|
| 21 | { |
|
| 22 | $response = $this->httpGet('/settings'); |
|
| 23 | if (!$this->hydrator) { |
|
| 24 | return $response; |
|
| 25 | } |
|
| 26 | // Use any valid status code here |
|
| 27 | if ($response->getStatusCode() !== 200) { |
|
| 28 | $this->handleErrors($response); |
|
| 29 | } |
|
| 30 | ||
| 31 | return $this->hydrator->hydrate($response, Setting::class); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param array $setting |
|
| @@ 41-53 (lines=13) @@ | ||
| 38 | * |
|
| 39 | * @see https://billogram.com/api/documentation#settings_fetch |
|
| 40 | */ |
|
| 41 | public function update(array $setting) |
|
| 42 | { |
|
| 43 | $response = $this->httpPUT('/settings', $setting); |
|
| 44 | if (!$this->hydrator) { |
|
| 45 | return $response; |
|
| 46 | } |
|
| 47 | // Use any valid status code here |
|
| 48 | if ($response->getStatusCode() !== 200) { |
|
| 49 | $this->handleErrors($response); |
|
| 50 | } |
|
| 51 | ||
| 52 | return $this->hydrator->hydrate($response, Setting::class); |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||