| @@ 155-168 (lines=14) @@ | ||
| 152 | * @param string $comment |
|
| 153 | * @return bool |
|
| 154 | */ |
|
| 155 | public function setOrderComment(int $orderId, string $comment) : bool |
|
| 156 | { |
|
| 157 | Assert::that($orderId)->greaterThan(0, 'The $orderId has to be positive'); |
|
| 158 | Assert::that($comment)->minLength(1, 'The length of $comment has to be > 0'); |
|
| 159 | ||
| 160 | return (bool)$this->master->doRequest( |
|
| 161 | 'PUT', |
|
| 162 | sprintf( |
|
| 163 | '/admin/WEBAPI/Endpoints/v1_0/OrderService/{KEY}/SetOrderComment/%d?comment=%s', |
|
| 164 | $orderId, |
|
| 165 | rawurlencode($comment) |
|
| 166 | ) |
|
| 167 | ); |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * @param int $orderId |
|
| @@ 175-184 (lines=10) @@ | ||
| 172 | * @param int $orderState |
|
| 173 | * @return bool |
|
| 174 | */ |
|
| 175 | public function setOrderState(int $orderId, int $orderState) : bool |
|
| 176 | { |
|
| 177 | Assert::that($orderId)->greaterThan(0, 'The $orderId has to be positive'); |
|
| 178 | Assert::that($orderState)->greaterThan(0, 'The $orderState has to be positive'); |
|
| 179 | ||
| 180 | return (bool)$this->master->doRequest( |
|
| 181 | 'PUT', |
|
| 182 | sprintf('/admin/WEBAPI/Endpoints/v1_0/OrderService/{KEY}/SetOrderState/%d/%d', $orderId, $orderState) |
|
| 183 | ); |
|
| 184 | } |
|
| 185 | ||
| 186 | /** |
|
| 187 | * @param int $orderId |
|
| @@ 191-204 (lines=14) @@ | ||
| 188 | * @param string $trackingNumber |
|
| 189 | * @return bool |
|
| 190 | */ |
|
| 191 | public function setTrackNumber(int $orderId, string $trackingNumber) : bool |
|
| 192 | { |
|
| 193 | Assert::that($orderId)->greaterThan(0, 'The $orderId has to be positive'); |
|
| 194 | Assert::that($trackingNumber)->minLength(1, 'The length of $trackingNumber has to be > 0'); |
|
| 195 | ||
| 196 | return (bool)$this->master->doRequest( |
|
| 197 | 'PUT', |
|
| 198 | sprintf( |
|
| 199 | '/admin/WEBAPI/Endpoints/v1_0/OrderService/{KEY}/SetTrackNumber/%d?tracknumber=%s', |
|
| 200 | $orderId, |
|
| 201 | rawurlencode($trackingNumber) |
|
| 202 | ) |
|
| 203 | ); |
|
| 204 | } |
|
| 205 | ||
| 206 | /****************** |
|
| 207 | * Helper methods * |
|
| @@ 18-27 (lines=10) @@ | ||
| 15 | * @param int $siteId |
|
| 16 | * @return array |
|
| 17 | */ |
|
| 18 | public function getProduct(string $productNumber, int $siteId) : array |
|
| 19 | { |
|
| 20 | Assert::that($productNumber)->minLength(1, 'The length of $productNumber has to be > 0'); |
|
| 21 | Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive'); |
|
| 22 | ||
| 23 | return (array)$this->master->doRequest( |
|
| 24 | 'GET', |
|
| 25 | sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/%s/%d', rawurlencode($productNumber), $siteId) |
|
| 26 | ); |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @see http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductService/help/operations/GetProductsInCategory |
|
| @@ 36-45 (lines=10) @@ | ||
| 33 | * @param int $siteId |
|
| 34 | * @return array |
|
| 35 | */ |
|
| 36 | public function getProductsInCategory(int $categoryId, int $siteId) : array |
|
| 37 | { |
|
| 38 | Assert::that($categoryId)->greaterThan(0, 'The $categoryId has to be positive'); |
|
| 39 | Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive'); |
|
| 40 | ||
| 41 | return (array)$this->master->doRequest( |
|
| 42 | 'GET', |
|
| 43 | sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/Products/%d/%d', $categoryId, $siteId) |
|
| 44 | ); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * @see http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductService/help/operations/GetCategories |
|
| @@ 70-79 (lines=10) @@ | ||
| 67 | * @param int $siteId |
|
| 68 | * @return array |
|
| 69 | */ |
|
| 70 | public function getSubCategories(int $categoryId, int $siteId) : array |
|
| 71 | { |
|
| 72 | Assert::that($categoryId)->greaterThan(0, 'The $categoryId has to be positive'); |
|
| 73 | Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive'); |
|
| 74 | ||
| 75 | return (array)$this->master->doRequest( |
|
| 76 | 'GET', |
|
| 77 | sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/Categories/%d/%d', $categoryId, $siteId) |
|
| 78 | ); |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * @see http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductService/help/operations/GetProductByMetadata |
|
| @@ 126-135 (lines=10) @@ | ||
| 123 | * @param int $siteId |
|
| 124 | * @return array |
|
| 125 | */ |
|
| 126 | public function getCategory(int $categoryId, int $siteId) : array |
|
| 127 | { |
|
| 128 | Assert::that($categoryId)->greaterThan(0, 'The $categoryId has to be positive'); |
|
| 129 | Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive'); |
|
| 130 | ||
| 131 | return (array)$this->master->doRequest( |
|
| 132 | 'GET', |
|
| 133 | sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/Category/%d/%d', $categoryId, $siteId) |
|
| 134 | ); |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * @see http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductService/help/operations/FindProductNumbersByKeyword |
|
| @@ 144-157 (lines=14) @@ | ||
| 141 | * @param int $siteId |
|
| 142 | * @return array |
|
| 143 | */ |
|
| 144 | public function findProductNumbersByKeyword(string $keyword, int $siteId) : array |
|
| 145 | { |
|
| 146 | Assert::that($keyword)->minLength(1, 'The length of $keyword has to be > 0'); |
|
| 147 | Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive'); |
|
| 148 | ||
| 149 | return (array)$this->master->doRequest( |
|
| 150 | 'GET', |
|
| 151 | sprintf( |
|
| 152 | '/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/FindProductNumbersByKeyword/%s/%d', |
|
| 153 | rawurlencode($keyword), |
|
| 154 | $siteId |
|
| 155 | ) |
|
| 156 | ); |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * @see http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductService/help/operations/GetProductsByBarcode |
|
| @@ 166-175 (lines=10) @@ | ||
| 163 | * @param int $siteId |
|
| 164 | * @return array |
|
| 165 | */ |
|
| 166 | public function getProductsByBarcode(string $barCode, int $siteId) : array |
|
| 167 | { |
|
| 168 | Assert::that($barCode)->minLength(1, 'The length of $barCode has to be > 0'); |
|
| 169 | Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive'); |
|
| 170 | ||
| 171 | return (array)$this->master->doRequest( |
|
| 172 | 'GET', |
|
| 173 | sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/ByBarcode/%s/%d', rawurlencode($barCode), $siteId) |
|
| 174 | ); |
|
| 175 | } |
|
| 176 | ||
| 177 | /** |
|
| 178 | * @see http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductService/help/operations/GetProductsByModificationDate |
|
| @@ 230-239 (lines=10) @@ | ||
| 227 | * @param int $pageSize |
|
| 228 | * @return array |
|
| 229 | */ |
|
| 230 | public function getProductPage(int $page = 1, int $pageSize = 100) : array |
|
| 231 | { |
|
| 232 | Assert::that($page)->greaterThan(0, 'The $page has to be positive'); |
|
| 233 | Assert::that($pageSize)->greaterThan(0, 'The $pageSize has to be positive'); |
|
| 234 | ||
| 235 | return (array)$this->master->doRequest( |
|
| 236 | 'GET', |
|
| 237 | sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductDataService/{KEY}/ProductPage/%d/%d', $page, $pageSize) |
|
| 238 | ); |
|
| 239 | } |
|
| 240 | ||
| 241 | /** |
|
| 242 | * This method will return the number of pages you need to iterate to get the whole catalog using a page size of $pageSize |
|
| @@ 42-51 (lines=10) @@ | ||
| 39 | * @param int $pageSize |
|
| 40 | * @return array |
|
| 41 | */ |
|
| 42 | public function getProductTagPage(int $page = 1, int $pageSize = 100) : array |
|
| 43 | { |
|
| 44 | Assert::that($page)->greaterThan(0, '$page has to be positive'); |
|
| 45 | Assert::that($pageSize)->greaterThan(0, '$pageSize has to be positive'); |
|
| 46 | ||
| 47 | return $this->master->doRequest( |
|
| 48 | 'GET', |
|
| 49 | sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductTagService/{KEY}/ProductTagPage/%d/%d', $page, $pageSize) |
|
| 50 | ); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * @see http://4221117.shop53.dandomain.dk/admin/WEBAPI/Endpoints/v1_0/ProductTagService/help/operations/CreateProductTag |
|
| @@ 102-111 (lines=10) @@ | ||
| 99 | * @param int $tagValueId |
|
| 100 | * @return bool |
|
| 101 | */ |
|
| 102 | public function assignTagValueToProduct(string $productNumber, int $tagValueId) : bool |
|
| 103 | { |
|
| 104 | Assert::that($productNumber)->minLength(1, 'The length of $productNumber has to be > 0'); |
|
| 105 | Assert::that($tagValueId)->greaterThan(0, '$tagValueId has to be positive'); |
|
| 106 | ||
| 107 | return (bool)$this->master->doRequest( |
|
| 108 | 'PUT', |
|
| 109 | sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductTagService/{KEY}/AssignTagValueToProduct/%s/%d', rawurlencode($productNumber), $tagValueId) |
|
| 110 | ); |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||