Skip to content

Commit

Permalink
Added return service for handling v3/returns/company/fbo & v3/returns…
Browse files Browse the repository at this point in the history
…/company/fbs methods. (#78)
  • Loading branch information
holdmann authored Sep 1, 2023
1 parent 0f0b5e9 commit 3eed5b4
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions src/Service/V3/ReturnService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

declare(strict_types=1);

namespace Gam6itko\OzonSeller\Service\V3;

use Gam6itko\OzonSeller\Service\AbstractService;
use Gam6itko\OzonSeller\Utils\ArrayHelper;


class ReturnService extends AbstractService
{
private $path = '/v3/returns/company';

/**
* @see https://api-seller.ozon.ru/v3/returns/company/fbo
*
* @param array $filter
* @param string|null $lastId
* @param int $limit
*
* @return array
*/
public function fbo(array $filter, ?string $lastId = '', int $limit = 100): array
{
assert($limit > 0 && $limit <= 1000);

$body = [
'filter' => ArrayHelper::pick($filter, ['posting_number', 'status']),
'last_id' => $lastId ?? '',
'limit' => $limit,
];

return $this->request('POST', "{$this->path}/fbo", $body);
}

/**
* @see https://api-seller.ozon.ru/v3/returns/company/fbs
*
* @param array $filter
* @param string|null $lastId
* @param int $limit
*
* @return array
*/
public function fbs(array $filter, ?string $lastId = '', int $limit = 100): array
{
assert($limit > 0 && $limit <= 1000);

$body = [
'filter' => ArrayHelper::pick($filter, [
'accepted_from_customer_moment', 'last_free_waiting_day', 'posting_number',
'product_name', 'product_offer_id', 'status'
]),
'last_id' => $lastId ?? '',
'limit' => $limit,
];

return $this->request('POST', "{$this->path}/fbs", $body);
}
}

0 comments on commit 3eed5b4

Please sign in to comment.