Skip to content

Commit

Permalink
Add some deprecated endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
mdpoulter committed Nov 15, 2023
1 parent 57abf6d commit 2f2dfe7
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/ZeroNine/Requests/RegisterSales/GetRegisterSale.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace SimpleSquid\Vend\ZeroNine\Requests\RegisterSales;

use Saloon\Enums\Method;
use Saloon\Http\Request;

class GetRegisterSale extends Request
{
protected Method $method = Method::GET;

public function resolveEndpoint(): string
{
return "/register_sales/{$this->registerSaleId}";
}

public function __construct(
protected string $registerSaleId,
) {
}
}
40 changes: 40 additions & 0 deletions src/ZeroNine/Requests/RegisterSales/ListRegisterSales.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace SimpleSquid\Vend\ZeroNine\Requests\RegisterSales;

use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\PaginationPlugin\Contracts\Paginatable;

class ListRegisterSales extends Request implements Paginatable
{
protected Method $method = Method::GET;

public function resolveEndpoint(): string
{
return '/register_sales';
}

/**
* @param null|string[] $status
*/
public function __construct(
protected ?string $since = null,
protected ?string $outletId = null,
protected ?array $status = null,
protected ?int $page = null,
protected ?int $pageSize = null,
) {
}

public function defaultQuery(): array
{
return array_filter([
'since' => $this->since,
'outlet_id' => $this->outletId,
'status' => $this->status,
'page' => $this->page,
'page_size' => $this->pageSize,
]);
}
}
21 changes: 21 additions & 0 deletions src/ZeroNine/Resources/RegisterSales.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use Saloon\Http\Response;
use SimpleSquid\Vend\Common\BaseResource;
use SimpleSquid\Vend\ZeroNine\Requests\RegisterSales\CreateUpdateRegisterSale;
use SimpleSquid\Vend\ZeroNine\Requests\RegisterSales\GetRegisterSale;
use SimpleSquid\Vend\ZeroNine\Requests\RegisterSales\ListRegisterSales;

class RegisterSales extends BaseResource
{
Expand All @@ -16,4 +18,23 @@ public function createUpdateRegisterSale(
): Response {
return $this->connector->send(new CreateUpdateRegisterSale($payload));
}

public function getRegisterSale(
string $registerSaleId,
): Response {
return $this->connector->send(new GetRegisterSale($registerSaleId));
}

/**
* @param null|string[] $status
*/
public function listRegisterSales(
?string $since = null,
?string $outletId = null,
?array $status = null,
?int $page = null,
?int $pageSize = null,
): Response {
return $this->connector->send(new ListRegisterSales($since, $outletId, $status, $page, $pageSize));
}
}

0 comments on commit 2f2dfe7

Please sign in to comment.