Skip to content

Commit 8969963

Browse files
committed
Added OrderType enum
1 parent 837e92b commit 8969963

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/Api/Filter/OrderListFilter.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@
66

77
use Terminal42\CashctrlApi\ApiClientInterface;
88
use Terminal42\CashctrlApi\Entity\Order;
9+
use Terminal42\CashctrlApi\Enum\OrderType;
910
use Terminal42\CashctrlApi\Exception\DomainException;
1011

1112
/**
1213
* @extends ListFilter<Order>
1314
*/
1415
class OrderListFilter extends ListFilter
1516
{
16-
public const TYPE_SALES = 'SALES';
17-
18-
public const TYPE_PURCHASE = 'PURCHASE';
19-
2017
protected int|null $categoryId = null;
2118

2219
protected string|null $columns = null;
@@ -41,7 +38,7 @@ class OrderListFilter extends ListFilter
4138

4239
protected int|null $statusId = null;
4340

44-
protected string|null $type = null;
41+
protected OrderType|null $type = null;
4542

4643
private readonly ApiClientInterface $client;
4744

@@ -102,7 +99,7 @@ public function withStatus(int $statusId): self
10299
return $this;
103100
}
104101

105-
public function ofType(string $type): self
102+
public function ofType(OrderType $type): self
106103
{
107104
$this->type = $type;
108105

src/Enum/OrderType.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Terminal42\CashctrlApi\Enum;
6+
7+
enum OrderType: string
8+
{
9+
case Sales = 'SALES';
10+
case Purchase = 'PURCHASE';
11+
}

0 commit comments

Comments
 (0)