diff --git a/src/Enums/Permission.php b/src/Enums/Permission.php index dcd9c42..dce2943 100644 --- a/src/Enums/Permission.php +++ b/src/Enums/Permission.php @@ -14,6 +14,12 @@ enum Permission: string // Shipping Methods case QueryShippingMethods = 'shippingmethod.queryshippingmethods'; + // Warehouses + case QueryWarehouses = 'warehouse.querywarehouses'; + + // Storage Locations + case QueryStorageLocations = 'warehouse.querystoragelocations'; + // Suppliers case QuerySuppliers = 'supplier.querysuppliers'; diff --git a/src/Modules/Warehouse/DataTransferObjects/StorageLocationDto.php b/src/Modules/Warehouse/DataTransferObjects/StorageLocationDto.php new file mode 100644 index 0000000..4f0d39f --- /dev/null +++ b/src/Modules/Warehouse/DataTransferObjects/StorageLocationDto.php @@ -0,0 +1,35 @@ +getArrayValue($data, 'SortNumber'), + $service->getArrayValue($data, 'Priority'), + $service->getArrayValue($data, 'LockForShipment'), + $service->getArrayValue($data, 'LockForAvailability'), + $service->getArrayValue($data, 'Comment'), + ); + } +} diff --git a/src/Modules/Warehouse/DataTransferObjects/WarehouseDto.php b/src/Modules/Warehouse/DataTransferObjects/WarehouseDto.php new file mode 100644 index 0000000..7cb8efa --- /dev/null +++ b/src/Modules/Warehouse/DataTransferObjects/WarehouseDto.php @@ -0,0 +1,33 @@ +json['Items'])); + } +} diff --git a/src/Modules/Warehouse/Responses/QueryWarehousesResponse.php b/src/Modules/Warehouse/Responses/QueryWarehousesResponse.php new file mode 100644 index 0000000..c38e6a5 --- /dev/null +++ b/src/Modules/Warehouse/Responses/QueryWarehousesResponse.php @@ -0,0 +1,17 @@ +json['Items'])); + } +} diff --git a/src/Modules/Warehouse/StorageLocationRepository.php b/src/Modules/Warehouse/StorageLocationRepository.php new file mode 100644 index 0000000..6000762 --- /dev/null +++ b/src/Modules/Warehouse/StorageLocationRepository.php @@ -0,0 +1,46 @@ +get('/v1/warehouses/' . $request->warehouseId . '/storagelocations', [ + 'pageNumber' => $request->pageNumber, + 'pageSize' => $request->pageSize, + ]); + + if ($response->wasSuccessful) { + return new QueryStorageLocationsResponse($response); + } + + $this->throwExceptionsIfPossible($response); + throw new UnhandledResponseException($response); + } +} diff --git a/src/Modules/Warehouse/WarehouseRepository.php b/src/Modules/Warehouse/WarehouseRepository.php new file mode 100644 index 0000000..c5ff8dc --- /dev/null +++ b/src/Modules/Warehouse/WarehouseRepository.php @@ -0,0 +1,47 @@ +get('/v1/warehouses', [ + 'isActive' => $request->isActive, + 'pageNumber' => $request->pageNumber, + 'pageSize' => $request->pageSize, + ]); + + if ($response->wasSuccessful) { + return new QueryWarehousesResponse($response); + } + + $this->throwExceptionsIfPossible($response); + throw new UnhandledResponseException($response); + } +} diff --git a/src/Services/DataTransferObjectService.php b/src/Services/DataTransferObjectService.php index 100387d..8f45b37 100644 --- a/src/Services/DataTransferObjectService.php +++ b/src/Services/DataTransferObjectService.php @@ -12,7 +12,7 @@ public function getArrayValue(array $array, string $key): mixed $value = $array[$key]; - if (is_array($value)) { + if (is_array($value) || is_bool($value)) { return $value; }